mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-14 05:05:14 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21fe08cadc | ||
|
|
e8ec4d9b33 | ||
|
|
1ef30650b8 | ||
|
|
a36b333cc2 | ||
|
|
fa7b79c063 | ||
|
|
4ec13d6058 | ||
|
|
8e1687aef6 | ||
|
|
aef3da8689 | ||
|
|
84567a1b1c | ||
|
|
afac5ba023 | ||
|
|
3dc5e96b85 | ||
|
|
b2a0b7ca70 | ||
|
|
3be03b13e5 | ||
|
|
3508ce361b | ||
|
|
9350499cfc | ||
|
|
4d7370cb4f | ||
|
|
6d0ef4ec20 | ||
|
|
965537bc54 | ||
|
|
5362ed19b6 | ||
|
|
2d2c1a2dec | ||
|
|
47aee066cc | ||
|
|
1f6b3679b2 | ||
|
|
219741d873 | ||
|
|
11daa4e73b | ||
|
|
b4c2a79743 | ||
|
|
34ec357927 | ||
|
|
f9bfc42aa7 | ||
|
|
06e8700a00 | ||
|
|
9c4371263f | ||
|
|
284d8a13e8 | ||
|
|
ec5479ce35 | ||
|
|
868d2d9638 | ||
|
|
62a9592d3d | ||
|
|
10d6970fb1 | ||
|
|
50a339934c | ||
|
|
2ce4ed68c9 | ||
|
|
db7e5eb5ef | ||
|
|
a5d80ba505 | ||
|
|
23eb2a692f | ||
|
|
b321737f20 | ||
|
|
1f4cc0f4ae | ||
|
|
ddc8ede1ab | ||
|
|
b37acfe18c | ||
|
|
08bc001306 | ||
|
|
80ac75bcb6 | ||
|
|
f2e690d8c3 | ||
|
|
7b42569e12 | ||
|
|
3b452f4ea6 | ||
|
|
b8a4155924 | ||
|
|
cd9e1ba28d | ||
|
|
b8445a158c | ||
|
|
b3d9b5ba18 | ||
|
|
cb48f1919c | ||
|
|
cd48d21d94 | ||
|
|
8ec0a172bc | ||
|
|
4a678af8c6 | ||
|
|
dd60572a8b | ||
|
|
fab044e6da | ||
|
|
2073e1b602 | ||
|
|
8ee5b53874 | ||
|
|
ad6b1efa2f | ||
|
|
ffa4ba3aef | ||
|
|
300a193064 | ||
|
|
e256e17f57 | ||
|
|
381ecb0687 | ||
|
|
4210cd0bfc | ||
|
|
34f98f46ee | ||
|
|
31b2b07ef7 | ||
|
|
9bc0dd679f | ||
|
|
203b927414 | ||
|
|
1b818f33ad | ||
|
|
a7ee59cfb4 | ||
|
|
d2a1a60ab6 | ||
|
|
33ad1a9c2d | ||
|
|
5a2baae7b3 | ||
|
|
58d7a1a1c7 | ||
|
|
40637e8169 | ||
|
|
b931235eb9 | ||
|
|
9e6e7ed2b2 | ||
|
|
742e4900c8 | ||
|
|
3c40d0b52d | ||
|
|
5d27808262 | ||
|
|
9e6688995e | ||
|
|
a898d2780f | ||
|
|
0c8e079fa6 | ||
|
|
9f936c5e9c | ||
|
|
2346344a08 | ||
|
|
4862bdfd61 | ||
|
|
e9071366c3 | ||
|
|
184e42f065 | ||
|
|
7891a7c449 | ||
|
|
4ad3ed84f6 | ||
|
|
0210398466 | ||
|
|
2c08afa5dd | ||
|
|
6077da5824 | ||
|
|
c211f84be6 | ||
|
|
2a26b6c28b | ||
|
|
e4f0316ae0 | ||
|
|
aefef0d6cf | ||
|
|
fcd8e2011d | ||
|
|
7b5cdcbd17 | ||
|
|
566ac1b4a7 | ||
|
|
5ad0a449d6 | ||
|
|
50cce58e9a | ||
|
|
95c0638353 | ||
|
|
aca1717341 | ||
|
|
0d2c8934a5 | ||
|
|
ab8d9dc52f | ||
|
|
9138c575d8 | ||
|
|
d664514801 | ||
|
|
276f48df88 | ||
|
|
cd8b579166 | ||
|
|
34376418e2 | ||
|
|
327afc7c84 | ||
|
|
ba9ecd1910 | ||
|
|
4e83ea15f7 | ||
|
|
0a9f1c7d45 | ||
|
|
b15296ff31 | ||
|
|
04c12cb83d | ||
|
|
6e93d810ca | ||
|
|
eaea13f59f | ||
|
|
3cf084ecae | ||
|
|
f94705b204 | ||
|
|
32c96bd755 | ||
|
|
193d7c7054 | ||
|
|
f5d5ecdfaf | ||
|
|
7c7993487d | ||
|
|
f21ce5a3f7 | ||
|
|
ebe8ee4235 | ||
|
|
6e2d1146f2 | ||
|
|
4767105543 | ||
|
|
ed2e6384ed | ||
|
|
3cedc2dc0d | ||
|
|
b2ddc3f337 | ||
|
|
91e3ac9ab0 | ||
|
|
1bddda4d85 | ||
|
|
8c5b881de5 | ||
|
|
5cf61e933d | ||
|
|
aa08666d72 | ||
|
|
455671735e | ||
|
|
e9d8f881ce | ||
|
|
55ba27be34 | ||
|
|
c095d689c3 | ||
|
|
6e0f828781 | ||
|
|
d6b771c345 | ||
|
|
1e137b710b | ||
|
|
6d05403db4 | ||
|
|
73f2e47e51 | ||
|
|
8710fc41aa | ||
|
|
ae952af227 | ||
|
|
35ee866a32 | ||
|
|
520181ab91 | ||
|
|
18d9185cae | ||
|
|
841a773708 | ||
|
|
5f4236a0c2 | ||
|
|
765f22f0f4 | ||
|
|
fc3f467ff1 | ||
|
|
4d7bc38cdc | ||
|
|
a3af26dd7e | ||
|
|
4e26c69eb6 | ||
|
|
498e897c67 | ||
|
|
57bb17ca85 | ||
|
|
0be105dc42 | ||
|
|
c28adce59b | ||
|
|
7870f699e4 | ||
|
|
6fc0c02473 | ||
|
|
1a1a58269d | ||
|
|
fe6c2fdef2 | ||
|
|
927b425baa | ||
|
|
f6a6af9575 | ||
|
|
127bcae693 | ||
|
|
b947188419 | ||
|
|
b01df0368a | ||
|
|
d9735e9e3e | ||
|
|
8c86f0ef98 | ||
|
|
de35dd590c | ||
|
|
67a0dc4fa9 | ||
|
|
5a6755afcb | ||
|
|
3f0014152b | ||
|
|
e2a8c0f591 | ||
|
|
a7086c4f27 | ||
|
|
27622431dc | ||
|
|
6b7022680e | ||
|
|
d40ba6c272 | ||
|
|
bf8b3d9821 | ||
|
|
401aace63c | ||
|
|
d42cf84421 | ||
|
|
02d12d0de2 | ||
|
|
06f01bc496 | ||
|
|
f0064700f8 | ||
|
|
b66dfcd26f | ||
|
|
02650b7f0e | ||
|
|
68cae94e0b | ||
|
|
287c78f6ab | ||
|
|
c21493b89f | ||
|
|
b6e3facf99 | ||
|
|
b4068c7cf3 | ||
|
|
c66dfaddf4 | ||
|
|
ed94ef2ae4 | ||
|
|
51cbef6f63 | ||
|
|
d6ca7905ab | ||
|
|
2073ce56f5 | ||
|
|
ef1b70e009 | ||
|
|
cc14efa5bc | ||
|
|
db0dcbf315 | ||
|
|
e9ad4aeca5 | ||
|
|
02d7cce6e2 | ||
|
|
b7691f15bd | ||
|
|
ddee1b0666 | ||
|
|
12f4614d07 | ||
|
|
32c292920e | ||
|
|
de366a2f6b | ||
|
|
2781dbd121 | ||
|
|
bf70fa8729 | ||
|
|
05449a2c1b | ||
|
|
fd2493f7c4 | ||
|
|
4158e0a143 | ||
|
|
d659304d0a | ||
|
|
6ec2c0f295 | ||
|
|
7a0db73e6f | ||
|
|
2e4c30fa07 | ||
|
|
dd9010375b | ||
|
|
a2a3e98977 | ||
|
|
1b9c21fb18 | ||
|
|
8486615972 | ||
|
|
378f4bd846 | ||
|
|
f52b276c55 | ||
|
|
5466269793 | ||
|
|
9ae1f0c6a9 | ||
|
|
4d56beff96 | ||
|
|
073f92889f | ||
|
|
1221b78adb | ||
|
|
ff5150d9a4 | ||
|
|
e2a21b6f0c | ||
|
|
8f7e3cf9d0 | ||
|
|
0a96ba819f | ||
|
|
3953ed882a | ||
|
|
9ecafbbfe7 | ||
|
|
c4d497a010 | ||
|
|
a51d426a63 | ||
|
|
4517da3757 | ||
|
|
668c5d1927 | ||
|
|
e3233bf6b6 | ||
|
|
8f3596a633 | ||
|
|
f8e1c9e55b | ||
|
|
3b0ffc7ec1 | ||
|
|
721be13c5b | ||
|
|
a0af42fce6 | ||
|
|
affac6132a | ||
|
|
8bb4c753e2 | ||
|
|
9d9b8b7006 | ||
|
|
2c3b392a9a | ||
|
|
d6cff4dc6f | ||
|
|
a85284cfbd | ||
|
|
e14d0ab687 | ||
|
|
d508c2816f | ||
|
|
375234d9ff | ||
|
|
bf60087f69 | ||
|
|
90ddbd5eed | ||
|
|
69474954ac | ||
|
|
b09a18c50d | ||
|
|
3e7a2cd95f | ||
|
|
26546b4258 | ||
|
|
0eca5a39a7 | ||
|
|
72c4d3365a | ||
|
|
6c65b1525f | ||
|
|
2cec9080f6 | ||
|
|
7029f8927f | ||
|
|
877519f839 | ||
|
|
12ce2df60d | ||
|
|
f5228370c5 | ||
|
|
6ff9971122 | ||
|
|
69ce078b8c | ||
|
|
32b5b719e4 | ||
|
|
66809587a7 | ||
|
|
af3412cdea | ||
|
|
d9963c8597 | ||
|
|
035aa4a0bb | ||
|
|
d1ff7a7cc6 | ||
|
|
6de5398de3 | ||
|
|
a1373f559a | ||
|
|
3dc4aa8c36 | ||
|
|
613d8952e3 | ||
|
|
b2741627b1 | ||
|
|
422494834c | ||
|
|
5059b5c887 | ||
|
|
4626a15dd1 | ||
|
|
98ae96438e | ||
|
|
1989d9476c | ||
|
|
62b08cfcd7 | ||
|
|
0299809431 | ||
|
|
5210672f6b | ||
|
|
a8991a1da4 | ||
|
|
36b5e963e6 | ||
|
|
317fce927c | ||
|
|
44e7ead165 | ||
|
|
e10a80eeac | ||
|
|
067b32eef4 | ||
|
|
4b3673159e | ||
|
|
24cc23d96d | ||
|
|
d4476375cf | ||
|
|
302c0aeeba | ||
|
|
7625ec2c83 | ||
|
|
2ed284440f | ||
|
|
ba0fe3c710 | ||
|
|
9b8a5ce03b | ||
|
|
52d9d4112f | ||
|
|
4d7aa45e75 | ||
|
|
4f6e011e2e | ||
|
|
a1b3bf8c21 | ||
|
|
e764d4df76 | ||
|
|
2a4647a32f | ||
|
|
74e543d21f | ||
|
|
412e44aa0e | ||
|
|
2888e8b946 | ||
|
|
2f4f028d8b | ||
|
|
88c6637fa9 | ||
|
|
f8333ce5fd | ||
|
|
c59929c351 | ||
|
|
fb32e3730e | ||
|
|
2aee5b7e1e | ||
|
|
fb9c0b3360 | ||
|
|
edb8f44f06 | ||
|
|
b50d2359d7 | ||
|
|
21667f64cd | ||
|
|
2b81e969ea | ||
|
|
ad6a9b97e2 | ||
|
|
ec4d88f496 | ||
|
|
3d86656c1d | ||
|
|
3768a1ae18 | ||
|
|
fc695704a1 | ||
|
|
24dfa6ec84 | ||
|
|
6bebb37320 | ||
|
|
cd72b08b23 | ||
|
|
5215c87f14 | ||
|
|
fb9712a962 | ||
|
|
55f0c7b1f2 | ||
|
|
d4fb5e3cb9 | ||
|
|
8a6f72f3d7 | ||
|
|
ebc3737ebf | ||
|
|
58b90cc2d8 | ||
|
|
62c4328e00 | ||
|
|
2fc90989b7 | ||
|
|
0d50976f3c | ||
|
|
ac2434287d | ||
|
|
9069e5de23 | ||
|
|
552893661b | ||
|
|
a05b79dff9 | ||
|
|
ddc65ffdd1 | ||
|
|
3ab2ca2206 | ||
|
|
2abdfeefce | ||
|
|
a702593e05 | ||
|
|
b4c1f9d2b6 | ||
|
|
8a2800e787 | ||
|
|
a9739e7c4c | ||
|
|
c7e8607f6b | ||
|
|
f479c6c61e | ||
|
|
e2586f82b0 | ||
|
|
2e8cf949a5 | ||
|
|
c7fb0b9079 | ||
|
|
f5109f5af0 | ||
|
|
1bd0dedaaa | ||
|
|
c1432f6538 | ||
|
|
cf147260d2 | ||
|
|
3a73c9ae44 | ||
|
|
dbcdae2d04 | ||
|
|
70d8f2910e | ||
|
|
d110145422 | ||
|
|
ae199bf10f | ||
|
|
b47dbebee5 | ||
|
|
94306d5282 | ||
|
|
00292f6611 | ||
|
|
c89b4c032c | ||
|
|
d83a9c402c | ||
|
|
55f64b82cd | ||
|
|
127287e9c4 | ||
|
|
48b16bbc04 | ||
|
|
a420f9620e | ||
|
|
fa4d969f11 | ||
|
|
326eb46f40 | ||
|
|
7812f29985 | ||
|
|
7e7b77c138 | ||
|
|
9d5b26c682 | ||
|
|
42a6501d1a | ||
|
|
5b4aaf787b | ||
|
|
b5240ba555 | ||
|
|
ef9a1fafaf | ||
|
|
a4cf101a98 | ||
|
|
e6efa9dacc | ||
|
|
adc90f13ab | ||
|
|
15d29c1ffe | ||
|
|
6250acbdb1 | ||
|
|
ec5d1a8a24 | ||
|
|
dd5f2af2bd | ||
|
|
eab522e49a | ||
|
|
fe3816515c | ||
|
|
19e251af0f | ||
|
|
f9315de5a4 | ||
|
|
1fb38e78c2 | ||
|
|
ca5d201376 | ||
|
|
3d54b57635 | ||
|
|
d53ae497dc | ||
|
|
3bc00d6c4b | ||
|
|
e0045d49b6 | ||
|
|
fc01665ea5 | ||
|
|
57beea5776 | ||
|
|
5f3df3960e | ||
|
|
040984073a | ||
|
|
135bc829bd | ||
|
|
f938a7e7b8 | ||
|
|
f38b17c9bf | ||
|
|
aacbb77a75 | ||
|
|
89519adfbe | ||
|
|
26a69b31fa | ||
|
|
a9401edbf5 | ||
|
|
b3d0c7a208 | ||
|
|
1d0737fa58 | ||
|
|
1eeda0abd5 | ||
|
|
4ff8b7f7c9 | ||
|
|
6d07bacfc0 | ||
|
|
141f57937b | ||
|
|
0ffda36340 | ||
|
|
3922956abd | ||
|
|
9cbfdc9e01 | ||
|
|
9e0876fb0c | ||
|
|
49b1cf794d | ||
|
|
6fdb09caac | ||
|
|
dc9701e848 | ||
|
|
802b9687d0 | ||
|
|
ab703f2c9b | ||
|
|
0fab8d7b36 | ||
|
|
df9a1ba4de | ||
|
|
d11e0cfa89 | ||
|
|
258b75caaa | ||
|
|
6088a2a04d | ||
|
|
4cf31ef8e7 | ||
|
|
1a05945136 | ||
|
|
a778f668a1 | ||
|
|
8c27717915 | ||
|
|
97460c7864 | ||
|
|
9662b51284 | ||
|
|
30757c8c93 | ||
|
|
ac8c5689f8 | ||
|
|
6100a9aa2e | ||
|
|
67fd79c427 | ||
|
|
15f40952f7 | ||
|
|
c70fdfcd20 | ||
|
|
e2688cd96e | ||
|
|
1beb0b24f3 | ||
|
|
a22ff96f32 | ||
|
|
31d7addbf5 | ||
|
|
f32c66b5f4 | ||
|
|
71206cce8e | ||
|
|
d741bd1bfd | ||
|
|
0410a6e0cc | ||
|
|
a7db4add01 | ||
|
|
d2aaf69e73 | ||
|
|
eb520e4cc0 | ||
|
|
baf785db2e | ||
|
|
f7ab6a5010 | ||
|
|
22dda0f004 | ||
|
|
82b248ada6 | ||
|
|
2cbd078f51 | ||
|
|
1c02d4bfbf | ||
|
|
716f248dcd | ||
|
|
867a3e0085 | ||
|
|
fa0e93148c | ||
|
|
e054b19038 | ||
|
|
5f6da1c0f8 | ||
|
|
407d4a75bb | ||
|
|
34160ec4ec | ||
|
|
6770ae09d3 | ||
|
|
b34d96c1c3 | ||
|
|
c3d5a4a783 | ||
|
|
828c373b6d | ||
|
|
fd2df2ede4 | ||
|
|
63cb01d656 | ||
|
|
1c59e0a121 | ||
|
|
8a0adb0183 | ||
|
|
12545799f9 | ||
|
|
99be023555 | ||
|
|
0ffd4fd1a2 | ||
|
|
0925ebb4fa | ||
|
|
43d3b66471 | ||
|
|
73e561d51a | ||
|
|
3062864d2c | ||
|
|
681c331d2c | ||
|
|
989b5b8e3d | ||
|
|
4b43d40257 | ||
|
|
bedf57f515 | ||
|
|
4d1801f1a8 | ||
|
|
85ac3861e7 | ||
|
|
b94a9e1ed1 | ||
|
|
009ce67dbe | ||
|
|
f2a97c6294 | ||
|
|
c8775f9398 | ||
|
|
3ea5f0ec81 | ||
|
|
51c30d2144 | ||
|
|
ad7458633d | ||
|
|
010f91c341 | ||
|
|
bd134904da | ||
|
|
cea1469d47 | ||
|
|
5e6f62f2f1 | ||
|
|
0fb669f9d6 | ||
|
|
51f4735e22 | ||
|
|
7768896a25 | ||
|
|
80ce3401e9 | ||
|
|
b9c9f76197 | ||
|
|
9f666b5106 | ||
|
|
c19683bb19 | ||
|
|
ba20a26459 | ||
|
|
72f000b088 | ||
|
|
1094323fe4 | ||
|
|
f79b4f5ce1 | ||
|
|
2ce37586de | ||
|
|
ca407bdf9d | ||
|
|
506ffb1f74 | ||
|
|
ffc9da3a52 | ||
|
|
1ce590705a | ||
|
|
a749a69501 | ||
|
|
e8fd72d5bb | ||
|
|
e59adf8f04 | ||
|
|
8fb1053bfe | ||
|
|
4f136612d9 | ||
|
|
ff498c4aed | ||
|
|
65211d70bc | ||
|
|
72d848c21d | ||
|
|
9577fb1f47 | ||
|
|
f508a6a0d6 | ||
|
|
a2599d0fc2 | ||
|
|
727e8b0bde | ||
|
|
4b3017faf2 | ||
|
|
78b178f716 | ||
|
|
baf073c6c5 | ||
|
|
7296e729ce | ||
|
|
7cf96b1a9e | ||
|
|
05ac60f348 | ||
|
|
080e734812 | ||
|
|
7eb453acd5 | ||
|
|
3a4f411faa | ||
|
|
4c04c52a9d | ||
|
|
a730d142be | ||
|
|
a61e1620e7 | ||
|
|
e4f85c39b2 | ||
|
|
9ec93868c1 | ||
|
|
d46c3fc694 | ||
|
|
d6d67dbdcb | ||
|
|
73ce7e7e63 | ||
|
|
f8b30d02ec | ||
|
|
2e72b98ed8 | ||
|
|
a8999f947d | ||
|
|
ccf830a458 | ||
|
|
9b9642fca4 | ||
|
|
e0d634e5c3 | ||
|
|
e62f1a8991 | ||
|
|
7bbc8cb035 | ||
|
|
38989c080e | ||
|
|
b4fb989f02 | ||
|
|
08b770bc1b | ||
|
|
cb530ce9e2 | ||
|
|
e105489549 | ||
|
|
95f22ad2a7 | ||
|
|
d229d15c76 | ||
|
|
deb63d8117 | ||
|
|
ecadd90f94 | ||
|
|
419ab1055e | ||
|
|
213744b51e | ||
|
|
b47217154a | ||
|
|
c7a65b99a6 | ||
|
|
249d3236d0 | ||
|
|
d521d95a3d | ||
|
|
987cc1fb28 | ||
|
|
7ec5ab2e48 | ||
|
|
08fe02d9fc | ||
|
|
6201a1a70f | ||
|
|
f1bbfccee2 | ||
|
|
1821246647 | ||
|
|
010c0266ef | ||
|
|
592fde9564 | ||
|
|
508a43be8c | ||
|
|
3a4734aa97 | ||
|
|
c935d93471 | ||
|
|
577d7c33df | ||
|
|
da436e4383 | ||
|
|
da12206a7c | ||
|
|
82de6b0dde | ||
|
|
6c7ffa8380 | ||
|
|
895789c673 | ||
|
|
55a91a8242 | ||
|
|
d7e14fc000 | ||
|
|
0a2c51373a | ||
|
|
f28ac696ee | ||
|
|
e019c24779 | ||
|
|
72731bb70b | ||
|
|
d390b02b8e | ||
|
|
9a0d8becd8 | ||
|
|
99880de508 | ||
|
|
9bec482e39 | ||
|
|
f6fbd3da9d | ||
|
|
efeed02327 | ||
|
|
76dcf299b7 | ||
|
|
bc82c5a593 | ||
|
|
fd19f2714f | ||
|
|
10454ea42f | ||
|
|
c5b95ccf6b | ||
|
|
617a8f1227 | ||
|
|
1e547e6e8c | ||
|
|
ea193b9dae | ||
|
|
3239db74b1 | ||
|
|
735d6bd42e | ||
|
|
f69a414266 | ||
|
|
2e1f5829ee | ||
|
|
a3cb624893 | ||
|
|
07fed89197 | ||
|
|
e603eaa5d4 | ||
|
|
63d72da75b | ||
|
|
bbd3fa0c61 | ||
|
|
fafb007d45 | ||
|
|
9fafc4ddfd | ||
|
|
24e0cbd0e1 | ||
|
|
766de5eb7c | ||
|
|
a4e1a53bf9 | ||
|
|
bf46a7c193 | ||
|
|
48814dcd46 | ||
|
|
1c1609b7d0 | ||
|
|
68b082af0c | ||
|
|
a14a26fa44 | ||
|
|
5bdca67817 | ||
|
|
337116ba3d | ||
|
|
db5c43f791 | ||
|
|
7b21ee09da | ||
|
|
88636fbd49 | ||
|
|
80a183578b | ||
|
|
046ac74eef | ||
|
|
161a71f34c | ||
|
|
267757362f | ||
|
|
da2a7671e1 | ||
|
|
86a54ab102 | ||
|
|
8175837596 | ||
|
|
67961b9ea0 | ||
|
|
44aabce335 | ||
|
|
00baeeac7e | ||
|
|
78143b92af | ||
|
|
60e3ecc734 | ||
|
|
b03595a5c2 | ||
|
|
be3d9d4219 | ||
|
|
78e526d5fa | ||
|
|
42e826a47d | ||
|
|
afbb696d19 | ||
|
|
c1f8f16a9b | ||
|
|
9a1e998918 | ||
|
|
85c19f8819 | ||
|
|
68e11668e4 | ||
|
|
e268877e7e | ||
|
|
b9b51bf05a | ||
|
|
97cbc73e2a | ||
|
|
288006a259 | ||
|
|
f74b6f91f6 | ||
|
|
e342c3beaf | ||
|
|
93602febc0 | ||
|
|
7886c2d419 | ||
|
|
ed4cdb7afc | ||
|
|
0859e438eb | ||
|
|
f55ec70868 | ||
|
|
4cf44c0045 | ||
|
|
dba08b0461 | ||
|
|
14d4662b83 | ||
|
|
df09ef2e8f | ||
|
|
2ed24dd8c7 | ||
|
|
146bc99dcf | ||
|
|
7d1be3bdff | ||
|
|
bd22e8363a | ||
|
|
13c29075c5 | ||
|
|
e503aa60d5 | ||
|
|
2c0ddf03ab | ||
|
|
8a8dc872fa | ||
|
|
b4a2033855 | ||
|
|
f85a5e6f4b | ||
|
|
b203fc2c07 | ||
|
|
3fee967f83 | ||
|
|
5b7e1e73e6 | ||
|
|
ead9e56eb2 | ||
|
|
0dcca5c22f | ||
|
|
6dde1c82cd | ||
|
|
b233d5558f | ||
|
|
619404e3fd | ||
|
|
dd8d90221a | ||
|
|
0092f063af | ||
|
|
451364edb1 | ||
|
|
18d192f0ea | ||
|
|
b8458aa5cc | ||
|
|
3fc16193d9 | ||
|
|
ecfe33e799 | ||
|
|
1576d44dce | ||
|
|
9c66f418c4 | ||
|
|
52d5733ff0 | ||
|
|
a0e68930d8 | ||
|
|
e757bb10bc | ||
|
|
0fe1f06d36 | ||
|
|
284acc8ba7 | ||
|
|
b7c72fe1c4 | ||
|
|
a5eb1ed262 | ||
|
|
417141dd61 | ||
|
|
2fa09258b1 | ||
|
|
2ed973bf1d | ||
|
|
9378b5082b | ||
|
|
a9f027b9c4 | ||
|
|
87a8ad5cd3 | ||
|
|
dca81a78f8 | ||
|
|
c9cbf7c58e | ||
|
|
ac700aa646 | ||
|
|
ee42c6166b | ||
|
|
c0659069d0 | ||
|
|
60c8294801 | ||
|
|
fa7e68c397 | ||
|
|
0817d1eccb | ||
|
|
99a9344e77 | ||
|
|
85f23fae45 | ||
|
|
8dd162d3ff | ||
|
|
57a90331bd | ||
|
|
69daa921b8 | ||
|
|
8ed3234a14 | ||
|
|
0797198341 | ||
|
|
2905865228 | ||
|
|
fd418816b9 | ||
|
|
329d23c5d6 | ||
|
|
62cb8a9920 | ||
|
|
caa52c10c5 | ||
|
|
5c9be03d6d | ||
|
|
2cef3017cd | ||
|
|
b9c85d5cef | ||
|
|
4bfd5e4e53 | ||
|
|
6712933e0f | ||
|
|
6a36ff9495 | ||
|
|
209ea708c4 | ||
|
|
383e69dc79 | ||
|
|
41ca25499e | ||
|
|
e476c87d93 | ||
|
|
233a88ad11 | ||
|
|
9668e2be96 | ||
|
|
a76ca26309 | ||
|
|
12ffdd2835 | ||
|
|
4febdd9667 | ||
|
|
e23d0dd71e | ||
|
|
1f65350a16 | ||
|
|
f97de3247f | ||
|
|
6e26ca8c27 | ||
|
|
b970803c91 | ||
|
|
126e375187 | ||
|
|
7d7d666369 | ||
|
|
ca6f187f64 | ||
|
|
0f53f2226d | ||
|
|
45d5982f04 | ||
|
|
1f916a78e6 | ||
|
|
4f16766c00 | ||
|
|
584bbcd839 | ||
|
|
779e7ceb93 | ||
|
|
2ae64eed27 | ||
|
|
d63282419d | ||
|
|
1452af69b4 | ||
|
|
006d217ddd | ||
|
|
6a60c4cf45 | ||
|
|
c2729758f2 | ||
|
|
0b31edd3e1 | ||
|
|
dd0e0635ec | ||
|
|
d0d5aa6425 | ||
|
|
be16239bf7 | ||
|
|
5fa908329c | ||
|
|
0ced3098fd | ||
|
|
dc8a217381 | ||
|
|
ce05140d9d | ||
|
|
3dc4c5faa9 | ||
|
|
eecf08fe94 | ||
|
|
28f57d2ae3 | ||
|
|
b165c324a3 | ||
|
|
26e06a2157 | ||
|
|
eda429346a | ||
|
|
6a5ecb38fc | ||
|
|
92ac370570 | ||
|
|
91d2c560a8 | ||
|
|
0cc3da3a4e | ||
|
|
66ef8b9d65 | ||
|
|
22fccf958f | ||
|
|
fc8f296538 | ||
|
|
92f5e991da | ||
|
|
42db4e2b74 | ||
|
|
39a06c251a | ||
|
|
7f41b88821 | ||
|
|
62b6aef925 | ||
|
|
89e1cc61b7 | ||
|
|
a08460b08c | ||
|
|
603f1cfdc5 | ||
|
|
cd3684cfa8 | ||
|
|
388f8b197d | ||
|
|
4e03e2015c | ||
|
|
8c182d0592 | ||
|
|
25f66e1a6a | ||
|
|
5348bfbe29 | ||
|
|
473013144d | ||
|
|
1f7a61ff99 | ||
|
|
750a5211c0 | ||
|
|
327b5b5675 | ||
|
|
7b98f503de | ||
|
|
16caa4f431 | ||
|
|
0051e3edb0 | ||
|
|
64c4fd521a | ||
|
|
5b620e069d | ||
|
|
dfc8a22010 | ||
|
|
137437c6db | ||
|
|
2779e38386 | ||
|
|
a525b5687d | ||
|
|
b81a6e01dc | ||
|
|
ddb85ca59e | ||
|
|
4dcf140b13 | ||
|
|
29103e06b5 | ||
|
|
6040d33886 | ||
|
|
39910e0949 | ||
|
|
0ae99356d5 | ||
|
|
81fd08cad0 | ||
|
|
08fc98e544 | ||
|
|
cd05d13c9e | ||
|
|
5cc16ecc96 | ||
|
|
7b49187432 | ||
|
|
226dcab028 | ||
|
|
8a2757b9e2 | ||
|
|
e6ce73154c | ||
|
|
465b4444e8 | ||
|
|
f8e8262e70 | ||
|
|
7a5a3475cf | ||
|
|
7cc661648b | ||
|
|
acfafa9d91 | ||
|
|
98bb5428c8 | ||
|
|
8dd76bee16 | ||
|
|
3473d0f899 | ||
|
|
ec622ab417 | ||
|
|
3647fcc8af | ||
|
|
cbb0d2d116 | ||
|
|
88ab880d90 | ||
|
|
6f2d9f5854 | ||
|
|
28ee846711 | ||
|
|
75d0ea41fa | ||
|
|
6a75a421f0 | ||
|
|
fa8db4baa7 | ||
|
|
3f764fe576 | ||
|
|
99c32453d0 | ||
|
|
94a23f969c | ||
|
|
ac08ca6c30 | ||
|
|
e64fec0a0f | ||
|
|
e2527c97f9 | ||
|
|
1930ac784a | ||
|
|
e9665d1605 | ||
|
|
671881d12d | ||
|
|
907e3bc851 | ||
|
|
b8a204c09b | ||
|
|
25005f6ab0 | ||
|
|
144c1e767a | ||
|
|
65d5286c12 | ||
|
|
1f5bf95b48 | ||
|
|
25e845d1be | ||
|
|
711f40b715 | ||
|
|
848dc439cb | ||
|
|
f56f6d78b0 | ||
|
|
1d4055aa2b | ||
|
|
e77419464c | ||
|
|
cea5324737 | ||
|
|
eaef5507fc | ||
|
|
ac695f7df5 | ||
|
|
2ffbee0e0b | ||
|
|
26ec81e097 | ||
|
|
57f5199797 | ||
|
|
713535c232 | ||
|
|
504f20f77e | ||
|
|
6a84279cb5 | ||
|
|
82c53be476 | ||
|
|
a6b89bb2dc | ||
|
|
ed3265ddc5 | ||
|
|
6a0835a144 | ||
|
|
ac89e8176f | ||
|
|
c6ae27df0b | ||
|
|
d7aa6ec179 | ||
|
|
f545262547 | ||
|
|
83a457be99 | ||
|
|
d08290769c | ||
|
|
637fa3f83e | ||
|
|
829fd4c70d | ||
|
|
6b2584b7a2 | ||
|
|
eae34f44e6 | ||
|
|
087b9fdf03 | ||
|
|
8d0a98bb50 | ||
|
|
caf37a3666 | ||
|
|
3ab370773d | ||
|
|
0e14ad772f | ||
|
|
163ab32161 | ||
|
|
cfbb7304d8 | ||
|
|
e743727fcd | ||
|
|
2175bfbd09 | ||
|
|
a1c84f4523 | ||
|
|
916708d59e | ||
|
|
a06ea4aa98 | ||
|
|
ca752c3497 | ||
|
|
211074caca | ||
|
|
2f924dd373 | ||
|
|
6175ffe321 | ||
|
|
68cdf74747 | ||
|
|
b1e9585744 | ||
|
|
b929851a33 | ||
|
|
3470c57bea | ||
|
|
0c3c1f98ec | ||
|
|
acda9df6f9 | ||
|
|
b59d8a44df | ||
|
|
b5250f2635 | ||
|
|
3192f9ece7 | ||
|
|
089ac0f11c | ||
|
|
1d2d7eddf7 | ||
|
|
1b8f2fff2a | ||
|
|
47e7600a21 | ||
|
|
aa4180418f | ||
|
|
5ededac618 | ||
|
|
2740f1691f | ||
|
|
0de45ae542 | ||
|
|
b8be913233 | ||
|
|
d423d46080 | ||
|
|
c7e441b49c | ||
|
|
231897ad21 | ||
|
|
22a74fece3 | ||
|
|
5b06606339 | ||
|
|
fef4cb511e | ||
|
|
265d1ec403 | ||
|
|
0eee27e7b7 | ||
|
|
0eadf43ccc | ||
|
|
5fa179f52b | ||
|
|
9986d7a732 | ||
|
|
ae5895dd3a | ||
|
|
ab8fe29d0c | ||
|
|
537636c7e5 | ||
|
|
379f0ac840 | ||
|
|
4a99c66490 | ||
|
|
0baf7c50ed | ||
|
|
a93df6bad3 | ||
|
|
8012adae7b | ||
|
|
f61aad9399 | ||
|
|
4f8a9f6dba | ||
|
|
e13bcfbbbd | ||
|
|
6f7d430291 | ||
|
|
650aa2cfbf | ||
|
|
d2ffe11637 | ||
|
|
052826fdd1 | ||
|
|
c47495657b | ||
|
|
d5286af19b | ||
|
|
95b52400d5 | ||
|
|
22e304a6da | ||
|
|
67a25fed4c | ||
|
|
9c2b381f79 | ||
|
|
a2bc9dbc7b | ||
|
|
0433ba88f9 | ||
|
|
6d5aa694aa | ||
|
|
b305ea6918 | ||
|
|
02d5ffac8b | ||
|
|
c3d25e01e8 | ||
|
|
974075dc6c | ||
|
|
c267ffbced | ||
|
|
52f32190aa | ||
|
|
9b76b7868e | ||
|
|
47ee29cf60 | ||
|
|
1bc9d5f9d4 | ||
|
|
ba1ecc079b | ||
|
|
f939fc12fe | ||
|
|
95923bd6a6 | ||
|
|
2cdc240eeb | ||
|
|
5d00311619 | ||
|
|
d02b25f99b | ||
|
|
0d1c3a04b7 | ||
|
|
60a777aa24 | ||
|
|
0b86fc416c | ||
|
|
da99a5dc03 | ||
|
|
97c9a05ecd | ||
|
|
9d56d2940a | ||
|
|
93b8c255e8 | ||
|
|
93a0df697f | ||
|
|
3aa2f55d71 | ||
|
|
7548fed236 | ||
|
|
d5a3fe37a9 | ||
|
|
1d64f0bab6 | ||
|
|
1d32c92eef | ||
|
|
43a176ef35 | ||
|
|
fc049e9caf | ||
|
|
a737b2163c | ||
|
|
ba24760f05 | ||
|
|
68e93ad549 | ||
|
|
7aff61d4dc | ||
|
|
ab10c47576 | ||
|
|
a2814891a4 | ||
|
|
1d9d5d7159 | ||
|
|
f4ca512cc8 | ||
|
|
9289898605 | ||
|
|
9e10007658 | ||
|
|
9a2b42a3ff | ||
|
|
0435d061f2 | ||
|
|
6029a57f53 | ||
|
|
ede3d3bcbc | ||
|
|
f868dc04e4 | ||
|
|
6cee62971e | ||
|
|
b61c697827 | ||
|
|
b2a836b51e | ||
|
|
8a3eb3c8ba | ||
|
|
4196b9316c | ||
|
|
34e1d16097 | ||
|
|
3ae831b413 | ||
|
|
0692b77351 | ||
|
|
e3aa65c502 | ||
|
|
69363a9e4d | ||
|
|
8522c9ed2a | ||
|
|
f0057011f7 | ||
|
|
1ee6d2a02e | ||
|
|
a1a44c02ab | ||
|
|
3add7b9cb1 | ||
|
|
d4fd77c450 | ||
|
|
f6481e2fdc | ||
|
|
d600ee67ee | ||
|
|
a504e06dd7 | ||
|
|
66abff154f | ||
|
|
4beda9accf | ||
|
|
93b716f4aa | ||
|
|
464c692789 | ||
|
|
49b6b48b99 | ||
|
|
2f10a596a7 | ||
|
|
0fff129c7c | ||
|
|
fd520abff8 | ||
|
|
547734f14d | ||
|
|
c1a0d7e076 | ||
|
|
b14ec5333b | ||
|
|
f7c398aaff | ||
|
|
45aa0550a1 | ||
|
|
1029ea6d02 | ||
|
|
0f42c7d501 | ||
|
|
f96e75a64e | ||
|
|
14c0cf3c88 | ||
|
|
d891bc49ac | ||
|
|
597ba9e333 | ||
|
|
2efa0406e3 | ||
|
|
8e4900ef40 | ||
|
|
dc546b0f6e | ||
|
|
1deb9bdcad | ||
|
|
2c09b6a7ea | ||
|
|
83adb046bf | ||
|
|
255227393f | ||
|
|
5b25cd7cd8 | ||
|
|
535c0f6328 | ||
|
|
527203e98e | ||
|
|
7b56c4bc0e | ||
|
|
78a00b7d7f | ||
|
|
963fcc1705 | ||
|
|
00c378a21f | ||
|
|
a4b746ea04 | ||
|
|
2c8ba4cd59 | ||
|
|
be7280480c | ||
|
|
5a99098d0b | ||
|
|
fb8ccdcd35 | ||
|
|
8ca1967ea2 | ||
|
|
b1efe548af | ||
|
|
120f129d67 | ||
|
|
96b93a3da4 | ||
|
|
d42f69cdf7 | ||
|
|
04877eec24 | ||
|
|
053658d584 | ||
|
|
6876ecd36e | ||
|
|
76be9271f2 | ||
|
|
983c5c2c2a | ||
|
|
5b66ea8b80 | ||
|
|
70b4c070cc | ||
|
|
cce7a5f423 | ||
|
|
2fd4e13193 | ||
|
|
7eab453e1b | ||
|
|
f6abc26e38 | ||
|
|
ea03c24f05 | ||
|
|
fcbfa6b01c | ||
|
|
9dd5b37815 | ||
|
|
88015bf06b | ||
|
|
7ea9026a59 | ||
|
|
ebec3740c2 | ||
|
|
23f2d9dc0f | ||
|
|
73521d9ff8 | ||
|
|
366041f014 | ||
|
|
80483e8e0d | ||
|
|
5320ca4d6f | ||
|
|
33167b8b05 | ||
|
|
624a35e20b | ||
|
|
ef4479de37 | ||
|
|
e9ce56889c | ||
|
|
6273355b36 | ||
|
|
050c471b8e | ||
|
|
fa8c3ebca3 | ||
|
|
75eb3bc4e7 | ||
|
|
52328c6e99 | ||
|
|
f67ad422a4 | ||
|
|
879ca4f81b | ||
|
|
9417597809 | ||
|
|
20daca0631 | ||
|
|
b317297e4d | ||
|
|
1c5fe69d46 | ||
|
|
a20713a4af | ||
|
|
d2caf5545c | ||
|
|
c5df10951a | ||
|
|
d1de53722b | ||
|
|
00ba950c7b | ||
|
|
05d18c2493 | ||
|
|
397ec0734f | ||
|
|
d8388d7ab6 | ||
|
|
148b7779f3 | ||
|
|
dbb95312e2 | ||
|
|
f47dbf6bef | ||
|
|
fc659dfd69 | ||
|
|
ec1ef903c3 | ||
|
|
1915f1331e | ||
|
|
d0f3fe233d | ||
|
|
ca2e738c81 | ||
|
|
177d84c081 | ||
|
|
4613f49b90 | ||
|
|
04e309ce35 | ||
|
|
ac72f3e9b5 | ||
|
|
ff5c8b8557 | ||
|
|
deedb0b77c | ||
|
|
2cc6b61207 | ||
|
|
0fb1efaf58 | ||
|
|
2073d76939 | ||
|
|
03b9e27342 | ||
|
|
3b1e470c6d | ||
|
|
f2a655b6cc | ||
|
|
c488293484 | ||
|
|
9c4637fa8c | ||
|
|
87ceef7346 | ||
|
|
0993971437 | ||
|
|
e00b682606 | ||
|
|
a54a1bdc6b | ||
|
|
5362cd5f78 | ||
|
|
e46cedb9be | ||
|
|
e59a68718b | ||
|
|
6c5f863aec | ||
|
|
6f84e9abca | ||
|
|
08721544d1 | ||
|
|
82129ef5d5 | ||
|
|
69cecfeb38 | ||
|
|
1dd15b6ea6 | ||
|
|
bb7c2bc623 | ||
|
|
eb0ca72d8e | ||
|
|
26b4a96981 | ||
|
|
051ade8391 | ||
|
|
e3aa2baac6 | ||
|
|
1faeb1414d | ||
|
|
106344fb01 | ||
|
|
17ee7397a8 | ||
|
|
3671fb8483 | ||
|
|
c801dbf7d9 | ||
|
|
982cc3023c | ||
|
|
7486e51b76 | ||
|
|
e39214489e | ||
|
|
784573d14a | ||
|
|
353d3eb651 | ||
|
|
223ff46e4c | ||
|
|
7b5cb0cd30 | ||
|
|
5b2dd224dc | ||
|
|
16bb742fce | ||
|
|
3d2cbc2662 | ||
|
|
21fd22d6ec | ||
|
|
a0b76449c7 | ||
|
|
2b5ff972bf | ||
|
|
8322e8f580 | ||
|
|
69b8cc095f | ||
|
|
81ebdef91d | ||
|
|
b78d8c23da | ||
|
|
5dde542557 | ||
|
|
7478c462f2 | ||
|
|
e8a0acd666 | ||
|
|
d38a11a64b | ||
|
|
651ec3d0ec | ||
|
|
6d441fc378 | ||
|
|
fbfa091d05 | ||
|
|
f041e30b91 | ||
|
|
41f83caf1c | ||
|
|
c7bd07f75a | ||
|
|
3de372bb1b | ||
|
|
c134bfbeee | ||
|
|
5bf3d7c115 | ||
|
|
add6614e2b | ||
|
|
7c612afb7e | ||
|
|
e22ad7fa22 | ||
|
|
f6a8ccf40a | ||
|
|
178365909f | ||
|
|
9939fdb139 | ||
|
|
4bebc88ee1 | ||
|
|
557962dcff | ||
|
|
5bab03fcf8 | ||
|
|
996b1c7e8c | ||
|
|
e19c4e5d1c | ||
|
|
050931e3f9 | ||
|
|
e551232efa | ||
|
|
b06af56f55 | ||
|
|
2bf21a8322 | ||
|
|
3f2d73f157 | ||
|
|
d6ea8200af | ||
|
|
0aa32d51bb | ||
|
|
2073702c37 | ||
|
|
b729552289 | ||
|
|
8f759107f1 | ||
|
|
b17a1fc541 | ||
|
|
5fcdb07b70 | ||
|
|
7f8ba6c7f3 | ||
|
|
4b68955b1d | ||
|
|
b69d743e78 | ||
|
|
4f21fffe7e | ||
|
|
c5d128ec1a | ||
|
|
b64755e391 | ||
|
|
022fb98e85 | ||
|
|
570fe42828 | ||
|
|
6c30d6413e | ||
|
|
6ba5559289 | ||
|
|
e927351156 | ||
|
|
38e71ff8c8 | ||
|
|
3b0ee3aa8b | ||
|
|
6e746484fc | ||
|
|
74724a70a5 | ||
|
|
1fec91df90 | ||
|
|
d18f45311a | ||
|
|
93dd49ab29 | ||
|
|
1f14d97ae5 | ||
|
|
0af19cd0c1 | ||
|
|
38a92d500a | ||
|
|
6b0d38ab2c | ||
|
|
88510f9c07 | ||
|
|
da90e18c6e | ||
|
|
763ed7a687 | ||
|
|
1773ceee65 | ||
|
|
feeb0edaf1 | ||
|
|
78c3da9e09 | ||
|
|
4f39538148 | ||
|
|
bb92250c78 | ||
|
|
41141c568e | ||
|
|
f6d03984ae | ||
|
|
ad8a3efc5a | ||
|
|
831d3c996d | ||
|
|
136d65300d | ||
|
|
14740648d5 | ||
|
|
08cae37b47 | ||
|
|
ceed6cdce5 | ||
|
|
3af4feb22f | ||
|
|
dda7aa54b6 | ||
|
|
16f37b35a5 | ||
|
|
300a796626 | ||
|
|
f6cf0f6e5f | ||
|
|
69e16b4c5e | ||
|
|
0368ae1269 | ||
|
|
580043087e | ||
|
|
6f5db56451 | ||
|
|
500bbfcd81 | ||
|
|
63d0fb9ce4 | ||
|
|
7a86d7eba9 | ||
|
|
4344c500b5 | ||
|
|
443594d0c4 | ||
|
|
87aabbff99 | ||
|
|
2f82502a6f | ||
|
|
fe22d5d20f | ||
|
|
ec14f0c83f | ||
|
|
35dcf428c9 | ||
|
|
a932883e41 | ||
|
|
b475e0cce5 | ||
|
|
58a84254ef | ||
|
|
7223426a2b | ||
|
|
b9a0104860 | ||
|
|
937fd8646f | ||
|
|
b973108e1e | ||
|
|
51dffcbca9 | ||
|
|
76ae81983c | ||
|
|
df38312ab0 | ||
|
|
8d8a7238ee | ||
|
|
d3c4e709ff | ||
|
|
4e8c79eb7f | ||
|
|
ee16363fd2 | ||
|
|
60a3dcf956 | ||
|
|
b0937b2259 | ||
|
|
c5e3e51055 | ||
|
|
4c6cc1db75 | ||
|
|
6d9e8019e1 | ||
|
|
ee41006f01 | ||
|
|
b25d88f6d2 | ||
|
|
5dac0025f6 | ||
|
|
f0616f0b5c | ||
|
|
6e649e659e | ||
|
|
0f39aab92a | ||
|
|
761c1926a1 | ||
|
|
0258d1661c | ||
|
|
b0f98b1016 | ||
|
|
edbc04c709 | ||
|
|
7ec1b48eb8 | ||
|
|
93ba6bf344 | ||
|
|
970785f1a0 | ||
|
|
cfff7583d2 | ||
|
|
8fcc7db138 | ||
|
|
1d39f854cf | ||
|
|
dda7a53e4d | ||
|
|
f32b346d84 | ||
|
|
4e8d992c7d | ||
|
|
9501dc6e69 | ||
|
|
18b519c0d6 | ||
|
|
daa33def28 | ||
|
|
2b42986e75 | ||
|
|
efc6bf1b94 | ||
|
|
149365be01 | ||
|
|
9a86cdb99b | ||
|
|
c240826c06 | ||
|
|
caf52fdfab | ||
|
|
9c1e26bd3b | ||
|
|
f7e096fee3 | ||
|
|
73dbb6420e | ||
|
|
87f721cc87 | ||
|
|
ff03259279 | ||
|
|
dbba6a3be7 | ||
|
|
e84e65da40 | ||
|
|
53b7799056 | ||
|
|
412f8a5975 | ||
|
|
322c501d89 | ||
|
|
8a1dd2fe05 | ||
|
|
0eae1c91c8 | ||
|
|
be14ade55e | ||
|
|
cc13ba4dc0 | ||
|
|
05291fbc74 | ||
|
|
1f5fd52e9b | ||
|
|
43a91d61eb | ||
|
|
283f1e6482 | ||
|
|
886b69d197 | ||
|
|
3df374151b | ||
|
|
7bd6c77e5e | ||
|
|
b0400cc6ef | ||
|
|
72f889cca3 | ||
|
|
b1ae9233bc | ||
|
|
7ec2d4cd39 | ||
|
|
573a6cd356 | ||
|
|
95612cfa60 | ||
|
|
3e6656f9ab | ||
|
|
ccdb39e0a6 | ||
|
|
62ddaef6a7 | ||
|
|
ea44c25efc | ||
|
|
7672019c42 | ||
|
|
5b7f88c7f2 | ||
|
|
e9683cfd3d | ||
|
|
ac060e78a3 | ||
|
|
6c239755dc | ||
|
|
3813e141f8 | ||
|
|
a027c30d42 | ||
|
|
4e956a7d9e | ||
|
|
42481a1fd1 | ||
|
|
947427ae83 | ||
|
|
6ad762a8c0 | ||
|
|
fa3f2a885a | ||
|
|
acea4f3bb6 | ||
|
|
66871a8103 | ||
|
|
2115939b03 | ||
|
|
345532d70b | ||
|
|
944ed9f4e9 | ||
|
|
09d353a08f | ||
|
|
20ef1ad524 | ||
|
|
a706a1cc03 | ||
|
|
87fbb0bffc | ||
|
|
959e5f515a | ||
|
|
1c0c3e955d | ||
|
|
93724f139a | ||
|
|
0e25cad542 | ||
|
|
58918640ad | ||
|
|
8e6ef48342 | ||
|
|
fdac0091ce | ||
|
|
4e0813a6cf | ||
|
|
6e40b4ebd4 | ||
|
|
3d9a71d28a | ||
|
|
2dfbfc122c | ||
|
|
437c2d8000 | ||
|
|
900c5db537 | ||
|
|
e183b12388 | ||
|
|
9906579faa | ||
|
|
98f2caaa5f | ||
|
|
886a425c6f | ||
|
|
51b4a04cd0 | ||
|
|
d04946c717 | ||
|
|
193eb6b7ef | ||
|
|
1a9e39f116 | ||
|
|
48e28efa9e | ||
|
|
bcb3effb3c | ||
|
|
29c017256a | ||
|
|
8aeac3ca0c | ||
|
|
793a58bb66 | ||
|
|
c4d720cdbb | ||
|
|
386642761d | ||
|
|
613a0dc5b5 | ||
|
|
baa00b7f43 | ||
|
|
45a8a65dee | ||
|
|
2a8d363aab | ||
|
|
9e32add8e6 | ||
|
|
1a43c452ea | ||
|
|
03cae905c6 | ||
|
|
b02d90a5e6 | ||
|
|
206fe6a5ec | ||
|
|
d8d3f94a99 | ||
|
|
565a33db8f | ||
|
|
2bfc2e2a7d | ||
|
|
5389a5bff4 | ||
|
|
aad8382e8d | ||
|
|
1d9f7cd4f8 | ||
|
|
c0acc0f522 | ||
|
|
b9e0056255 | ||
|
|
397477b4e9 | ||
|
|
9e4c5cb833 | ||
|
|
01cfa69791 | ||
|
|
3fbf949b82 | ||
|
|
762b212bdf | ||
|
|
56100c60da | ||
|
|
30ba05f239 | ||
|
|
e63ee1f16c | ||
|
|
760d7aa8fa | ||
|
|
11a712626c | ||
|
|
782a05f9de | ||
|
|
09903f303a | ||
|
|
413fcf3a20 | ||
|
|
5c16c6b13a | ||
|
|
1f1b791bf0 | ||
|
|
bf1ebda27b | ||
|
|
2946869a28 | ||
|
|
c469accea7 | ||
|
|
b526ee6116 | ||
|
|
f1886bb280 | ||
|
|
48461d4b28 | ||
|
|
c55762568f | ||
|
|
f6d0c2394c | ||
|
|
f956c304c5 | ||
|
|
27b0ffea3e | ||
|
|
223a78837b | ||
|
|
41cce2f604 | ||
|
|
e0c74f0d34 | ||
|
|
e95aed631d | ||
|
|
ffa4c58acb | ||
|
|
c827f760f6 | ||
|
|
6db10d14be | ||
|
|
8b76775adb | ||
|
|
f0e48240c9 | ||
|
|
78bcec17c8 | ||
|
|
ec88357a8c | ||
|
|
5ca3209b44 | ||
|
|
0df27e8b2d | ||
|
|
901ec1537a | ||
|
|
0ae6073a18 | ||
|
|
8307162d58 | ||
|
|
738c69de37 | ||
|
|
b4afb6bbe5 | ||
|
|
637c4b283c | ||
|
|
78b8881659 | ||
|
|
a3714bcedf | ||
|
|
5dd5fd4a56 | ||
|
|
fece5986bf | ||
|
|
8d60a570d5 | ||
|
|
a7e92301ef | ||
|
|
a4b6efd473 | ||
|
|
92a060fd6a | ||
|
|
d33cb3ae09 | ||
|
|
b8452344de | ||
|
|
930393cf02 | ||
|
|
49f801e6fe | ||
|
|
2118414023 | ||
|
|
87004b05f7 | ||
|
|
e7cb57c0b8 | ||
|
|
0245f82d31 | ||
|
|
39912f5263 | ||
|
|
20c1e2ad98 | ||
|
|
21964f4394 | ||
|
|
66d30cd4eb | ||
|
|
95f2c9fe7d | ||
|
|
975553805c | ||
|
|
2cdb2a7b05 | ||
|
|
573312acb6 | ||
|
|
f7aed66054 | ||
|
|
82f9f11f39 | ||
|
|
6d55632cb7 | ||
|
|
2593afab81 | ||
|
|
5b2d69cc5b | ||
|
|
bb33f19a4b | ||
|
|
d9d363b172 | ||
|
|
9e2c5ef112 | ||
|
|
55b929cab2 | ||
|
|
c19988b766 | ||
|
|
ae7453f2ba | ||
|
|
0e57572183 | ||
|
|
3a781eb26b | ||
|
|
3eb4916379 | ||
|
|
724ce7f524 | ||
|
|
ac5dd84c25 | ||
|
|
d968424300 | ||
|
|
473d0a7567 | ||
|
|
93e2236a6d | ||
|
|
f7737e2e16 | ||
|
|
e76d2469e5 | ||
|
|
24c7b92b25 | ||
|
|
dddb8b6121 | ||
|
|
71d1d25c7a | ||
|
|
da2292e5c7 | ||
|
|
b37e55423b | ||
|
|
5bd1c41900 | ||
|
|
829f74d293 | ||
|
|
75f10004fe | ||
|
|
24f4e18b77 | ||
|
|
a182371d69 | ||
|
|
bba392ec8a | ||
|
|
d65ec44e3b | ||
|
|
04af9e5267 | ||
|
|
447e90bcef | ||
|
|
59fc3dcdf4 | ||
|
|
a911db9cba | ||
|
|
1a9bf9b959 | ||
|
|
ae26e1f02a | ||
|
|
d43baf71a7 | ||
|
|
7ebc83e34d | ||
|
|
b0a7a533c9 | ||
|
|
d90c934c05 | ||
|
|
05846dae07 | ||
|
|
447fbb178d | ||
|
|
b56471a689 | ||
|
|
1318e37d58 | ||
|
|
22a00a0cd2 | ||
|
|
768eb43fe8 | ||
|
|
7c78fa1885 | ||
|
|
5038f418c1 | ||
|
|
e5cfd9d8af | ||
|
|
cc0f0794b8 | ||
|
|
6b8c325436 | ||
|
|
6fed0802ee | ||
|
|
32f0598d06 | ||
|
|
7ea9a33f3b | ||
|
|
ea99527d23 | ||
|
|
f377f69fec | ||
|
|
2a1fe6ed6f | ||
|
|
f50adbbdb0 | ||
|
|
3b7d4eb2cd | ||
|
|
bcbad5b9a0 | ||
|
|
0ff67d71d7 | ||
|
|
efcb44dd47 | ||
|
|
1fe611e544 | ||
|
|
a6352deb14 | ||
|
|
bd0ba42d72 | ||
|
|
46b8b6ce90 | ||
|
|
fdabfd76d6 | ||
|
|
ea9ed226e0 | ||
|
|
98194095fe | ||
|
|
3f4c0f8017 | ||
|
|
14904b8965 | ||
|
|
17acead581 | ||
|
|
095b9f05c3 | ||
|
|
68449b3ad3 | ||
|
|
ff6dca1839 | ||
|
|
df5aed8c11 | ||
|
|
eb71459201 | ||
|
|
b7195100fd | ||
|
|
f28a0f2dd1 | ||
|
|
303e6da265 | ||
|
|
ef5da92061 | ||
|
|
3e0a8627e1 | ||
|
|
fd5c1e824e | ||
|
|
f5e211a120 | ||
|
|
55e728eb31 | ||
|
|
47c8386f83 | ||
|
|
d5c559cde4 | ||
|
|
d9d83ef277 | ||
|
|
d4d399fcce | ||
|
|
6fbe49845f | ||
|
|
7933f2b5dd | ||
|
|
0f9cd74fdb | ||
|
|
09147be095 | ||
|
|
7a542f5d81 | ||
|
|
420f93c83b | ||
|
|
a337a5eb7e | ||
|
|
595878d7f5 | ||
|
|
242a6e484e | ||
|
|
01eb033cf5 | ||
|
|
1c303b00fe | ||
|
|
f704e33362 | ||
|
|
5beedd9b58 | ||
|
|
9abb46d527 | ||
|
|
cd931d9b53 | ||
|
|
a4bf0390a0 | ||
|
|
72d2299ca0 | ||
|
|
ff68026d4f | ||
|
|
bf5c381136 | ||
|
|
5c319390d7 | ||
|
|
effda851f6 | ||
|
|
52f8da14ea | ||
|
|
eb6172cd1e | ||
|
|
32e218da16 | ||
|
|
4fc71aa390 | ||
|
|
c9de3b4080 | ||
|
|
2d382ea853 | ||
|
|
808a5918e6 | ||
|
|
d32fe6f64f | ||
|
|
f6ebdb3174 | ||
|
|
8207d52123 | ||
|
|
62a34c3eb6 | ||
|
|
6aa452a643 | ||
|
|
719010ad2b | ||
|
|
927f781708 | ||
|
|
e88dbdbf44 | ||
|
|
b778eff5f9 | ||
|
|
805e703284 | ||
|
|
464197c3a7 |
+25
-17
@@ -1,21 +1,29 @@
|
|||||||
Makefile
|
*.flc
|
||||||
config.cache
|
|
||||||
config.h
|
|
||||||
config.log
|
|
||||||
config.status
|
|
||||||
stamp-h*
|
|
||||||
bison-*
|
|
||||||
patches
|
|
||||||
*.patch *.log log patches applied
|
*.patch *.log log patches applied
|
||||||
*.prj
|
*.prj
|
||||||
releases
|
|
||||||
*.flc
|
|
||||||
autom4te.cache
|
|
||||||
intl
|
|
||||||
Makefile.in
|
|
||||||
configure
|
|
||||||
config.hin
|
|
||||||
aclocal.m4
|
|
||||||
ABOUT-NLS
|
ABOUT-NLS
|
||||||
INSTALL
|
|
||||||
COPYING
|
COPYING
|
||||||
|
INSTALL
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
_*
|
||||||
|
a.exe
|
||||||
|
a.out
|
||||||
|
aclocal.m4
|
||||||
|
autom4te.cache
|
||||||
|
b.out
|
||||||
|
bison-*
|
||||||
|
conf[0-9]*
|
||||||
|
confdefs*
|
||||||
|
config.cache
|
||||||
|
config.h
|
||||||
|
config.hin
|
||||||
|
config.log
|
||||||
|
config.status
|
||||||
|
configure
|
||||||
|
configure.lineno
|
||||||
|
conftest*
|
||||||
|
intl
|
||||||
|
patches
|
||||||
|
releases
|
||||||
|
stamp-h*
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
data/glr.c
|
||||||
|
data/yacc.c
|
||||||
|
lib/yyerror.c
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
doc/bison.texinfo
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
Version 2, June 1991
|
Version 2, June 1991
|
||||||
|
|
||||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
@@ -305,7 +305,7 @@ the "copyright" line and a pointer to where the full notice is found.
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
@@ -313,7 +313,7 @@ Also add information on how to contact you by electronic and paper mail.
|
|||||||
If the program is interactive, make it output a short notice like this
|
If the program is interactive, make it output a short notice like this
|
||||||
when it starts in an interactive mode:
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
Gnomovision version 69, Copyright (C) year name of author
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
This is free software, and you are welcome to redistribute it
|
This is free software, and you are welcome to redistribute it
|
||||||
under certain conditions; type `show c' for details.
|
under certain conditions; type `show c' for details.
|
||||||
|
|||||||
+26
@@ -4,9 +4,31 @@
|
|||||||
# It is necessary if you want to build targets usually of interest
|
# It is necessary if you want to build targets usually of interest
|
||||||
# only to the maintainer.
|
# only to the maintainer.
|
||||||
|
|
||||||
|
# Copyright (C) 2001, 2003 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.,
|
||||||
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
# Systems where /bin/sh is not the default shell need this. The $(shell)
|
# Systems where /bin/sh is not the default shell need this. The $(shell)
|
||||||
# command below won't work with e.g. stock DOS/Windows shells.
|
# command below won't work with e.g. stock DOS/Windows shells.
|
||||||
|
ifeq ($(wildcard /bin/s[h]),/bin/sh)
|
||||||
SHELL = /bin/sh
|
SHELL = /bin/sh
|
||||||
|
else
|
||||||
|
# will be used only with the next shell-test line, then overwritten
|
||||||
|
# by a configured-in value
|
||||||
|
SHELL = sh
|
||||||
|
endif
|
||||||
|
|
||||||
have-Makefile := $(shell test -f Makefile && echo yes)
|
have-Makefile := $(shell test -f Makefile && echo yes)
|
||||||
|
|
||||||
@@ -14,7 +36,11 @@ have-Makefile := $(shell test -f Makefile && echo yes)
|
|||||||
# give them a diagnostic.
|
# give them a diagnostic.
|
||||||
ifeq ($(have-Makefile),yes)
|
ifeq ($(have-Makefile),yes)
|
||||||
|
|
||||||
|
# Make tar archive easier to reproduce.
|
||||||
|
export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
|
||||||
|
|
||||||
include Makefile
|
include Makefile
|
||||||
|
include $(srcdir)/Makefile.cfg
|
||||||
include $(srcdir)/Makefile.maint
|
include $(srcdir)/Makefile.maint
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -52,11 +52,10 @@ release:
|
|||||||
that 1. Bison compiles cleanly, 2. the parsers it produces compile
|
that 1. Bison compiles cleanly, 2. the parsers it produces compile
|
||||||
cleanly too.
|
cleanly too.
|
||||||
|
|
||||||
- Change tests/bison to run `valgrind -q bison' to run Bison under
|
- run `make maintainer-check' which:
|
||||||
Valgrind.
|
- runs `valgrind -q bison' to run Bison under Valgrind.
|
||||||
|
- runs the parsers under Valgrind.
|
||||||
- Run the test suite with `./testsuite PREPARSER='valgrind -q' to make
|
- runs the test suite with G++ as C compiler...
|
||||||
sure the parser behave properly.
|
|
||||||
|
|
||||||
- Change tests/atlocal/CFLAGS to add your preferred options. For
|
- Change tests/atlocal/CFLAGS to add your preferred options. For
|
||||||
instance, `-traditional' to check that the parsers are K&R. Note
|
instance, `-traditional' to check that the parsers are K&R. Note
|
||||||
@@ -64,23 +63,20 @@ release:
|
|||||||
but currently is actually GNU C, nor for lalr1.cc, which anyway is
|
but currently is actually GNU C, nor for lalr1.cc, which anyway is
|
||||||
not exercised yet in the test suite.
|
not exercised yet in the test suite.
|
||||||
|
|
||||||
- Change tests/atlocal/CC to use a C++ compiler.
|
|
||||||
|
|
||||||
|
|
||||||
* Release Procedure
|
* Release Procedure
|
||||||
|
|
||||||
|
** Try to get the *.pot files to the Translation Project at least one week
|
||||||
|
before a stable release, to give them time to translate them.
|
||||||
|
|
||||||
** Tests
|
** Tests
|
||||||
See above.
|
See above.
|
||||||
|
|
||||||
** Update the foreign files
|
** Update the foreign files
|
||||||
Running `make update' in the top level should make it all for you.
|
Running `./bootstrap' in the top level should update them all for you.
|
||||||
This covers PO files too. Beware that it happens that some PO files
|
This covers PO files too. Sometimes a PO file contains problems that
|
||||||
contain serious problems and are rejected by recent Gettext releases:
|
causes it to be rejected by recent Gettext releases; please report
|
||||||
fix them all, and complain to the Translation Project!
|
these 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
|
** Update NEWS
|
||||||
The version number, *and* the date of the release (including for
|
The version number, *and* the date of the release (including for
|
||||||
@@ -110,13 +106,19 @@ In configure.ac. Run `make', check this in.
|
|||||||
|
|
||||||
** Announce
|
** Announce
|
||||||
Complete/fix the announcement file, and send it at least to
|
Complete/fix the announcement file, and send it at least to
|
||||||
[email protected] (if a real release, or a ``serious beta''),
|
info-gnu@gnu.org (if a real release, or a ``serious beta''),
|
||||||
[email protected], and [email protected].
|
bug-[email protected], [email protected], [email protected],
|
||||||
|
and [email protected].
|
||||||
|
|
||||||
|
Send the same announcement on the comp.compilers newsgroup by sending
|
||||||
|
email to [email protected]. Do not make any Cc as the moderator will
|
||||||
|
throw away anything cross-posted or Cc'ed. It really needs to be a
|
||||||
|
separate message.
|
||||||
|
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
@@ -132,5 +134,5 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
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
|
along with GNU Bison; see the file COPYING. If not, write to the Free
|
||||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
02111-1307, USA.
|
02110-1301, USA.
|
||||||
|
|||||||
+17
-23
@@ -1,5 +1,5 @@
|
|||||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
## Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
## Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||||
|
|
||||||
## This program is free software; you can redistribute it and/or modify
|
## 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
|
## it under the terms of the GNU General Public License as published by
|
||||||
@@ -13,31 +13,25 @@
|
|||||||
|
|
||||||
## You should have received a copy of the GNU General Public License
|
## You should have received a copy of the GNU General Public License
|
||||||
## along with this program; if not, write to the Free Software
|
## along with this program; if not, write to the Free Software
|
||||||
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
## 02111-1307 USA
|
## 02110-1301 USA
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
SUBDIRS = config po lib data src doc m4 tests
|
SUBDIRS = build-aux po runtime-po lib data src doc examples tests
|
||||||
|
|
||||||
EXTRA_DIST = REFERENCES OChangeLog Makefile.maint GNUmakefile
|
# Files installed for use by Automake.
|
||||||
|
aclocaldir = @aclocaldir@
|
||||||
|
aclocal_DATA = m4/bison-i18n.m4
|
||||||
|
|
||||||
|
EXTRA_DIST = GNUmakefile Makefile.cfg Makefile.maint \
|
||||||
|
OChangeLog PACKAGING \
|
||||||
|
djgpp/Makefile.maint djgpp/README.in djgpp/config.bat \
|
||||||
|
djgpp/config.sed djgpp/config.site djgpp/config_h.sed \
|
||||||
|
djgpp/subpipe.c djgpp/subpipe.h djgpp/djunpack.bat \
|
||||||
|
djgpp/fnchange.lst
|
||||||
|
|
||||||
|
|
||||||
## ---------------------------- ##
|
.PHONY: maintainer-check
|
||||||
## Customizing Makefile.maint. ##
|
maintainer-check:
|
||||||
## ---------------------------- ##
|
cd tests && $(MAKE) $(AM_MAKEFLAGS) $@
|
||||||
|
|
||||||
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
|
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# Customize Makefile.maint for Bison. -*- makefile -*-
|
||||||
|
# Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
# 02110-1301, USA.
|
||||||
|
|
||||||
|
build_aux_dir = $(srcdir)/build-aux
|
||||||
|
prev_version_file = $(build_aux_dir)/prev-version.txt
|
||||||
|
announce_gen = $(build_aux_dir)/announce-gen
|
||||||
|
release_archive_dir = releases
|
||||||
|
|
||||||
|
# Use alpha.gnu.org for alpha and beta releases.
|
||||||
|
# Use ftp.gnu.org for major releases.
|
||||||
|
gnu_ftp_host-alpha = alpha
|
||||||
|
gnu_ftp_host-beta = alpha
|
||||||
|
gnu_ftp_host-major = ftp
|
||||||
|
gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE))
|
||||||
|
|
||||||
|
url_dir_list = \
|
||||||
|
ftp://$(gnu_rel_host).gnu.org/gnu/bison
|
||||||
|
|
||||||
|
# Files to update automatically.
|
||||||
|
wget_files = \
|
||||||
|
$(build_aux_dir)/config.guess \
|
||||||
|
$(build_aux_dir)/config.sub \
|
||||||
|
$(build_aux_dir)/texinfo.tex \
|
||||||
|
|
||||||
|
cvs_files = \
|
||||||
|
$(build_aux_dir)/install-sh \
|
||||||
|
$(build_aux_dir)/mdate-sh \
|
||||||
|
$(build_aux_dir)/missing \
|
||||||
|
$(build_aux_dir)/mkinstalldirs
|
||||||
|
|
||||||
|
# Tests not to run.
|
||||||
|
local-checks-to-skip = \
|
||||||
|
changelog-check
|
||||||
+542
-249
@@ -1,8 +1,8 @@
|
|||||||
# -*-Makefile-*-
|
# -*-Makefile-*-
|
||||||
# This Makefile fragment is shared between fileutils, sh-utils, textutils,
|
# This Makefile fragment is shared between the coreutils,
|
||||||
# CPPI, Bison, and Autoconf.
|
# CPPI, Bison, and Autoconf.
|
||||||
|
|
||||||
## Copyright 2001 Free Software Foundation, Inc.
|
## Copyright (C) 2001-2006 Free Software Foundation, Inc.
|
||||||
##
|
##
|
||||||
## This program is free software; you can redistribute it and/or modify
|
## 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
|
## it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,43 +16,525 @@
|
|||||||
##
|
##
|
||||||
## You should have received a copy of the GNU General Public License
|
## You should have received a copy of the GNU General Public License
|
||||||
## along with this program; if not, write to the Free Software
|
## along with this program; if not, write to the Free Software
|
||||||
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
## 02111-1307, USA.
|
## 02110-1301, USA.
|
||||||
|
|
||||||
|
# This is reported not to work with make-3.79.1
|
||||||
|
# ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||||
|
ME := Makefile.maint
|
||||||
|
|
||||||
# Do not save the original name or timestamp in the .tar.gz file.
|
# Do not save the original name or timestamp in the .tar.gz file.
|
||||||
GZIP_ENV = '--no-name --best'
|
# Use --rsyncable if available.
|
||||||
|
gzip_rsyncable = \
|
||||||
|
(gzip --help|grep rsyncable) >/dev/null 2>&1 && echo --rsyncable
|
||||||
|
GZIP_ENV = "--no-name --best `$(gzip_rsyncable)`"
|
||||||
|
|
||||||
CVS = cvs
|
CVS = cvs
|
||||||
|
|
||||||
prev_version_file ?= .prev-version
|
# cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/
|
||||||
|
CVS_LIST = sh -c ' \
|
||||||
|
if test -x $(srcdir)/build-aux/cvsu; then \
|
||||||
|
$(srcdir)/build-aux/cvsu --find --types=AFGM $$*; \
|
||||||
|
else \
|
||||||
|
awk -F/ '\''{ \
|
||||||
|
if (!$$1 && $$3 !~ /^-/) { \
|
||||||
|
f=FILENAME; \
|
||||||
|
sub(/CVS\/Entries/, "", f); \
|
||||||
|
print f $$2; \
|
||||||
|
}}'\'' \
|
||||||
|
$$(find $${*-*} -name Entries -print) /dev/null; \
|
||||||
|
fi \
|
||||||
|
' dummy
|
||||||
|
|
||||||
|
CVS_LIST_EXCEPT = \
|
||||||
|
$(CVS_LIST) | if test -f .x-$@; then grep -vEf .x-$@; else grep -v ChangeLog; fi
|
||||||
|
|
||||||
|
ifeq ($(origin prev_version_file), undefined)
|
||||||
|
prev_version_file = .prev-version
|
||||||
|
endif
|
||||||
|
|
||||||
THIS_VERSION_REGEXP = $(subst .,\.,$(VERSION))
|
|
||||||
PREV_VERSION := $(shell cat $(prev_version_file))
|
PREV_VERSION := $(shell cat $(prev_version_file))
|
||||||
PREV_VERSION_REGEXP := $(shell echo $(PREV_VERSION)|sed 's/\./\\./g')
|
VERSION_REGEXP = $(subst .,\.,$(VERSION))
|
||||||
|
|
||||||
tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
|
tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
|
||||||
tag-this-version = $(subst .,_,$(VERSION))
|
tag-this-version = $(subst .,_,$(VERSION))
|
||||||
tag-prev-version = $(subst .,_,$(PREV_VERSION))
|
|
||||||
this-cvs-tag = $(tag-package)-$(tag-this-version)
|
this-cvs-tag = $(tag-package)-$(tag-this-version)
|
||||||
prev-cvs-tag = $(tag-package)-$(tag-prev-version)
|
|
||||||
my_distdir = $(PACKAGE)-$(VERSION)
|
my_distdir = $(PACKAGE)-$(VERSION)
|
||||||
|
|
||||||
# Old releases are stored here.
|
# Old releases are stored here.
|
||||||
# Used for diffs and xdeltas.
|
# Used for diffs and xdeltas.
|
||||||
release_archive_dir ?= ../release
|
release_archive_dir ?= ../release
|
||||||
|
|
||||||
|
# Prevent programs like 'sort' from considering distinct strings to be equal.
|
||||||
|
# Doing it here saves us from having to set LC_ALL elsewhere in this file.
|
||||||
|
export LC_ALL = C
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## --------------- ##
|
||||||
|
## Sanity checks. ##
|
||||||
|
## --------------- ##
|
||||||
|
|
||||||
|
# FIXME: add a check to prohibit definition in src/*.c of symbols defined
|
||||||
|
# in system.h. E.g. today I removed from tail.c a useless definition of
|
||||||
|
# ENOSYS. It was useless because system.h ensures it's defined.
|
||||||
|
|
||||||
|
# Checks that don't require cvs.
|
||||||
|
# Run `changelog-check' last, as previous test may reveal problems requiring
|
||||||
|
# new ChangeLog entries.
|
||||||
|
local-checks-available = \
|
||||||
|
po-check copyright-check writable-files m4-check author_mark_check \
|
||||||
|
changelog-check strftime-check $(syntax-check-rules) \
|
||||||
|
makefile_path_separator_check \
|
||||||
|
makefile-check
|
||||||
|
.PHONY: $(local-checks-available)
|
||||||
|
|
||||||
|
local-check = $(filter-out $(local-checks-to-skip), $(local-checks-available))
|
||||||
|
|
||||||
|
.PHONY: $(syntax-check-rules)
|
||||||
|
syntax-check-rules = \
|
||||||
|
sc_cast_of_argument_to_free \
|
||||||
|
sc_cast_of_x_alloc_return_value \
|
||||||
|
sc_cast_of_alloca_return_value \
|
||||||
|
sc_changelog \
|
||||||
|
sc_dd_max_sym_length \
|
||||||
|
sc_error_exit_success \
|
||||||
|
sc_file_system \
|
||||||
|
sc_no_if_have_config_h \
|
||||||
|
sc_obsolete_symbols \
|
||||||
|
sc_prohibit_atoi_atof \
|
||||||
|
sc_prohibit_jm_in_m4 \
|
||||||
|
sc_prohibit_assert_without_use \
|
||||||
|
sc_require_config_h \
|
||||||
|
sc_root_tests \
|
||||||
|
sc_space_tab \
|
||||||
|
sc_sun_os_names \
|
||||||
|
sc_system_h_headers \
|
||||||
|
sc_tight_scope \
|
||||||
|
sc_trailing_blank \
|
||||||
|
sc_two_space_separator_in_usage \
|
||||||
|
sc_unmarked_diagnostics \
|
||||||
|
sc_useless_cpp_parens
|
||||||
|
|
||||||
|
syntax-check: $(syntax-check-rules)
|
||||||
|
# @grep -nE '# *include <(limits|std(def|arg|bool))\.h>' \
|
||||||
|
# $$(find -type f -name '*.[chly]') && \
|
||||||
|
# { echo '$(ME): found conditional include' 1>&2; \
|
||||||
|
# exit 1; } || :
|
||||||
|
|
||||||
|
# grep -nE '^# *include <(string|stdlib)\.h>' \
|
||||||
|
# $(srcdir)/{lib,src}/*.[chy] && \
|
||||||
|
# { echo '$(ME): FIXME' 1>&2; \
|
||||||
|
# exit 1; } || :
|
||||||
|
# FIXME: don't allow `#include .strings\.h' anywhere
|
||||||
|
|
||||||
|
sc_cast_of_argument_to_free:
|
||||||
|
@grep -nE '\<free \(\(' $(srcdir)/{lib,src}/*.[chly] && \
|
||||||
|
{ echo '$(ME): don'\''t cast free argument' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
sc_cast_of_x_alloc_return_value:
|
||||||
|
@grep -nE --exclude=$(srcdir)/lib/regex.c \
|
||||||
|
'\*\) *x(m|c|re)alloc\>' \
|
||||||
|
$(srcdir)/{lib,src}/*.[chy] && \
|
||||||
|
{ echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
sc_cast_of_alloca_return_value:
|
||||||
|
@grep -nE '\*\) *alloca\>' \
|
||||||
|
$(srcdir)/src/*.[chy] && \
|
||||||
|
{ echo '$(ME): don'\''t cast alloca return value' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
sc_space_tab:
|
||||||
|
@grep -n '[ ] ' $$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# Don't use the old ato* functions in `real' code.
|
||||||
|
# They provide no error checking mechanism.
|
||||||
|
# Instead, use strto* functions.
|
||||||
|
sc_prohibit_atoi_atof:
|
||||||
|
@grep -nE '\<ato([filq]|ll)\>' $$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): do not use ato''f, ato''i, ato''l, ato''ll, or ato''q' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# Using EXIT_SUCCESS as the first argument to error is misleading,
|
||||||
|
# since when that parameter is 0, error does not exit. Use `0' instead.
|
||||||
|
sc_error_exit_success:
|
||||||
|
@grep -nF 'error (EXIT_SUCCESS,' \
|
||||||
|
$$(find -type f -name '*.[chly]') && \
|
||||||
|
{ echo '$(ME): found error (EXIT_SUCCESS' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
sc_file_system:
|
||||||
|
@grep -ni 'file''system' $$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): found use of "file''system";' \
|
||||||
|
'rewrite to use "file system"' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
sc_no_if_have_config_h:
|
||||||
|
@grep -n '^# *if HAVE_CONFIG_H' $$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): found use of #if HAVE_CONFIG_H; use #ifdef' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# Nearly all .c files must include <config.h>.
|
||||||
|
sc_require_config_h:
|
||||||
|
@grep -L '^# *include <config\.h>' \
|
||||||
|
$$($(CVS_LIST_EXCEPT) | grep '\.c$$') \
|
||||||
|
| grep . && \
|
||||||
|
{ echo '$(ME): the above files do not include <config.h>' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# Prohibit the inclusion of assert.h without an actual use of assert.
|
||||||
|
sc_prohibit_assert_without_use:
|
||||||
|
@files=$$(grep -l '# *include <assert\.h>' \
|
||||||
|
$$($(CVS_LIST_EXCEPT) | grep '\.c$$')) && \
|
||||||
|
grep -L '\<assert (' $$files \
|
||||||
|
| grep . && \
|
||||||
|
{ echo "$(ME): the above files include <assert.h> but don't use it" \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
sc_obsolete_symbols:
|
||||||
|
@grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
|
||||||
|
$$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
|
||||||
|
|
||||||
|
# Each nonempty line must start with a year number, or a TAB.
|
||||||
|
sc_changelog:
|
||||||
|
@grep -n '^[^12 ]' $$(find . -maxdepth 2 -name ChangeLog) && \
|
||||||
|
{ echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
# Ensure that dd's definition of LONGEST_SYMBOL stays in sync
|
||||||
|
# with the strings from the two affected variables.
|
||||||
|
dd_c = $(srcdir)/src/dd.c
|
||||||
|
sc_dd_max_sym_length:
|
||||||
|
ifneq ($(wildcard $(dd_c)),)
|
||||||
|
@len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
|
||||||
|
sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \
|
||||||
|
|sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \
|
||||||
|
| wc --max-line-length); \
|
||||||
|
max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
|
||||||
|
|tr -d '"' | wc --max-line-length); \
|
||||||
|
if test "$$len" = "$$max"; then :; else \
|
||||||
|
echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Many m4 macros names once began with `jm_'.
|
||||||
|
# On 2004-04-13, they were all changed to start with gl_ instead.
|
||||||
|
# Make sure that none are inadvertently reintroduced.
|
||||||
|
sc_prohibit_jm_in_m4:
|
||||||
|
@grep -nE 'jm_[A-Z]' \
|
||||||
|
$$($(CVS_LIST) $(srcdir)/m4 |grep '\.m4$$') && \
|
||||||
|
{ echo '$(ME): do not use jm_ in m4 macro names' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
sc_root_tests:
|
||||||
|
@t1=sc-root.expected; t2=sc-root.actual; \
|
||||||
|
grep -nl '^PRIV_CHECK_ARG=require-root' \
|
||||||
|
$$($(CVS_LIST) tests) |sed s,tests,., |sort > $$t1; \
|
||||||
|
sed -n 's, cd \([^ ]*\) .*MAKE..check TESTS=\(.*\),./\1/\2,p' \
|
||||||
|
$(srcdir)/tests/Makefile.am |sort > $$t2; \
|
||||||
|
diff -u $$t1 $$t2 || diff=1; \
|
||||||
|
rm -f $$t1 $$t2; \
|
||||||
|
test "$$diff" \
|
||||||
|
&& { echo 'tests/Makefile.am: missing check-root action'>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
# Create a list of regular expressions matching the names
|
||||||
|
# of files included from system.h. Exclude a couple.
|
||||||
|
.re-list:
|
||||||
|
@sed -n '/^# *include /s///p' $(srcdir)/src/system.h \
|
||||||
|
| grep -Ev 'sys/(param|file)\.h' \
|
||||||
|
| sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
|
||||||
|
> $@-t
|
||||||
|
@mv $@-t $@
|
||||||
|
|
||||||
|
# Files in src/ should not include directly any of
|
||||||
|
# the headers already included via system.h.
|
||||||
|
sc_system_h_headers: .re-list
|
||||||
|
@if test -f $(srcdir)/src/system.h; then \
|
||||||
|
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \
|
||||||
|
grep -nE -f .re-list \
|
||||||
|
$$($(CVS_LIST) src | \
|
||||||
|
grep -Ev '((copy|system)\.h|parse-gram\.c)$$') \
|
||||||
|
&& { echo '$(ME): the above are already included via system.h'\
|
||||||
|
1>&2; exit 1; } || :; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
sc_sun_os_names:
|
||||||
|
@grep -nEi \
|
||||||
|
'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
|
||||||
|
$$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
sc_tight_scope:
|
||||||
|
$(MAKE) -C src $@
|
||||||
|
|
||||||
|
sc_trailing_blank:
|
||||||
|
@grep -n '[ ]$$' $$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): found trailing blank(s)' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
sc_two_space_separator_in_usage:
|
||||||
|
@grep -n '^ *--[a-z][0-9A-Za-z-]* [^ ].*\\$$' \
|
||||||
|
$$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo "$(ME): help2man requires at least two spaces between"; \
|
||||||
|
echo "$(ME): an option and its description"; \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# Look for diagnostics that aren't marked for translation.
|
||||||
|
# This won't find any for which error's format string is on a separate line.
|
||||||
|
sc_unmarked_diagnostics:
|
||||||
|
@grep -nE \
|
||||||
|
'\<error \([^"]*"[^"]*[a-z]{3}' $$($(CVS_LIST_EXCEPT)) \
|
||||||
|
| grep -v '_''(' && \
|
||||||
|
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
# Avoid useless parentheses like those in this example:
|
||||||
|
# #if defined (SYMBOL) || defined (SYM2)
|
||||||
|
sc_useless_cpp_parens:
|
||||||
|
@grep -n '^# *if .*defined *(' $$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): found useless parentheses in cpp directive' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# Ensure that date's --help output stays in sync with the info
|
||||||
|
# documentation for GNU strftime. The only exception is %N,
|
||||||
|
# which date accepts but GNU strftime does not.
|
||||||
|
extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
|
||||||
|
strftime-check:
|
||||||
|
if test -f $(srcdir)/src/date.c; then \
|
||||||
|
grep '^ %. ' $(srcdir)/src/date.c | sort \
|
||||||
|
| $(extract_char) > $@-src; \
|
||||||
|
{ echo N; \
|
||||||
|
info libc date calendar format | grep '^ `%.'\' \
|
||||||
|
| $(extract_char); } | sort > $@-info; \
|
||||||
|
diff -u $@-src $@-info || exit 1; \
|
||||||
|
rm -f $@-src $@-info; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ensure that we use only the standard $(VAR) notation,
|
||||||
|
# not @...@ in Makefile.am, now that we can rely on automake
|
||||||
|
# to emit a definition for each substituted variable.
|
||||||
|
makefile-check:
|
||||||
|
grep -nE '@[A-Z_0-9]+@' `find . -name Makefile.am` \
|
||||||
|
&& { echo 'Makefile.maint: use $$(...), not @...@' 1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
news-date-check: NEWS
|
||||||
|
today=`date +%Y-%m-%d`; \
|
||||||
|
if head NEWS | grep '^\*.* $(VERSION_REGEXP) ('$$today')' \
|
||||||
|
>/dev/null; then \
|
||||||
|
:; \
|
||||||
|
else \
|
||||||
|
echo "version or today's date is not in NEWS" 1>&2; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
changelog-check:
|
||||||
|
if head ChangeLog | grep 'Version $(VERSION_REGEXP)\.$$' \
|
||||||
|
>/dev/null; then \
|
||||||
|
:; \
|
||||||
|
else \
|
||||||
|
echo "$(VERSION) not in ChangeLog" 1>&2; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
m4-check:
|
||||||
|
@grep -n 'AC_DEFUN([^[]' m4/*.m4 \
|
||||||
|
&& { echo 'Makefile.maint: quote the first arg to AC_DEFUN' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
# Verify that all source files using _() are listed in po/POTFILES.in.
|
||||||
|
# FIXME: don't hard-code file names below; use a more general mechanism.
|
||||||
|
po-check:
|
||||||
|
if test -f po/POTFILES.in; then \
|
||||||
|
grep -E -v '^(#|$$)' po/POTFILES.in \
|
||||||
|
| grep -v '^src/false\.c$$' | sort > $@-1; \
|
||||||
|
files=; \
|
||||||
|
for file in $$($(CVS_LIST_EXCEPT)) lib/*.[ch]; do \
|
||||||
|
case $$file in \
|
||||||
|
djgpp/* | man/*) continue;; \
|
||||||
|
esac; \
|
||||||
|
case $$file in \
|
||||||
|
*.[ch]) \
|
||||||
|
base=`expr " $$file" : ' \(.*\)\..'`; \
|
||||||
|
{ test -f $$base.l || test -f $$base.y; } && continue;; \
|
||||||
|
esac; \
|
||||||
|
files="$$files $$file"; \
|
||||||
|
done; \
|
||||||
|
grep -E -l '\bN?_\([^)"]*("|$$)' $$files | sort -u > $@-2; \
|
||||||
|
diff -u $@-1 $@-2 || exit 1; \
|
||||||
|
rm -f $@-1 $@-2; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# In a definition of #define AUTHORS "... and ..." where the RHS contains
|
||||||
|
# the English word `and', the string must be marked with `N_ (...)' so that
|
||||||
|
# gettext recognizes it as a string requiring translation.
|
||||||
|
author_mark_check:
|
||||||
|
@grep -n '^# *define AUTHORS "[^"]* and ' src/*.c |grep -v ' N_ (' && \
|
||||||
|
{ echo 'Makefile.maint: enclose the above strings in N_ (...)' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
# Sometimes it is useful to change the PATH environment variable
|
||||||
|
# in Makefiles. When doing so, it's better not to use the Unix-centric
|
||||||
|
# path separator of `:', but rather the automake-provided `@PATH_SEPARATOR@'.
|
||||||
|
# It'd be better to use `find -print0 ...|xargs -0 ...', but less portable,
|
||||||
|
# and there probably aren't many projects with so many Makefile.am files
|
||||||
|
# that we'd have to worry about limits on command line length.
|
||||||
|
msg = 'Makefile.maint: Do not use `:'\'' above; use @PATH_SEPARATOR@ instead'
|
||||||
|
makefile_path_separator_check:
|
||||||
|
@grep -n 'PATH=.*:' `find $(srcdir) -name Makefile.am` \
|
||||||
|
&& { echo $(msg) 1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# Check that `make alpha' will not fail at the end of the process.
|
||||||
|
writable-files:
|
||||||
|
if test -d $(release_archive_dir); then :; else \
|
||||||
|
mkdir $(release_archive_dir); \
|
||||||
|
fi
|
||||||
|
for file in $(distdir).tar.gz $(xd-delta) \
|
||||||
|
$(release_archive_dir)/$(distdir).tar.gz \
|
||||||
|
$(release_archive_dir)/$(xd-delta); do \
|
||||||
|
test -e $$file || continue; \
|
||||||
|
test -w $$file \
|
||||||
|
|| { echo ERROR: $$file is not writable; fail=1; }; \
|
||||||
|
done; \
|
||||||
|
test "$$fail" && exit 1 || :
|
||||||
|
|
||||||
|
v_etc_file = lib/version-etc.c
|
||||||
|
# Make sure that the copyright date in $(v_etc_file) is up to date.
|
||||||
|
copyright-check:
|
||||||
|
@if test -f $(v_etc_file); then \
|
||||||
|
grep 'enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' $(v_etc_file) \
|
||||||
|
>/dev/null \
|
||||||
|
|| { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
|
||||||
|
exit 1; }; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Sanity checks with the CVS repository.
|
||||||
|
cvs-tag-check:
|
||||||
|
echo $(this-cvs-tag); \
|
||||||
|
if $(CVS) -n log -h README | grep -e $(this-cvs-tag): >/dev/null; then \
|
||||||
|
echo "$(this-cvs-tag) as already been used; not tagging" 1>&2; \
|
||||||
|
exit 1; \
|
||||||
|
else :; fi
|
||||||
|
|
||||||
|
cvs-diff-check:
|
||||||
|
if $(CVS) diff >cvs-diffs; then \
|
||||||
|
rm cvs-diffs; \
|
||||||
|
else \
|
||||||
|
echo "Some files are locally modified:" 1>&2; \
|
||||||
|
cat cvs-diffs; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
cvs-check: cvs-diff-check cvs-tag-check
|
||||||
|
|
||||||
|
maintainer-distcheck: changelog-check
|
||||||
|
$(MAKE) distcheck
|
||||||
|
$(MAKE) my-distcheck
|
||||||
|
|
||||||
|
|
||||||
|
# Tag before making distribution. Also, don't make a distribution if
|
||||||
|
# checks fail. Also, make sure the NEWS file is up-to-date.
|
||||||
|
# FIXME: use dist-hook/my-dist like distcheck-hook/my-distcheck.
|
||||||
|
cvs-dist: $(local-check) cvs-check maintainer-distcheck
|
||||||
|
$(CVS) update po
|
||||||
|
$(CVS) tag -c $(this-cvs-tag)
|
||||||
|
$(MAKE) dist
|
||||||
|
|
||||||
|
# Use this to make sure we don't run these programs when building
|
||||||
|
# from a virgin tgz file, below.
|
||||||
|
null_AM_MAKEFLAGS = \
|
||||||
|
ACLOCAL=false \
|
||||||
|
AUTOCONF=false \
|
||||||
|
AUTOMAKE=false \
|
||||||
|
AUTOHEADER=false \
|
||||||
|
MAKEINFO=false
|
||||||
|
|
||||||
|
# Detect format-string/arg-list mismatches that would normally be obscured
|
||||||
|
# by the use of _(). The --disable-nls effectively defines away that macro,
|
||||||
|
# and building with CFLAGS='-Wformat -Werror' causes any format warning to be
|
||||||
|
# treated as a failure. Also, check for shadowing problems with -Wshadow.
|
||||||
|
# These CFLAGS are pretty strict. If you build this target, you probably
|
||||||
|
# have to have a recent version of gcc and glibc headers.
|
||||||
|
TMPDIR ?= /tmp
|
||||||
|
t=$(TMPDIR)/$(PACKAGE)/test
|
||||||
|
my-distcheck: $(local-check) $(release_archive_dir)/$(prev-tgz)
|
||||||
|
-rm -rf $(t)
|
||||||
|
mkdir -p $(t)
|
||||||
|
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
|
||||||
|
cd $(t)/$(distdir) \
|
||||||
|
&& ./configure --disable-nls \
|
||||||
|
&& $(MAKE) CFLAGS='-Werror -Wall -Wformat -Wshadow' \
|
||||||
|
AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
|
||||||
|
&& $(MAKE) dvi \
|
||||||
|
&& $(MAKE) check \
|
||||||
|
&& $(MAKE) distclean
|
||||||
|
(cd $(t) && mv $(distdir) $(distdir).old \
|
||||||
|
&& $(AMTAR) -zxf - ) < $(distdir).tar.gz
|
||||||
|
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
|
||||||
|
-rm -rf $(t)
|
||||||
|
@echo "========================"; \
|
||||||
|
echo "$(distdir).tar.gz is ready for distribution"; \
|
||||||
|
echo "========================"
|
||||||
|
|
||||||
|
WGET = wget
|
||||||
|
WGETFLAGS = -C off
|
||||||
|
|
||||||
|
rel-check:
|
||||||
|
tarz=/tmp/rel-check-tarz-$$$$; \
|
||||||
|
md5_tmp=/tmp/rel-check-md5-$$$$; \
|
||||||
|
set -e; \
|
||||||
|
trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \
|
||||||
|
$(WGET) $(WGETFLAGS) -q --output-document=$$tarz $(url); \
|
||||||
|
echo "$(md5) -" > $$md5_tmp; \
|
||||||
|
md5sum -c $$md5_tmp < $$tarz
|
||||||
|
|
||||||
|
prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
|
||||||
|
xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
|
||||||
|
|
||||||
|
rel-files = $(xd-delta) $(DIST_ARCHIVES)
|
||||||
|
announcement: NEWS ChangeLog $(rel-files)
|
||||||
|
@./announce-gen \
|
||||||
|
--release-type=$(RELEASE_TYPE) \
|
||||||
|
--package=$(PACKAGE) \
|
||||||
|
--prev=$(PREV_VERSION) \
|
||||||
|
--curr=$(VERSION) \
|
||||||
|
--release-archive-directory=$(release_archive_dir) \
|
||||||
|
--gpg-key-id=$(gpg_key_ID) \
|
||||||
|
--news=NEWS \
|
||||||
|
$(addprefix --url-dir=, $(url_dir_list)) \
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## Updating files. ##
|
## Updating files. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
|
|
||||||
WGET = wget
|
|
||||||
ftp-gnu = ftp://ftp.gnu.org/gnu
|
ftp-gnu = ftp://ftp.gnu.org/gnu
|
||||||
|
www-gnu = http://www.gnu.org
|
||||||
|
|
||||||
# Use mv, if you don't have/want move-if-change.
|
# Use mv, if you don't have/want move-if-change.
|
||||||
move_if_change ?= move-if-change
|
move_if_change ?= move-if-change
|
||||||
|
|
||||||
|
|
||||||
|
# --------------------- #
|
||||||
|
# Updating everything. #
|
||||||
|
# --------------------- #
|
||||||
|
|
||||||
|
.PHONY: update
|
||||||
|
local_updates ?= wget-update cvs-update po-update
|
||||||
|
update: $(local_updates)
|
||||||
|
|
||||||
|
|
||||||
# ------------------- #
|
# ------------------- #
|
||||||
# Updating PO files. #
|
# Updating PO files. #
|
||||||
# ------------------- #
|
# ------------------- #
|
||||||
@@ -63,7 +545,8 @@ do-po-update:
|
|||||||
tmppo=/tmp/$(PACKAGE)-$(VERSION)-po &&\
|
tmppo=/tmp/$(PACKAGE)-$(VERSION)-po &&\
|
||||||
rm -rf $$tmppo && \
|
rm -rf $$tmppo && \
|
||||||
mkdir $$tmppo && \
|
mkdir $$tmppo && \
|
||||||
(cd $$tmppo && $(WGET) -r -l1 -nd --no-parent -A '*.po' $(po_repo)) &&\
|
(cd $$tmppo && \
|
||||||
|
$(WGET) $(WGETFLAGS) -r -l1 -nd --no-parent -A '*.po' $(po_repo)) &&\
|
||||||
cp $$tmppo/*.po po
|
cp $$tmppo/*.po po
|
||||||
cd po && $(MAKE) update-po
|
cd po && $(MAKE) update-po
|
||||||
$(MAKE) po-check
|
$(MAKE) po-check
|
||||||
@@ -80,267 +563,77 @@ po-update:
|
|||||||
# The following pseudo table associates a local directory and a URL
|
# The following pseudo table associates a local directory and a URL
|
||||||
# with each of the files that belongs to some other package and is
|
# with each of the files that belongs to some other package and is
|
||||||
# regularly updated from the specified URL.
|
# regularly updated from the specified URL.
|
||||||
wget_files ?= $(srcdir)/config.guess $(srcdir)/config.sub \
|
wget_files ?= \
|
||||||
$(srcdir)/src/ansi2knr.c \
|
$(srcdir)/build-aux/config.guess \
|
||||||
$(srcdir)/doc/texinfo.tex
|
$(srcdir)/build-aux/config.sub \
|
||||||
wget-targets = $(patsubst %, get-%, $(wget_files))
|
$(srcdir)/build-aux/texinfo.tex \
|
||||||
|
$(srcdir)/src/ansi2knr.c
|
||||||
|
|
||||||
config.guess-url_prefix = $(ftp-gnu)/config/
|
get-targets = $(patsubst %, get-%, $(wget_files))
|
||||||
config.sub-url_prefix = $(ftp-gnu)/config/
|
|
||||||
|
config.guess-url_prefix = $(ftp-gnu)/build-aux/
|
||||||
|
config.sub-url_prefix = $(ftp-gnu)/build-aux/
|
||||||
|
|
||||||
ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
|
ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
|
||||||
|
|
||||||
texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
|
texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
|
||||||
|
|
||||||
standards.texi-url_prefix = $(ftp-gnu)/GNUinfo/
|
standards.texi-url_prefix = $(www-gnu)/prep/
|
||||||
make-stds.texi-url_prefix = $(ftp-gnu)/GNUinfo/
|
make-stds.texi-url_prefix = $(standards.texi-url_prefix)
|
||||||
|
|
||||||
target = $(patsubst get-%, %, $@)
|
target = $(patsubst get-%, %, $@)
|
||||||
url = $($(notdir $(target))-url_prefix)$(notdir $(target))
|
url = $($(notdir $(target))-url_prefix)$(notdir $(target))
|
||||||
|
|
||||||
.PHONY: $(wget-targets)
|
.PHONY: $(get-targets)
|
||||||
$(wget-targets):
|
$(get-targets):
|
||||||
$(WGET) $(url) -O $(target).t \
|
$(WGET) $(WGETFLAGS) $(url) -O $(target).t \
|
||||||
&& $(move_if_change) $(target).t $(target)
|
&& $(move_if_change) $(target).t $(target)
|
||||||
|
|
||||||
|
cvs_files ?= \
|
||||||
|
$(srcdir)/build-aux/depcomp \
|
||||||
|
$(srcdir)/build-aux/install-sh \
|
||||||
|
$(srcdir)/build-aux/missing \
|
||||||
|
$(srcdir)/build-aux/mkinstalldirs \
|
||||||
|
$(srcdir)/src/ansi2knr.c
|
||||||
|
automake_repo=:pserver:anoncvs:[email protected]:/cvs/automake
|
||||||
.PHONY: wget-update
|
.PHONY: wget-update
|
||||||
wget-update: $(wget-targets)
|
wget-update: $(get-targets)
|
||||||
|
|
||||||
|
|
||||||
# Updating tools via CVS.
|
|
||||||
cvs_files ?= depcomp missing
|
|
||||||
cvs-targets = $(patsubst %, get-%, $(cvs_files))
|
|
||||||
|
|
||||||
automake_repo = :pserver:[email protected]:/cvs/automake
|
|
||||||
.PHONY: $(cvs-targets)
|
|
||||||
$(cvs-targets):
|
|
||||||
$(CVS) -d $(automake_repo) co -p automake/lib/$(notdir $(target)) \
|
|
||||||
>$(target).t \
|
|
||||||
&& $(move_if_change) $(target).t $(target);
|
|
||||||
|
|
||||||
.PHONY: cvs-update
|
.PHONY: cvs-update
|
||||||
cvs-update: $(cvs-targets)
|
cvs-update:
|
||||||
|
fail=; \
|
||||||
|
for f in $(cvs_files); do \
|
||||||
# --------------------- #
|
test -f $$f || { echo "*** skipping $$f" 1>&2; continue; }; \
|
||||||
# Updating everything. #
|
cvs diff $$f > /dev/null \
|
||||||
# --------------------- #
|
|| { echo "*** $$f is locally modified; skipping it" 1>&2; \
|
||||||
|
fail=yes; continue; }; \
|
||||||
.PHONY: update
|
file=$$(basename $$f); \
|
||||||
update: wget-update cvs-update po-update
|
echo checking out $$file...; \
|
||||||
|
$(CVS) -d $(automake_repo) co -p automake/lib/$$file> $$f.t \
|
||||||
|
&& $(move_if_change) $$f.t $$f; \
|
||||||
|
|
||||||
## --------------- ##
|
|
||||||
## Sanity checks. ##
|
|
||||||
## --------------- ##
|
|
||||||
|
|
||||||
# Checks that don't require cvs. Run `changelog-check' last as
|
|
||||||
# previous test may reveal problems requiring new ChangeLog entries.
|
|
||||||
local-check: po-check copyright-check writable-files changelog-check
|
|
||||||
|
|
||||||
changelog-check:
|
|
||||||
if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
|
|
||||||
:; \
|
|
||||||
else \
|
|
||||||
echo "$(VERSION) not in ChangeLog" 1>&2; \
|
|
||||||
exit 1; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Verify that all source files using _() are listed in po/POTFILES.in.
|
|
||||||
po-check:
|
|
||||||
if test -f po/POTFILES.in; then \
|
|
||||||
grep -E -v '^(#|$$)' po/POTFILES.in | sort > $@-1; \
|
|
||||||
grep -E -l '\b_\(' lib/*.c src/*.c | sort > $@-2; \
|
|
||||||
diff -u $@-1 $@-2 || exit 1; \
|
|
||||||
rm -f $@-1 $@-2; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check that `make alpha' will not fail at the end of the process.
|
|
||||||
writable-files:
|
|
||||||
if test -d $(release_archive_dir); then :; else \
|
|
||||||
mkdir $(release_archive_dir); \
|
|
||||||
fi
|
|
||||||
for file in $(distdir).tar.gz $(xd-delta) \
|
|
||||||
$(release_archive_dir)/$(distdir).tar.gz \
|
|
||||||
$(release_archive_dir)/$(xd-delta); do \
|
|
||||||
test -e $$file || continue; \
|
|
||||||
test -w $$file \
|
|
||||||
|| { echo ERROR: $$file is not writable; fail=1; }; \
|
|
||||||
done; \
|
done; \
|
||||||
test "$$fail" && exit 1 || :
|
test "$$fail" && exit 1
|
||||||
|
|
||||||
# Make sure that the copyright date in lib/version-etc.c is up to date.
|
emit_upload_commands:
|
||||||
copyright-check:
|
@echo =====================================
|
||||||
@if test -f lib/version-etc.c; then \
|
@echo =====================================
|
||||||
grep 'N_("Copyright (C) $(shell date +%Y) Free' lib/version-etc.c \
|
@echo "$(srcdir)/gnupload $(GNUPLOADFLAGS) \\"
|
||||||
>/dev/null \
|
@echo " --to $(gnu_rel_host):coreutils \\"
|
||||||
|| { echo 'out of date copyright in $<; update it' 1>&2; exit 1; }; \
|
@echo " $(rel-files)"
|
||||||
fi
|
@echo '# send the /tmp/announcement e-mail'
|
||||||
|
@echo =====================================
|
||||||
|
@echo =====================================
|
||||||
# Sanity checks with the CVS repository.
|
|
||||||
cvs-tag-check:
|
|
||||||
echo $(this-cvs-tag); \
|
|
||||||
if $(CVS) -n log -h README | grep -e $(this-cvs-tag): >/dev/null; then \
|
|
||||||
echo "$(this-cvs-tag) as already been used; not tagging" 1>&2; \
|
|
||||||
exit 1; \
|
|
||||||
else :; fi
|
|
||||||
|
|
||||||
cvs-diff-check:
|
|
||||||
if $(CVS) diff >cvs-diffs; then \
|
|
||||||
rm cvs-diffs; \
|
|
||||||
else \
|
|
||||||
echo "Some files are locally modified:" 1>&2; \
|
|
||||||
cat cvs-diffs; \
|
|
||||||
exit 1; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
cvs-check: cvs-diff-check cvs-tag-check
|
|
||||||
|
|
||||||
maintainer-distcheck: changelog-check
|
|
||||||
$(MAKE) distcheck
|
|
||||||
$(MAKE) my-distcheck
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## -------------- ##
|
|
||||||
## Making dists. ##
|
|
||||||
## -------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# Tag before making distribution. Also, don't make a distribution if
|
|
||||||
# checks fail. Also, make sure the NEWS file is up-to-date.
|
|
||||||
# FIXME: use dist-hook/my-dist like distcheck-hook/my-distcheck.
|
|
||||||
cvs-dist: local-check cvs-check maintainer-distcheck
|
|
||||||
$(CVS) update po
|
|
||||||
$(CVS) tag -c $(this-cvs-tag)
|
|
||||||
$(MAKE) dist
|
|
||||||
|
|
||||||
# Use this to make sure we don't run these programs when building
|
|
||||||
# from a virgin tgz file, below.
|
|
||||||
null_AM_MAKEFLAGS = \
|
|
||||||
ACLOCAL=false \
|
|
||||||
AUTOCONF=false \
|
|
||||||
AUTOM4TE=false \
|
|
||||||
AUTOMAKE=false \
|
|
||||||
AUTOHEADER=false \
|
|
||||||
MAKEINFO=false
|
|
||||||
|
|
||||||
# Detect format-string/arg-list mismatches that would normally be obscured
|
|
||||||
# by the use of _(). The --disable-nls effectively defines away that macro,
|
|
||||||
# and building with CFLAGS='-Wformat -Werror' causes any format warning to be
|
|
||||||
# treated as a failure.
|
|
||||||
t=./=test
|
|
||||||
my-distcheck: writable-files po-check
|
|
||||||
-rm -rf $(t)
|
|
||||||
mkdir $(t)
|
|
||||||
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
|
|
||||||
cd $(t)/$(distdir) \
|
|
||||||
&& ./configure --disable-nls \
|
|
||||||
&& $(MAKE) CFLAGS='-Wformat -Werror' \
|
|
||||||
AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
|
|
||||||
&& $(MAKE) dvi \
|
|
||||||
&& $(MAKE) check \
|
|
||||||
&& $(MAKE) distclean
|
|
||||||
cd $(t) && mv $(distdir) $(distdir).old \
|
|
||||||
&& $(AMTAR) -zxf ../$(distdir).tar.gz
|
|
||||||
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
|
|
||||||
-rm -rf $(t)
|
|
||||||
@echo "========================"; \
|
|
||||||
echo "$(distdir).tar.gz is ready for distribution"; \
|
|
||||||
echo "========================"
|
|
||||||
|
|
||||||
# This must be the same name on both hosts.
|
|
||||||
# Make it a symlink that points to the right place.
|
|
||||||
real_dir = fetish-ftp
|
|
||||||
|
|
||||||
url_dir_list = $(foreach x,$(hosts),ftp://$($(x)_host)/$($(x)_url_dir))
|
|
||||||
|
|
||||||
tgz-md5 = $(shell md5sum < $(my_distdir).tar.gz|sed 's/ -//')
|
|
||||||
tgz-sha1 = $(shell sha1sum < $(my_distdir).tar.gz|sed 's/ -//')
|
|
||||||
bz2-md5 = $(shell md5sum < $(my_distdir).tar.bz2|sed 's/ -//')
|
|
||||||
bz2-sha1 = $(shell sha1sum < $(my_distdir).tar.bz2|sed 's/ -//')
|
|
||||||
tgz-size = $(shell du --human $(my_distdir).tar.gz|sed 's/\([Mk]\).*/ \1B/')
|
|
||||||
bz2-size = $(shell du --human $(my_distdir).tar.bz2|sed 's/\([Mk]\).*/ \1B/')
|
|
||||||
xd-size = $(shell du --human $(xd-delta)|sed 's/\([Mk]\).*/ \1B/')
|
|
||||||
|
|
||||||
rel-check:
|
|
||||||
tarz=/tmp/rel-check-tarz-$$$$; \
|
|
||||||
md5_tmp=/tmp/rel-check-md5-$$$$; \
|
|
||||||
set -e; \
|
|
||||||
trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \
|
|
||||||
$(WGET) -q --output-document=$$tarz $(url); \
|
|
||||||
echo "$(md5) -" > $$md5_tmp; \
|
|
||||||
md5sum -c $$md5_tmp < $$tarz
|
|
||||||
|
|
||||||
prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
|
|
||||||
xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
|
|
||||||
|
|
||||||
GZIP = gzip
|
|
||||||
BZIP2 = bzip2
|
|
||||||
$(my_distdir).tar.bz2: $(my_distdir).tar.gz
|
|
||||||
$(GZIP) -dc $< > $(my_distdir).tar
|
|
||||||
rm -f $@
|
|
||||||
$(BZIP2) -9 $(my_distdir).tar
|
|
||||||
|
|
||||||
rel-files = $(xd-delta) $(distdir).tar.bz2 $(distdir).tar.gz
|
|
||||||
announcement: NEWS ChangeLog $(rel-files)
|
|
||||||
@( \
|
|
||||||
echo Subject: $(my_distdir) released; \
|
|
||||||
echo; \
|
|
||||||
echo FIXME: put comments here; \
|
|
||||||
echo; \
|
|
||||||
for url in $(url_dir_list); do \
|
|
||||||
echo " $$url/$(my_distdir).tar.gz ($(tgz-size))"; \
|
|
||||||
echo " $$url/$(my_distdir).tar.bz2 ($(bz2-size))"; \
|
|
||||||
done; \
|
|
||||||
echo; \
|
|
||||||
echo And here are xdelta-style diffs; \
|
|
||||||
echo; \
|
|
||||||
for url in $(url_dir_list); do \
|
|
||||||
echo " $$url/$(xd-delta) ($(xd-size))"; \
|
|
||||||
done; \
|
|
||||||
echo; \
|
|
||||||
echo "Here are the MD5 and SHA1 signatures for the compressed tar files:"; \
|
|
||||||
echo; \
|
|
||||||
echo "$(tgz-md5) $(my_distdir).tar.gz"; \
|
|
||||||
echo "$(bz2-md5) $(my_distdir).tar.bz2"; \
|
|
||||||
echo "$(tgz-sha1) $(my_distdir).tar.gz"; \
|
|
||||||
echo "$(bz2-sha1) $(my_distdir).tar.bz2"; \
|
|
||||||
echo; \
|
|
||||||
echo NEWS:; \
|
|
||||||
sed -n "/$(THIS_VERSION_REGEXP)[]:]/,/$(PREV_VERSION_REGEXP)[]:]/p" NEWS \
|
|
||||||
| grep -v '^\['; \
|
|
||||||
echo; \
|
|
||||||
echo ChangeLog entries:; \
|
|
||||||
find . -name ChangeLog -maxdepth 2 \
|
|
||||||
| xargs $(CVS) diff -up -r$(prev-cvs-tag) -rHEAD \
|
|
||||||
| sed -n 's/^+//p' \
|
|
||||||
| perl -ne 'm!^\+\+ (\./)?! or print,next;' \
|
|
||||||
-e 'print "\n"."*"x70 ."\n"; s///; print; print "*"x70 ."\n"'; \
|
|
||||||
)
|
|
||||||
|
|
||||||
define emit-rsync-commands
|
|
||||||
echo =====================================
|
|
||||||
echo =====================================
|
|
||||||
echo 'for host in $(a_host) $(b_host); do \'
|
|
||||||
echo ' rsync -e ssh --pro -av $(xd-delta) $(my_distdir).tar.bz2 \'
|
|
||||||
echo ' $(my_distdir).tar.gz $$host:$(real_dir); done'
|
|
||||||
echo '# send the /tmp/announcement e-mail'
|
|
||||||
echo =====================================
|
|
||||||
echo =====================================
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz
|
$(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz
|
||||||
xdelta delta -9 $^ $@ || :
|
xdelta delta -9 $^ $@ || :
|
||||||
|
|
||||||
alpha:
|
.PHONY: alpha beta major
|
||||||
|
alpha beta major: news-date-check $(local-check)
|
||||||
$(MAKE) cvs-dist
|
$(MAKE) cvs-dist
|
||||||
$(MAKE) $(xd-delta)
|
$(MAKE) $(xd-delta)
|
||||||
$(MAKE) -s announcement > /tmp/announce-$(my_distdir)
|
$(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir)
|
||||||
ln $(rel-files) $(release_archive_dir)
|
ln $(rel-files) $(release_archive_dir)
|
||||||
chmod a-w $(rel-files)
|
chmod a-w $(rel-files)
|
||||||
|
$(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
|
||||||
echo $(VERSION) > $(prev_version_file)
|
echo $(VERSION) > $(prev_version_file)
|
||||||
$(CVS) ci -m. $(prev_version_file)
|
$(CVS) ci -m. $(prev_version_file)
|
||||||
@$(emit-rsync-commands)
|
|
||||||
|
|||||||
@@ -1,10 +1,417 @@
|
|||||||
Bison News
|
Bison News
|
||||||
----------
|
----------
|
||||||
|
|
||||||
Changes in version 1.49c:
|
Changes in version 2.3a, 2006-09-13:
|
||||||
|
|
||||||
|
* Instead of %union, you can define and use your own union type
|
||||||
|
YYSTYPE if your grammar contains at least one <type> tag.
|
||||||
|
Your YYSTYPE need not be a macro; it can be a typedef.
|
||||||
|
This change is for compatibility with other Yacc implementations,
|
||||||
|
and is required by POSIX.
|
||||||
|
|
||||||
Changes in version 1.49b, 2002-08-12:
|
* Locations columns and lines start at 1.
|
||||||
|
In accordance with the GNU Coding Standards and Emacs.
|
||||||
|
|
||||||
|
* You may now declare per-type and default %destructor's and %printer's:
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
%union { char *string; }
|
||||||
|
%token <string> STRING1
|
||||||
|
%token <string> STRING2
|
||||||
|
%type <string> string1
|
||||||
|
%type <string> string2
|
||||||
|
%union { char character; }
|
||||||
|
%token <character> CHR
|
||||||
|
%type <character> chr
|
||||||
|
%destructor { free ($$); } %symbol-default
|
||||||
|
%destructor { free ($$); printf ("%d", @$.first_line); } STRING1 string1
|
||||||
|
%destructor { } <character>
|
||||||
|
|
||||||
|
guarantees that, when the parser discards any user-defined symbol that has a
|
||||||
|
semantic type tag other than `<character>', it passes its semantic value to
|
||||||
|
`free'. However, when the parser discards a `STRING1' or a `string1', it
|
||||||
|
also prints its line number to `stdout'. It performs only the second
|
||||||
|
`%destructor' in this case, so it invokes `free' only once.
|
||||||
|
|
||||||
|
* Except for LALR(1) parsers in C with POSIX Yacc emulation enabled (with `-y',
|
||||||
|
`--yacc', or `%yacc'), Bison no longer generates #define statements for
|
||||||
|
associating token numbers with token names. Removing the #define statements
|
||||||
|
helps to sanitize the global namespace during preprocessing, but POSIX Yacc
|
||||||
|
requires them. Bison still generates an enum for token names in all cases.
|
||||||
|
|
||||||
|
* Handling of traditional Yacc prologue blocks is now more consistent but
|
||||||
|
potentially incompatible with previous releases of Bison.
|
||||||
|
|
||||||
|
As before, you declare prologue blocks in your grammar file with the
|
||||||
|
`%{ ... %}' syntax. To generate the pre-prologue, Bison concatenates all
|
||||||
|
prologue blocks that you've declared before the first %union. To generate
|
||||||
|
the post-prologue, Bison concatenates all prologue blocks that you've
|
||||||
|
declared after the first %union.
|
||||||
|
|
||||||
|
Previous releases of Bison inserted the pre-prologue into both the header
|
||||||
|
file and the code file in all cases except for LALR(1) parsers in C. In the
|
||||||
|
latter case, Bison inserted it only into the code file. For parsers in C++,
|
||||||
|
the point of insertion was before any token definitions (which associate
|
||||||
|
token numbers with names). For parsers in C, the point of insertion was
|
||||||
|
after the token definitions.
|
||||||
|
|
||||||
|
Now, Bison never inserts the pre-prologue into the header file. In the code
|
||||||
|
file, it always inserts it before the token definitions.
|
||||||
|
|
||||||
|
* Bison now provides a more flexible alternative to the traditional Yacc
|
||||||
|
prologue blocks: %before-header, %start-header, %end-header, and
|
||||||
|
%after-header.
|
||||||
|
|
||||||
|
For example, the following declaration order in the grammar file reflects the
|
||||||
|
order in which Bison will output these code blocks. However, you are free to
|
||||||
|
declare these code blocks in your grammar file in whatever order is most
|
||||||
|
convenient for you:
|
||||||
|
|
||||||
|
%before-header {
|
||||||
|
/* Bison treats this block like a pre-prologue block: it inserts it into
|
||||||
|
* the code file before the contents of the header file. It does *not*
|
||||||
|
* insert it into the header file. This is a good place to put
|
||||||
|
* #include's that you want at the top of your code file. A common
|
||||||
|
* example is `#include "system.h"'. */
|
||||||
|
}
|
||||||
|
%start-header {
|
||||||
|
/* Bison inserts this block into both the header file and the code file.
|
||||||
|
* In both files, the point of insertion is before any Bison-generated
|
||||||
|
* token, semantic type, location type, and class definitions. This is a
|
||||||
|
* good place to define %union dependencies, for example. */
|
||||||
|
}
|
||||||
|
%union {
|
||||||
|
/* Unlike the traditional Yacc prologue blocks, the output order for the
|
||||||
|
* new %*-header blocks is not affected by their declaration position
|
||||||
|
* relative to any %union in the grammar file. */
|
||||||
|
}
|
||||||
|
%end-header {
|
||||||
|
/* Bison inserts this block into both the header file and the code file.
|
||||||
|
* In both files, the point of insertion is after the Bison-generated
|
||||||
|
* definitions. This is a good place to declare or define public
|
||||||
|
* functions or data structures that depend on the Bison-generated
|
||||||
|
* definitions. */
|
||||||
|
}
|
||||||
|
%after-header {
|
||||||
|
/* Bison treats this block like a post-prologue block: it inserts it into
|
||||||
|
* the code file after the contents of the header file. It does *not*
|
||||||
|
* insert it into the header file. This is a good place to declare or
|
||||||
|
* define internal functions or data structures that depend on the
|
||||||
|
* Bison-generated definitions. */
|
||||||
|
}
|
||||||
|
|
||||||
|
If you have multiple occurrences of any one of the above declarations, Bison
|
||||||
|
will concatenate the contents in declaration order.
|
||||||
|
|
||||||
|
* The option `--report=look-ahead' has been changed to `--report=lookahead'.
|
||||||
|
The old spelling still works, but is not documented and may be removed
|
||||||
|
in a future release.
|
||||||
|
|
||||||
|
Changes in version 2.3, 2006-06-05:
|
||||||
|
|
||||||
|
* GLR grammars should now use `YYRECOVERING ()' instead of `YYRECOVERING',
|
||||||
|
for compatibility with LALR(1) grammars.
|
||||||
|
|
||||||
|
* It is now documented that any definition of YYSTYPE or YYLTYPE should
|
||||||
|
be to a type name that does not contain parentheses or brackets.
|
||||||
|
|
||||||
|
Changes in version 2.2, 2006-05-19:
|
||||||
|
|
||||||
|
* The distribution terms for all Bison-generated parsers now permit
|
||||||
|
using the parsers in nonfree programs. Previously, this permission
|
||||||
|
was granted only for Bison-generated LALR(1) parsers in C.
|
||||||
|
|
||||||
|
* %name-prefix changes the namespace name in C++ outputs.
|
||||||
|
|
||||||
|
* The C++ parsers export their token_type.
|
||||||
|
|
||||||
|
* Bison now allows multiple %union declarations, and concatenates
|
||||||
|
their contents together.
|
||||||
|
|
||||||
|
* New warning: unused values
|
||||||
|
Right-hand side symbols whose values are not used are reported,
|
||||||
|
if the symbols have destructors. For instance:
|
||||||
|
|
||||||
|
exp: exp "?" exp ":" exp { $1 ? $1 : $3; }
|
||||||
|
| exp "+" exp
|
||||||
|
;
|
||||||
|
|
||||||
|
will trigger a warning about $$ and $5 in the first rule, and $3 in
|
||||||
|
the second ($1 is copied to $$ by the default rule). This example
|
||||||
|
most likely contains three errors, and could be rewritten as:
|
||||||
|
|
||||||
|
exp: exp "?" exp ":" exp
|
||||||
|
{ $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); }
|
||||||
|
| exp "+" exp
|
||||||
|
{ $$ = $1 ? $1 : $3; if ($1) free ($3); }
|
||||||
|
;
|
||||||
|
|
||||||
|
However, if the original actions were really intended, memory leaks
|
||||||
|
and all, the warnings can be suppressed by letting Bison believe the
|
||||||
|
values are used, e.g.:
|
||||||
|
|
||||||
|
exp: exp "?" exp ":" exp { $1 ? $1 : $3; (void) ($$, $5); }
|
||||||
|
| exp "+" exp { $$ = $1; (void) $3; }
|
||||||
|
;
|
||||||
|
|
||||||
|
If there are mid-rule actions, the warning is issued if no action
|
||||||
|
uses it. The following triggers no warning: $1 and $3 are used.
|
||||||
|
|
||||||
|
exp: exp { push ($1); } '+' exp { push ($3); sum (); };
|
||||||
|
|
||||||
|
The warning is intended to help catching lost values and memory leaks.
|
||||||
|
If a value is ignored, its associated memory typically is not reclaimed.
|
||||||
|
|
||||||
|
* %destructor vs. YYABORT, YYACCEPT, and YYERROR.
|
||||||
|
Destructors are now called when user code invokes YYABORT, YYACCEPT,
|
||||||
|
and YYERROR, for all objects on the stack, other than objects
|
||||||
|
corresponding to the right-hand side of the current rule.
|
||||||
|
|
||||||
|
* %expect, %expect-rr
|
||||||
|
Incorrect numbers of expected conflicts are now actual errors,
|
||||||
|
instead of warnings.
|
||||||
|
|
||||||
|
* GLR, YACC parsers.
|
||||||
|
The %parse-params are available in the destructors (and the
|
||||||
|
experimental printers) as per the documentation.
|
||||||
|
|
||||||
|
* Bison now warns if it finds a stray `$' or `@' in an action.
|
||||||
|
|
||||||
|
* %require "VERSION"
|
||||||
|
This specifies that the grammar file depends on features implemented
|
||||||
|
in Bison version VERSION or higher.
|
||||||
|
|
||||||
|
* lalr1.cc: The token and value types are now class members.
|
||||||
|
The tokens were defined as free form enums and cpp macros. YYSTYPE
|
||||||
|
was defined as a free form union. They are now class members:
|
||||||
|
tokens are enumerations of the `yy::parser::token' struct, and the
|
||||||
|
semantic values have the `yy::parser::semantic_type' type.
|
||||||
|
|
||||||
|
If you do not want or can update to this scheme, the directive
|
||||||
|
`%define "global_tokens_and_yystype" "1"' triggers the global
|
||||||
|
definition of tokens and YYSTYPE. This change is suitable both
|
||||||
|
for previous releases of Bison, and this one.
|
||||||
|
|
||||||
|
If you wish to update, then make sure older version of Bison will
|
||||||
|
fail using `%require "2.2"'.
|
||||||
|
|
||||||
|
* DJGPP support added.
|
||||||
|
|
||||||
|
Changes in version 2.1, 2005-09-16:
|
||||||
|
|
||||||
|
* The C++ lalr1.cc skeleton supports %lex-param.
|
||||||
|
|
||||||
|
* Bison-generated parsers now support the translation of diagnostics like
|
||||||
|
"syntax error" into languages other than English. The default
|
||||||
|
language is still English. For details, please see the new
|
||||||
|
Internationalization section of the Bison manual. Software
|
||||||
|
distributors should also see the new PACKAGING file. Thanks to
|
||||||
|
Bruno Haible for this new feature.
|
||||||
|
|
||||||
|
* Wording in the Bison-generated parsers has been changed slightly to
|
||||||
|
simplify translation. In particular, the message "memory exhausted"
|
||||||
|
has replaced "parser stack overflow", as the old message was not
|
||||||
|
always accurate for modern Bison-generated parsers.
|
||||||
|
|
||||||
|
* Destructors are now called when the parser aborts, for all symbols left
|
||||||
|
behind on the stack. Also, the start symbol is now destroyed after a
|
||||||
|
successful parse. In both cases, the behavior was formerly inconsistent.
|
||||||
|
|
||||||
|
* When generating verbose diagnostics, Bison-generated parsers no longer
|
||||||
|
quote the literal strings associated with tokens. For example, for
|
||||||
|
a syntax error associated with '%token NUM "number"' they might
|
||||||
|
print 'syntax error, unexpected number' instead of 'syntax error,
|
||||||
|
unexpected "number"'.
|
||||||
|
|
||||||
|
Changes in version 2.0, 2004-12-25:
|
||||||
|
|
||||||
|
* Possibly-incompatible changes
|
||||||
|
|
||||||
|
- Bison-generated parsers no longer default to using the alloca function
|
||||||
|
(when available) to extend the parser stack, due to widespread
|
||||||
|
problems in unchecked stack-overflow detection. You can "#define
|
||||||
|
YYSTACK_USE_ALLOCA 1" to require the use of alloca, but please read
|
||||||
|
the manual to determine safe values for YYMAXDEPTH in that case.
|
||||||
|
|
||||||
|
- Error token location.
|
||||||
|
During error recovery, the location of the syntax error is updated
|
||||||
|
to cover the whole sequence covered by the error token: it includes
|
||||||
|
the shifted symbols thrown away during the first part of the error
|
||||||
|
recovery, and the lookahead rejected during the second part.
|
||||||
|
|
||||||
|
- Semicolon changes:
|
||||||
|
. Stray semicolons are no longer allowed at the start of a grammar.
|
||||||
|
. Semicolons are now required after in-grammar declarations.
|
||||||
|
|
||||||
|
- Unescaped newlines are no longer allowed in character constants or
|
||||||
|
string literals. They were never portable, and GCC 3.4.0 has
|
||||||
|
dropped support for them. Better diagnostics are now generated if
|
||||||
|
forget a closing quote.
|
||||||
|
|
||||||
|
- NUL bytes are no longer allowed in Bison string literals, unfortunately.
|
||||||
|
|
||||||
|
* New features
|
||||||
|
|
||||||
|
- GLR grammars now support locations.
|
||||||
|
|
||||||
|
- New directive: %initial-action.
|
||||||
|
This directive allows the user to run arbitrary code (including
|
||||||
|
initializing @$) from yyparse before parsing starts.
|
||||||
|
|
||||||
|
- A new directive "%expect-rr N" specifies the expected number of
|
||||||
|
reduce/reduce conflicts in GLR parsers.
|
||||||
|
|
||||||
|
- %token numbers can now be hexadecimal integers, e.g., `%token FOO 0x12d'.
|
||||||
|
This is a GNU extension.
|
||||||
|
|
||||||
|
- The option `--report=lookahead' was changed to `--report=look-ahead'.
|
||||||
|
[However, this was changed back after 2.3.]
|
||||||
|
|
||||||
|
- Experimental %destructor support has been added to lalr1.cc.
|
||||||
|
|
||||||
|
- New configure option --disable-yacc, to disable installation of the
|
||||||
|
yacc command and -ly library introduced in 1.875 for POSIX conformance.
|
||||||
|
|
||||||
|
* Bug fixes
|
||||||
|
|
||||||
|
- For now, %expect-count violations are now just warnings, not errors.
|
||||||
|
This is for compatibility with Bison 1.75 and earlier (when there are
|
||||||
|
reduce/reduce conflicts) and with Bison 1.30 and earlier (when there
|
||||||
|
are too many or too few shift/reduce conflicts). However, in future
|
||||||
|
versions of Bison we plan to improve the %expect machinery so that
|
||||||
|
these violations will become errors again.
|
||||||
|
|
||||||
|
- Within Bison itself, numbers (e.g., goto numbers) are no longer
|
||||||
|
arbitrarily limited to 16-bit counts.
|
||||||
|
|
||||||
|
- Semicolons are now allowed before "|" in grammar rules, as POSIX requires.
|
||||||
|
|
||||||
|
Changes in version 1.875, 2003-01-01:
|
||||||
|
|
||||||
|
* The documentation license has been upgraded to version 1.2
|
||||||
|
of the GNU Free Documentation License.
|
||||||
|
|
||||||
|
* syntax error processing
|
||||||
|
|
||||||
|
- In Yacc-style parsers YYLLOC_DEFAULT is now used to compute error
|
||||||
|
locations too. This fixes bugs in error-location computation.
|
||||||
|
|
||||||
|
- %destructor
|
||||||
|
It is now possible to reclaim the memory associated to symbols
|
||||||
|
discarded during error recovery. This feature is still experimental.
|
||||||
|
|
||||||
|
- %error-verbose
|
||||||
|
This new directive is preferred over YYERROR_VERBOSE.
|
||||||
|
|
||||||
|
- #defining yyerror to steal internal variables is discouraged.
|
||||||
|
It is not guaranteed to work forever.
|
||||||
|
|
||||||
|
* POSIX conformance
|
||||||
|
|
||||||
|
- Semicolons are once again optional at the end of grammar rules.
|
||||||
|
This reverts to the behavior of Bison 1.33 and earlier, and improves
|
||||||
|
compatibility with Yacc.
|
||||||
|
|
||||||
|
- `parse error' -> `syntax error'
|
||||||
|
Bison now uniformly uses the term `syntax error'; formerly, the code
|
||||||
|
and manual sometimes used the term `parse error' instead. POSIX
|
||||||
|
requires `syntax error' in diagnostics, and it was thought better to
|
||||||
|
be consistent.
|
||||||
|
|
||||||
|
- The documentation now emphasizes that yylex and yyerror must be
|
||||||
|
declared before use. C99 requires this.
|
||||||
|
|
||||||
|
- Bison now parses C99 lexical constructs like UCNs and
|
||||||
|
backslash-newline within C escape sequences, as POSIX 1003.1-2001 requires.
|
||||||
|
|
||||||
|
- File names are properly escaped in C output. E.g., foo\bar.y is
|
||||||
|
output as "foo\\bar.y".
|
||||||
|
|
||||||
|
- Yacc command and library now available
|
||||||
|
The Bison distribution now installs a `yacc' command, as POSIX requires.
|
||||||
|
Also, Bison now installs a small library liby.a containing
|
||||||
|
implementations of Yacc-compatible yyerror and main functions.
|
||||||
|
This library is normally not useful, but POSIX requires it.
|
||||||
|
|
||||||
|
- Type clashes now generate warnings, not errors.
|
||||||
|
|
||||||
|
- If the user does not define YYSTYPE as a macro, Bison now declares it
|
||||||
|
using typedef instead of defining it as a macro.
|
||||||
|
For consistency, YYLTYPE is also declared instead of defined.
|
||||||
|
|
||||||
|
* Other compatibility issues
|
||||||
|
|
||||||
|
- %union directives can now have a tag before the `{', e.g., the
|
||||||
|
directive `%union foo {...}' now generates the C code
|
||||||
|
`typedef union foo { ... } YYSTYPE;'; this is for Yacc compatibility.
|
||||||
|
The default union tag is `YYSTYPE', for compatibility with Solaris 9 Yacc.
|
||||||
|
For consistency, YYLTYPE's struct tag is now `YYLTYPE' not `yyltype'.
|
||||||
|
This is for compatibility with both Yacc and Bison 1.35.
|
||||||
|
|
||||||
|
- `;' is output before the terminating `}' of an action, for
|
||||||
|
compatibility with Bison 1.35.
|
||||||
|
|
||||||
|
- Bison now uses a Yacc-style format for conflict reports, e.g.,
|
||||||
|
`conflicts: 2 shift/reduce, 1 reduce/reduce'.
|
||||||
|
|
||||||
|
- `yystype' and `yyltype' are now obsolescent macros instead of being
|
||||||
|
typedefs or tags; they are no longer documented and are planned to be
|
||||||
|
withdrawn in a future release.
|
||||||
|
|
||||||
|
* GLR parser notes
|
||||||
|
|
||||||
|
- GLR and inline
|
||||||
|
Users of Bison have to decide how they handle the portability of the
|
||||||
|
C keyword `inline'.
|
||||||
|
|
||||||
|
- `parsing stack overflow...' -> `parser stack overflow'
|
||||||
|
GLR parsers now report `parser stack overflow' as per the Bison manual.
|
||||||
|
|
||||||
|
* Bison now warns if it detects conflicting outputs to the same file,
|
||||||
|
e.g., it generates a warning for `bison -d -o foo.h foo.y' since
|
||||||
|
that command outputs both code and header to foo.h.
|
||||||
|
|
||||||
|
* #line in output files
|
||||||
|
- --no-line works properly.
|
||||||
|
|
||||||
|
* Bison can no longer be built by a K&R C compiler; it requires C89 or
|
||||||
|
later to be built. This change originally took place a few versions
|
||||||
|
ago, but nobody noticed until we recently asked someone to try
|
||||||
|
building Bison with a K&R C compiler.
|
||||||
|
|
||||||
|
Changes in version 1.75, 2002-10-14:
|
||||||
|
|
||||||
|
* Bison should now work on 64-bit hosts.
|
||||||
|
|
||||||
|
* Indonesian translation thanks to Tedi Heriyanto.
|
||||||
|
|
||||||
|
* GLR parsers
|
||||||
|
Fix spurious parse errors.
|
||||||
|
|
||||||
|
* Pure parsers
|
||||||
|
Some people redefine yyerror to steal yyparse' private variables.
|
||||||
|
Reenable this trick until an official feature replaces it.
|
||||||
|
|
||||||
|
* Type Clashes
|
||||||
|
In agreement with POSIX and with other Yaccs, leaving a default
|
||||||
|
action is valid when $$ is untyped, and $1 typed:
|
||||||
|
|
||||||
|
untyped: ... typed;
|
||||||
|
|
||||||
|
but the converse remains an error:
|
||||||
|
|
||||||
|
typed: ... untyped;
|
||||||
|
|
||||||
|
* Values of mid-rule actions
|
||||||
|
The following code:
|
||||||
|
|
||||||
|
foo: { ... } { $$ = $1; } ...
|
||||||
|
|
||||||
|
was incorrectly rejected: $1 is defined in the second mid-rule
|
||||||
|
action, and is equal to the $$ of the first mid-rule action.
|
||||||
|
|
||||||
|
Changes in version 1.50, 2002-10-04:
|
||||||
|
|
||||||
* GLR parsing
|
* GLR parsing
|
||||||
The declaration
|
The declaration
|
||||||
@@ -14,27 +421,30 @@ Changes in version 1.49b, 2002-08-12:
|
|||||||
%dprec and %merge on grammar rules allow parse-time resolution of
|
%dprec and %merge on grammar rules allow parse-time resolution of
|
||||||
ambiguities. Contributed by Paul Hilfinger.
|
ambiguities. Contributed by Paul Hilfinger.
|
||||||
|
|
||||||
|
Unfortunately Bison 1.50 does not work properly on 64-bit hosts
|
||||||
|
like the Alpha, so please stick to 32-bit hosts for now.
|
||||||
|
|
||||||
* Output Directory
|
* Output Directory
|
||||||
When not in Yacc compatibility mode, when the output file was not
|
When not in Yacc compatibility mode, when the output file was not
|
||||||
specified, runnning `bison foo/bar.y' created `foo/bar.c'. It
|
specified, running `bison foo/bar.y' created `foo/bar.c'. It
|
||||||
now creates `bar.c'.
|
now creates `bar.c'.
|
||||||
|
|
||||||
* Undefined token
|
* Undefined token
|
||||||
The undefined token was systematically mapped to 2 which prevented
|
The undefined token was systematically mapped to 2 which prevented
|
||||||
the use of 2 from the user. This is no longer the case.
|
the use of 2 by the user. This is no longer the case.
|
||||||
|
|
||||||
* Unknown token numbers
|
* Unknown token numbers
|
||||||
If yylex returned a code out of range, yyparse could die. This is
|
If yylex returned an out of range value, yyparse could die. This is
|
||||||
no longer the case.
|
no longer the case.
|
||||||
|
|
||||||
* Error token
|
* Error token
|
||||||
According to POSIX, the error token should be numbered as 256.
|
According to POSIX, the error token must be 256.
|
||||||
Bison extends this requirement by making it a preference: *if* the
|
Bison extends this requirement by making it a preference: *if* the
|
||||||
user specified that one of her tokens is numbered 256, then error
|
user specified that one of her tokens is numbered 256, then error
|
||||||
will be mapped onto another number.
|
will be mapped onto another number.
|
||||||
|
|
||||||
* Verbose error messages
|
* Verbose error messages
|
||||||
They no longer report `..., expecting error or...' for state where
|
They no longer report `..., expecting error or...' for states where
|
||||||
error recovery is possible.
|
error recovery is possible.
|
||||||
|
|
||||||
* End token
|
* End token
|
||||||
@@ -47,7 +457,8 @@ Changes in version 1.49b, 2002-08-12:
|
|||||||
allowed some non-error action other than a default reduction on the
|
allowed some non-error action other than a default reduction on the
|
||||||
error token. The new behavior has long been the documented behavior,
|
error token. The new behavior has long been the documented behavior,
|
||||||
and has long been required by POSIX. For more details, please see
|
and has long been required by POSIX. For more details, please see
|
||||||
<http://mail.gnu.org/pipermail/bug-bison/2002-May/001452.html>.
|
Paul Eggert, "Reductions during Bison error handling" (2002-05-20)
|
||||||
|
<http://lists.gnu.org/archive/html/bug-bison/2002-05/msg00038.html>.
|
||||||
|
|
||||||
* Traces
|
* Traces
|
||||||
Popped tokens and nonterminals are now reported.
|
Popped tokens and nonterminals are now reported.
|
||||||
@@ -98,9 +509,9 @@ Changes in version 1.49b, 2002-08-12:
|
|||||||
the user symbol is used in the reports, the graphs, and the verbose
|
the user symbol is used in the reports, the graphs, and the verbose
|
||||||
error messages instead of `$end', which remains being the default.
|
error messages instead of `$end', which remains being the default.
|
||||||
For instance
|
For instance
|
||||||
%token YYEOF 0
|
%token MYEOF 0
|
||||||
or
|
or
|
||||||
%token YYEOF 0 "end of file"
|
%token MYEOF 0 "end of file"
|
||||||
|
|
||||||
* Semantic parser
|
* Semantic parser
|
||||||
This old option, which has been broken for ages, is removed.
|
This old option, which has been broken for ages, is removed.
|
||||||
@@ -110,20 +521,20 @@ Changes in version 1.49b, 2002-08-12:
|
|||||||
Croatian, thanks to Denis Lackovic.
|
Croatian, thanks to Denis Lackovic.
|
||||||
|
|
||||||
* Incorrect token definitions
|
* Incorrect token definitions
|
||||||
When fed with `%token 'a' "A"', Bison used to output `#define 'a' 65'.
|
When given `%token 'a' "A"', Bison used to output `#define 'a' 65'.
|
||||||
|
|
||||||
* Token definitions as enums
|
* Token definitions as enums
|
||||||
Tokens are output both as the traditional #define's, and, provided
|
Tokens are output both as the traditional #define's, and, provided
|
||||||
the compiler supports ANSI C or is a C++ compiler, as enums.
|
the compiler supports ANSI C or is a C++ compiler, as enums.
|
||||||
This helps debuggers producing symbols instead of values.
|
This lets debuggers display names instead of integers.
|
||||||
|
|
||||||
* Reports
|
* Reports
|
||||||
In addition to --verbose, bison supports --report=THINGS, which
|
In addition to --verbose, bison supports --report=THINGS, which
|
||||||
produces additional information:
|
produces additional information:
|
||||||
- itemset
|
- itemset
|
||||||
complete the core item sets with their closure
|
complete the core item sets with their closure
|
||||||
- lookahead
|
- lookahead [changed to `look-ahead' in 1.875e through 2.3, but changed back]
|
||||||
explicitly associate lookaheads to items
|
explicitly associate lookahead tokens to items
|
||||||
- solved
|
- solved
|
||||||
describe shift/reduce conflicts solving.
|
describe shift/reduce conflicts solving.
|
||||||
Bison used to systematically output this information on top of
|
Bison used to systematically output this information on top of
|
||||||
@@ -155,7 +566,6 @@ Changes in version 1.35, 2002-03-25:
|
|||||||
|
|
||||||
This kludge also addresses some C++ problems when the stack was
|
This kludge also addresses some C++ problems when the stack was
|
||||||
extended.
|
extended.
|
||||||
|
|
||||||
|
|
||||||
Changes in version 1.34, 2002-03-12:
|
Changes in version 1.34, 2002-03-12:
|
||||||
|
|
||||||
@@ -211,6 +621,8 @@ Changes in version 1.31, 2002-01-14:
|
|||||||
alloca is used only when compiled with GCC, to avoid portability
|
alloca is used only when compiled with GCC, to avoid portability
|
||||||
problems as on AIX.
|
problems as on AIX.
|
||||||
|
|
||||||
|
* yyparse now returns 2 if memory is exhausted; formerly it dumped core.
|
||||||
|
|
||||||
* When the generated parser lacks debugging code, YYDEBUG is now 0
|
* When the generated parser lacks debugging code, YYDEBUG is now 0
|
||||||
(as POSIX requires) instead of being undefined.
|
(as POSIX requires) instead of being undefined.
|
||||||
|
|
||||||
@@ -281,8 +693,8 @@ Changes in version 1.31, 2002-01-14:
|
|||||||
|
|
||||||
Changes in version 1.30, 2001-10-26:
|
Changes in version 1.30, 2001-10-26:
|
||||||
|
|
||||||
* `--defines' and `--graph' have now an optionnal argument which is the
|
* `--defines' and `--graph' have now an optional argument which is the
|
||||||
output file name. `-d' and `-g' do not change, they do not take any
|
output file name. `-d' and `-g' do not change; they do not take any
|
||||||
argument.
|
argument.
|
||||||
|
|
||||||
* `%source_extension' and `%header_extension' are removed, failed
|
* `%source_extension' and `%header_extension' are removed, failed
|
||||||
@@ -405,21 +817,22 @@ End:
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
|
||||||
|
2004, 2005, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Autoconf.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
GNU Autoconf is free software; you can redistribute it and/or modify
|
Bison is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2, or (at your option)
|
the Free Software Foundation; either version 2, or (at your option)
|
||||||
any later version.
|
any later version.
|
||||||
|
|
||||||
GNU Autoconf is distributed in the hope that it will be useful,
|
Bison is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with autoconf; see the file COPYING. If not, write to
|
along with autoconf; see the file COPYING. If not, write to
|
||||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
Boston, MA 02111-1307, USA.
|
Boston, MA 02110-1301, USA.
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
Packaging hints for binary package distributors
|
||||||
|
===============================================
|
||||||
|
|
||||||
|
Although the source of the bison package comes as a single package,
|
||||||
|
in distributions of binary packages the installed files should
|
||||||
|
be split into two packages:
|
||||||
|
|
||||||
|
bison-runtime
|
||||||
|
Contents: Runtime libraries and programs.
|
||||||
|
Audience: Anyone who wants to run internationalized programs
|
||||||
|
that contain Bison-generated parsers.
|
||||||
|
|
||||||
|
bison
|
||||||
|
Contents: Tools and documentation for developers that use Bison.
|
||||||
|
Audience: Anyone who wants to develop programs that use parsers.
|
||||||
|
Dependencies: requires bison-runtime.
|
||||||
|
|
||||||
|
The 'bison-runtime' binary package is much smaller than the 'bison'
|
||||||
|
binary package. It should be included in any distribution that
|
||||||
|
contains localized programs that use the diagnostics contained in
|
||||||
|
Bison-generated parsers.
|
||||||
|
|
||||||
|
If you want to install both packages at the same time, you simply do
|
||||||
|
at the toplevel directory:
|
||||||
|
|
||||||
|
./configure
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
|
After installation, the file
|
||||||
|
|
||||||
|
$prefix/share/locale/*/LC_MESSAGES/bison-runtime.mo
|
||||||
|
|
||||||
|
belongs to the bison-runtime package; all other installed files belong
|
||||||
|
to the bison package.
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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 autoconf; see the file COPYING. If not, write to
|
||||||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02110-1301, USA.
|
||||||
@@ -1,24 +1,41 @@
|
|||||||
This directory contains the Bison parser generator.
|
This directory contains the Bison parser generator.
|
||||||
|
|
||||||
See the file INSTALL for compilation and installation instructions.
|
See the file INSTALL for generic compilation and installation instructions.
|
||||||
See the file doc/FAQ for frequently asked questions.
|
See the file doc/FAQ for frequently asked questions.
|
||||||
|
|
||||||
It was once true that, when installing Bison on Sequent (or Pyramid?)
|
Bison requires GNU m4 1.4.3 or later. See:
|
||||||
systems, you had to be in the Berkeley universe. This may no longer
|
|
||||||
be true; we have no way to tell.
|
|
||||||
|
|
||||||
On VMS, you will probably have to create Makefile from Makefile.in by
|
ftp://ftp.gnu.org/gnu/m4/m4-1.4.3.tar.gz
|
||||||
hand. Remember to do `SET COMMAND BISON' to install the data in
|
|
||||||
`BISON.CLD'.
|
|
||||||
|
|
||||||
VMS and MS-DOS builds are probably broken right now. If you are able
|
Bison can work with pre-1.4.3 distributions of GNU m4 if they are
|
||||||
to build Bison on either platform and you need to make changes to do
|
sufficiently patched, but if you encounter a bug with an older
|
||||||
so, please submit those changes as a bug report.
|
distribution and report a bug we will probably suggest that you
|
||||||
|
upgrade to 1.4.3 as the first step in trying to fix it.
|
||||||
|
|
||||||
Send bug reports to [email protected]. Please include the version
|
Please send bug reports to <[email protected]>. Please include the
|
||||||
number from `bison --version', and a complete, self-contained test
|
version number from `bison --version', and a complete, self-contained
|
||||||
case in each bug report.
|
test case in each bug report.
|
||||||
|
|
||||||
If you have questions about using Bison which the documentation does
|
If you have questions about using Bison and the documentation does
|
||||||
not answer, send mail to [email protected].
|
not answer them, please send mail to <[email protected]>.
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
Copyright (C) 1992, 1998, 1999, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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 autoconf; see the file COPYING. If not, write to
|
||||||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02110-1301, USA.
|
||||||
|
|||||||
+21
-6
@@ -7,11 +7,26 @@ The documentation still needs more work. Suggestions welcome.
|
|||||||
Patches even more welcome.
|
Patches even more welcome.
|
||||||
|
|
||||||
Please send comments and problem reports about this test release to
|
Please send comments and problem reports about this test release to
|
||||||
[email protected]. This program will get better only if you report
|
<[email protected]>. This program will get better only if you report
|
||||||
the problems you encounter.
|
the problems you encounter.
|
||||||
|
|
||||||
Please, *do not package this*, *do not distribute it* widely, it is
|
-----
|
||||||
not ready for full scale use. Because it is not fully functional, if
|
|
||||||
you distribute this package, we will be buried under bug reports from
|
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||||
panicked users. We don't have time to spend on this, and nor do the
|
|
||||||
users.
|
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., 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02110-1301, USA.
|
||||||
|
|||||||
+24
-30
@@ -6,17 +6,31 @@ Bison.
|
|||||||
* Requirements
|
* Requirements
|
||||||
|
|
||||||
Only the sources are installed in the CVS repository (to ease the
|
Only the sources are installed in the CVS repository (to ease the
|
||||||
maintenance, merges etc.), therefore you will have to the maintainer
|
maintenance, merges etc.), therefore you will have to get the latest
|
||||||
tools we depend upon:
|
stable versions of the maintainer tools we depend upon, including:
|
||||||
|
|
||||||
- Automake 1.7
|
- Automake <http://www.gnu.org/software/automake/>
|
||||||
|
- Autoconf <http://www.gnu.org/software/autoconf/>
|
||||||
|
- Flex <http://www.gnu.org/software/flex/>
|
||||||
|
- Gettext <http://www.gnu.org/software/gettext/>
|
||||||
|
- Gzip <http://www.gnu.org/software/gzip/>
|
||||||
|
- Tar <http://www.gnu.org/software/tar/>
|
||||||
|
- Wget <http://www.gnu.org/software/wget/>
|
||||||
|
|
||||||
- Autoconf 2.54
|
As of this writing, the latest stable version of Gzip is 1.2.4 but we
|
||||||
|
suggest using test version 1.3.5 (or later, if one becomes available).
|
||||||
|
|
||||||
- Gettext 0.11.5
|
Valgrind <http://valgrind.org/> is also highly recommended, if
|
||||||
|
Valgrind supports your architecture.
|
||||||
|
|
||||||
|
Bison is written using Bison grammars, so there are bootstrapping
|
||||||
|
issues. The bootstrap script attempts to discover when the C code
|
||||||
|
generated from the grammars is out of date, and to bootstrap with an
|
||||||
|
out-of-date version of the C code, but the process is not foolproof.
|
||||||
|
Also, you may run into similar problems yourself if you modify Bison.
|
||||||
|
|
||||||
Only building the initial full source tree will be a bit painful,
|
Only building the initial full source tree will be a bit painful,
|
||||||
later, a plain `cvs update -P & make' should be sufficient.
|
later, a plain `cvs update -P && make' should be sufficient.
|
||||||
|
|
||||||
* First CVS checkout
|
* First CVS checkout
|
||||||
|
|
||||||
@@ -39,33 +53,13 @@ and the CVS master copy:
|
|||||||
|
|
||||||
$ cvs diff
|
$ cvs diff
|
||||||
|
|
||||||
should output no difference, except maybe the date in po/*.po files.
|
should output no difference.
|
||||||
|
|
||||||
Enjoy!
|
Enjoy!
|
||||||
|
|
||||||
* Troubleshooting
|
|
||||||
|
|
||||||
Unfortunately the current Gettext still does not include all the
|
|
||||||
needed tools so that the bootstrapping always perform successfully.
|
|
||||||
|
|
||||||
If you experience problems, I suggest the following:
|
|
||||||
|
|
||||||
1. Do a regular CVS checkout
|
|
||||||
|
|
||||||
2. Fetch a recent tarball in:
|
|
||||||
http://www.lrde.epita.fr/~akim/download/
|
|
||||||
|
|
||||||
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.
|
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
@@ -81,5 +75,5 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Bison; see the file COPYING. If not, write to
|
along with Bison; see the file COPYING. If not, write to
|
||||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
Boston, MA 02111-1307, USA.
|
Boston, MA 02110-1301, USA.
|
||||||
|
|||||||
+5
-2
@@ -20,11 +20,14 @@ Also, Bison uses a faster but less space-efficient encoding for the
|
|||||||
parse tables (see Corbett's PhD thesis from Berkeley, "Static
|
parse tables (see Corbett's PhD thesis from Berkeley, "Static
|
||||||
Semantics in Compiler Error Recovery", June 1985, Report No. UCB/CSD
|
Semantics in Compiler Error Recovery", June 1985, Report No. UCB/CSD
|
||||||
85/251), and more modern technique for generating the lookahead sets.
|
85/251), and more modern technique for generating the lookahead sets.
|
||||||
(See "Efficient Construction of LALR(1) Lookahead Sets" by F. DeRemer
|
(See Frank DeRemer and Thomas Pennello, "Efficient Computation of
|
||||||
and A. Pennello, in ACM TOPLS Vol 4 No 4, October 1982. Their
|
LALR(1) Look-Ahead Sets", ACM Transactions on Programming Languages
|
||||||
|
and Systems (TOPLAS) 4, 4 (October 1982), 615-649. Their
|
||||||
technique is the standard one now.)
|
technique is the standard one now.)
|
||||||
|
|
||||||
paul rubin
|
paul rubin
|
||||||
free software foundation
|
free software foundation
|
||||||
|
|
||||||
|
|
||||||
|
[DeRemer-Pennello reference corrected by Paul Eggert <[email protected]>,
|
||||||
|
2004-06-21.]
|
||||||
|
|||||||
@@ -1,60 +1,86 @@
|
|||||||
Bison was originally written by Robert Corbett. It would not be what
|
Bison was originally written by Robert Corbett. It would not be what
|
||||||
it is today without the invaluable help of these people:
|
it is today without the invaluable help of these people:
|
||||||
|
|
||||||
Airy Andre [email protected]
|
Airy Andre [email protected]
|
||||||
Akim Demaille [email protected]
|
Akim Demaille [email protected]
|
||||||
Albert Chin-A-Young [email protected]
|
Albert Chin-A-Young [email protected]
|
||||||
Alexander Belopolsky [email protected]
|
Alexander Belopolsky [email protected]
|
||||||
Andreas Schwab [email protected]
|
Alexandre Duret-Lutz [email protected]
|
||||||
Arnold Robbins [email protected]
|
Andreas Schwab [email protected]
|
||||||
Benoit Perrot [email protected]
|
Andrew Suffield [email protected]
|
||||||
Bruce Lilly [email protected]
|
Anthony Heading [email protected]
|
||||||
Cris Bailiff c.bailiff+bison@awayweb.com
|
Arnold Robbins arnold@skeeve.com
|
||||||
Cris van Pelt [email protected]
|
Art Haas [email protected]
|
||||||
Daniel Hagerty hag@gnu.org
|
Baron Schwartz baron@sequent.org
|
||||||
David J. MacKenzie [email protected]
|
Benoit Perrot [email protected]
|
||||||
Dick Streefland [email protected]
|
Bert Deknuydt [email protected]
|
||||||
Enrico Scholz [email protected]
|
Bruce Lilly [email protected]
|
||||||
Evgeny Stambulchik [email protected]
|
Bruno Haible [email protected]
|
||||||
Fabrice Bauzac [email protected]
|
Charles-Henri de Boysson [email protected]
|
||||||
Florian Krohm [email protected].com
|
Cris Bailiff c.bailiff+bison@awayweb.com
|
||||||
H. Merijn Brand h.m.brand@hccnet.nl
|
Cris van Pelt [email protected].nl
|
||||||
Hans Aberg [email protected]
|
Daniel Hagerty [email protected]
|
||||||
Jesse Thilo jthilo@gnu.org
|
David J. MacKenzie djm@gnu.org
|
||||||
Jim Meyering [email protected]
|
Derek M. Jones [email protected]
|
||||||
Juan Manuel Guerrero [email protected]
|
Dick Streefland [email protected]
|
||||||
Kees Zeelenberg [email protected]
|
Enrico Scholz [email protected]
|
||||||
Keith Browne [email protected]
|
Evgeny Stambulchik [email protected]
|
||||||
Laurent Mascherpa [email protected]
|
Fabrice Bauzac [email protected]
|
||||||
Magnus Fromreide [email protected]
|
Florian Krohm [email protected]
|
||||||
Marc Autret [email protected]
|
Frank Heckenbach [email protected]
|
||||||
Martin Mokrejs [email protected]
|
Guido Trentalancia [email protected]
|
||||||
Matt Kraai [email protected]
|
H. Merijn Brand [email protected]
|
||||||
Michael Hayes [email protected]
|
Hans Aberg [email protected]
|
||||||
Mike Castle [email protected]
|
Jan Nieuwenhuizen [email protected]
|
||||||
Neil Booth [email protected]
|
Jesse Thilo [email protected]
|
||||||
Nelson H. F. Beebe [email protected]
|
Jim Kent [email protected]
|
||||||
Nicolas Burrus [email protected]
|
Jim Meyering [email protected]
|
||||||
Nicolas Tisserand [email protected]
|
Joel E. Denny [email protected]
|
||||||
Noah Friedman [email protected]
|
Juan Manuel Guerrero [email protected]
|
||||||
Pascal Bart [email protected]
|
Kees Zeelenberg [email protected]
|
||||||
Paul Eggert eggert@twinsun.com
|
Keith Browne kbrowne@legato.com
|
||||||
Paul Hilfinger [email protected]
|
Laurent Mascherpa [email protected]
|
||||||
Per Allansson [email protected]
|
Magnus Fromreide [email protected]
|
||||||
Peter Hámorský [email protected]
|
Marc Autret [email protected]
|
||||||
Piotr Gackiewicz [email protected]
|
Martin Mokrejs [email protected]
|
||||||
R Blake [email protected]
|
Martin Nylin [email protected]
|
||||||
Raja R Harinath [email protected].edu
|
Matt Kraai [email protected].edu
|
||||||
Richard Stallman [email protected]
|
Matt Rosing [email protected]
|
||||||
Robert Anisko [email protected]
|
Michael Hayes [email protected]
|
||||||
Shura [email protected]
|
Mickael Labau [email protected]
|
||||||
Tim Josling [email protected]
|
Mike Castle [email protected]
|
||||||
Tom Lane [email protected]
|
Neil Booth [email protected]
|
||||||
Tom Tromey [email protected]
|
Nelson H. F. Beebe [email protected]
|
||||||
Wayne Green [email protected]
|
Nicolas Burrus [email protected]
|
||||||
Wolfram Wagner [email protected]
|
Nicolas Tisserand [email protected]
|
||||||
Wwp [email protected]
|
Noah Friedman [email protected]
|
||||||
Zack Weinberg [email protected]
|
Oleg Smolsky [email protected]
|
||||||
|
Pascal Bart [email protected]
|
||||||
|
Paul Eggert [email protected]
|
||||||
|
Paul Hilfinger [email protected]
|
||||||
|
Per Allansson [email protected]
|
||||||
|
Peter Fales [email protected]
|
||||||
|
Peter Hamorsky [email protected]
|
||||||
|
Piotr Gackiewicz [email protected]
|
||||||
|
Quoc Peyrot [email protected]
|
||||||
|
R Blake [email protected]
|
||||||
|
Raja R Harinath [email protected]
|
||||||
|
Richard Stallman [email protected]
|
||||||
|
Robert Anisko [email protected]
|
||||||
|
Shura [email protected]
|
||||||
|
Steve Murphy [email protected]
|
||||||
|
Tim Josling [email protected]
|
||||||
|
Tim Van Holder [email protected]
|
||||||
|
Tom Lane [email protected]
|
||||||
|
Tom Tromey [email protected]
|
||||||
|
Tommy Nordgren [email protected]
|
||||||
|
Troy A. Johnson [email protected]
|
||||||
|
Tys Lefering [email protected]
|
||||||
|
Vin Shelton [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
|
Many people are not named here because we lost track of them. We
|
||||||
thank them! Please, help us keeping this list up to date.
|
thank them! Please, help us keeping this list up to date.
|
||||||
|
|||||||
@@ -2,97 +2,41 @@
|
|||||||
|
|
||||||
* Header guards
|
* Header guards
|
||||||
|
|
||||||
En rentrant chez moi, je relance un `make' sur un projet que j'ai avancé
|
From Franc,ois: should we keep the directory part in the CPP guard?
|
||||||
ailleurs durant la semaine. Le système que j'utilise ici est un peu plus
|
|
||||||
à jour que l'autre, et le Bison est probablement plus récent itou. Ici,
|
|
||||||
c'est la version 1.33. J'obtiens, en montrant un peu plus que nécessaire:
|
|
||||||
|
|
||||||
---------------------------------------------------------------------->
|
|
||||||
cd ~/fpub/pyrexpp/Pyrexpp/
|
|
||||||
LANGUAGE= /usr/bin/make MAKEFLAGS='-k -j2'
|
|
||||||
/usr/bin/make -C .. install
|
|
||||||
make[1]: Entre dans le répertoire `/bpi/titan/home/pinard/fpub/pyrexpp'
|
|
||||||
install -g bpi -m 2775 -d Prépare-titan
|
|
||||||
chmod g+sw Prépare-titan
|
|
||||||
touch Prépare-titan/.estampille
|
|
||||||
/usr/bin/gcc -fPIC -I/usr/include/python2.2 -IPrépare-titan -g -c -o Prépare-titan/ctools.o ctools.c
|
|
||||||
bison -d -o Prépare-titan/c-parser.c c-parser.y
|
|
||||||
/usr/bin/gcc -fPIC -I/usr/include/python2.2 -IPrépare-titan -g -c -o Prépare-titan/c-parser.o Prépare-titan/c-parser.c
|
|
||||||
flex -t c-scanner.l | grep -v '^#line' > Prépare-titan/c-scanner.c
|
|
||||||
/usr/bin/gcc -fPIC -I/usr/include/python2.2 -IPrépare-titan -g -c -o Prépare-titan/c-scanner.o Prépare-titan/c-scanner.c
|
|
||||||
In file included from Prépare-titan/c-scanner.c:547:
|
|
||||||
Prépare-titan/c-parser.h:1: warning: garbage at end of `#ifndef' argument
|
|
||||||
Prépare-titan/c-parser.h:2: warning: missing white space after `#define BISON_PR'
|
|
||||||
/usr/bin/gcc -o Prépare-titan/ctools.so Prépare-titan/ctools.o Prépare-titan/c-scanner.o -shared -lm
|
|
||||||
python setup.py --quiet build
|
|
||||||
install -g bpi -m 664 Prépare-titan/ctools.so /bpi/titan/local/lib/python2.2/site-packages/Pyrexpp
|
|
||||||
python setup.py --quiet install
|
|
||||||
make[1]: Quitte le répertoire `/bpi/titan/home/pinard/fpub/pyrexpp'
|
|
||||||
[...]
|
|
||||||
----------------------------------------------------------------------<
|
|
||||||
|
|
||||||
Diagnostics que je n'avais sûrement pas, plus tôt en journée, sur l'autre
|
|
||||||
système. En allant voir, je trouve:
|
|
||||||
|
|
||||||
---------------------------------------------------------------------->
|
|
||||||
#ifndef BISON_PRÉPARE_TITAN_C_PARSER_H
|
|
||||||
# define BISON_PRÉPARE_TITAN_C_PARSER_H
|
|
||||||
|
|
||||||
# ifndef YYSTYPE
|
|
||||||
# define YYSTYPE int
|
|
||||||
# endif
|
|
||||||
# define IDENTIFIER 257
|
|
||||||
[...]
|
|
||||||
|
|
||||||
extern YYSTYPE yylval;
|
|
||||||
|
|
||||||
#endif /* not BISON_PRÉPARE_TITAN_C_PARSER_H */
|
|
||||||
----------------------------------------------------------------------<
|
|
||||||
|
|
||||||
Le pré-processeur de C n'est pas à l'aise avec les caractères accentués
|
|
||||||
dans les identificateurs.
|
|
||||||
|
|
||||||
Bon, de mon expérience, il n'a jamais été nécessaire de protéger un fichier
|
|
||||||
`.h' de Bison ou Yacc contre de multiples inclusions, mais si ça été
|
|
||||||
fait, je présume qu'il y avait un problème réel et convaincant à régler,
|
|
||||||
et qu'il ne s'agit pas d'une simple fantaisie: je ne mettrai donc pas
|
|
||||||
ça en doute. Mais le choix du nom de l'identificateur laisse à désirer,
|
|
||||||
tu en conviendras :-). Et faut-il vraiment y inclure le répertoire?
|
|
||||||
|
|
||||||
|
|
||||||
* URGENT: Documenting C++ output
|
* Yacc.c: CPP Macros
|
||||||
Write a first documentation for C++ output.
|
|
||||||
|
|
||||||
|
Do some people use YYPURE, YYLSP_NEEDED like we do in the test suite?
|
||||||
|
They should not: it is not documented. But if they need to, let's
|
||||||
|
find something clean (not like YYLSP_NEEDED...).
|
||||||
|
|
||||||
|
|
||||||
|
* Installation
|
||||||
|
|
||||||
|
** Disable installation of yacc.
|
||||||
|
|
||||||
|
Add an option to 'configure' that allows people to install Bison
|
||||||
|
without installing the yacc wrapper script or the rarely-used little
|
||||||
|
yacc library required by Posix. This is for people who prefer some
|
||||||
|
other implementation of yacc.
|
||||||
|
|
||||||
* Documentation
|
* Documentation
|
||||||
Before releasing, make sure the documentation refers to the current
|
Before releasing, make sure the documentation ("Understanding your
|
||||||
`output' format.
|
parser") refers to the current `output' format.
|
||||||
|
|
||||||
|
* lalr1.cc
|
||||||
|
** vector
|
||||||
|
Move to using vector, drop stack.hh.
|
||||||
|
|
||||||
* Error messages
|
** I18n
|
||||||
Some are really funky. For instance
|
Catch up with yacc.c.
|
||||||
|
|
||||||
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
|
* Report
|
||||||
|
|
||||||
** GLR
|
** GLR
|
||||||
How would Paul like to display the conflicted actions? In particular,
|
How would Paul like to display the conflicted actions? In particular,
|
||||||
what when two reductions are possible on a given lookahead, but one is
|
what when two reductions are possible on a given lookahead token, but one is
|
||||||
part of $default. Should we make the two reductions explicit, or just
|
part of $default. Should we make the two reductions explicit, or just
|
||||||
keep $default? See the following point.
|
keep $default? See the following point.
|
||||||
|
|
||||||
@@ -115,31 +59,67 @@ DeRemer and Penello: they already provide the algorithm.
|
|||||||
|
|
||||||
* Extensions
|
* Extensions
|
||||||
|
|
||||||
** yyerror, yysymprint interface
|
** Labeling the symbols
|
||||||
It should be improved, in particular when using Bison features such as
|
Have a look at the Lemon parser generator: instead of $1, $2 etc. they
|
||||||
locations, and YYPARSE_PARAMS. For the time being, it is recommended
|
can name the values. This is much more pleasant. For instance:
|
||||||
to #define yyerror and yyprint to steal internal variables...
|
|
||||||
|
|
||||||
** Several %unions
|
exp (res): exp (a) '+' exp (b) { $res = $a + $b; };
|
||||||
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:
|
I love this. I have been bitten too often by the removal of the
|
||||||
|
symbol, and forgetting to shift all the $n to $n-1. If you are
|
||||||
|
unlucky, it compiles...
|
||||||
|
|
||||||
- when --yacc, this must be flagged as an error. Don't make it fatal
|
But instead of using $a etc., we can use regular variables. And
|
||||||
though.
|
instead of using (), I propose to use `:' (again). Paul suggests
|
||||||
|
supporting `->' in addition to `:' to separate LHS and RHS. In other
|
||||||
|
words:
|
||||||
|
|
||||||
- The #line must now appear *inside* the definition of yystype.
|
r:exp -> a:exp '+' b:exp { r = a + b; };
|
||||||
Something like
|
|
||||||
|
|
||||||
{
|
That requires an significant improvement of the grammar parser. Using
|
||||||
#line 12 "foo.y"
|
GLR would be nice. It also requires that Bison know the type of the
|
||||||
int ival;
|
symbols (which will be useful for %include anyway). So we have some
|
||||||
#line 23 "foo.y"
|
time before...
|
||||||
char *sval;
|
|
||||||
}
|
Note that there remains the problem of locations: `@r'?
|
||||||
|
|
||||||
|
|
||||||
|
** $-1
|
||||||
|
We should find a means to provide an access to values deep in the
|
||||||
|
stack. For instance, instead of
|
||||||
|
|
||||||
|
baz: qux { $$ = $<foo>-1 + $<bar>0 + $1; }
|
||||||
|
|
||||||
|
we should be able to have:
|
||||||
|
|
||||||
|
foo($foo) bar($bar) baz($bar): qux($qux) { $baz = $foo + $bar + $qux; }
|
||||||
|
|
||||||
|
Or something like this.
|
||||||
|
|
||||||
|
** %if and the like
|
||||||
|
It should be possible to have %if/%else/%endif. The implementation is
|
||||||
|
not clear: should it be lexical or syntactic. Vadim Maslow thinks it
|
||||||
|
must be in the scanner: we must not parse what is in a switched off
|
||||||
|
part of %if. Akim Demaille thinks it should be in the parser, so as
|
||||||
|
to avoid falling into another CPP mistake.
|
||||||
|
|
||||||
|
** -D, --define-muscle NAME=VALUE
|
||||||
|
To define muscles via cli. Or maybe support directly NAME=VALUE?
|
||||||
|
|
||||||
|
** XML Output
|
||||||
|
There are couple of available extensions of Bison targeting some XML
|
||||||
|
output. Some day we should consider including them. One issue is
|
||||||
|
that they seem to be quite orthogonal to the parsing technique, and
|
||||||
|
seem to depend mostly on the possibility to have some code triggered
|
||||||
|
for each reduction. As a matter of fact, such hooks could also be
|
||||||
|
used to generate the yydebug traces. Some generic scheme probably
|
||||||
|
exists in there.
|
||||||
|
|
||||||
|
XML output for GNU Bison and gcc
|
||||||
|
http://www.cs.may.ie/~jpower/Research/bisonXML/
|
||||||
|
|
||||||
|
XML output for GNU Bison
|
||||||
|
http://yaxx.sourceforge.net/
|
||||||
|
|
||||||
* Unit rules
|
* Unit rules
|
||||||
Maybe we could expand unit rules, i.e., transform
|
Maybe we could expand unit rules, i.e., transform
|
||||||
@@ -183,7 +163,7 @@ There are a couple of proposed outputs:
|
|||||||
which is based on Bison.
|
which is based on Bison.
|
||||||
<http://www.goice.co.jp/member/mo/hack-progs/bison-java.html>
|
<http://www.goice.co.jp/member/mo/hack-progs/bison-java.html>
|
||||||
|
|
||||||
Sébastien Serrurier ([email protected]) is working on this: he is
|
Sebastien Serrurier ([email protected]) is working on this: he is
|
||||||
expected to contact the authors, design the output, and implement it
|
expected to contact the authors, design the output, and implement it
|
||||||
into Bison.
|
into Bison.
|
||||||
|
|
||||||
@@ -201,49 +181,28 @@ Paul notes:
|
|||||||
PDP-10 ports :-) but they should probably be documented
|
PDP-10 ports :-) but they should probably be documented
|
||||||
somewhere.
|
somewhere.
|
||||||
|
|
||||||
|
More importantly, Bison does not currently allow NUL bytes in
|
||||||
|
tokens, either via escapes (e.g., "x\0y") or via a NUL byte in
|
||||||
|
the source code. This should get fixed.
|
||||||
|
|
||||||
* --graph
|
* --graph
|
||||||
Show reductions. []
|
Show reductions.
|
||||||
|
|
||||||
* Broken options ?
|
* Broken options ?
|
||||||
** %no-lines [ok]
|
** %no-parser
|
||||||
** %no-parser []
|
** %token-table
|
||||||
** %pure-parser []
|
** Skeleton strategy
|
||||||
** %token-table []
|
Must we keep %no-parser? %token-table?
|
||||||
** Options which could use parse_dquoted_param ().
|
|
||||||
Maybe transferred 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
|
* src/print_graph.c
|
||||||
Find the best graph parameters. []
|
Find the best graph parameters.
|
||||||
|
|
||||||
* doc/bison.texinfo
|
|
||||||
** Update
|
|
||||||
informations about ERROR_VERBOSE. []
|
|
||||||
** Add explanations 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
|
* BTYacc
|
||||||
See if we can integrate backtracking in Bison. Contact the BTYacc
|
See if we can integrate backtracking in Bison. Charles-Henri de
|
||||||
maintainers.
|
Boysson <[email protected]> is working on this, and already has some
|
||||||
|
results. Vadim Maslow, the maintainer of BTYacc was contacted, and we
|
||||||
|
stay in touch with him. Adjusting the Bison grammar parser will be
|
||||||
|
needed to support some extra BTYacc features. This is less urgent.
|
||||||
|
|
||||||
** Keeping the conflicted actions
|
** Keeping the conflicted actions
|
||||||
First, analyze the differences between byacc and btyacc (I'm referring
|
First, analyze the differences between byacc and btyacc (I'm referring
|
||||||
@@ -357,21 +316,22 @@ the parser with a means to create the (visual) parse tree.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation,
|
||||||
|
Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
GNU Bison is free software; you can redistribute it and/or modify
|
Bison is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2, or (at your option)
|
the Free Software Foundation; either version 2, or (at your option)
|
||||||
any later version.
|
any later version.
|
||||||
|
|
||||||
GNU Bison is distributed in the hope that it will be useful,
|
Bison is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Bison; see the file COPYING. If not, write to
|
along with Bison; see the file COPYING. If not, write to
|
||||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
Boston, MA 02111-1307, USA.
|
Boston, MA 02110-1301, USA.
|
||||||
|
|||||||
@@ -1,6 +1,345 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
echo "Bootstrapping CVS Bison..."
|
# Bootstrap this package from CVS.
|
||||||
|
|
||||||
echo "running: autoreconf --verbose --install --force"
|
# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||||
autoreconf --verbose --install --force
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
# 02110-1301, USA.
|
||||||
|
|
||||||
|
# Written by Paul Eggert.
|
||||||
|
|
||||||
|
package=bison
|
||||||
|
|
||||||
|
# Translation Project URL, for the registry of all projects.
|
||||||
|
TP_URL='http://www.iro.umontreal.ca/translation/registry.cgi?domain='
|
||||||
|
|
||||||
|
# Ensure file names are sorted consistently across platforms.
|
||||||
|
# Also, ensure diagnostics are in English, e.g., "wget --help" below.
|
||||||
|
LC_ALL=C
|
||||||
|
export LC_ALL
|
||||||
|
|
||||||
|
# Parse options.
|
||||||
|
|
||||||
|
for option
|
||||||
|
do
|
||||||
|
case $option in
|
||||||
|
--help)
|
||||||
|
echo "$0: usage: $0 [--gnulib-srcdir=DIR] [--cvs-user=USERNAME] [--skip-po]"
|
||||||
|
exit;;
|
||||||
|
--gnulib-srcdir=*)
|
||||||
|
GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
|
||||||
|
--cvs-user=*)
|
||||||
|
CVS_USER=`expr "$option" : '--cvs-user=\(.*\)'`;;
|
||||||
|
--skip-po)
|
||||||
|
SKIP_PO=t;;
|
||||||
|
*)
|
||||||
|
echo >&2 "$0: $option: unknown option"
|
||||||
|
exit 1;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "$0: Bootstrapping CVS $package..."
|
||||||
|
|
||||||
|
cleanup_gnulib() {
|
||||||
|
status=$?
|
||||||
|
rm -fr gnulib
|
||||||
|
exit $status
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get gnulib files.
|
||||||
|
|
||||||
|
case ${GNULIB_SRCDIR--} in
|
||||||
|
-)
|
||||||
|
if [ ! -d gnulib ]; then
|
||||||
|
echo "$0: getting gnulib files..."
|
||||||
|
|
||||||
|
case ${CVS_AUTH-pserver} in
|
||||||
|
pserver)
|
||||||
|
CVS_PREFIX=':pserver:anonymous@';;
|
||||||
|
ssh)
|
||||||
|
CVS_PREFIX="$CVS_USER${CVS_USER+@}";;
|
||||||
|
*)
|
||||||
|
echo "$0: $CVS_AUTH: Unknown CVS access method" >&2
|
||||||
|
exit 1;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case $CVS_RSH in
|
||||||
|
'') export CVS_RSH=ssh;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
trap cleanup_gnulib 1 2 13 15
|
||||||
|
|
||||||
|
cvs -z3 -q -d ${CVS_PREFIX}cvs.savannah.gnu.org:/cvsroot/gnulib co gnulib ||
|
||||||
|
cleanup_gnulib
|
||||||
|
|
||||||
|
trap - 1 2 13 15
|
||||||
|
fi
|
||||||
|
GNULIB_SRCDIR=gnulib
|
||||||
|
esac
|
||||||
|
|
||||||
|
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
||||||
|
<$gnulib_tool || exit
|
||||||
|
|
||||||
|
gnulib_modules='
|
||||||
|
argmatch
|
||||||
|
dirname
|
||||||
|
error
|
||||||
|
extensions
|
||||||
|
fopen-safer
|
||||||
|
getopt
|
||||||
|
gettext
|
||||||
|
hash
|
||||||
|
malloc
|
||||||
|
mbswidth
|
||||||
|
obstack
|
||||||
|
quote
|
||||||
|
quotearg
|
||||||
|
stdbool
|
||||||
|
stdint
|
||||||
|
stpcpy
|
||||||
|
strerror
|
||||||
|
strtoul
|
||||||
|
strverscmp
|
||||||
|
unistd-safer
|
||||||
|
unlocked-io
|
||||||
|
verify
|
||||||
|
xalloc
|
||||||
|
xalloc-die
|
||||||
|
xstrndup
|
||||||
|
'
|
||||||
|
|
||||||
|
previous_gnulib_modules=
|
||||||
|
while [ "$gnulib_modules" != "$previous_gnulib_modules" ]; do
|
||||||
|
previous_gnulib_modules=$gnulib_modules
|
||||||
|
gnulib_modules=`
|
||||||
|
(echo "$gnulib_modules"
|
||||||
|
for gnulib_module in $gnulib_modules; do
|
||||||
|
$gnulib_tool --extract-dependencies $gnulib_module
|
||||||
|
done) | sort -u
|
||||||
|
`
|
||||||
|
done
|
||||||
|
|
||||||
|
gnulib_files=`
|
||||||
|
(echo m4/warning.m4
|
||||||
|
for gnulib_module in $gnulib_modules; do
|
||||||
|
$gnulib_tool --extract-filelist $gnulib_module
|
||||||
|
done) | sort -u
|
||||||
|
`
|
||||||
|
|
||||||
|
gnulib_dirs=`echo "$gnulib_files" | sed 's,/[^/]*$,,' | sort -u`
|
||||||
|
mkdir -p $gnulib_dirs || exit
|
||||||
|
|
||||||
|
for gnulib_file in $gnulib_files; do
|
||||||
|
dest=$gnulib_file
|
||||||
|
rm -f $dest &&
|
||||||
|
echo "$0: Copying file $GNULIB_SRCDIR/$gnulib_file" &&
|
||||||
|
cp -p $GNULIB_SRCDIR/$gnulib_file $dest || exit
|
||||||
|
done
|
||||||
|
|
||||||
|
# This suppresses a bogus diagnostic
|
||||||
|
# "warning: macro `AM_LANGINFO_CODESET' not found in library".
|
||||||
|
echo "$0: patching m4/gettext.m4 to remove need for intl/* ..."
|
||||||
|
sed '
|
||||||
|
/^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
|
||||||
|
AC_DEFUN([AM_INTL_SUBDIR], [])
|
||||||
|
/^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
|
||||||
|
AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
|
||||||
|
' m4/gettext.m4 >m4/gettext_gl.m4 || exit
|
||||||
|
|
||||||
|
|
||||||
|
# Get translations.
|
||||||
|
|
||||||
|
get_translations() {
|
||||||
|
subdir=$1
|
||||||
|
domain=$2
|
||||||
|
|
||||||
|
echo "$0: getting translations into $subdir for $domain..."
|
||||||
|
(cd $subdir && rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'`) &&
|
||||||
|
|
||||||
|
$WGET_COMMAND -O "$subdir/$domain.html" "$TP_URL$domain" &&
|
||||||
|
|
||||||
|
sed -n 's|.*"http://[^"]*/translation/teams/PO/\([^/"]*\)/'"$domain"'-\([^/"]*\)\.[^."]*\.po".*|\1.\2|p' <"$subdir/$domain.html" |
|
||||||
|
sort -k 1,1 -k 2,2n -k2,2 -k3,3n -k3,3 -k4,4n -k4,4 -k5,5n -k5.5 |
|
||||||
|
awk -F. '
|
||||||
|
{ if (lang && $1 != lang) print lang, ver }
|
||||||
|
{ lang = $1; ver = substr($0, index($0, ".") + 1) }
|
||||||
|
END { if (lang) print lang, ver }
|
||||||
|
' | awk -v domain="$domain" -v subdir="$subdir" '
|
||||||
|
{
|
||||||
|
lang = $1
|
||||||
|
|
||||||
|
# Work around bugs in Bison 2.3 translations uncovered by gettext 0.15.
|
||||||
|
# This workaround can be removed once the translations are fixed.
|
||||||
|
if (lang == "id" || lang == "tr") next
|
||||||
|
|
||||||
|
ver = $2
|
||||||
|
urlfmt = ""
|
||||||
|
printf "$WGET_COMMAND -O %s/%s.po 'http://www.iro.umontreal.ca/translation/teams/PO/%s/%s-%s.%s.po' &&\n", subdir, lang, lang, domain, ver, lang
|
||||||
|
}
|
||||||
|
END { print ":" }
|
||||||
|
' | sh &&
|
||||||
|
ls "$subdir"/*.po | sed 's|.*/||; s|\.po$||' >"$subdir/LINGUAS" &&
|
||||||
|
rm "$subdir/$domain.html"
|
||||||
|
}
|
||||||
|
|
||||||
|
case $SKIP_PO in
|
||||||
|
'')
|
||||||
|
case `wget --help` in
|
||||||
|
*'--no-cache'*)
|
||||||
|
no_cache='--no-cache';;
|
||||||
|
*'--cache=on/off'*)
|
||||||
|
no_cache='--cache=off';;
|
||||||
|
*)
|
||||||
|
no_cache='';;
|
||||||
|
esac
|
||||||
|
|
||||||
|
WGET_COMMAND="wget -nv $no_cache"
|
||||||
|
export WGET_COMMAND
|
||||||
|
|
||||||
|
get_translations po $package || exit
|
||||||
|
|
||||||
|
case $package in
|
||||||
|
bison)
|
||||||
|
get_translations runtime-po $package-runtime || exit
|
||||||
|
esac;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
# Generate autoconf and automake snippets.
|
||||||
|
|
||||||
|
(echo '# This file is generated automatically by "bootstrap".' &&
|
||||||
|
echo 'AC_DEFUN([GNULIB_AUTOCONF_SNIPPET],[' &&
|
||||||
|
$gnulib_tool --extract-autoconf-snippet $gnulib_modules |
|
||||||
|
sed 's/AM_GNU_GETTEXT(\[external]/&, [need-ngettext]/' &&
|
||||||
|
echo '])'
|
||||||
|
) >m4/gnulib.m4 || exit
|
||||||
|
|
||||||
|
(echo '# This file is generated automatically by "bootstrap".' &&
|
||||||
|
$gnulib_tool --extract-automake-snippet $gnulib_modules |
|
||||||
|
sed 's/^[ ]*AM_CPPFLAGS[ ]*+=/# (commented out by bootstrap) &/'
|
||||||
|
) >lib/gnulib.mk || exit
|
||||||
|
|
||||||
|
|
||||||
|
# Reconfigure, getting other files.
|
||||||
|
|
||||||
|
echo "$0: autopoint --force ..."
|
||||||
|
autopoint --force || exit
|
||||||
|
|
||||||
|
# We don't need intl, so remove it.
|
||||||
|
intl_files_to_remove='
|
||||||
|
intl
|
||||||
|
m4/codeset.m4
|
||||||
|
m4/gettext.m4
|
||||||
|
m4/glibc2.m4
|
||||||
|
m4/glibc21.m4
|
||||||
|
m4/intdiv0.m4
|
||||||
|
m4/intmax.m4
|
||||||
|
m4/inttypes-h.m4
|
||||||
|
m4/inttypes-pri.m4
|
||||||
|
m4/lcmessage.m4
|
||||||
|
m4/lock.m4
|
||||||
|
m4/longdouble.m4
|
||||||
|
m4/printf-posix.m4
|
||||||
|
m4/signed.m4
|
||||||
|
m4/size_max.m4
|
||||||
|
m4/visibility.m4
|
||||||
|
m4/wint_t.m4
|
||||||
|
m4/xsize.m4
|
||||||
|
'
|
||||||
|
echo $0: rm -fr $intl_files_to_remove ...
|
||||||
|
rm -fr $intl_files_to_remove || exit
|
||||||
|
|
||||||
|
|
||||||
|
# Undo changes to gnulib files that autoreconf made.
|
||||||
|
for gnulib_file in $gnulib_files; do
|
||||||
|
test ! -f $gnulib_file || cmp -s $gnulib_file $GNULIB_SRCDIR/$gnulib_file || {
|
||||||
|
rm -f $gnulib_file &&
|
||||||
|
echo "$0: Copying file $GNULIB_SRCDIR/$gnulib_file again" &&
|
||||||
|
cp -p $GNULIB_SRCDIR/$gnulib_file $gnulib_file || exit
|
||||||
|
}
|
||||||
|
done
|
||||||
|
|
||||||
|
# Make sure aclocal.m4 is not older than input files.
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
for command in \
|
||||||
|
'aclocal --force -I m4' \
|
||||||
|
'autoconf --force' \
|
||||||
|
'autoheader --force' \
|
||||||
|
'automake --add-missing --copy --force-missing';
|
||||||
|
do
|
||||||
|
echo "$0: $command ..."
|
||||||
|
$command || exit
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# Put bug-reporting address into po/Makevars.
|
||||||
|
echo "$0: Creating po/Makevars from po/Makevars.template ..."
|
||||||
|
sed '
|
||||||
|
/^MSGID_BUGS_ADDRESS *=/s/=.*/= [email protected]/
|
||||||
|
/^XGETTEXT_OPTIONS *=/{
|
||||||
|
s/$/ \\/
|
||||||
|
a\
|
||||||
|
--flag=_:1:pass-c-format \\\
|
||||||
|
--flag=N_:1:pass-c-format \\\
|
||||||
|
--flag=error:3:c-format --flag=error_at_line:5:c-format \\\
|
||||||
|
--flag=warn:1:c-format --flag=warn_at:2:c-format \\\
|
||||||
|
--flag=complain:1:c-format --flag=complain_at:2:c-format \\\
|
||||||
|
--flag=fatal:1:c-format --flag=fatal_at:2:c-format
|
||||||
|
}
|
||||||
|
' po/Makevars.template >po/Makevars
|
||||||
|
|
||||||
|
# Likewise for runtime-po/Makevars, except also change a few other parameters.
|
||||||
|
sed '
|
||||||
|
s/^\(DOMAIN\) *=.*/\1 = bison-runtime/
|
||||||
|
s/^\(subdir\) *=.*/\1 = runtime-po/
|
||||||
|
s/^\(XGETTEXT_OPTIONS\) *=.*/\1 = --keyword=YY_/
|
||||||
|
' <po/Makevars >runtime-po/Makevars
|
||||||
|
|
||||||
|
# Copy identical files from po to runtime-po.
|
||||||
|
(cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
|
||||||
|
|
||||||
|
# if src/parse-gram.[ch] are out of date, rebuild them.
|
||||||
|
parse_gram_y=`find src/parse-gram.y \
|
||||||
|
'(' -newer src/parse-gram.c -o -newer src/parse-gram.h ')' \
|
||||||
|
-print` || exit
|
||||||
|
case $parse_gram_y in
|
||||||
|
?*)
|
||||||
|
echo "$0: warning: bootstrapping with old src/parse-gram.[ch] files."
|
||||||
|
|
||||||
|
echo "$0: touch -c src/parse-gram.[ch] ... "
|
||||||
|
touch -c src/parse-gram.[ch] || exit
|
||||||
|
|
||||||
|
echo "$0: ./configure --disable-nls ..."
|
||||||
|
./configure --disable-nls || exit
|
||||||
|
|
||||||
|
echo "$0: (cd lib && make) ..."
|
||||||
|
(cd lib && make) || exit
|
||||||
|
|
||||||
|
echo "$0: (cd src && make) ..."
|
||||||
|
(cd src && make) || exit
|
||||||
|
|
||||||
|
echo "$0: rm -f src/parse-gram.c src/parse-gram.h ..."
|
||||||
|
rm -f src/parse-gram.c src/parse-gram.h || exit
|
||||||
|
|
||||||
|
echo "$0: (cd src && make parse-gram.c parse-gram.h) ..."
|
||||||
|
(cd src && make parse-gram.c parse-gram.h) || exit
|
||||||
|
|
||||||
|
echo "$0: make distclean ..."
|
||||||
|
make distclean || exit;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "$0: done. Now you can run './configure'."
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
Makefile
|
|
||||||
*.t
|
*.t
|
||||||
|
Makefile
|
||||||
Makefile.in
|
Makefile.in
|
||||||
mkinstalldirs
|
|
||||||
missing
|
|
||||||
config.sub
|
|
||||||
config.guess
|
config.guess
|
||||||
|
config.rpath
|
||||||
|
config.sub
|
||||||
|
depcomp
|
||||||
|
install-sh
|
||||||
mdate-sh
|
mdate-sh
|
||||||
|
missing
|
||||||
|
mkinstalldirs
|
||||||
texinfo.tex
|
texinfo.tex
|
||||||
|
ylwrap
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
EXTRA_DIST = move-if-change prev-version.txt config.rpath
|
EXTRA_DIST = prev-version.txt
|
||||||
Executable
+338
@@ -0,0 +1,338 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
# Generate an announcement message.
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
use Getopt::Long;
|
||||||
|
use Digest::MD5;
|
||||||
|
use Digest::SHA1;
|
||||||
|
|
||||||
|
(my $VERSION = '$Revision$ ') =~ tr/[0-9].//cd;
|
||||||
|
(my $ME = $0) =~ s|.*/||;
|
||||||
|
|
||||||
|
my %valid_release_types = map {$_ => 1} qw (alpha beta major);
|
||||||
|
|
||||||
|
END
|
||||||
|
{
|
||||||
|
# Nobody ever checks the status of print()s. That's okay, because
|
||||||
|
# if any do fail, we're guaranteed to get an indicator when we close()
|
||||||
|
# the filehandle.
|
||||||
|
#
|
||||||
|
# Close stdout now, and if there were no errors, return happy status.
|
||||||
|
# If stdout has already been closed by the script, though, do nothing.
|
||||||
|
defined fileno STDOUT
|
||||||
|
or return;
|
||||||
|
close STDOUT
|
||||||
|
and return;
|
||||||
|
|
||||||
|
# Errors closing stdout. Indicate that, and hope stderr is OK.
|
||||||
|
warn "$ME: closing standard output: $!\n";
|
||||||
|
|
||||||
|
# Don't be so arrogant as to assume that we're the first END handler
|
||||||
|
# defined, and thus the last one invoked. There may be others yet
|
||||||
|
# to come. $? will be passed on to them, and to the final _exit().
|
||||||
|
#
|
||||||
|
# If it isn't already an error, make it one (and if it _is_ an error,
|
||||||
|
# preserve the value: it might be important).
|
||||||
|
$? ||= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub usage ($)
|
||||||
|
{
|
||||||
|
my ($exit_code) = @_;
|
||||||
|
my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
|
||||||
|
if ($exit_code != 0)
|
||||||
|
{
|
||||||
|
print $STREAM "Try `$ME --help' for more information.\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
my @types = sort keys %valid_release_types;
|
||||||
|
print $STREAM <<EOF;
|
||||||
|
Usage: $ME [OPTIONS]
|
||||||
|
|
||||||
|
OPTIONS:
|
||||||
|
|
||||||
|
Generate an announcement message.
|
||||||
|
|
||||||
|
FIXME: describe the following
|
||||||
|
|
||||||
|
--release-type=TYPE TYPE must be one of @types
|
||||||
|
--package-name=PACKAGE_NAME
|
||||||
|
--previous-version=VER
|
||||||
|
--current-version=VER
|
||||||
|
--release-archive-directory=DIR
|
||||||
|
--url-directory=URL_DIR
|
||||||
|
--news=NEWS_FILE optional
|
||||||
|
|
||||||
|
--help display this help and exit
|
||||||
|
--version output version information and exit
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
exit $exit_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub print_changelog_deltas ($$)
|
||||||
|
{
|
||||||
|
my ($package_name, $prev_version) = @_;
|
||||||
|
|
||||||
|
# Print new ChangeLog entries.
|
||||||
|
|
||||||
|
# First find all CVS-controlled ChangeLog files.
|
||||||
|
use File::Find;
|
||||||
|
my @changelog;
|
||||||
|
find ({wanted => sub {$_ eq 'ChangeLog' && -d 'CVS'
|
||||||
|
and push @changelog, $File::Find::name}},
|
||||||
|
'.');
|
||||||
|
|
||||||
|
# If there are no ChangeLog files, we're done.
|
||||||
|
@changelog
|
||||||
|
or return;
|
||||||
|
my %changelog = map {$_ => 1} @changelog;
|
||||||
|
|
||||||
|
# Reorder the list of files so that if there are ChangeLog
|
||||||
|
# files in the specified directories, they're listed first,
|
||||||
|
# in this order:
|
||||||
|
my @dir = qw ( . src lib m4 config doc );
|
||||||
|
|
||||||
|
# A typical @changelog array might look like this:
|
||||||
|
# ./ChangeLog
|
||||||
|
# ./po/ChangeLog
|
||||||
|
# ./m4/ChangeLog
|
||||||
|
# ./lib/ChangeLog
|
||||||
|
# ./doc/ChangeLog
|
||||||
|
# ./config/ChangeLog
|
||||||
|
my @reordered;
|
||||||
|
foreach my $d (@dir)
|
||||||
|
{
|
||||||
|
my $dot_slash = $d eq '.' ? $d : "./$d";
|
||||||
|
my $target = "$dot_slash/ChangeLog";
|
||||||
|
delete $changelog{$target}
|
||||||
|
and push @reordered, $target;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Append any remaining ChangeLog files.
|
||||||
|
push @reordered, sort keys %changelog;
|
||||||
|
|
||||||
|
# Remove leading `./'.
|
||||||
|
@reordered = map { s!^\./!!; $_ } @reordered;
|
||||||
|
|
||||||
|
print "\nChangeLog entries:\n\n";
|
||||||
|
# print join ("\n", @reordered), "\n";
|
||||||
|
|
||||||
|
$prev_version =~ s/\./_/g;
|
||||||
|
my $prev_cvs_tag = "\U$package_name\E-$prev_version";
|
||||||
|
|
||||||
|
my $cmd = "cvs -n diff -u -r$prev_cvs_tag -rHEAD @reordered";
|
||||||
|
open DIFF, '-|', $cmd
|
||||||
|
or die "$ME: cannot run `$cmd': $!\n";
|
||||||
|
# Print two types of lines, making minor changes:
|
||||||
|
# Lines starting with `+++ ', e.g.,
|
||||||
|
# +++ ChangeLog 22 Feb 2003 16:52:51 -0000 1.247
|
||||||
|
# and those starting with `+'.
|
||||||
|
# Don't print the others.
|
||||||
|
my $prev_printed_line_empty = 1;
|
||||||
|
while (defined (my $line = <DIFF>))
|
||||||
|
{
|
||||||
|
if ($line =~ /^\+\+\+ /)
|
||||||
|
{
|
||||||
|
my $separator = "*"x70 ."\n";
|
||||||
|
$line =~ s///;
|
||||||
|
$line =~ s/\s.*//;
|
||||||
|
$prev_printed_line_empty
|
||||||
|
or print "\n";
|
||||||
|
print $separator, $line, $separator;
|
||||||
|
}
|
||||||
|
elsif ($line =~ /^\+/)
|
||||||
|
{
|
||||||
|
$line =~ s///;
|
||||||
|
print $line;
|
||||||
|
$prev_printed_line_empty = ($line =~ /^$/);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close DIFF;
|
||||||
|
|
||||||
|
# The exit code should be 1.
|
||||||
|
# Allow in case there are no modified ChangeLog entries.
|
||||||
|
$? == 256 || $? == 128
|
||||||
|
or warn "$ME: warning: `cmd' had unexpected exit code or signal ($?)\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
my $release_type;
|
||||||
|
my $package_name;
|
||||||
|
my $prev_version;
|
||||||
|
my $curr_version;
|
||||||
|
my $release_archive_dir;
|
||||||
|
my @url_dir_list;
|
||||||
|
my $news_file;
|
||||||
|
|
||||||
|
GetOptions
|
||||||
|
(
|
||||||
|
'release-type=s' => \$release_type,
|
||||||
|
'package-name=s' => \$package_name,
|
||||||
|
'previous-version=s' => \$prev_version,
|
||||||
|
'current-version=s' => \$curr_version,
|
||||||
|
'release-archive-directory=s' => \$release_archive_dir,
|
||||||
|
'url-directory=s@' => \@url_dir_list,
|
||||||
|
'news=s@' => \$news_file,
|
||||||
|
|
||||||
|
help => sub { usage 0 },
|
||||||
|
version => sub { print "$ME version $VERSION\n"; exit },
|
||||||
|
) or usage 1;
|
||||||
|
|
||||||
|
my $fail = 0;
|
||||||
|
# Ensure that sure each required option is specified.
|
||||||
|
$release_type
|
||||||
|
or (warn "$ME: release type not specified\n"), $fail = 1;
|
||||||
|
$package_name
|
||||||
|
or (warn "$ME: package name not specified\n"), $fail = 1;
|
||||||
|
$prev_version
|
||||||
|
or (warn "$ME: previous version string not specified\n"), $fail = 1;
|
||||||
|
$curr_version
|
||||||
|
or (warn "$ME: current version string not specified\n"), $fail = 1;
|
||||||
|
$release_archive_dir
|
||||||
|
or (warn "$ME: release directory name not specified\n"), $fail = 1;
|
||||||
|
@url_dir_list
|
||||||
|
or (warn "$ME: URL directory name(s) not specified\n"), $fail = 1;
|
||||||
|
|
||||||
|
exists $valid_release_types{$release_type}
|
||||||
|
or (warn "$ME: `$release_type': invalid release type\n"), $fail = 1;
|
||||||
|
|
||||||
|
@ARGV
|
||||||
|
and (warn "$ME: too many arguments\n"), $fail = 1;
|
||||||
|
$fail
|
||||||
|
and usage 1;
|
||||||
|
|
||||||
|
my $my_distdir = "$package_name-$curr_version";
|
||||||
|
my $tgz = "$my_distdir.tar.gz";
|
||||||
|
my $tbz = "$my_distdir.tar.bz2";
|
||||||
|
my $xd = "$package_name-$prev_version-$curr_version.xdelta";
|
||||||
|
|
||||||
|
my %size;
|
||||||
|
|
||||||
|
foreach my $f (($tgz, $tbz, $xd))
|
||||||
|
{
|
||||||
|
my $cmd = "du --human $f";
|
||||||
|
my $t = `$cmd`;
|
||||||
|
# FIXME-someday: give a better diagnostic, a la $PROCESS_STATUS
|
||||||
|
$@
|
||||||
|
and (warn "$ME: command failed: `$cmd'\n"), $fail = 1;
|
||||||
|
chomp $t;
|
||||||
|
$t =~ s/^([\d.]+[MkK]).*/${1}B/;
|
||||||
|
$size{$f} = $t;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fail
|
||||||
|
and exit 1;
|
||||||
|
|
||||||
|
# The markup is escaped as <\# so that when this script is sent by
|
||||||
|
# mail (or part of a diff), Gnus is not triggered.
|
||||||
|
print <<EOF;
|
||||||
|
|
||||||
|
Subject: $my_distdir released
|
||||||
|
|
||||||
|
<\#secure method=pgpmime mode=sign>
|
||||||
|
|
||||||
|
FIXME: put comments here
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
print "Here are the compressed sources:\n";
|
||||||
|
foreach my $url (@url_dir_list)
|
||||||
|
{
|
||||||
|
print " $url/$tgz ($size{$tgz})\n";
|
||||||
|
print " $url/$tbz ($size{$tbz})\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\nAnd here are xdelta-style diffs:\n";
|
||||||
|
foreach my $url (@url_dir_list)
|
||||||
|
{
|
||||||
|
print " $url/$xd ($size{$xd})\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\nHere are GPG detached signatures:\n";
|
||||||
|
foreach my $url (@url_dir_list)
|
||||||
|
{
|
||||||
|
print " $url/$tgz.asc\n";
|
||||||
|
print " $url/$tbz.asc\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
# FIXME: clean up upon interrupt or die
|
||||||
|
my $tmpdir = $ENV{TMPDIR} || '/tmp';
|
||||||
|
my $tmp = "$tmpdir/$ME-$$";
|
||||||
|
unlink $tmp; # ignore failure
|
||||||
|
|
||||||
|
print "\nHere are the MD5 and SHA1 signatures:\n";
|
||||||
|
print "\n";
|
||||||
|
# The markup is escaped as <\# so that when this script is sent by
|
||||||
|
# mail (or part of a diff), Gnus is not triggered.
|
||||||
|
print "<\#part type=text/plain filename=\"$tmp\" disposition=inline>\n"
|
||||||
|
. "<\#/part>\n";
|
||||||
|
|
||||||
|
open OUT, '>', $tmp
|
||||||
|
or die "$ME: $tmp: cannot open for writing: $!\n";
|
||||||
|
|
||||||
|
foreach my $meth (qw (md5 sha1))
|
||||||
|
{
|
||||||
|
foreach my $f (($tgz, $tbz, $xd))
|
||||||
|
{
|
||||||
|
open IN, '<', $f
|
||||||
|
or die "$ME: $f: cannot open for reading: $!\n";
|
||||||
|
binmode IN;
|
||||||
|
my $dig =
|
||||||
|
($meth eq 'md5'
|
||||||
|
? Digest::MD5->new->addfile(*IN)->hexdigest
|
||||||
|
: Digest::SHA1->new->addfile(*IN)->hexdigest);
|
||||||
|
close IN;
|
||||||
|
print OUT "$dig $f\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
close OUT
|
||||||
|
or die "$ME: $tmp: while writing: $!\n";
|
||||||
|
chmod 0400, $tmp; # ignore failure
|
||||||
|
|
||||||
|
if ($news_file)
|
||||||
|
{
|
||||||
|
print "\nNEWS\n\n";
|
||||||
|
|
||||||
|
# Print all lines from $news_file, starting with the first one
|
||||||
|
# that mentions $curr_version up to but not including
|
||||||
|
# the first occurrence of $prev_version.
|
||||||
|
my $in_items;
|
||||||
|
open NEWS, '<', $news_file
|
||||||
|
or die "$ME: $news_file: cannot open for reading: $!\n";
|
||||||
|
while (defined (my $line = <NEWS>))
|
||||||
|
{
|
||||||
|
if ( ! $in_items)
|
||||||
|
{
|
||||||
|
# Match lines like this one:
|
||||||
|
# * Major changes in release 5.0.1:
|
||||||
|
# but not any other line that starts with a space, *, or -.
|
||||||
|
$line =~ /^(\* Major changes.*|[^ *-].*)\Q$curr_version\E/o
|
||||||
|
or next;
|
||||||
|
$in_items = 1;
|
||||||
|
print $line;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# Be careful that this regexp cannot match version numbers
|
||||||
|
# in NEWS items -- they might well say `introduced in 4.5.5',
|
||||||
|
# and we don't want that to match.
|
||||||
|
$line =~ /^(\* Major changes.*|[^ *-].*)\Q$prev_version\E/o
|
||||||
|
and last;
|
||||||
|
print $line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close NEWS;
|
||||||
|
|
||||||
|
$in_items
|
||||||
|
or die "$ME: $news_file: no matching lines for `$curr_version'\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$release_type eq 'major'
|
||||||
|
or print_changelog_deltas ($package_name, $prev_version);
|
||||||
|
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
2.0
|
||||||
-423
@@ -1,423 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
|
|
||||||
# depcomp - compile a program generating dependencies as side-effects
|
|
||||||
# Copyright 1999, 2000 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 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.
|
|
||||||
|
|
||||||
# Originally written by Alexandre Oliva <[email protected]>.
|
|
||||||
|
|
||||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
|
||||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
# `libtool' can also be set to `yes' or `no'.
|
|
||||||
|
|
||||||
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"
|
|
||||||
|
|
||||||
# Some modes work just like other modes, but use different flags. We
|
|
||||||
# parameterize here, but still list the modes in the big case below,
|
|
||||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
|
||||||
# here, because this file can only contain one case statement.
|
|
||||||
if test "$depmode" = hp; then
|
|
||||||
# HP compiler uses -M and no extra arg.
|
|
||||||
gccflag=-M
|
|
||||||
depmode=gcc
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "$depmode" = dashXmstdout; then
|
|
||||||
# This is just like dashmstdout with a different argument.
|
|
||||||
dashmflag=-xM
|
|
||||||
depmode=dashmstdout
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$depmode" in
|
|
||||||
gcc3)
|
|
||||||
## gcc 3 implements dependency tracking that does exactly what
|
|
||||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
|
||||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
|
||||||
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
|
|
||||||
stat=$?
|
|
||||||
if test $stat -eq 0; then :
|
|
||||||
else
|
|
||||||
rm -f "$tmpdepfile"
|
|
||||||
exit $stat
|
|
||||||
fi
|
|
||||||
mv "$tmpdepfile" "$depfile"
|
|
||||||
;;
|
|
||||||
|
|
||||||
gcc)
|
|
||||||
## There are various ways to get dependency output from gcc. Here's
|
|
||||||
## why we pick this rather obscure method:
|
|
||||||
## - Don't want to use -MD because we'd like the dependencies to end
|
|
||||||
## up in a subdir. Having to rename by hand is ugly.
|
|
||||||
## (We might end up doing this anyway to support other compilers.)
|
|
||||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
|
||||||
## -MM, not -M (despite what the docs say).
|
|
||||||
## - Using -M directly means running the compiler twice (even worse
|
|
||||||
## than renaming).
|
|
||||||
if test -z "$gccflag"; then
|
|
||||||
gccflag=-MD,
|
|
||||||
fi
|
|
||||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
|
||||||
stat=$?
|
|
||||||
if test $stat -eq 0; then :
|
|
||||||
else
|
|
||||||
rm -f "$tmpdepfile"
|
|
||||||
exit $stat
|
|
||||||
fi
|
|
||||||
rm -f "$depfile"
|
|
||||||
echo "$object : \\" > "$depfile"
|
|
||||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
|
||||||
## The second -e expression handles DOS-style file names with drive letters.
|
|
||||||
sed -e 's/^[^:]*: / /' \
|
|
||||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
|
||||||
## This next piece of magic avoids the `deleted header file' problem.
|
|
||||||
## The problem is that when a header file which appears in a .P file
|
|
||||||
## is deleted, the dependency causes make to die (because there is
|
|
||||||
## typically no way to rebuild the header). We avoid this by adding
|
|
||||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
|
||||||
## this for us directly.
|
|
||||||
tr ' ' '
|
|
||||||
' < "$tmpdepfile" |
|
|
||||||
## Some versions of gcc put a space before the `:'. On the theory
|
|
||||||
## that the space means something, we add a space to the output as
|
|
||||||
## well.
|
|
||||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
|
||||||
## correctly. Breaking it into two sed invocations is a workaround.
|
|
||||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
|
||||||
rm -f "$tmpdepfile"
|
|
||||||
;;
|
|
||||||
|
|
||||||
hp)
|
|
||||||
# This case exists only to let depend.m4 do its work. It works by
|
|
||||||
# looking at the text of this script. This case will never be run,
|
|
||||||
# since it is checked for above.
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
|
|
||||||
sgi)
|
|
||||||
if test "$libtool" = yes; then
|
|
||||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
|
||||||
else
|
|
||||||
"$@" -MDupdate "$tmpdepfile"
|
|
||||||
fi
|
|
||||||
stat=$?
|
|
||||||
if test $stat -eq 0; then :
|
|
||||||
else
|
|
||||||
rm -f "$tmpdepfile"
|
|
||||||
exit $stat
|
|
||||||
fi
|
|
||||||
rm -f "$depfile"
|
|
||||||
|
|
||||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
|
||||||
echo "$object : \\" > "$depfile"
|
|
||||||
|
|
||||||
# Clip off the initial element (the dependent). Don't try to be
|
|
||||||
# clever and replace this with sed code, as IRIX sed won't handle
|
|
||||||
# lines with more than a fixed number of characters (4096 in
|
|
||||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
|
||||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
|
||||||
# dependency line.
|
|
||||||
tr ' ' '
|
|
||||||
' < "$tmpdepfile" \
|
|
||||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
|
||||||
tr '
|
|
||||||
' ' ' >> $depfile
|
|
||||||
echo >> $depfile
|
|
||||||
|
|
||||||
# The second pass generates a dummy entry for each header file.
|
|
||||||
tr ' ' '
|
|
||||||
' < "$tmpdepfile" \
|
|
||||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
|
||||||
>> $depfile
|
|
||||||
else
|
|
||||||
# The sourcefile does not contain any dependencies, so just
|
|
||||||
# store a dummy comment line, to avoid errors with the Makefile
|
|
||||||
# "include basename.Plo" scheme.
|
|
||||||
echo "#dummy" > "$depfile"
|
|
||||||
fi
|
|
||||||
rm -f "$tmpdepfile"
|
|
||||||
;;
|
|
||||||
|
|
||||||
aix)
|
|
||||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
|
||||||
# in a .u file. This file always lives in the current directory.
|
|
||||||
# Also, the AIX compiler puts `$object:' at the start of each line;
|
|
||||||
# $object doesn't have directory information.
|
|
||||||
stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
|
|
||||||
tmpdepfile="$stripped.u"
|
|
||||||
outname="$stripped.o"
|
|
||||||
if test "$libtool" = yes; then
|
|
||||||
"$@" -Wc,-M
|
|
||||||
else
|
|
||||||
"$@" -M
|
|
||||||
fi
|
|
||||||
|
|
||||||
stat=$?
|
|
||||||
if test $stat -eq 0; then :
|
|
||||||
else
|
|
||||||
rm -f "$tmpdepfile"
|
|
||||||
exit $stat
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -f "$tmpdepfile"; then
|
|
||||||
# Each line is of the form `foo.o: dependent.h'.
|
|
||||||
# Do two passes, one to just change these to
|
|
||||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
|
||||||
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
|
|
||||||
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
|
|
||||||
else
|
|
||||||
# The sourcefile does not contain any dependencies, so just
|
|
||||||
# store a dummy comment line, to avoid errors with the Makefile
|
|
||||||
# "include basename.Plo" scheme.
|
|
||||||
echo "#dummy" > "$depfile"
|
|
||||||
fi
|
|
||||||
rm -f "$tmpdepfile"
|
|
||||||
;;
|
|
||||||
|
|
||||||
tru64)
|
|
||||||
# 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
|
|
||||||
# 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$//'`
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
stat=$?
|
|
||||||
if test $stat -eq 0; then :
|
|
||||||
else
|
|
||||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
|
||||||
exit $stat
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -f "$tmpdepfile1"; then
|
|
||||||
tmpdepfile="$tmpdepfile1"
|
|
||||||
else
|
|
||||||
tmpdepfile="$tmpdepfile2"
|
|
||||||
fi
|
|
||||||
if test -f "$tmpdepfile"; then
|
|
||||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
|
||||||
# That's a space and a tab in the [].
|
|
||||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
|
||||||
else
|
|
||||||
echo "#dummy" > "$depfile"
|
|
||||||
fi
|
|
||||||
rm -f "$tmpdepfile"
|
|
||||||
;;
|
|
||||||
|
|
||||||
#nosideeffect)
|
|
||||||
# This comment above is used by automake to tell side-effect
|
|
||||||
# dependency tracking mechanisms from slower ones.
|
|
||||||
|
|
||||||
dashmstdout)
|
|
||||||
# Important note: in order to support this mode, a compiler *must*
|
|
||||||
# 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
|
|
||||||
done
|
|
||||||
|
|
||||||
test -z "$dashmflag" && dashmflag=-M
|
|
||||||
"$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
|
||||||
rm -f "$depfile"
|
|
||||||
cat < "$tmpdepfile" > "$depfile"
|
|
||||||
tr ' ' '
|
|
||||||
' < "$tmpdepfile" | \
|
|
||||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
|
||||||
## correctly. Breaking it into two sed invocations is a workaround.
|
|
||||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
|
||||||
rm -f "$tmpdepfile"
|
|
||||||
;;
|
|
||||||
|
|
||||||
dashXmstdout)
|
|
||||||
# This case only exists to satisfy depend.m4. It is never actually
|
|
||||||
# run, as this mode is specially recognized in the preamble.
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
|
|
||||||
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} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
|
||||||
rm -f "$depfile"
|
|
||||||
cat < "$tmpdepfile" > "$depfile"
|
|
||||||
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.
|
|
||||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
|
||||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
|
||||||
;;
|
|
||||||
|
|
||||||
cpp)
|
|
||||||
# Important note: in order to support this mode, a compiler *must*
|
|
||||||
# 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
|
|
||||||
done
|
|
||||||
|
|
||||||
"$@" -E |
|
|
||||||
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
|
||||||
sed '$ s: \\$::' > "$tmpdepfile"
|
|
||||||
rm -f "$depfile"
|
|
||||||
echo "$object : \\" > "$depfile"
|
|
||||||
cat < "$tmpdepfile" >> "$depfile"
|
|
||||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
|
||||||
rm -f "$tmpdepfile"
|
|
||||||
;;
|
|
||||||
|
|
||||||
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.
|
|
||||||
"$@" || exit $?
|
|
||||||
IFS=" "
|
|
||||||
for arg
|
|
||||||
do
|
|
||||||
case "$arg" in
|
|
||||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
|
||||||
set fnord "$@"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
set fnord "$@" "$arg"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
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"
|
|
||||||
echo " " >> "$depfile"
|
|
||||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
|
||||||
rm -f "$tmpdepfile"
|
|
||||||
;;
|
|
||||||
|
|
||||||
none)
|
|
||||||
exec "$@"
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
echo "Unknown depmode $depmode" 1>&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
@@ -1,251 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# install - install a program, script, or datafile
|
|
||||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
|
||||||
#
|
|
||||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
|
||||||
#
|
|
||||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
# documentation for any purpose is hereby granted without fee, provided that
|
|
||||||
# the above copyright notice appear in all copies and that both that
|
|
||||||
# copyright notice and this permission notice appear in supporting
|
|
||||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
|
||||||
# publicity pertaining to distribution of the software without specific,
|
|
||||||
# written prior permission. M.I.T. makes no representations about the
|
|
||||||
# suitability of this software for any purpose. It is provided "as is"
|
|
||||||
# without express or implied warranty.
|
|
||||||
#
|
|
||||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
|
||||||
# `make' implicit rules from creating a file called install from it
|
|
||||||
# when there is no Makefile.
|
|
||||||
#
|
|
||||||
# This script is compatible with the BSD install script, but was written
|
|
||||||
# from scratch. It can only install one file at a time, a restriction
|
|
||||||
# shared with many OS's install programs.
|
|
||||||
|
|
||||||
|
|
||||||
# set DOITPROG to echo to test this script
|
|
||||||
|
|
||||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
|
||||||
doit="${DOITPROG-}"
|
|
||||||
|
|
||||||
|
|
||||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
|
||||||
|
|
||||||
mvprog="${MVPROG-mv}"
|
|
||||||
cpprog="${CPPROG-cp}"
|
|
||||||
chmodprog="${CHMODPROG-chmod}"
|
|
||||||
chownprog="${CHOWNPROG-chown}"
|
|
||||||
chgrpprog="${CHGRPPROG-chgrp}"
|
|
||||||
stripprog="${STRIPPROG-strip}"
|
|
||||||
rmprog="${RMPROG-rm}"
|
|
||||||
mkdirprog="${MKDIRPROG-mkdir}"
|
|
||||||
|
|
||||||
transformbasename=""
|
|
||||||
transform_arg=""
|
|
||||||
instcmd="$mvprog"
|
|
||||||
chmodcmd="$chmodprog 0755"
|
|
||||||
chowncmd=""
|
|
||||||
chgrpcmd=""
|
|
||||||
stripcmd=""
|
|
||||||
rmcmd="$rmprog -f"
|
|
||||||
mvcmd="$mvprog"
|
|
||||||
src=""
|
|
||||||
dst=""
|
|
||||||
dir_arg=""
|
|
||||||
|
|
||||||
while [ x"$1" != x ]; do
|
|
||||||
case $1 in
|
|
||||||
-c) instcmd="$cpprog"
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-d) dir_arg=true
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-m) chmodcmd="$chmodprog $2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-o) chowncmd="$chownprog $2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-g) chgrpcmd="$chgrpprog $2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-s) stripcmd="$stripprog"
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
*) if [ x"$src" = x ]
|
|
||||||
then
|
|
||||||
src=$1
|
|
||||||
else
|
|
||||||
# this colon is to work around a 386BSD /bin/sh bug
|
|
||||||
:
|
|
||||||
dst=$1
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ x"$src" = x ]
|
|
||||||
then
|
|
||||||
echo "install: no input file specified"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
:
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ x"$dir_arg" != x ]; then
|
|
||||||
dst=$src
|
|
||||||
src=""
|
|
||||||
|
|
||||||
if [ -d $dst ]; then
|
|
||||||
instcmd=:
|
|
||||||
chmodcmd=""
|
|
||||||
else
|
|
||||||
instcmd=$mkdirprog
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
|
|
||||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
|
||||||
# might cause directories to be created, which would be especially bad
|
|
||||||
# if $src (and thus $dsttmp) contains '*'.
|
|
||||||
|
|
||||||
if [ -f "$src" ] || [ -d "$src" ]
|
|
||||||
then
|
|
||||||
:
|
|
||||||
else
|
|
||||||
echo "install: $src does not exist"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ x"$dst" = x ]
|
|
||||||
then
|
|
||||||
echo "install: no destination specified"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
:
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If destination is a directory, append the input filename; if your system
|
|
||||||
# does not like double slashes in filenames, you may need to add some logic
|
|
||||||
|
|
||||||
if [ -d $dst ]
|
|
||||||
then
|
|
||||||
dst="$dst"/`basename $src`
|
|
||||||
else
|
|
||||||
:
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
## this sed command emulates the dirname command
|
|
||||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
|
||||||
|
|
||||||
# Make sure that the destination directory exists.
|
|
||||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
|
||||||
|
|
||||||
# Skip lots of stat calls in the usual case.
|
|
||||||
if [ ! -d "$dstdir" ]; then
|
|
||||||
defaultIFS='
|
|
||||||
'
|
|
||||||
IFS="${IFS-${defaultIFS}}"
|
|
||||||
|
|
||||||
oIFS="${IFS}"
|
|
||||||
# Some sh's can't handle IFS=/ for some reason.
|
|
||||||
IFS='%'
|
|
||||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
|
||||||
IFS="${oIFS}"
|
|
||||||
|
|
||||||
pathcomp=''
|
|
||||||
|
|
||||||
while [ $# -ne 0 ] ; do
|
|
||||||
pathcomp="${pathcomp}${1}"
|
|
||||||
shift
|
|
||||||
|
|
||||||
if [ ! -d "${pathcomp}" ] ;
|
|
||||||
then
|
|
||||||
$mkdirprog "${pathcomp}"
|
|
||||||
else
|
|
||||||
:
|
|
||||||
fi
|
|
||||||
|
|
||||||
pathcomp="${pathcomp}/"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ x"$dir_arg" != x ]
|
|
||||||
then
|
|
||||||
$doit $instcmd $dst &&
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
if [ x"$transformarg" = x ]
|
|
||||||
then
|
|
||||||
dstfile=`basename $dst`
|
|
||||||
else
|
|
||||||
dstfile=`basename $dst $transformbasename |
|
|
||||||
sed $transformarg`$transformbasename
|
|
||||||
fi
|
|
||||||
|
|
||||||
# don't allow the sed command to completely eliminate the filename
|
|
||||||
|
|
||||||
if [ x"$dstfile" = x ]
|
|
||||||
then
|
|
||||||
dstfile=`basename $dst`
|
|
||||||
else
|
|
||||||
:
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Make a temp file name in the proper directory.
|
|
||||||
|
|
||||||
dsttmp=$dstdir/#inst.$$#
|
|
||||||
|
|
||||||
# Move or copy the file name to the temp name
|
|
||||||
|
|
||||||
$doit $instcmd $src $dsttmp &&
|
|
||||||
|
|
||||||
trap "rm -f ${dsttmp}" 0 &&
|
|
||||||
|
|
||||||
# and set any options; do chmod last to preserve setuid bits
|
|
||||||
|
|
||||||
# If any of these fail, we abort the whole thing. If we want to
|
|
||||||
# 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 :;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.
|
|
||||||
|
|
||||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
|
||||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
|
||||||
|
|
||||||
fi &&
|
|
||||||
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# Like mv $1 $2, but if the files are the same, just delete $1.
|
|
||||||
# Status is 0 if $2 is changed, 1 otherwise.
|
|
||||||
if
|
|
||||||
test -r $2
|
|
||||||
then
|
|
||||||
if
|
|
||||||
cmp -s $1 $2
|
|
||||||
then
|
|
||||||
echo $2 is unchanged
|
|
||||||
rm -f $1
|
|
||||||
else
|
|
||||||
mv -f $1 $2
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
mv -f $1 $2
|
|
||||||
fi
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
1.49a
|
|
||||||
+94
-73
@@ -1,6 +1,7 @@
|
|||||||
# Configure template for GNU Bison. -*-Autoconf-*-
|
# Configure template for GNU Bison. -*-Autoconf-*-
|
||||||
#
|
#
|
||||||
# Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software
|
||||||
|
# Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,40 +15,25 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
# 02111-1307 USA
|
# 02110-1301 USA
|
||||||
|
|
||||||
# We need a recent Autoconf to run a recent Autotest.
|
# We use macros like AC_CHECK_HEADERS_ONCE, so we need Autoconf 2.60 or better.
|
||||||
AC_PREREQ(2.54)
|
AC_PREREQ(2.60)
|
||||||
|
|
||||||
AC_INIT([GNU Bison], [1.49c], [[email protected]])
|
AC_INIT([GNU Bison], [2.3a], [[email protected]])
|
||||||
AC_CONFIG_AUX_DIR(config)
|
AC_CONFIG_AUX_DIR([build-aux])
|
||||||
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE([1.7 check-news readme-alpha dist-bzip2])
|
# We don't have a file m4/Makefile.am, so we need Automake 1.8 or later.
|
||||||
AM_CONFIG_HEADER(config.h:config.hin)
|
AM_INIT_AUTOMAKE([1.8 check-news readme-alpha dist-bzip2])
|
||||||
|
AC_CONFIG_HEADERS([config.h:config.hin])
|
||||||
|
|
||||||
# Initialize the test suite.
|
gl_USE_SYSTEM_EXTENSIONS
|
||||||
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.
|
# Checks for the compiler.
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AM_PROG_LEX
|
|
||||||
AC_PROG_YACC
|
|
||||||
AC_MINIX
|
|
||||||
AC_ISC_POSIX
|
|
||||||
AM_PROG_CC_STDC
|
AM_PROG_CC_STDC
|
||||||
AC_PROG_RANLIB
|
|
||||||
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,
|
AC_ARG_ENABLE(gcc-warnings,
|
||||||
[ --enable-gcc-warnings turn on lots of GCC warnings (not recommended)],
|
[ --enable-gcc-warnings turn on lots of GCC warnings (not recommended)],
|
||||||
[case "${enableval}" in
|
[case "${enableval}" in
|
||||||
@@ -56,63 +42,98 @@ AC_ARG_ENABLE(gcc-warnings,
|
|||||||
esac],
|
esac],
|
||||||
[enableval=no])
|
[enableval=no])
|
||||||
if test "${enableval}" = yes; then
|
if test "${enableval}" = yes; then
|
||||||
BISON_WARNING(-Werror)
|
gl_WARNING_CFLAGS([-Werror])
|
||||||
AC_SUBST([WERROR_CFLAGS], [$WARNING_CFLAGS])
|
AC_SUBST([WERROR_CFLAGS], [$WARNING_CFLAGS])
|
||||||
WARNING_CFLAGS=
|
WARNING_CFLAGS=
|
||||||
BISON_WARNING(-Wall)
|
gl_WARNING_CFLAGS([-Wextra -Wno-sign-compare])
|
||||||
BISON_WARNING(-W)
|
gl_WARNING_CFLAGS([-Wall])
|
||||||
BISON_WARNING(-Wbad-function-cast)
|
gl_WARNING_CFLAGS([-Wcast-align])
|
||||||
BISON_WARNING(-Wcast-align)
|
gl_WARNING_CFLAGS([-Wcast-qual])
|
||||||
BISON_WARNING(-Wcast-qual)
|
gl_WARNING_CFLAGS([-Wformat])
|
||||||
BISON_WARNING(-Wformat)
|
gl_WARNING_CFLAGS([-Wpointer-arith])
|
||||||
BISON_WARNING(-Wmissing-declarations)
|
gl_WARNING_CFLAGS([-Wwrite-strings])
|
||||||
BISON_WARNING(-Wmissing-prototypes)
|
AC_SUBST([WARNING_CXXFLAGS], [$WARNING_CFLAGS])
|
||||||
BISON_WARNING(-Wnested-externs)
|
# The following warnings are not suitable for C++.
|
||||||
BISON_WARNING(-Wshadow)
|
gl_WARNING_CFLAGS([-Wbad-function-cast])
|
||||||
BISON_WARNING(-Wstrict-prototypes)
|
gl_WARNING_CFLAGS([-Wmissing-declarations])
|
||||||
BISON_WARNING(-Wwrite-strings)
|
gl_WARNING_CFLAGS([-Wmissing-prototypes])
|
||||||
|
gl_WARNING_CFLAGS([-Wshadow])
|
||||||
|
gl_WARNING_CFLAGS([-Wstrict-prototypes])
|
||||||
|
AC_DEFINE([lint], 1, [Define to 1 if the compiler is checking for lint.])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Checks for libraries.
|
BISON_TEST_FOR_WORKING_C_COMPILER
|
||||||
AC_DEFINE([_GNU_SOURCE],1,[Define to 1 for GNU C library extensions.])
|
|
||||||
|
AC_ARG_ENABLE([yacc],
|
||||||
|
[AC_HELP_STRING([--disable-yacc],
|
||||||
|
[do not build a yacc command or an -ly library])],
|
||||||
|
, [enable_yacc=yes])
|
||||||
|
case $enable_yacc in
|
||||||
|
yes)
|
||||||
|
YACC_SCRIPT=yacc
|
||||||
|
YACC_LIBRARY=liby.a;;
|
||||||
|
*)
|
||||||
|
YACC_SCRIPT=
|
||||||
|
YACC_LIBRARY=;;
|
||||||
|
esac
|
||||||
|
AC_SUBST([YACC_SCRIPT])
|
||||||
|
AC_SUBST([YACC_LIBRARY])
|
||||||
|
|
||||||
|
# Checks for programs.
|
||||||
|
AC_PROG_LEX
|
||||||
|
AC_PROG_YACC
|
||||||
|
AC_PROG_RANLIB
|
||||||
|
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.])
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
AC_HEADER_STDC
|
AC_CHECK_HEADERS_ONCE([locale.h])
|
||||||
AC_CHECK_HEADERS([ctype.h locale.h memory.h stdlib.h string.h unistd.h])
|
AM_STDBOOL_H
|
||||||
|
|
||||||
# Checks for compiler characteristics.
|
# Checks for compiler characteristics.
|
||||||
AC_C_CONST
|
|
||||||
AC_C_INLINE
|
AC_C_INLINE
|
||||||
AM_C_PROTOTYPES
|
|
||||||
|
|
||||||
# Checks for library functions.
|
# Checks for library functions.
|
||||||
AC_FUNC_ALLOCA
|
AC_CHECK_FUNCS_ONCE([setlocale])
|
||||||
AC_FUNC_OBSTACK
|
|
||||||
AC_FUNC_ERROR_AT_LINE
|
|
||||||
AC_FUNC_STRNLEN
|
|
||||||
UTILS_FUNC_MKSTEMP
|
|
||||||
AC_CHECK_FUNCS(setlocale)
|
|
||||||
AC_CHECK_DECLS([free, getenv, getopt,
|
|
||||||
stpcpy, strchr, strspn, strnlen,
|
|
||||||
malloc, memchr, memrchr])
|
|
||||||
AC_REPLACE_FUNCS(memchr memrchr \
|
|
||||||
strchr stpcpy strrchr strspn strtol)
|
|
||||||
AC_FUNC_MALLOC
|
|
||||||
AC_FUNC_REALLOC
|
|
||||||
jm_PREREQ_QUOTEARG
|
|
||||||
jm_FUNC_ARGMATCH
|
|
||||||
jm_PREREQ_ERROR
|
|
||||||
jm_PREREQ_TEMPNAME
|
|
||||||
AM_WITH_DMALLOC
|
AM_WITH_DMALLOC
|
||||||
|
BISON_PREREQ_SUBPIPE
|
||||||
BISON_PREREQ_TIMEVAR
|
BISON_PREREQ_TIMEVAR
|
||||||
|
|
||||||
# Gettext.
|
# gnulib and gettext.
|
||||||
AM_GNU_GETTEXT(external, need-ngettext)
|
GNULIB_AUTOCONF_SNIPPET
|
||||||
AM_GNU_GETTEXT_VERSION(0.11.5)
|
# We've never tested with gettext versions before 0.15, so play it safe.
|
||||||
|
AM_GNU_GETTEXT_VERSION([0.15])
|
||||||
|
BISON_I18N
|
||||||
|
|
||||||
AC_OUTPUT([Makefile
|
# Internationalized parsers.
|
||||||
config/Makefile
|
AC_CONFIG_FILES([runtime-po/Makefile.in])
|
||||||
po/Makefile.in
|
# Autoconf macros for packages using internationalized parsers.
|
||||||
data/Makefile
|
aclocaldir='${datadir}/aclocal'
|
||||||
lib/Makefile src/Makefile doc/Makefile
|
AC_SUBST([aclocaldir])
|
||||||
m4/Makefile])
|
|
||||||
|
# Initialize the test suite.
|
||||||
|
AC_CONFIG_TESTDIR(tests)
|
||||||
|
AC_CONFIG_FILES([tests/Makefile tests/atlocal])
|
||||||
|
AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
|
||||||
|
AC_CHECK_PROGS([VALGRIND], [valgrind])
|
||||||
|
AC_PROG_CXX
|
||||||
|
BISON_TEST_FOR_WORKING_CXX_COMPILER
|
||||||
|
AM_MISSING_PROG([AUTOM4TE], [autom4te])
|
||||||
|
# Needed by tests/atlocal.in.
|
||||||
|
AC_SUBST([GCC])
|
||||||
|
O0CFLAGS=`echo $CFLAGS | sed 's/-O[[0-9]] *//'`
|
||||||
|
AC_SUBST([O0CFLAGS])
|
||||||
|
O0CXXFLAGS=`echo $CXXFLAGS | sed 's/-O[[0-9]] *//'`
|
||||||
|
AC_SUBST([O0CXXFLAGS])
|
||||||
|
|
||||||
|
AC_CONFIG_FILES([Makefile
|
||||||
|
build-aux/Makefile
|
||||||
|
po/Makefile.in
|
||||||
|
data/Makefile
|
||||||
|
examples/Makefile
|
||||||
|
examples/calc++/Makefile
|
||||||
|
lib/Makefile src/Makefile doc/Makefile])
|
||||||
|
AC_OUTPUT
|
||||||
|
|||||||
+7
-5
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2002 Free Software Foundation, Inc.
|
## Copyright (C) 2002, 2005 Free Software Foundation, Inc.
|
||||||
|
|
||||||
## This program is free software; you can redistribute it and/or modify
|
## 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
|
## it under the terms of the GNU General Public License as published by
|
||||||
@@ -12,10 +12,12 @@
|
|||||||
|
|
||||||
## You should have received a copy of the GNU General Public License
|
## You should have received a copy of the GNU General Public License
|
||||||
## along with this program; if not, write to the Free Software
|
## along with this program; if not, write to the Free Software
|
||||||
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
## 02111-1307 USA
|
## 02110-1301 USA
|
||||||
|
|
||||||
dist_pkgdata_DATA = c.m4 yacc.c lalr1.cc glr.c
|
dist_pkgdata_DATA = README \
|
||||||
|
c.m4 yacc.c glr.c \
|
||||||
|
c++.m4 location.cc lalr1.cc glr.cc
|
||||||
|
|
||||||
m4sugardir = $(pkgdatadir)/m4sugar
|
m4sugardir = $(pkgdatadir)/m4sugar
|
||||||
dist_m4sugar_DATA = m4sugar/m4sugar.m4 m4sugar/version.m4
|
dist_m4sugar_DATA = m4sugar/m4sugar.m4
|
||||||
|
|||||||
+45
@@ -0,0 +1,45 @@
|
|||||||
|
-*- outline -*-
|
||||||
|
|
||||||
|
This directory contains Bison skeletons: the general shapes of the
|
||||||
|
different parser kinds, that are specialized for specific grammars by
|
||||||
|
the bison program.
|
||||||
|
|
||||||
|
Currently, there are only three supported skeletons:
|
||||||
|
|
||||||
|
- yacc.c
|
||||||
|
It used to be named bison.simple: it corresponds to C Yacc
|
||||||
|
compatible LALR(1) parsers.
|
||||||
|
|
||||||
|
- lalr1.cc
|
||||||
|
Produces a C++ parser class. It is still very experimental, and not
|
||||||
|
yet supported. Please, subscribe to [email protected].
|
||||||
|
|
||||||
|
- glr.c
|
||||||
|
A Generalized LR C parser based on Bison's LALR(1) tables.
|
||||||
|
|
||||||
|
These skeletons are the only ones supported by the Bison team.
|
||||||
|
Because the interface between skeletons and the bison program is not
|
||||||
|
finished, *we are not bound to it*. In particular, Bison is not
|
||||||
|
mature enough for us to consider that ``foreign skeletons'' are
|
||||||
|
supported.
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
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., 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02110-1301, USA.
|
||||||
+124
@@ -0,0 +1,124 @@
|
|||||||
|
m4_divert(-1) -*- Autoconf -*-
|
||||||
|
|
||||||
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
|
# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
# 02110-1301 USA
|
||||||
|
|
||||||
|
m4_include(b4_pkgdatadir/[c.m4])
|
||||||
|
|
||||||
|
## ---------------- ##
|
||||||
|
## Default values. ##
|
||||||
|
## ---------------- ##
|
||||||
|
|
||||||
|
# Default parser class name.
|
||||||
|
m4_define_default([b4_parser_class_name], [parser])
|
||||||
|
m4_define_default([b4_location_type], [location])
|
||||||
|
m4_define_default([b4_filename_type], [std::string])
|
||||||
|
m4_define_default([b4_namespace], m4_defn([b4_prefix]))
|
||||||
|
m4_define_default([b4_define_location_comparison],
|
||||||
|
m4_if(b4_filename_type, [std::string], [1], [0]))
|
||||||
|
|
||||||
|
|
||||||
|
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||||
|
# -----------------------------------------------------
|
||||||
|
# Output the definition of the tokens as enums.
|
||||||
|
m4_define([b4_token_enums],
|
||||||
|
[/* Tokens. */
|
||||||
|
enum yytokentype {
|
||||||
|
m4_map_sep([ b4_token_enum], [,
|
||||||
|
],
|
||||||
|
[$@])
|
||||||
|
};
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
## ----------------- ##
|
||||||
|
## Semantic Values. ##
|
||||||
|
## ----------------- ##
|
||||||
|
|
||||||
|
|
||||||
|
# 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],
|
||||||
|
[(yysemantic_stack_@{($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],
|
||||||
|
[(yylocation_stack_@{($1) - ($2)@})])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_parse_param_decl
|
||||||
|
# -------------------
|
||||||
|
# Extra formal arguments of the constructor.
|
||||||
|
# Change the parameter names from "foo" into "foo_yyarg", so that
|
||||||
|
# there is no collision bw the user chosen attribute name, and the
|
||||||
|
# argument name in the constructor.
|
||||||
|
m4_define([b4_parse_param_decl],
|
||||||
|
[m4_ifset([b4_parse_param],
|
||||||
|
[m4_map_sep([b4_parse_param_decl_1], [, ], [b4_parse_param])])])
|
||||||
|
|
||||||
|
m4_define([b4_parse_param_decl_1],
|
||||||
|
[$1_yyarg])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# b4_parse_param_cons
|
||||||
|
# -------------------
|
||||||
|
# Extra initialisations of the constructor.
|
||||||
|
m4_define([b4_parse_param_cons],
|
||||||
|
[m4_ifset([b4_parse_param],
|
||||||
|
[
|
||||||
|
b4_cc_constructor_calls(b4_parse_param)])])
|
||||||
|
m4_define([b4_cc_constructor_calls],
|
||||||
|
[m4_map_sep([b4_cc_constructor_call], [,
|
||||||
|
], [$@])])
|
||||||
|
m4_define([b4_cc_constructor_call],
|
||||||
|
[$2 ($2_yyarg)])
|
||||||
|
|
||||||
|
# b4_parse_param_vars
|
||||||
|
# -------------------
|
||||||
|
# Extra instance variables.
|
||||||
|
m4_define([b4_parse_param_vars],
|
||||||
|
[m4_ifset([b4_parse_param],
|
||||||
|
[
|
||||||
|
/* User arguments. */
|
||||||
|
b4_cc_var_decls(b4_parse_param)])])
|
||||||
|
m4_define([b4_cc_var_decls],
|
||||||
|
[m4_map_sep([b4_cc_var_decl], [
|
||||||
|
], [$@])])
|
||||||
|
m4_define([b4_cc_var_decl],
|
||||||
|
[ $1;])
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
m4_divert(-1) -*- C -*-
|
m4_divert(-1) -*- Autoconf -*-
|
||||||
|
|
||||||
# C M4 Macros for Bison.
|
# C M4 Macros for Bison.
|
||||||
# Copyright (C) 2002 Free Software Foundation, Inc.
|
# Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -15,21 +15,22 @@ m4_divert(-1) -*- C -*-
|
|||||||
|
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
# 02111-1307 USA
|
# 02110-1301 USA
|
||||||
|
|
||||||
|
|
||||||
## ----------- ##
|
## ---------------- ##
|
||||||
## Copuright. ##
|
## Identification. ##
|
||||||
## ----------- ##
|
## ---------------- ##
|
||||||
|
|
||||||
# b4_copyright(TITLE, YEARS)
|
# b4_copyright(TITLE, YEARS)
|
||||||
# --------------------------
|
# --------------------------
|
||||||
m4_define([b4_copyright],
|
m4_define([b4_copyright],
|
||||||
[/* A Bison parser, made from b4_filename, by GNU bison b4_version. */
|
[/* A Bison parser, made by GNU Bison b4_version. */
|
||||||
|
|
||||||
/* $1,
|
/* $1
|
||||||
Copyright (C) $2 Free Software Foundation, Inc.
|
|
||||||
|
m4_text_wrap([Copyright (C) $2 Free Software Foundation, Inc.], [ ])
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -43,15 +44,102 @@ m4_define([b4_copyright],
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
Boston, MA 02111-1307, USA. */])
|
Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
|
/* As a special exception, you may create a larger work that contains
|
||||||
|
part or all of the Bison parser skeleton and distribute that work
|
||||||
|
under terms of your choice, so long as that work isn't itself a
|
||||||
|
parser generator using the skeleton or a modified version thereof
|
||||||
|
as a parser skeleton. Alternatively, if you modify or redistribute
|
||||||
|
the parser skeleton itself, you may (at your option) remove this
|
||||||
|
special exception, which will cause the skeleton and the resulting
|
||||||
|
Bison output files to be licensed under the GNU General Public
|
||||||
|
License without this special exception.
|
||||||
|
|
||||||
|
This special exception was added by the Free Software Foundation in
|
||||||
|
version 2.2 of Bison. */])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_identification
|
||||||
|
# -----------------
|
||||||
|
m4_define([b4_identification],
|
||||||
|
[/* Identify Bison output. */
|
||||||
|
[#]define YYBISON 1
|
||||||
|
|
||||||
|
/* Bison version. */
|
||||||
|
[#]define YYBISON_VERSION "b4_version"
|
||||||
|
|
||||||
|
/* Skeleton name. */
|
||||||
|
[#]define YYSKELETON_NAME b4_skeleton
|
||||||
|
|
||||||
|
/* Pure parsers. */
|
||||||
|
[#]define YYPURE b4_pure_flag
|
||||||
|
|
||||||
|
/* Using locations. */
|
||||||
|
[#]define YYLSP_NEEDED b4_locations_flag
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
## ---------------- ##
|
||||||
|
## Default values. ##
|
||||||
|
## ---------------- ##
|
||||||
|
|
||||||
|
m4_define_default([b4_epilogue], [])
|
||||||
|
|
||||||
|
# If the %union is not named, its name is YYSTYPE.
|
||||||
|
m4_define_default([b4_union_name], [YYSTYPE])
|
||||||
|
|
||||||
|
# The initial column and line.
|
||||||
|
m4_define_default([b4_location_initial_column], [1])
|
||||||
|
m4_define_default([b4_location_initial_line], [1])
|
||||||
|
|
||||||
|
|
||||||
|
## ------------------------ ##
|
||||||
|
## Pure/impure interfaces. ##
|
||||||
|
## ------------------------ ##
|
||||||
|
|
||||||
|
# b4_user_args
|
||||||
|
# ------------
|
||||||
|
m4_define([b4_user_args],
|
||||||
|
[m4_ifset([b4_parse_param], [, b4_c_args(b4_parse_param)])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_parse_param
|
||||||
|
# --------------
|
||||||
|
# If defined, b4_parse_param arrives double quoted, but below we prefer
|
||||||
|
# it to be single quoted.
|
||||||
|
m4_define_default([b4_parse_param])
|
||||||
|
m4_define([b4_parse_param],
|
||||||
|
b4_parse_param))
|
||||||
|
|
||||||
|
|
||||||
|
# b4_parse_param_for(DECL, FORMAL, BODY)
|
||||||
|
# ---------------------------------------
|
||||||
|
# Iterate over the user parameters, binding the declaration to DECL,
|
||||||
|
# the formal name to FORMAL, and evaluating the BODY.
|
||||||
|
m4_define([b4_parse_param_for],
|
||||||
|
[m4_foreach([$1_$2], m4_defn([b4_parse_param]),
|
||||||
|
[m4_pushdef([$1], m4_fst($1_$2))dnl
|
||||||
|
m4_pushdef([$2], m4_shift($1_$2))dnl
|
||||||
|
$3[]dnl
|
||||||
|
m4_popdef([$2])dnl
|
||||||
|
m4_popdef([$1])dnl
|
||||||
|
])])
|
||||||
|
|
||||||
|
# b4_parse_param_use
|
||||||
|
# ------------------
|
||||||
|
# `YYUSE' all the parse-params.
|
||||||
|
m4_define([b4_parse_param_use],
|
||||||
|
[b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal);
|
||||||
|
])dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
## Data Types. ##
|
## Data Types. ##
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
|
|
||||||
|
|
||||||
# b4_ints_in(INT1, INT2, LOW, HIGH)
|
# b4_ints_in(INT1, INT2, LOW, HIGH)
|
||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
# Return 1 iff both INT1 and INT2 are in [LOW, HIGH], 0 otherwise.
|
# Return 1 iff both INT1 and INT2 are in [LOW, HIGH], 0 otherwise.
|
||||||
@@ -65,14 +153,15 @@ m4_define([b4_ints_in],
|
|||||||
# MIN to MAX (included).
|
# MIN to MAX (included).
|
||||||
m4_define([b4_int_type],
|
m4_define([b4_int_type],
|
||||||
[m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
|
[m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
|
||||||
b4_ints_in($@, [-128], [128]), [1], [signed char],
|
b4_ints_in($@, [-128], [127]), [1], [signed char],
|
||||||
|
|
||||||
b4_ints_in($@, [0], [65535]), [1], [unsigned short],
|
b4_ints_in($@, [0], [65535]), [1], [unsigned short int],
|
||||||
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
b4_ints_in($@, [-32768], [32767]), [1], [short int],
|
||||||
|
|
||||||
m4_eval([0 <= $1]), [1], [unsigned int],
|
m4_eval([0 <= $1]), [1], [unsigned int],
|
||||||
|
|
||||||
[int])])
|
[int])])
|
||||||
|
|
||||||
|
|
||||||
# b4_int_type_for(NAME)
|
# b4_int_type_for(NAME)
|
||||||
# ---------------------
|
# ---------------------
|
||||||
@@ -82,6 +171,61 @@ m4_define([b4_int_type_for],
|
|||||||
[b4_int_type($1_min, $1_max)])
|
[b4_int_type($1_min, $1_max)])
|
||||||
|
|
||||||
|
|
||||||
|
## ---------##
|
||||||
|
## Values. ##
|
||||||
|
## ---------##
|
||||||
|
|
||||||
|
# b4_null
|
||||||
|
---------
|
||||||
|
# Return a null pointer constant. NULL infringes on the user name
|
||||||
|
# space in C, so use 0 rather than NULL.
|
||||||
|
m4_define([b4_null], [0])
|
||||||
|
|
||||||
|
|
||||||
|
## ------------------ ##
|
||||||
|
## Decoding options. ##
|
||||||
|
## ------------------ ##
|
||||||
|
|
||||||
|
# b4_flag_if(FLAG, IF-TRUE, IF-FALSE)
|
||||||
|
# -----------------------------------
|
||||||
|
# Run IF-TRUE if b4_FLAG_flag is 1, IF-FALSE if FLAG is 0, otherwise fail.
|
||||||
|
m4_define([b4_flag_if],
|
||||||
|
[m4_case(b4_$1_flag,
|
||||||
|
[0], [$3],
|
||||||
|
[1], [$2],
|
||||||
|
[m4_fatal([invalid $1 value: ]$1)])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_define_flag_if(FLAG)
|
||||||
|
# -----------------------
|
||||||
|
# Define "b4_FLAG_if(IF-TRUE, IF-FALSE)" that depends on the
|
||||||
|
# value of the Boolean FLAG.
|
||||||
|
m4_define([b4_define_flag_if],
|
||||||
|
[_b4_define_flag_if($[1], $[2], [$1])])
|
||||||
|
|
||||||
|
# _b4_define_flag_if($1, $2, FLAG)
|
||||||
|
# --------------------------------
|
||||||
|
# This macro works around the impossibility to define macros
|
||||||
|
# inside macros, because issuing `[$1]' is not possible in M4 :(.
|
||||||
|
# This sucks hard, GNU M4 should really provide M5 like $$1.
|
||||||
|
m4_define([_b4_define_flag_if],
|
||||||
|
[m4_if([$1$2], $[1]$[2], [],
|
||||||
|
[m4_fatal([$0: Invalid arguments: $@])])dnl
|
||||||
|
m4_define([b4_$3_if],
|
||||||
|
[b4_flag_if([$3], [$1], [$2])])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_FLAG_if(IF-TRUE, IF-FALSE)
|
||||||
|
# -----------------------------
|
||||||
|
# Expand IF-TRUE, if FLAG is true, IF-FALSE otherwise.
|
||||||
|
b4_define_flag_if([defines]) # Whether headers are requested.
|
||||||
|
b4_define_flag_if([error_verbose]) # Whether error are verbose.
|
||||||
|
b4_define_flag_if([locations]) # Whether locations are tracked.
|
||||||
|
b4_define_flag_if([pure]) # Whether the interface is pure.
|
||||||
|
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ------------------------- ##
|
## ------------------------- ##
|
||||||
## Assigning token numbers. ##
|
## Assigning token numbers. ##
|
||||||
## ------------------------- ##
|
## ------------------------- ##
|
||||||
@@ -94,6 +238,16 @@ m4_define([b4_token_define],
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_token_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||||
|
# -------------------------------------------------------
|
||||||
|
# Output the definition of the tokens (if there are) as #defines.
|
||||||
|
m4_define([b4_token_defines],
|
||||||
|
[m4_if([$@], [[]], [],
|
||||||
|
[/* Tokens. */
|
||||||
|
m4_map([b4_token_define], [$@])])
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
|
# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
|
||||||
# ---------------------------------------
|
# ---------------------------------------
|
||||||
# Output the definition of this token as an enum.
|
# Output the definition of this token as an enum.
|
||||||
@@ -101,77 +255,343 @@ m4_define([b4_token_enum],
|
|||||||
[$1 = $2])
|
[$1 = $2])
|
||||||
|
|
||||||
|
|
||||||
# b4_token_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||||
# -------------------------------------------------------
|
# -----------------------------------------------------
|
||||||
# Output the definition of the tokens (if there are) as enums and #define.
|
# Output the definition of the tokens (if there are) as enums.
|
||||||
m4_define([b4_token_defines],
|
m4_define([b4_token_enums],
|
||||||
[m4_if([$@], [[]], [],
|
[m4_if([$@], [[]], [],
|
||||||
[/* Tokens. */
|
[/* Tokens. */
|
||||||
#ifndef YYTOKENTYPE
|
#ifndef YYTOKENTYPE
|
||||||
# if defined (__STDC__) || defined (__cplusplus)
|
# define YYTOKENTYPE
|
||||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||||
know about them. */
|
know about them. */
|
||||||
enum yytokentype {
|
enum yytokentype {
|
||||||
m4_map_sep([ b4_token_enum], [,
|
m4_map_sep([ b4_token_enum], [,
|
||||||
],
|
],
|
||||||
[$@])
|
[$@])
|
||||||
};
|
};
|
||||||
# endif
|
#endif
|
||||||
/* POSIX requires `int' for tokens in interfaces. */
|
])])
|
||||||
# define YYTOKENTYPE int
|
|
||||||
#endif /* !YYTOKENTYPE */
|
|
||||||
m4_map([b4_token_define], [$@])
|
# b4_token_enums_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||||
])
|
# -------------------------------------------------------------
|
||||||
|
# Output the definition of the tokens (if there are any) as enums and, if POSIX
|
||||||
|
# Yacc is enabled, as #defines.
|
||||||
|
m4_define([b4_token_enums_defines],
|
||||||
|
[b4_token_enums($@)b4_yacc_if([b4_token_defines($@)], [])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
## ---------------------------------------------- ##
|
|
||||||
## Declaring C functions in both K&R and ANSI-C. ##
|
## --------------------------------------------- ##
|
||||||
## ---------------------------------------------- ##
|
## Defining C functions in both K&R and ANSI-C. ##
|
||||||
|
## --------------------------------------------- ##
|
||||||
|
|
||||||
|
|
||||||
# b4_c_function(NAME, RETURN-VALUE, [TYPE1, NAME1], ...)
|
# b4_modern_c
|
||||||
# ------------------------------------------------
|
# -----------
|
||||||
|
# A predicate useful in #if to determine whether C is ancient or modern.
|
||||||
|
#
|
||||||
|
# If __STDC__ is defined, the compiler is modern. IBM xlc 7.0 when run
|
||||||
|
# as 'cc' doesn't define __STDC__ (or __STDC_VERSION__) for pedantic
|
||||||
|
# reasons, but it defines __C99__FUNC__ so check that as well.
|
||||||
|
# Microsoft C normally doesn't define these macros, but it defines _MSC_VER.
|
||||||
|
# Consider a C++ compiler to be modern if it defines __cplusplus.
|
||||||
|
#
|
||||||
|
m4_define([b4_c_modern],
|
||||||
|
[[(defined __STDC__ || defined __C99__FUNC__ \
|
||||||
|
|| defined __cplusplus || defined _MSC_VER)]])
|
||||||
|
|
||||||
|
# b4_c_function_def(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
||||||
|
# ----------------------------------------------------------
|
||||||
# Declare the function NAME.
|
# Declare the function NAME.
|
||||||
m4_define([b4_c_function],
|
m4_define([b4_c_function_def],
|
||||||
[$2
|
[#if b4_c_modern
|
||||||
#if defined (__STDC__) || defined (__cplusplus)
|
b4_c_ansi_function_def($@)
|
||||||
$1 (b4_c_ansi_args(m4_shiftn(2, $@)))
|
|
||||||
#else
|
#else
|
||||||
$1 (b4_c_knr_arg_names(m4_shiftn(2, $@)))
|
$2
|
||||||
b4_c_knr_arg_decls(m4_shiftn(2, $@))
|
$1 (b4_c_knr_formal_names(m4_shiftn(2, $@)))
|
||||||
|
b4_c_knr_formal_decls(m4_shiftn(2, $@))
|
||||||
#endif[]dnl
|
#endif[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_c_ansi_args([TYPE1, NAME1], ...)
|
# b4_c_ansi_function_def(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
||||||
# -----------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
# Declare the function NAME in ANSI.
|
||||||
|
m4_define([b4_c_ansi_function_def],
|
||||||
|
[$2
|
||||||
|
$1 (b4_c_ansi_formals(m4_shiftn(2, $@)))[]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_c_ansi_formals([DECL1, NAME1], ...)
|
||||||
|
# --------------------------------------
|
||||||
# Output the arguments ANSI-C definition.
|
# Output the arguments ANSI-C definition.
|
||||||
m4_define([b4_c_ansi_args],
|
m4_define([b4_c_ansi_formals],
|
||||||
[m4_map_sep([b4_c_ansi_arg], [, ], [$@])])
|
[m4_case([$@],
|
||||||
|
[], [void],
|
||||||
|
[[]], [void],
|
||||||
|
[m4_map_sep([b4_c_ansi_formal], [, ], [$@])])])
|
||||||
|
|
||||||
m4_define([b4_c_ansi_arg],
|
m4_define([b4_c_ansi_formal],
|
||||||
[$1 $2])
|
[$1])
|
||||||
|
|
||||||
|
|
||||||
# b4_c_knr_args([TYPE1, NAME1], ...)
|
# b4_c_knr_formal_names([DECL1, NAME1], ...)
|
||||||
# ----------------------------------
|
# ------------------------------------------
|
||||||
# Output the argument names.
|
# Output the argument names.
|
||||||
m4_define([b4_c_knr_arg_names],
|
m4_define([b4_c_knr_formal_names],
|
||||||
[m4_map_sep([b4_c_knr_arg_name], [, ], [$@])])
|
[m4_map_sep([b4_c_knr_formal_name], [, ], [$@])])
|
||||||
|
|
||||||
m4_define([b4_c_knr_arg_name],
|
m4_define([b4_c_knr_formal_name],
|
||||||
[$2])
|
[$2])
|
||||||
|
|
||||||
|
|
||||||
# b4_c_knr_args([TYPE1, NAME1], ...)
|
# b4_c_knr_formal_decls([DECL1, NAME1], ...)
|
||||||
# ----------------------------------
|
# ------------------------------------------
|
||||||
# Output the K&R argument declarations.
|
# Output the K&R argument declarations.
|
||||||
m4_define([b4_c_knr_arg_decls],
|
m4_define([b4_c_knr_formal_decls],
|
||||||
[m4_map_sep([b4_c_knr_arg_decl],
|
[m4_map_sep([b4_c_knr_formal_decl],
|
||||||
[
|
[
|
||||||
],
|
],
|
||||||
[$@])])
|
[$@])])
|
||||||
|
|
||||||
m4_define([b4_c_knr_arg_decl],
|
m4_define([b4_c_knr_formal_decl],
|
||||||
[ $1 $2;])
|
[ $1;])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## ------------------------------------------------------------ ##
|
||||||
|
## Declaring (prototyping) C functions in both K&R and ANSI-C. ##
|
||||||
|
## ------------------------------------------------------------ ##
|
||||||
|
|
||||||
|
|
||||||
|
# b4_c_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
||||||
|
# -----------------------------------------------------------
|
||||||
|
# Declare the function NAME.
|
||||||
|
m4_define([b4_c_function_decl],
|
||||||
|
[#if defined __STDC__ || defined __cplusplus
|
||||||
|
b4_c_ansi_function_decl($@)
|
||||||
|
#else
|
||||||
|
$2 $1 ();
|
||||||
|
#endif[]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_c_ansi_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
||||||
|
# ----------------------------------------------------------------
|
||||||
|
# Declare the function NAME.
|
||||||
|
m4_define([b4_c_ansi_function_decl],
|
||||||
|
[$2 $1 (b4_c_ansi_formals(m4_shiftn(2, $@)));[]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## --------------------- ##
|
||||||
|
## Calling C functions. ##
|
||||||
|
## --------------------- ##
|
||||||
|
|
||||||
|
|
||||||
|
# b4_c_function_call(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
||||||
|
# -----------------------------------------------------------
|
||||||
|
# Call the function NAME with arguments NAME1, NAME2 etc.
|
||||||
|
m4_define([b4_c_function_call],
|
||||||
|
[$1 (b4_c_args(m4_shiftn(2, $@)))[]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_c_args([DECL1, NAME1], ...)
|
||||||
|
# ------------------------------
|
||||||
|
# Output the arguments NAME1, NAME2...
|
||||||
|
m4_define([b4_c_args],
|
||||||
|
[m4_map_sep([b4_c_arg], [, ], [$@])])
|
||||||
|
|
||||||
|
m4_define([b4_c_arg],
|
||||||
|
[$2])
|
||||||
|
|
||||||
|
|
||||||
|
## ----------- ##
|
||||||
|
## Synclines. ##
|
||||||
|
## ----------- ##
|
||||||
|
|
||||||
|
# b4_basename(NAME)
|
||||||
|
# -----------------
|
||||||
|
# Similar to POSIX basename; the differences don't matter here.
|
||||||
|
# Beware that NAME is not evaluated.
|
||||||
|
m4_define([b4_basename],
|
||||||
|
[m4_bpatsubst([$1], [^.*/\([^/]+\)/*$], [\1])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_syncline(LINE, FILE)
|
||||||
|
# -----------------------
|
||||||
|
m4_define([b4_syncline],
|
||||||
|
[b4_flag_if([synclines],
|
||||||
|
[/* Line __line__ of b4_basename(m4_quote(__file__)). */
|
||||||
|
[#]line $1 $2])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_user_code(USER-CODE)
|
||||||
|
# -----------------------
|
||||||
|
# Emit code from the user, ending it with synclines.
|
||||||
|
m4_define([b4_user_code],
|
||||||
|
[$1
|
||||||
|
b4_syncline([@oline@], [@ofile@])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_define_user_code(MACRO)
|
||||||
|
# --------------------------
|
||||||
|
# From b4_MACRO, build b4_user_MACRO that includes the synclines.
|
||||||
|
m4_define([b4_define_user_code],
|
||||||
|
[m4_define([b4_user_$1],
|
||||||
|
[b4_user_code([b4_$1])])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_user_actions
|
||||||
|
# b4_user_initial_action
|
||||||
|
# b4_user_post_prologue
|
||||||
|
# b4_user_start_header
|
||||||
|
# b4_user_stype
|
||||||
|
# ----------------------
|
||||||
|
# Macros that issue user code, ending with synclines.
|
||||||
|
b4_define_user_code([actions])
|
||||||
|
b4_define_user_code([initial_action])
|
||||||
|
b4_define_user_code([post_prologue])
|
||||||
|
b4_define_user_code([start_header])
|
||||||
|
b4_define_user_code([stype])
|
||||||
|
|
||||||
|
|
||||||
|
## -------------- ##
|
||||||
|
## User actions. ##
|
||||||
|
## -------------- ##
|
||||||
|
|
||||||
|
# b4_case(LABEL, STATEMENTS)
|
||||||
|
# --------------------------
|
||||||
|
m4_define([b4_case],
|
||||||
|
[ case $1:
|
||||||
|
$2
|
||||||
|
break;])
|
||||||
|
|
||||||
|
# b4_symbol_actions(FILENAME, LINENO,
|
||||||
|
# SYMBOL-TAG, SYMBOL-NUM,
|
||||||
|
# SYMBOL-ACTION, SYMBOL-TYPENAME)
|
||||||
|
# -------------------------------------------------
|
||||||
|
m4_define([b4_symbol_actions],
|
||||||
|
[m4_pushdef([b4_dollar_dollar],
|
||||||
|
[m4_ifval([$6], [(yyvaluep->$6)], [(*yyvaluep)])])dnl
|
||||||
|
m4_pushdef([b4_at_dollar], [(*yylocationp)])dnl
|
||||||
|
case $4: /* $3 */
|
||||||
|
b4_syncline([$2], [$1])
|
||||||
|
$5;
|
||||||
|
b4_syncline([@oline@], [@ofile@])
|
||||||
|
break;
|
||||||
|
m4_popdef([b4_at_dollar])dnl
|
||||||
|
m4_popdef([b4_dollar_dollar])dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_yydestruct_generate(FUNCTION-DECLARATOR)
|
||||||
|
# -------------------------------------------
|
||||||
|
# Generate the "yydestruct" function, which declaration is issued using
|
||||||
|
# FUNCTION-DECLARATOR, which may be "b4_c_ansi_function_def" for ISO C
|
||||||
|
# or "b4_c_function_def" for K&R.
|
||||||
|
m4_define_default([b4_yydestruct_generate],
|
||||||
|
[[/*-----------------------------------------------.
|
||||||
|
| Release the memory associated to this symbol. |
|
||||||
|
`-----------------------------------------------*/
|
||||||
|
|
||||||
|
/*ARGSUSED*/
|
||||||
|
]$1([yydestruct],
|
||||||
|
[static void],
|
||||||
|
[[const char *yymsg], [yymsg]],
|
||||||
|
[[int yytype], [yytype]],
|
||||||
|
[[YYSTYPE *yyvaluep], [yyvaluep]][]dnl
|
||||||
|
b4_locations_if( [, [[YYLTYPE *yylocationp], [yylocationp]]])[]dnl
|
||||||
|
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
||||||
|
{
|
||||||
|
YYUSE (yyvaluep);
|
||||||
|
]b4_locations_if([ YYUSE (yylocationp);
|
||||||
|
])dnl
|
||||||
|
b4_parse_param_use[]dnl
|
||||||
|
[
|
||||||
|
if (!yymsg)
|
||||||
|
yymsg = "Deleting";
|
||||||
|
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
|
||||||
|
|
||||||
|
switch (yytype)
|
||||||
|
{
|
||||||
|
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_destructors]))[
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_yy_symbol_print_generate(FUNCTION-DECLARATOR)
|
||||||
|
# ------------------------------------------------
|
||||||
|
# Generate the "yy_symbol_print" function, which declaration is issued using
|
||||||
|
# FUNCTION-DECLARATOR, which may be "b4_c_ansi_function_def" for ISO C
|
||||||
|
# or "b4_c_function_def" for K&R.
|
||||||
|
m4_define_default([b4_yy_symbol_print_generate],
|
||||||
|
[[
|
||||||
|
/*--------------------------------.
|
||||||
|
| Print this symbol on YYOUTPUT. |
|
||||||
|
`--------------------------------*/
|
||||||
|
|
||||||
|
/*ARGSUSED*/
|
||||||
|
]$1([yy_symbol_value_print],
|
||||||
|
[static void],
|
||||||
|
[[FILE *yyoutput], [yyoutput]],
|
||||||
|
[[int yytype], [yytype]],
|
||||||
|
[[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
|
||||||
|
b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
|
||||||
|
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
||||||
|
{
|
||||||
|
if (!yyvaluep)
|
||||||
|
return;
|
||||||
|
]b4_locations_if([ YYUSE (yylocationp);
|
||||||
|
])dnl
|
||||||
|
b4_parse_param_use[]dnl
|
||||||
|
[# ifdef YYPRINT
|
||||||
|
if (yytype < YYNTOKENS)
|
||||||
|
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
|
||||||
|
# else
|
||||||
|
YYUSE (yyoutput);
|
||||||
|
# endif
|
||||||
|
switch (yytype)
|
||||||
|
{
|
||||||
|
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
|
||||||
|
[ default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*--------------------------------.
|
||||||
|
| Print this symbol on YYOUTPUT. |
|
||||||
|
`--------------------------------*/
|
||||||
|
|
||||||
|
]$1([yy_symbol_print],
|
||||||
|
[static void],
|
||||||
|
[[FILE *yyoutput], [yyoutput]],
|
||||||
|
[[int yytype], [yytype]],
|
||||||
|
[[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
|
||||||
|
b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
|
||||||
|
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
||||||
|
{
|
||||||
|
if (yytype < YYNTOKENS)
|
||||||
|
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
|
||||||
|
else
|
||||||
|
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
|
||||||
|
|
||||||
|
]b4_locations_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp);
|
||||||
|
YYFPRINTF (yyoutput, ": ");
|
||||||
|
])dnl
|
||||||
|
[ yy_symbol_value_print (yyoutput, yytype, yyvaluep]dnl
|
||||||
|
b4_locations_if([, yylocationp])[]b4_user_args[);
|
||||||
|
YYFPRINTF (yyoutput, ")");
|
||||||
|
}]dnl
|
||||||
|
])
|
||||||
|
|||||||
+1625
-878
File diff suppressed because it is too large
Load Diff
+380
@@ -0,0 +1,380 @@
|
|||||||
|
m4_divert(-1) -*- C -*-
|
||||||
|
|
||||||
|
# C++ GLR skeleton for Bison
|
||||||
|
# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
# 02110-1301 USA
|
||||||
|
|
||||||
|
|
||||||
|
# This skeleton produces a C++ class that encapsulates a C glr parser.
|
||||||
|
# This is in order to reduce the maintenance burden. The glr.c
|
||||||
|
# skeleton is clean and pure enough so that there are no real
|
||||||
|
# problems. The C++ interface is the same as that of lalr1.cc. In
|
||||||
|
# fact, glr.c can replace yacc.c without the user noticing any
|
||||||
|
# difference, and similarly for glr.cc replacing lalr1.cc.
|
||||||
|
#
|
||||||
|
# The passing of parse-params
|
||||||
|
#
|
||||||
|
# The additional arguments are stored as members of the parser
|
||||||
|
# object, yyparser. The C routines need to carry yyparser
|
||||||
|
# throughout the C parser; that easy: just let yyparser become an
|
||||||
|
# additional parse-param. But because the C++ skeleton needs to
|
||||||
|
# know the "real" original parse-param, we save them
|
||||||
|
# (b4_parse_param_orig). Note that b4_parse_param is overquoted
|
||||||
|
# (and c.m4 strips one level of quotes). This is a PITA, and
|
||||||
|
# explains why there are so many levels of quotes.
|
||||||
|
#
|
||||||
|
# The locations
|
||||||
|
#
|
||||||
|
# We use location.cc just like lalr1.cc, but because glr.c stores
|
||||||
|
# the locations in a (C++) union, the position and location classes
|
||||||
|
# must not have a constructor. Therefore, contrary to lalr1.cc, we
|
||||||
|
# must not define "b4_location_constructors". As a consequence the
|
||||||
|
# user must initialize the first positions (in particular the
|
||||||
|
# filename member).
|
||||||
|
|
||||||
|
# We require a pure interface using locations.
|
||||||
|
m4_define([b4_locations_flag], [1])
|
||||||
|
m4_define([b4_pure_flag], [1])
|
||||||
|
|
||||||
|
# The header is mandatory.
|
||||||
|
b4_defines_if([],
|
||||||
|
[m4_fatal(b4_skeleton[: using %defines is mandatory])])
|
||||||
|
|
||||||
|
m4_include(b4_pkgdatadir/[c++.m4])
|
||||||
|
m4_include(b4_pkgdatadir/[location.cc])
|
||||||
|
|
||||||
|
|
||||||
|
# Save the parse parameters.
|
||||||
|
m4_define([b4_parse_param_orig], m4_defn([b4_parse_param]))
|
||||||
|
|
||||||
|
|
||||||
|
# b4_yy_symbol_print_generate
|
||||||
|
# ---------------------------
|
||||||
|
# Bypass the default implementation to generate the "yy_symbol_print"
|
||||||
|
# and "yy_symbol_value_print" functions.
|
||||||
|
m4_define([b4_yy_symbol_print_generate],
|
||||||
|
[[
|
||||||
|
/*--------------------.
|
||||||
|
| Print this symbol. |
|
||||||
|
`--------------------*/
|
||||||
|
|
||||||
|
]b4_c_ansi_function_def([yy_symbol_print],
|
||||||
|
[static void],
|
||||||
|
[[FILE *], []],
|
||||||
|
[[int yytype], [yytype]],
|
||||||
|
[[const b4_namespace::b4_parser_class_name::semantic_type *yyvaluep],
|
||||||
|
[yyvaluep]],
|
||||||
|
[[const b4_namespace::b4_parser_class_name::location_type *yylocationp],
|
||||||
|
[yylocationp]],
|
||||||
|
b4_parse_param)[
|
||||||
|
{
|
||||||
|
]b4_parse_param_use[]dnl
|
||||||
|
[ yyparser.yy_symbol_print_ (yytype, yyvaluep]b4_locations_if([, yylocationp])[);
|
||||||
|
}
|
||||||
|
]])
|
||||||
|
|
||||||
|
|
||||||
|
# Declare yyerror.
|
||||||
|
m4_append([b4_post_prologue],
|
||||||
|
[b4_syncline([@oline@], [@ofile@])
|
||||||
|
|
||||||
|
b4_c_ansi_function_decl([yyerror],
|
||||||
|
[static void],
|
||||||
|
[[b4_namespace::b4_parser_class_name::location_type *yylocationp], [yylocationp]],
|
||||||
|
b4_parse_param,
|
||||||
|
[[const char* msg], [msg]])])
|
||||||
|
|
||||||
|
|
||||||
|
# Define yyerror.
|
||||||
|
m4_append([b4_epilogue],
|
||||||
|
[b4_syncline([@oline@], [@ofile@])[
|
||||||
|
/*------------------.
|
||||||
|
| Report an error. |
|
||||||
|
`------------------*/
|
||||||
|
|
||||||
|
]b4_c_ansi_function_def([yyerror],
|
||||||
|
[static void],
|
||||||
|
[[b4_namespace::b4_parser_class_name::location_type *yylocationp], [yylocationp]],
|
||||||
|
b4_parse_param,
|
||||||
|
[[const char* msg], [msg]])[
|
||||||
|
{
|
||||||
|
]b4_parse_param_use[]dnl
|
||||||
|
[ yyparser.error (*yylocationp, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace ]b4_namespace[
|
||||||
|
{
|
||||||
|
]dnl In this section, the parse param are the original parse_params.
|
||||||
|
m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
||||||
|
[ /// Build a parser object.
|
||||||
|
]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
|
||||||
|
:])[
|
||||||
|
#if YYDEBUG
|
||||||
|
]m4_ifset([b4_parse_param], [ ], [ :])[yydebug_ (false),
|
||||||
|
yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
|
||||||
|
#endif]b4_parse_param_cons[
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
]b4_parser_class_name::~b4_parser_class_name[ ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
]b4_parser_class_name[::parse ()
|
||||||
|
{
|
||||||
|
return ::yyparse (*this]b4_user_args[);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if YYDEBUG
|
||||||
|
/*--------------------.
|
||||||
|
| Print this symbol. |
|
||||||
|
`--------------------*/
|
||||||
|
|
||||||
|
inline void
|
||||||
|
]b4_parser_class_name[::yy_symbol_value_print_ (int yytype,
|
||||||
|
const semantic_type* yyvaluep, const location_type* yylocationp)
|
||||||
|
{
|
||||||
|
/* Pacify ``unused variable'' warnings. */
|
||||||
|
YYUSE (yyvaluep);
|
||||||
|
YYUSE (yylocationp);
|
||||||
|
switch (yytype)
|
||||||
|
{
|
||||||
|
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
|
||||||
|
[ default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
]b4_parser_class_name[::yy_symbol_print_ (int yytype,
|
||||||
|
const semantic_type* yyvaluep, const location_type* yylocationp)
|
||||||
|
{
|
||||||
|
*yycdebug_ << (yytype < YYNTOKENS ? "token" : "nterm")
|
||||||
|
<< ' ' << yytname[yytype] << " ("
|
||||||
|
<< *yylocationp << ": ";
|
||||||
|
yy_symbol_value_print_ (yytype, yyvaluep, yylocationp);
|
||||||
|
*yycdebug_ << ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ostream&
|
||||||
|
]b4_parser_class_name[::debug_stream () const
|
||||||
|
{
|
||||||
|
return *yycdebug_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
]b4_parser_class_name[::set_debug_stream (std::ostream& o)
|
||||||
|
{
|
||||||
|
yycdebug_ = &o;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
]b4_parser_class_name[::debug_level_type
|
||||||
|
]b4_parser_class_name[::debug_level () const
|
||||||
|
{
|
||||||
|
return yydebug_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
]b4_parser_class_name[::set_debug_level (debug_level_type l)
|
||||||
|
{
|
||||||
|
yydebug_ = l;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
]m4_popdef([b4_parse_param])dnl
|
||||||
|
[} // namespace ]b4_namespace[
|
||||||
|
|
||||||
|
]])
|
||||||
|
|
||||||
|
|
||||||
|
# Let glr.c believe that the user arguments include the parser itself.
|
||||||
|
m4_ifset([b4_parse_param],
|
||||||
|
[m4_pushdef([b4_parse_param],
|
||||||
|
m4_dquote([[[b4_namespace::b4_parser_class_name& yyparser], [[yyparser]]],]
|
||||||
|
m4_defn([b4_parse_param])))],
|
||||||
|
[m4_pushdef([b4_parse_param],
|
||||||
|
[[[[b4_namespace::b4_parser_class_name& yyparser], [[yyparser]]]]])
|
||||||
|
])
|
||||||
|
m4_include(b4_pkgdatadir/[glr.c])
|
||||||
|
m4_popdef([b4_parse_param])
|
||||||
|
|
||||||
|
@output @output_header_name@
|
||||||
|
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
||||||
|
[2002, 2003, 2004, 2005, 2006])[
|
||||||
|
|
||||||
|
/* C++ GLR parser skeleton written by Akim Demaille. */
|
||||||
|
|
||||||
|
#ifndef PARSER_HEADER_H
|
||||||
|
# define PARSER_HEADER_H
|
||||||
|
|
||||||
|
]m4_ifdef([b4_start_header],
|
||||||
|
[[/* Copy the %start-header blocks. */
|
||||||
|
]b4_user_start_header])[
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
/* Using locations. */
|
||||||
|
#define YYLSP_NEEDED ]b4_locations_flag[
|
||||||
|
|
||||||
|
namespace ]b4_namespace[
|
||||||
|
{
|
||||||
|
class position;
|
||||||
|
class location;
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "location.hh"
|
||||||
|
|
||||||
|
/* Enabling traces. */
|
||||||
|
#ifndef YYDEBUG
|
||||||
|
# define YYDEBUG ]b4_debug_flag[
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
|
||||||
|
If N is 0, then set CURRENT to the empty location which ends
|
||||||
|
the previous symbol: RHS[0] (always defined). */
|
||||||
|
|
||||||
|
#ifndef YYLLOC_DEFAULT
|
||||||
|
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||||
|
do \
|
||||||
|
if (N) \
|
||||||
|
{ \
|
||||||
|
(Current).begin = YYRHSLOC (Rhs, 1).begin; \
|
||||||
|
(Current).end = YYRHSLOC (Rhs, N).end; \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
(Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \
|
||||||
|
} \
|
||||||
|
while (/*CONSTCOND*/ 0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace ]b4_namespace[
|
||||||
|
{
|
||||||
|
/// A Bison parser.
|
||||||
|
class ]b4_parser_class_name[
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/// Symbol semantic values.
|
||||||
|
#ifndef YYSTYPE
|
||||||
|
]m4_ifdef([b4_stype],
|
||||||
|
[ union semantic_type
|
||||||
|
b4_user_stype
|
||||||
|
;],
|
||||||
|
[m4_if(b4_tag_seen_flag, 0,
|
||||||
|
[[ typedef int semantic_type;]],
|
||||||
|
[[ typedef YYSTYPE semantic_type;]])])[
|
||||||
|
#else
|
||||||
|
typedef YYSTYPE semantic_type;
|
||||||
|
#endif
|
||||||
|
/// Symbol locations.
|
||||||
|
typedef ]b4_location_type[ location_type;
|
||||||
|
/// Tokens.
|
||||||
|
struct token
|
||||||
|
{
|
||||||
|
]b4_token_enums(b4_tokens)[
|
||||||
|
};
|
||||||
|
/// Token type.
|
||||||
|
typedef token::yytokentype token_type;
|
||||||
|
|
||||||
|
/// Build a parser object.
|
||||||
|
]b4_parser_class_name[ (]b4_parse_param_decl[);
|
||||||
|
virtual ~]b4_parser_class_name[ ();
|
||||||
|
|
||||||
|
/// Parse.
|
||||||
|
/// \returns 0 iff parsing succeeded.
|
||||||
|
virtual int parse ();
|
||||||
|
|
||||||
|
/// The current debugging stream.
|
||||||
|
std::ostream& debug_stream () const;
|
||||||
|
/// Set the current debugging stream.
|
||||||
|
void set_debug_stream (std::ostream &);
|
||||||
|
|
||||||
|
/// Type for debugging levels.
|
||||||
|
typedef int debug_level_type;
|
||||||
|
/// The current debugging level.
|
||||||
|
debug_level_type debug_level () const;
|
||||||
|
/// Set the current debugging level.
|
||||||
|
void set_debug_level (debug_level_type l);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
public:
|
||||||
|
/// Report a syntax error.
|
||||||
|
/// \param loc where the syntax error is found.
|
||||||
|
/// \param msg a description of the syntax error.
|
||||||
|
virtual void error (const location_type& loc, const std::string& msg);
|
||||||
|
private:
|
||||||
|
|
||||||
|
#if YYDEBUG
|
||||||
|
public:
|
||||||
|
/// \brief Report a symbol value on the debug stream.
|
||||||
|
/// \param yytype The token type.
|
||||||
|
/// \param yyvaluep Its semantic value.
|
||||||
|
/// \param yylocationp Its location.
|
||||||
|
virtual void yy_symbol_value_print_ (int yytype,
|
||||||
|
const semantic_type* yyvaluep,
|
||||||
|
const location_type* yylocationp);
|
||||||
|
/// \brief Report a symbol on the debug stream.
|
||||||
|
/// \param yytype The token type.
|
||||||
|
/// \param yyvaluep Its semantic value.
|
||||||
|
/// \param yylocationp Its location.
|
||||||
|
virtual void yy_symbol_print_ (int yytype,
|
||||||
|
const semantic_type* yyvaluep,
|
||||||
|
const location_type* yylocationp);
|
||||||
|
private:
|
||||||
|
/* Debugging. */
|
||||||
|
int yydebug_;
|
||||||
|
std::ostream* yycdebug_;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/// \brief Reclaim the memory associated to a symbol.
|
||||||
|
/// \param yymsg Why this token is reclaimed.
|
||||||
|
/// \param yytype The symbol type.
|
||||||
|
/// \param yyvaluep Its semantic value.
|
||||||
|
/// \param yylocationp Its location.
|
||||||
|
inline void yydestruct_ (const char* yymsg,
|
||||||
|
int yytype,
|
||||||
|
semantic_type* yyvaluep,
|
||||||
|
location_type* yylocationp);
|
||||||
|
|
||||||
|
]b4_parse_param_vars[
|
||||||
|
};
|
||||||
|
|
||||||
|
]dnl Redirections for glr.c.
|
||||||
|
m4_ifset([b4_global_tokens_and_yystype],
|
||||||
|
[b4_token_defines(b4_tokens)])
|
||||||
|
[
|
||||||
|
#ifndef YYSTYPE
|
||||||
|
# define YYSTYPE ]b4_namespace[::]b4_parser_class_name[::semantic_type
|
||||||
|
#endif
|
||||||
|
#ifndef YYLTYPE
|
||||||
|
# define YYLTYPE ]b4_namespace[::]b4_parser_class_name[::location_type
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
]m4_ifdef([b4_end_header],
|
||||||
|
[[/* Copy the %end-header blocks. */
|
||||||
|
]b4_end_header])[]dnl
|
||||||
|
|
||||||
|
[#endif /* ! defined PARSER_HEADER_H */]
|
||||||
+979
-708
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,280 @@
|
|||||||
|
m4_divert(-1)
|
||||||
|
|
||||||
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
|
# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
# 02110-1301 USA
|
||||||
|
|
||||||
|
# We do want M4 expansion after # for CPP macros.
|
||||||
|
m4_changecom()
|
||||||
|
m4_divert(0)dnl
|
||||||
|
@output b4_dir_prefix[]position.hh
|
||||||
|
b4_copyright([Positions for Bison parsers in C++],
|
||||||
|
[2002, 2003, 2004, 2005, 2006])[
|
||||||
|
|
||||||
|
/**
|
||||||
|
** \file position.hh
|
||||||
|
** Define the ]b4_namespace[::position class.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BISON_POSITION_HH
|
||||||
|
# define BISON_POSITION_HH
|
||||||
|
|
||||||
|
# include <iostream>
|
||||||
|
# include <string>
|
||||||
|
# include <algorithm>
|
||||||
|
|
||||||
|
namespace ]b4_namespace[
|
||||||
|
{
|
||||||
|
/// Abstract a position.
|
||||||
|
class position
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
]m4_ifdef([b4_location_constructors], [
|
||||||
|
/// Construct a position.
|
||||||
|
position ()
|
||||||
|
: filename (0), line (]b4_location_initial_line[), column (]b4_location_initial_column[)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
])[
|
||||||
|
/// Initialization.
|
||||||
|
inline void initialize (]b4_filename_type[* fn)
|
||||||
|
{
|
||||||
|
filename = fn;
|
||||||
|
line = ]b4_location_initial_line[;
|
||||||
|
column = ]b4_location_initial_column[;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \name Line and Column related manipulators
|
||||||
|
** \{ */
|
||||||
|
public:
|
||||||
|
/// (line related) Advance to the COUNT next lines.
|
||||||
|
inline void lines (int count = 1)
|
||||||
|
{
|
||||||
|
column = ]b4_location_initial_column[;
|
||||||
|
line += count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// (column related) Advance to the COUNT next columns.
|
||||||
|
inline void columns (int count = 1)
|
||||||
|
{
|
||||||
|
column = std::max (]b4_location_initial_column[u, column + count);
|
||||||
|
}
|
||||||
|
/** \} */
|
||||||
|
|
||||||
|
public:
|
||||||
|
/// File name to which this position refers.
|
||||||
|
]b4_filename_type[* filename;
|
||||||
|
/// Current line number.
|
||||||
|
unsigned int line;
|
||||||
|
/// Current column number.
|
||||||
|
unsigned int column;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Add and assign a position.
|
||||||
|
inline const position&
|
||||||
|
operator+= (position& res, const int width)
|
||||||
|
{
|
||||||
|
res.columns (width);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Add two position objects.
|
||||||
|
inline const position
|
||||||
|
operator+ (const position& begin, const int width)
|
||||||
|
{
|
||||||
|
position res = begin;
|
||||||
|
return res += width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Add and assign a position.
|
||||||
|
inline const position&
|
||||||
|
operator-= (position& res, const int width)
|
||||||
|
{
|
||||||
|
return res += -width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Add two position objects.
|
||||||
|
inline const position
|
||||||
|
operator- (const position& begin, const int width)
|
||||||
|
{
|
||||||
|
return begin + -width;
|
||||||
|
}
|
||||||
|
]m4_if(b4_define_location_comparison, [1], [[
|
||||||
|
/// Compare two position objects.
|
||||||
|
inline bool
|
||||||
|
operator== (const position& pos1, const position& pos2)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(pos1.filename == pos2.filename
|
||||||
|
|| pos1.filename && pos2.filename && *pos1.filename == *pos2.filename)
|
||||||
|
&& pos1.line == pos2.line && pos1.column == pos2.column;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Compare two position objects.
|
||||||
|
inline bool
|
||||||
|
operator!= (const position& pos1, const position& pos2)
|
||||||
|
{
|
||||||
|
return !(pos1 == pos2);
|
||||||
|
}
|
||||||
|
]])[
|
||||||
|
/** \brief Intercept output stream redirection.
|
||||||
|
** \param ostr the destination output stream
|
||||||
|
** \param pos a reference to the position to redirect
|
||||||
|
*/
|
||||||
|
inline std::ostream&
|
||||||
|
operator<< (std::ostream& ostr, const position& pos)
|
||||||
|
{
|
||||||
|
if (pos.filename)
|
||||||
|
ostr << *pos.filename << ':';
|
||||||
|
return ostr << pos.line << '.' << pos.column;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif // not BISON_POSITION_HH]
|
||||||
|
@output b4_dir_prefix[]location.hh
|
||||||
|
b4_copyright([Locations for Bison parsers in C++],
|
||||||
|
[2002, 2003, 2004, 2005, 2006])[
|
||||||
|
|
||||||
|
/**
|
||||||
|
** \file location.hh
|
||||||
|
** Define the ]b4_namespace[::location class.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BISON_LOCATION_HH
|
||||||
|
# define BISON_LOCATION_HH
|
||||||
|
|
||||||
|
# include <iostream>
|
||||||
|
# include <string>
|
||||||
|
# include "position.hh"
|
||||||
|
|
||||||
|
namespace ]b4_namespace[
|
||||||
|
{
|
||||||
|
|
||||||
|
/// Abstract a location.
|
||||||
|
class location
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
]m4_ifdef([b4_location_constructors], [
|
||||||
|
/// Construct a location.
|
||||||
|
location ()
|
||||||
|
: begin (), end ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
])[
|
||||||
|
/// Initialization.
|
||||||
|
inline void initialize (]b4_filename_type[* fn)
|
||||||
|
{
|
||||||
|
begin.initialize (fn);
|
||||||
|
end = begin;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \name Line and Column related manipulators
|
||||||
|
** \{ */
|
||||||
|
public:
|
||||||
|
/// Reset initial location to final location.
|
||||||
|
inline void step ()
|
||||||
|
{
|
||||||
|
begin = end;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Extend the current location to the COUNT next columns.
|
||||||
|
inline void columns (unsigned int count = 1)
|
||||||
|
{
|
||||||
|
end += count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Extend the current location to the COUNT next lines.
|
||||||
|
inline void lines (unsigned int count = 1)
|
||||||
|
{
|
||||||
|
end.lines (count);
|
||||||
|
}
|
||||||
|
/** \} */
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
/// Beginning of the located region.
|
||||||
|
position begin;
|
||||||
|
/// End of the located region.
|
||||||
|
position end;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Join two location objects to create a location.
|
||||||
|
inline const location operator+ (const location& begin, const location& end)
|
||||||
|
{
|
||||||
|
location res = begin;
|
||||||
|
res.end = end.end;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Add two location objects.
|
||||||
|
inline const location operator+ (const location& begin, unsigned int width)
|
||||||
|
{
|
||||||
|
location res = begin;
|
||||||
|
res.columns (width);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Add and assign a location.
|
||||||
|
inline location& operator+= (location& res, unsigned int width)
|
||||||
|
{
|
||||||
|
res.columns (width);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
]m4_if(b4_define_location_comparison, [1], [[
|
||||||
|
/// Compare two location objects.
|
||||||
|
inline bool
|
||||||
|
operator== (const location& loc1, const location& loc2)
|
||||||
|
{
|
||||||
|
return loc1.begin == loc2.begin && loc1.end == loc2.end;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Compare two location objects.
|
||||||
|
inline bool
|
||||||
|
operator!= (const location& loc1, const location& loc2)
|
||||||
|
{
|
||||||
|
return !(loc1 == loc2);
|
||||||
|
}
|
||||||
|
]])[
|
||||||
|
/** \brief Intercept output stream redirection.
|
||||||
|
** \param ostr the destination output stream
|
||||||
|
** \param loc a reference to the location to redirect
|
||||||
|
**
|
||||||
|
** Avoid duplicate information.
|
||||||
|
*/
|
||||||
|
inline std::ostream& operator<< (std::ostream& ostr, const location& loc)
|
||||||
|
{
|
||||||
|
position last = loc.end - 1;
|
||||||
|
ostr << loc.begin;
|
||||||
|
if (last.filename
|
||||||
|
&& (!loc.begin.filename
|
||||||
|
|| *loc.begin.filename != *last.filename))
|
||||||
|
ostr << '-' << last;
|
||||||
|
else if (loc.begin.line != last.line)
|
||||||
|
ostr << '-' << last.line << '.' << last.column;
|
||||||
|
else if (loc.begin.column != last.column)
|
||||||
|
ostr << '-' << last.column;
|
||||||
|
return ostr;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // not BISON_LOCATION_HH]
|
||||||
|
m4_divert(-1)
|
||||||
|
m4_changecom([#])
|
||||||
+340
-376
File diff suppressed because it is too large
Load Diff
@@ -1,9 +0,0 @@
|
|||||||
# 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]])
|
|
||||||
+884
-653
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,38 @@
|
|||||||
|
# DJGPP Maintainer's Makefile -*-Makefile-*-
|
||||||
|
# Requires GNU sed
|
||||||
|
|
||||||
|
## Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
## This program is free software; you can redistribute it and/or modify
|
||||||
|
## it under the terms of the GNU General Public License as published by
|
||||||
|
## the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
## any later version.
|
||||||
|
|
||||||
|
## This program is distributed in the hope that it will be useful,
|
||||||
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
## GNU General Public License for more details.
|
||||||
|
|
||||||
|
## You should have received a copy of the GNU General Public License
|
||||||
|
## along with this program; if not, write to the Free Software Foundation,
|
||||||
|
## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
top_srcdir = ..
|
||||||
|
srcdir = .
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
|
||||||
|
all: README
|
||||||
|
|
||||||
|
README: README.in $(top_srcdir)/configure
|
||||||
|
PACKAGE=`grep "^[ ]*PACKAGE=" $(top_srcdir)/configure | sed -e 's/^[ ]*PACKAGE=//' -e s/[\"\']//g`; \
|
||||||
|
VERSION=`grep "^[ ]*VERSION=" $(top_srcdir)/configure | sed -e 's/^[ ]*VERSION=//' -e s/[\"\']//g`; \
|
||||||
|
package_version=`echo "$${VERSION}" | sed 's/\.//g'`; \
|
||||||
|
tree_version=`echo "$${VERSION}" | sed 's/\.//2g'`; \
|
||||||
|
sed \
|
||||||
|
-e "s/@V@/$${PACKAGE}-$${VERSION}/g" \
|
||||||
|
-e "s/@VERSION@/$${VERSION}/g" \
|
||||||
|
-e "s/@PACKAGE_VERSION@/$$package_version/g" \
|
||||||
|
-e "s/@TREE_VERSION@/$$tree_version/g" \
|
||||||
|
$(srcdir)/README.in > t-$@
|
||||||
|
mv t-$@ $@
|
||||||
+194
@@ -0,0 +1,194 @@
|
|||||||
|
This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP.
|
||||||
|
|
||||||
|
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
|
||||||
|
1.: DJGPP specific changes.
|
||||||
|
=======================
|
||||||
|
|
||||||
|
The DJGPP port of Bison offers LFN and SFN support depending on which
|
||||||
|
OS it is running. If LFN support is available or not is determinated at
|
||||||
|
run time. If LFN support is available (DOS session under Win9X, Win2K,
|
||||||
|
WinXP, etc.) the standard posix file name extensions will be used.
|
||||||
|
These are: y.tab.c, y.tab.c++, y.tab.h, y.output, etc. If only SFN
|
||||||
|
support is available (plain DOS), then the standard MSDOS short file
|
||||||
|
names will be used. These are: y_tab.c, y_tab.h, y.out, etc.
|
||||||
|
It should be noticed that this bison version needs the m4 program as
|
||||||
|
back end to generate the parser file (y.tab.c etc.) from the skeleton
|
||||||
|
files. This implies that m4 must always be installed to get bison
|
||||||
|
working. m4 will use a couple of m4 scripts that will be installed in
|
||||||
|
/dev/env/DJDIR/share/bison and shall not be removed.
|
||||||
|
It should also be noticed that the skeleton files bison.simple and
|
||||||
|
bison.hairy are no longer supported. This applies also to the environ-
|
||||||
|
ment variables BISON_HAIRY and BISON_SIMPLE. Those variables are *no*
|
||||||
|
longer honored at all.
|
||||||
|
The kind of skeleton file bison.hairy is no longer supported at all.
|
||||||
|
The skeleton file bison.simple is now called yacc.c and is an m4 script.
|
||||||
|
The other two skeleton files supported by this bison version are glr.c
|
||||||
|
and lalr1.cc. The first one is a generalized LR C parser based on
|
||||||
|
Bison's LALR(1) tables and the second one is a experimental C++ parser
|
||||||
|
class.
|
||||||
|
As has been told before, bison uses m4 to generate the parser file.
|
||||||
|
This is done by forking and using pipes for the IPC. MSDOS does not
|
||||||
|
support this functionality so this has been reproduced in the usual
|
||||||
|
way by redirecting stdin and stdout of bison and m4 to temporary files
|
||||||
|
and processing these files in sequence. All the changes to the sources
|
||||||
|
are documented in the djgpp/diffs file.
|
||||||
|
|
||||||
|
Please **read** the docs.
|
||||||
|
|
||||||
|
|
||||||
|
2.: Installing the binary package.
|
||||||
|
==============================
|
||||||
|
|
||||||
|
2.1.: Copy the binary distribution into the top DJGPP installation directory,
|
||||||
|
just unzip it preserving the directory structure running *ONE* of the
|
||||||
|
following commands:
|
||||||
|
unzip32 bsn@[email protected] or
|
||||||
|
djtarx bsn@[email protected] or
|
||||||
|
pkunzip -d bsn@[email protected]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
3.: Building the binaries from sources.
|
||||||
|
===================================
|
||||||
|
|
||||||
|
3.1.: Create a temporary directory and copy the source package into the
|
||||||
|
directory. If you download the source distribution from one of the
|
||||||
|
DJGPP sites, just unzip it preserving the directory structure
|
||||||
|
running *ONE* of the following commands:
|
||||||
|
unzip32 bsn@[email protected] or
|
||||||
|
djtarx bsn@[email protected] or
|
||||||
|
pkunzip -d bsn@[email protected]
|
||||||
|
and proceed to the paragraph 3.3, below.
|
||||||
|
|
||||||
|
3.2.: Source distributions downloaded from one of the GNU FTP sites need
|
||||||
|
some more work to unpack, if LFN support is not available. If LFN is
|
||||||
|
available then you can extract the source files from the archive with
|
||||||
|
any unzip program and proceed to the paragraph 3.3, below. Any file
|
||||||
|
name issue will be handled by the the DJGPP configuration files.
|
||||||
|
To unpack the source distribution on SFN systems, first, you MUST use
|
||||||
|
the `djunpack' batch file to unzip the package. That is because some
|
||||||
|
file names in the official distributions need to be changed to avoid
|
||||||
|
problems on the various platforms supported by DJGPP.
|
||||||
|
`djunpack' invokes the `djtar' program (that is part of the basic DJGPP
|
||||||
|
development kit) to rename these files on the fly given a file with
|
||||||
|
name mappings; the distribution includes a file `djgpp/fnchange.lst'
|
||||||
|
with the necessary mappings. So you need first to retrieve that batch
|
||||||
|
file, and then invoke it to unpack the distribution. Here's how:
|
||||||
|
|
||||||
|
djtar -x -p -o bison-@VERSION@/djgpp/djunpack.bat bison-@[email protected] > djunpack.bat
|
||||||
|
djunpack bison-@[email protected]
|
||||||
|
|
||||||
|
(The name of the distribution archive and the leading directory of the
|
||||||
|
path to `djunpack.bat' in the distribution will be different for
|
||||||
|
versions of Bison other than @VERSION@.)
|
||||||
|
|
||||||
|
If the argument to `djunpack.bat' include leading directories, it MUST
|
||||||
|
be given with the DOS-style backslashes; Unix-style forward slashes
|
||||||
|
will NOT work.
|
||||||
|
|
||||||
|
If the distribution comes as a .tar.bz2 archive, and your version of
|
||||||
|
`djtar' doesn't support bzip2 decompression, you need to unpack it as
|
||||||
|
follows:
|
||||||
|
|
||||||
|
bnzip2 bison-@[email protected]
|
||||||
|
djtar -x -p -o bison-@VERSION@/djgpp/djunpack.bat bison-@[email protected] > djunpack.bat
|
||||||
|
djunpack bison-@[email protected]
|
||||||
|
|
||||||
|
3.3.: To build the binaries you will need the following binary packages:
|
||||||
|
djdev203.zip (or a later but NOT a prior version)
|
||||||
|
bsh204b.zip (or a later but NOT a prior version)
|
||||||
|
gcc410b.zip, gpp410b.zip, bnu2161b.zip, mak3791b.zip,
|
||||||
|
fil40b.zip, shl20jb.zip, txt20b.zip,
|
||||||
|
txi48b.zip, grep24b.zip, sed415b.zip,
|
||||||
|
m4-144b.zip.
|
||||||
|
|
||||||
|
If you want to run the check you will need also:
|
||||||
|
dif287b.zip
|
||||||
|
|
||||||
|
All this packages can be found in the v2gnu directory of any
|
||||||
|
ftp.delorie.com mirror.
|
||||||
|
You will need bsh204b.zip or later and *NOT* a prior version or
|
||||||
|
the build will fail. The same applies to djdev203.zip. Please note
|
||||||
|
that Bison requires m4-144b.zip or later to work properly. All the
|
||||||
|
other packages are the ones I have used to build the binaries
|
||||||
|
from this source. Previuos versions of this packages may do the
|
||||||
|
job as well but I have not tested this.
|
||||||
|
|
||||||
|
3.4.: If for some reason you want to reconfigure the package cd into the top
|
||||||
|
srcdir (bison-@TREE_VERSION@) and run the following commands:
|
||||||
|
del djgpp\config.cache
|
||||||
|
make clean
|
||||||
|
djgpp\config
|
||||||
|
|
||||||
|
Please note that you *MUST* delete the config.cache file in the djgpp
|
||||||
|
subdir or you will not really reconfigure the sources because the
|
||||||
|
configuration informations will be read from the cache file instead
|
||||||
|
of being newly computed.
|
||||||
|
To build the programs in a directory other than where the sources are,
|
||||||
|
you must add the parameter that specifies the source directory,
|
||||||
|
e.g:
|
||||||
|
x:\src\gnu\bison-@TREE_VERSION@\djgpp\config x:/src/gnu/bison-@TREE_VERSION@
|
||||||
|
|
||||||
|
Lets assume you want to build the binaries in a directory placed on a
|
||||||
|
different drive (z:\build in this case) from where the sources are,
|
||||||
|
then you will run the following commands:
|
||||||
|
z:
|
||||||
|
md \build
|
||||||
|
cd \build
|
||||||
|
x:\src\gnu\bison-@TREE_VERSION@\djgpp\config x:/src/gnu/bison-@TREE_VERSION@
|
||||||
|
|
||||||
|
The order of the options and the srcdir option does not matter. You
|
||||||
|
*MUST* use forward slashes to specify the source directory.
|
||||||
|
|
||||||
|
The batch file will set same environment variables, make MSDOS specific
|
||||||
|
modifications to the Makefile.in's and supply all other needed options
|
||||||
|
to the configure script.
|
||||||
|
|
||||||
|
3.5.: To compile the package run from the top srcdir the command:
|
||||||
|
make
|
||||||
|
|
||||||
|
3.6.: Now you can run the tests if you like. From the top srcdir run the
|
||||||
|
command:
|
||||||
|
make check
|
||||||
|
|
||||||
|
No test should fail but the tests #131 (Doxygen Public Documentation)
|
||||||
|
and #132 (Doxygen Private Documentation) will be skipped. Please note
|
||||||
|
that the testsuite only works with LFN available. On plain DOS, most
|
||||||
|
of the tests will fail due to invalid DOS names.
|
||||||
|
|
||||||
|
3.7.: To install the binaries, header, library, catalogs, and info docs
|
||||||
|
run the following command from the top srcdir:
|
||||||
|
make install
|
||||||
|
|
||||||
|
This will install the products into your DJGPP installation tree given
|
||||||
|
by the default prefix "/dev/env/DJDIR". If you prefer to install them
|
||||||
|
into some other directory you will have to set prefix to the appropiate
|
||||||
|
value:
|
||||||
|
make install prefix=z:/some/other/place
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Send GNU bison specific bug reports to <[email protected]>.
|
||||||
|
Send suggestions and bug reports concerning the DJGPP port to
|
||||||
|
comp.os.msdos.djgpp or <[email protected]>.
|
||||||
|
|
||||||
|
|
||||||
|
Enjoy.
|
||||||
|
|
||||||
|
Guerrero, Juan Manuel <[email protected]>
|
||||||
@@ -0,0 +1,480 @@
|
|||||||
|
@echo off
|
||||||
|
Rem Configure Bison for DJGPP.
|
||||||
|
|
||||||
|
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
|
||||||
|
Rem format, or else stock DOS/Windows shells will refuse to run it.
|
||||||
|
|
||||||
|
Rem Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Rem This program is free software; you can redistribute it and/or modify
|
||||||
|
Rem it under the terms of the GNU General Public License as published by
|
||||||
|
Rem the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
Rem any later version.
|
||||||
|
|
||||||
|
Rem This program is distributed in the hope that it will be useful,
|
||||||
|
Rem but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
Rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
Rem GNU General Public License for more details.
|
||||||
|
|
||||||
|
Rem You should have received a copy of the GNU General Public License
|
||||||
|
Rem along with this program; if not, write to the Free Software Foundation,
|
||||||
|
Rem Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
echo Configuring Bison for DJGPP v2.x...
|
||||||
|
|
||||||
|
Rem The SmallEnv tests protect against fixed and too small size
|
||||||
|
Rem of the environment in stock DOS shell.
|
||||||
|
|
||||||
|
Rem Find out if NLS is wanted or not,
|
||||||
|
Rem if dependency-tracking is wanted or not,
|
||||||
|
Rem if caching is wanted or not
|
||||||
|
Rem and where the sources are.
|
||||||
|
Rem We always default to NLS support,
|
||||||
|
Rem no dependency tracking
|
||||||
|
Rem and to in place configuration.
|
||||||
|
set ARGS=
|
||||||
|
set NLS=enabled
|
||||||
|
if not "%NLS%" == "enabled" goto SmallEnv
|
||||||
|
set CACHING=enabled
|
||||||
|
if not "%CACHING%" == "enabled" goto SmallEnv
|
||||||
|
set DEPENDENCY_TRACKING=disabled
|
||||||
|
if not "%DEPENDENCY_TRACKING%" == "disabled" goto SmallEnv
|
||||||
|
set LIBICONV_PREFIX=disabled
|
||||||
|
if not "%LIBICONV_PREFIX%" == "disabled" goto SmallEnv
|
||||||
|
set LIBINTL_PREFIX=disabled
|
||||||
|
if not "%LIBINTL_PREFIX%" == "disabled" goto SmallEnv
|
||||||
|
set HTML=enabled
|
||||||
|
if not "%HTML%" == "enabled" goto SmallEnv
|
||||||
|
set XSRC=.
|
||||||
|
if not "%XSRC%" == "." goto SmallEnv
|
||||||
|
|
||||||
|
Rem Loop over all arguments.
|
||||||
|
Rem Special arguments are: NLS, XSRC, CACHE, STATIC_LIBS, LIBICONV_PREFIX, LIBINTL_PREFIX and DEPS.
|
||||||
|
Rem All other arguments are stored into ARGS.
|
||||||
|
:ArgLoop
|
||||||
|
if "%1" == "nls" goto NextArgument
|
||||||
|
if "%1" == "NLS" goto NextArgument
|
||||||
|
if "%1" == "no-nls" goto NoNLS
|
||||||
|
if "%1" == "no-NLS" goto NoNLS
|
||||||
|
if "%1" == "NO-NLS" goto NoNLS
|
||||||
|
goto CachingOption
|
||||||
|
:NoNLS
|
||||||
|
if "%1" == "no-nls" set NLS=disabled
|
||||||
|
if "%1" == "no-NLS" set NLS=disabled
|
||||||
|
if "%1" == "NO-NLS" set NLS=disabled
|
||||||
|
if not "%NLS%" == "disabled" goto SmallEnv
|
||||||
|
goto NextArgument
|
||||||
|
:CachingOption
|
||||||
|
if "%1" == "cache" goto NextArgument
|
||||||
|
if "%1" == "CACHE" goto NextArgument
|
||||||
|
if "%1" == "no-cache" goto NoCaching
|
||||||
|
if "%1" == "no-CACHE" goto NoCaching
|
||||||
|
if "%1" == "NO-CACHE" goto NoCaching
|
||||||
|
goto DependencyOption
|
||||||
|
:NoCaching
|
||||||
|
if "%1" == "no-cache" set CACHING=disabled
|
||||||
|
if "%1" == "no-CACHE" set CACHING=disabled
|
||||||
|
if "%1" == "NO-CACHE" set CACHING=disabled
|
||||||
|
if not "%CACHING%" == "disabled" goto SmallEnv
|
||||||
|
goto NextArgument
|
||||||
|
:DependencyOption
|
||||||
|
if "%1" == "no-dep" goto NextArgument
|
||||||
|
if "%1" == "no-DEP" goto NextArgument
|
||||||
|
if "%1" == "NO-DEP" goto NextArgument
|
||||||
|
if "%1" == "dep" goto DependecyTraking
|
||||||
|
if "%1" == "DEP" goto DependecyTraking
|
||||||
|
goto LibiconvPrefixOption
|
||||||
|
:DependecyTraking
|
||||||
|
if "%1" == "dep" set DEPENDENCY_TRACKING=enabled
|
||||||
|
if "%1" == "DEP" set DEPENDENCY_TRACKING=enabled
|
||||||
|
if not "%DEPENDENCY_TRACKING%" == "enabled" goto SmallEnv
|
||||||
|
goto NextArgument
|
||||||
|
:LibiconvPrefixOption
|
||||||
|
if "%1" == "no-libiconvprefix" goto NextArgument
|
||||||
|
if "%1" == "no-LIBICONVPREFIX" goto NextArgument
|
||||||
|
if "%1" == "NO-LIBICONVPREFIX" goto NextArgument
|
||||||
|
if "%1" == "libiconvprefix" goto WithLibiconvPrefix
|
||||||
|
if "%1" == "LIBICONVPREFIX" goto WithLibiconvPrefix
|
||||||
|
goto LibintlPrefixOption
|
||||||
|
:WithLibiconvPrefix
|
||||||
|
if "%1" == "libiconvprefix" set LIBICONV_PREFIX=enabled
|
||||||
|
if "%1" == "LIBICONVPREFIX" set LIBICONV_PREFIX=enabled
|
||||||
|
if not "%LIBICONV_PREFIX%" == "enabled" goto SmallEnv
|
||||||
|
goto NextArgument
|
||||||
|
:LibintlPrefixOption
|
||||||
|
if "%1" == "no-libiconvprefix" goto NextArgument
|
||||||
|
if "%1" == "no-LIBICONVPREFIX" goto NextArgument
|
||||||
|
if "%1" == "NO-LIBICONVPREFIX" goto NextArgument
|
||||||
|
if "%1" == "libintlprefix" goto _WithLibintlPrefix
|
||||||
|
if "%1" == "LIBINTLPREFIX" goto _WithLibintlPrefix
|
||||||
|
goto HTMLOption
|
||||||
|
:_WithLibintlPrefix
|
||||||
|
if "%1" == "libintlprefix" set LIBINTL_PREFIX=enabled
|
||||||
|
if "%1" == "LIBINTLPREFIX" set LIBINTL_PREFIX=enabled
|
||||||
|
if not "%LIBINTL_PREFIX%" == "enabled" goto SmallEnv
|
||||||
|
:HTMLOption
|
||||||
|
if "%1" == "withhtml" goto NextArgument
|
||||||
|
if "%1" == "withHTML" goto NextArgument
|
||||||
|
if "%1" == "WITHHTML" goto NextArgument
|
||||||
|
if "%1" == "withouthtml" goto _WithoutHTML
|
||||||
|
if "%1" == "withoutHTML" goto _WithoutHTML
|
||||||
|
if "%1" == "WITHOUTHTML" goto _WithoutHTML
|
||||||
|
goto SrcDirOption
|
||||||
|
:_WithoutHTML
|
||||||
|
if "%1" == "withouthtml" set HTML=disabled
|
||||||
|
if "%1" == "withoutHTML" set HTML=disabled
|
||||||
|
if "%1" == "WITHOUTHTML" set HTML=disabled
|
||||||
|
if not "%HTML%" == "disabled" goto SmallEnv
|
||||||
|
goto NextArgument
|
||||||
|
:SrcDirOption
|
||||||
|
echo %1 | grep -q "/"
|
||||||
|
if errorlevel 1 goto CollectArgument
|
||||||
|
set XSRC=%1
|
||||||
|
if not "%XSRC%" == "%1" goto SmallEnv
|
||||||
|
goto NextArgument
|
||||||
|
:CollectArgument
|
||||||
|
set _ARGS=%ARGS% %1
|
||||||
|
if not "%_ARGS%" == "%ARGS% %1" if not "%_ARGS%" == "%ARGS%%1" goto SmallEnv
|
||||||
|
echo %_ARGS% | grep -q "[^ ]"
|
||||||
|
if not errorlevel 0 set ARGS=%_ARGS%
|
||||||
|
set _ARGS=
|
||||||
|
:NextArgument
|
||||||
|
shift
|
||||||
|
if not "%1" == "" goto ArgLoop
|
||||||
|
|
||||||
|
Rem Create an arguments file for the configure script.
|
||||||
|
echo --srcdir=%XSRC% > arguments
|
||||||
|
if "%CACHING%" == "enabled" echo --cache-file=%XSRC%/djgpp/config.cache >> arguments
|
||||||
|
if "%DEPENDENCY_TRACKING%" == "enabled" echo --enable-dependency-tracking >> arguments
|
||||||
|
if "%DEPENDENCY_TRACKING%" == "disabled" echo --disable-dependency-tracking >> arguments
|
||||||
|
if "%LIBICONV_PREFIX%" == "enabled" echo --with-libiconv-prefix >> arguments
|
||||||
|
if "%LIBICONV_PREFIX%" == "disabled" echo --without-libiconv-prefix >> arguments
|
||||||
|
if "%LIBINTL_PREFIX%" == "enabled" echo --with-libintl-prefix >> arguments
|
||||||
|
if "%LIBINTL_PREFIX%" == "disabled" echo --without-libintl-prefix >> arguments
|
||||||
|
if "%HTML%" == "enabled" echo --enable-html >> arguments
|
||||||
|
if "%HTML%" == "disabled" echo --disable-html >> arguments
|
||||||
|
if not "%ARGS%" == "" echo %ARGS% >> arguments
|
||||||
|
set ARGS=
|
||||||
|
set CACHING=
|
||||||
|
set DEPENDENCY_TRACKING=
|
||||||
|
set LIBICONV_PREFIX=
|
||||||
|
set LIBINTL_PREFIX=
|
||||||
|
set HTML=
|
||||||
|
|
||||||
|
if "%XSRC%" == "." goto InPlace
|
||||||
|
|
||||||
|
:NotInPlace
|
||||||
|
redir -e /dev/null update %XSRC%/configure.orig ./configure
|
||||||
|
test -f ./configure
|
||||||
|
if errorlevel 1 update %XSRC%/configure ./configure
|
||||||
|
|
||||||
|
:InPlace
|
||||||
|
Rem Update configuration files
|
||||||
|
echo Updating configuration scripts...
|
||||||
|
test -f ./configure.orig
|
||||||
|
if errorlevel 1 update configure configure.orig
|
||||||
|
sed -f %XSRC%/djgpp/config.sed configure.orig > configure
|
||||||
|
if errorlevel 1 goto SedError
|
||||||
|
|
||||||
|
Rem Make sure they have a config.site file
|
||||||
|
set CONFIG_SITE=%XSRC%/djgpp/config.site
|
||||||
|
if not "%CONFIG_SITE%" == "%XSRC%/djgpp/config.site" goto SmallEnv
|
||||||
|
|
||||||
|
Rem Make sure crucial file names are not munged by unpacking
|
||||||
|
test -f %XSRC%/po/Makefile.in.in
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/po/Makefile.in.in %XSRC%/po/Makefile.in-in
|
||||||
|
test -f %XSRC%/po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/po/Makefile.in %XSRC%/po/Makefile.in-in
|
||||||
|
test -f %XSRC%/po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/po/Makefile.inin %XSRC%/po/Makefile.in-in
|
||||||
|
test -f %XSRC%/po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/po/Makefile.in_in %XSRC%/po/Makefile.in-in
|
||||||
|
test -f %XSRC%/po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/po/Makefile_in.in %XSRC%/po/Makefile.in-in
|
||||||
|
test -f %XSRC%/runtime-po/Makefile.in.in
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.in.in %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
test -f %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.in %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
test -f %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.inin %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
test -f %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.in_in %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
test -f %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile_in.in %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
test -f %XSRC%/data/c++.m4
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/data/c++.m4 %XSRC%/data/cxx.m4
|
||||||
|
test -f %XSRC%/data/cxx.m4
|
||||||
|
if errorlevel 1 mv -f %XSRC%/data/cpp.m4 %XSRC%/data/cxx.m4
|
||||||
|
:scan_gram_c_Test
|
||||||
|
test -f %XSRC%/src/c-scan-gram.c
|
||||||
|
if not errorlevel 1 goto scan_skel_c_Test
|
||||||
|
test -f %XSRC%/src/scan-gram-c.c
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/src/scan-gram-c.c %XSRC%/src/c-scan-gram.c
|
||||||
|
:scan_skel_c_Test
|
||||||
|
test -f %XSRC%/src/c-scan-skel.c
|
||||||
|
if not errorlevel 1 goto FixFiles
|
||||||
|
test -f %XSRC%/src/scan-skel-c.c
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/src/scan-skel-c.c %XSRC%/src/c-scan-skel.c
|
||||||
|
|
||||||
|
:FixFiles
|
||||||
|
Rem Fix data/lalr1.cc and data/location.cc to reflect the renaming of c++.m4
|
||||||
|
sed "s/c++\.m4/cxx.m4/" %XSRC%/data/lalr1.cc > lalr1.cc
|
||||||
|
if errorlevel 1 goto lalr1_ccFileError
|
||||||
|
mv ./lalr1.cc %XSRC%/data/lalr1.cc
|
||||||
|
sed "s/c++\.m4/cxx.m4/" %XSRC%/data/location.cc > location.cc
|
||||||
|
if errorlevel 1 goto location.ccFileError
|
||||||
|
mv ./location.cc %XSRC%/data/location.cc
|
||||||
|
sed "s/c++\.m4/cxx.m4/" %XSRC%/data/glr.cc > glr.cc
|
||||||
|
if errorlevel 1 goto glr.ccFileError
|
||||||
|
mv ./glr.cc %XSRC%/data/glr.cc
|
||||||
|
|
||||||
|
Rem Define DJGPP specific defs in config.hin
|
||||||
|
echo Editing config.hin...
|
||||||
|
test -f %XSRC%/config_h.orig
|
||||||
|
if errorlevel 1 update %XSRC%/config.hin %XSRC%/config_h.orig
|
||||||
|
sed -f %XSRC%/djgpp/config_h.sed %XSRC%/config_h.orig > config.hin
|
||||||
|
if errorlevel 1 goto SedError2
|
||||||
|
mv -f config.hin %XSRC%/config.hin
|
||||||
|
|
||||||
|
|
||||||
|
Rem Fixing ilicit testsuite file name.
|
||||||
|
test -f %XSRC%/tests/c++.at
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/tests/c++.at %XSRC%/tests/cxx.at
|
||||||
|
|
||||||
|
Rem Fixing ilicit calc++ file names in the calc++ directory.
|
||||||
|
test -d %XSRC%/examples/calc++
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calc++ %XSRC%/examples/calcxx
|
||||||
|
test -d %XSRC%/examples/calcxx
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcpp %XSRC%/examples/calcxx
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-scanner.cc
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-scanner.cc %XSRC%/examples/calcxx/calcxx-scanner.cc
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-scanner.cc
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-scanner.cc %XSRC%/examples/calcxx/calcxx-scanner.cc
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-scanner.ll
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-scanner.ll %XSRC%/examples/calcxx/calcxx-scanner.ll
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-scanner.ll
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-scanner.ll %XSRC%/examples/calcxx/calcxx-scanner.ll
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-driver.cc
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-driver.cc %XSRC%/examples/calcxx/calcxx-driver.cc
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-driver.cc
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-driver.cc %XSRC%/examples/calcxx/calcxx-driver.cc
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-driver.hh
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-driver.hh %XSRC%/examples/calcxx/calcxx-driver.hh
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-driver.hh
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-driver.hh %XSRC%/examples/calcxx/calcxx-driver.hh
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-parser.cc
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.cc %XSRC%/examples/calcxx/calcxx-parser.cc
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-parser.cc
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.cc %XSRC%/examples/calcxx/calcxx-parser.cc
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-parser.hh
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.hh %XSRC%/examples/calcxx/calcxx-parser.hh
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-parser.hh
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.hh %XSRC%/examples/calcxx/calcxx-parser.hh
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-parser.stamp
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.stamp %XSRC%/examples/calcxx/calcxx-parser.stamp
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-parser.stamp
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.stamp %XSRC%/examples/calcxx/calcxx-parser.stamp
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-parser.yy
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.yy %XSRC%/examples/calcxx/calcxx-parser.yy
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-parser.yy
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.yy %XSRC%/examples/calcxx/calcxx-parser.yy
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++.cc
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++.cc %XSRC%/examples/calcxx/calcxx.cc
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx.cc
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp.cc %XSRC%/examples/calcxx/calcxx.cc
|
||||||
|
|
||||||
|
Rem Fixing #include lines in calcxx files.
|
||||||
|
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx.cc > calcxx.cc
|
||||||
|
if errorlevel 1 goto calcxxFileError
|
||||||
|
mv ./calcxx.cc %XSRC%/examples/calcxx/calcxx.cc
|
||||||
|
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-driver.cc > calcxx-driver.cc
|
||||||
|
if errorlevel 1 goto calcxxFileError
|
||||||
|
mv ./calcxx-driver.cc %XSRC%/examples/calcxx/calcxx-driver.cc
|
||||||
|
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-driver.hh > calcxx-driver.hh
|
||||||
|
if errorlevel 1 goto calcxxFileError
|
||||||
|
mv ./calcxx-driver.hh %XSRC%/examples/calcxx/calcxx-driver.hh
|
||||||
|
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-parser.cc > calcxx-parser.cc
|
||||||
|
if errorlevel 1 goto calcxxFileError
|
||||||
|
mv ./calcxx-parser.cc %XSRC%/examples/calcxx/calcxx-parser.cc
|
||||||
|
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-parser.hh > calcxx-parser.hh
|
||||||
|
if errorlevel 1 goto calcxxFileError
|
||||||
|
mv ./calcxx-parser.hh %XSRC%/examples/calcxx/calcxx-parser.hh
|
||||||
|
:sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-parser.yy > calcxx-parser.yy
|
||||||
|
:if errorlevel 1 goto calcxxFileError
|
||||||
|
:mv ./calcxx-parser.yy %XSRC%/examples/calcxx/calcxx-parser.yy
|
||||||
|
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-scanner.cc > calcxx-scanner.cc
|
||||||
|
if errorlevel 1 goto calcxxFileError
|
||||||
|
mv ./calcxx-scanner.cc %XSRC%/examples/calcxx/calcxx-scanner.cc
|
||||||
|
:sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-scanner.ll > calcxx-scanner.ll
|
||||||
|
:if errorlevel 1 goto calcxxFileError
|
||||||
|
:mv ./calcxx-scanner.ll %XSRC%/examples/calcxx/calcxx-scanner.ll
|
||||||
|
sed "s/calc++/calcxx/" %XSRC%/examples/calcxx/test > test
|
||||||
|
if errorlevel 1 goto calcxxFileError
|
||||||
|
mv ./test %XSRC%/examples/calcxx/test
|
||||||
|
|
||||||
|
|
||||||
|
Rem Fixing the scanner files to make file names 8.3 valid.
|
||||||
|
Rem Use only if you want to change the scan-gram.l and scan-skel.l files.
|
||||||
|
: sed "/outfile=/s/\.yy/yy/" %XSRC%/src/scan-gram.l > scan-gram.l
|
||||||
|
: if errorlevel 1 goto ScannerFileError
|
||||||
|
: mv ./scan-gram.l %XSRC%/src/scan-gram.l
|
||||||
|
: sed "/outfile=/s/\.yy/yy/" %XSRC%/src/scan-skel.l > scan-skel.l
|
||||||
|
: if errorlevel 1 goto ScannerFileError
|
||||||
|
: mv ./scan-skel.l %XSRC%/src/scan-skel.l
|
||||||
|
|
||||||
|
|
||||||
|
Rem This is required because DOS/Windows are case-insensitive
|
||||||
|
Rem to file names, and "make install" will do nothing if Make
|
||||||
|
Rem finds a file called `install'.
|
||||||
|
if exist INSTALL ren INSTALL INSTALL.txt
|
||||||
|
|
||||||
|
Rem Set SHELL to a sane default or some configure tests stop working
|
||||||
|
Rem if the package is configured across partitions.
|
||||||
|
if not "%SHELL%" == "" goto HomeName
|
||||||
|
set SHELL=/bin/sh
|
||||||
|
if not "%SHELL%" == "/bin/sh" goto SmallEnv
|
||||||
|
echo No SHELL found in the environment, using default value
|
||||||
|
|
||||||
|
:HomeName
|
||||||
|
Rem Set HOME to a sane default so configure stops complaining.
|
||||||
|
if not "%HOME%" == "" goto HostName
|
||||||
|
set HOME=%XSRC%/djgpp
|
||||||
|
if not "%HOME%" == "%XSRC%/djgpp" goto SmallEnv
|
||||||
|
echo No HOME found in the environment, using default value
|
||||||
|
|
||||||
|
:HostName
|
||||||
|
Rem Set HOSTNAME so it shows in config.status
|
||||||
|
if not "%HOSTNAME%" == "" goto hostdone
|
||||||
|
if "%windir%" == "" goto msdos
|
||||||
|
set OS=MS-Windows
|
||||||
|
if not "%OS%" == "MS-Windows" goto SmallEnv
|
||||||
|
goto haveos
|
||||||
|
:msdos
|
||||||
|
set OS=MS-DOS
|
||||||
|
if not "%OS%" == "MS-DOS" goto SmallEnv
|
||||||
|
:haveos
|
||||||
|
if not "%USERNAME%" == "" goto haveuname
|
||||||
|
if not "%USER%" == "" goto haveuser
|
||||||
|
echo No USERNAME and no USER found in the environment, using default values
|
||||||
|
set HOSTNAME=Unknown PC
|
||||||
|
if not "%HOSTNAME%" == "Unknown PC" goto SmallEnv
|
||||||
|
goto userdone
|
||||||
|
:haveuser
|
||||||
|
set HOSTNAME=%USER%'s PC
|
||||||
|
if not "%HOSTNAME%" == "%USER%'s PC" goto SmallEnv
|
||||||
|
goto userdone
|
||||||
|
:haveuname
|
||||||
|
set HOSTNAME=%USERNAME%'s PC
|
||||||
|
if not "%HOSTNAME%" == "%USERNAME%'s PC" goto SmallEnv
|
||||||
|
:userdone
|
||||||
|
set _HOSTNAME=%HOSTNAME%, %OS%
|
||||||
|
if not "%_HOSTNAME%" == "%HOSTNAME%, %OS%" goto SmallEnv
|
||||||
|
set HOSTNAME=%_HOSTNAME%
|
||||||
|
:hostdone
|
||||||
|
set _HOSTNAME=
|
||||||
|
set OS=
|
||||||
|
|
||||||
|
Rem install-sh is required by the configure script but clashes with the
|
||||||
|
Rem various Makefile install-foo targets, so we MUST have it before the
|
||||||
|
Rem script runs and rename it afterwards
|
||||||
|
test -f %XSRC%/install-sh
|
||||||
|
if not errorlevel 1 goto NoRen0
|
||||||
|
test -f %XSRC%/install-sh.sh
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/install-sh.sh %XSRC%/install-sh
|
||||||
|
:NoRen0
|
||||||
|
|
||||||
|
if "%NLS%" == "disabled" goto WithoutNLS
|
||||||
|
|
||||||
|
:WithNLS
|
||||||
|
Rem Check for the needed libraries and binaries.
|
||||||
|
test -x /dev/env/DJDIR/bin/msgfmt.exe
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
test -x /dev/env/DJDIR/bin/xgettext.exe
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
test -f /dev/env/DJDIR/include/libcharset.h
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
test -f /dev/env/DJDIR/lib/libcharset.a
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
test -f /dev/env/DJDIR/include/iconv.h
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
test -f /dev/env/DJDIR/lib/libiconv.a
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
test -f /dev/env/DJDIR/include/libintl.h
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
test -f /dev/env/DJDIR/lib/libintl.a
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
|
||||||
|
Rem Recreate the files in the %XSRC%/po subdir with our ported tools.
|
||||||
|
redir -e /dev/null rm %XSRC%/po/*.gmo
|
||||||
|
redir -e /dev/null rm %XSRC%/po/bison.pot
|
||||||
|
redir -e /dev/null rm %XSRC%/po/cat-id-tbl.c
|
||||||
|
redir -e /dev/null rm %XSRC%/po/stamp-cat-id
|
||||||
|
|
||||||
|
Rem Update the arguments file for the configure script.
|
||||||
|
Rem We prefer without-included-gettext because libintl.a from gettext package
|
||||||
|
Rem is the only one that is garanteed to have been ported to DJGPP.
|
||||||
|
echo --enable-nls --without-included-gettext >> arguments
|
||||||
|
goto ConfigurePackage
|
||||||
|
|
||||||
|
:MissingNLSTools
|
||||||
|
echo Needed libs/tools for NLS not found. Configuring without NLS.
|
||||||
|
:WithoutNLS
|
||||||
|
Rem Update the arguments file for the configure script.
|
||||||
|
echo --disable-nls >> arguments
|
||||||
|
|
||||||
|
:ConfigurePackage
|
||||||
|
echo Running the ./configure script...
|
||||||
|
sh ./configure @arguments
|
||||||
|
if errorlevel 1 goto CfgError
|
||||||
|
rm arguments
|
||||||
|
echo Done.
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:lalr1_ccFileError
|
||||||
|
echo ./data/lalr1.cc file editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:glr_ccFileError
|
||||||
|
echo ./data/glr.cc file editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:location_ccFileError
|
||||||
|
echo ./data/location.cc file editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:calcxxFileError
|
||||||
|
echo ./examples/calcxx file editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:ScannerFileError
|
||||||
|
echo ./scanner file editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:SedError
|
||||||
|
echo ./configure script editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:SedError2
|
||||||
|
echo ./config.hin editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:CfgError
|
||||||
|
echo ./configure script exited abnormally!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:SmallEnv
|
||||||
|
echo Your environment size is too small. Enlarge it and run me again.
|
||||||
|
echo Configuration NOT done!
|
||||||
|
|
||||||
|
:End
|
||||||
|
test -f %XSRC%/install-sh.sh
|
||||||
|
if not errorlevel 1 goto NoRen1
|
||||||
|
test -f %XSRC%/install-sh
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/install-sh %XSRC%/install-sh.sh
|
||||||
|
:NoRen1
|
||||||
|
if "%SHELL%" == "/bin/sh" set SHELL=
|
||||||
|
if "%HOME%" == "%XSRC%/djgpp" set HOME=
|
||||||
|
set CONFIG_SITE=
|
||||||
|
set HOSTNAME=
|
||||||
|
set NLS=
|
||||||
|
set XSRC=
|
||||||
@@ -0,0 +1,164 @@
|
|||||||
|
# DJGPP specific configuration file.
|
||||||
|
# Sed script for additional DJGPP specific editing
|
||||||
|
# of the configure script generated by autoconf 2.57.
|
||||||
|
|
||||||
|
|
||||||
|
# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
# Additional editing of Makefiles
|
||||||
|
/(echo[ ]*':t/ a\
|
||||||
|
# DJGPP specific Makefile changes.\
|
||||||
|
/^aliaspath * *=/s,:,";",g;t t\
|
||||||
|
/TEXINPUTS=/s,:,";",g;t t\
|
||||||
|
/PATH=/s,:,";",g;t t\
|
||||||
|
s,\\.deps,_deps,g;t t\
|
||||||
|
s,\\.new\\.,_new.,g;t t\
|
||||||
|
s,\\.old\\.,_old.,g;t t\
|
||||||
|
s,c++\\.at,cxx.at,g;t t\
|
||||||
|
s,c++\\.m4,cxx.m4,g;t t\
|
||||||
|
s,calc++,calcxx,g;t t\
|
||||||
|
s,scan-gram-c,c-scan-gram,g;t t\
|
||||||
|
s,scan-skel-c,c-scan-skel,g;t t\
|
||||||
|
s,Makefile\\.in\\.in,Makefile.in-in,g;t t\
|
||||||
|
s,Makefile\\.am\\.in,Makefile.am-in,g;t t\
|
||||||
|
s,(MAKEINFOFLAGS),& --no-split,\
|
||||||
|
/^install-info-am:/,/^$/ {\
|
||||||
|
/@list=/ s,\\\$(INFO_DEPS),& bison.i,\
|
||||||
|
/@for *file/ s,\\\$(INFO_DEPS),& bison.i,\
|
||||||
|
s,file-\\[0-9\\]\\[0-9\\],& \\$\\$file[0-9] \\$\\$file[0-9][0-9],\
|
||||||
|
}\
|
||||||
|
/^\\.y\\.c:/,/^$/ {\
|
||||||
|
/\\\$(YACCCOMPILE)/ {\
|
||||||
|
a\\\
|
||||||
|
-@test -f y.tab.c && mv -f y.tab.c y_tab.c\\\
|
||||||
|
-@test -f y.tab.h && mv -f y.tab.h y_tab.h\
|
||||||
|
}\
|
||||||
|
}\
|
||||||
|
/^libbison.a:/ i\\\
|
||||||
|
\\$(top_srcdir)/djgpp/subpipe.c: \\$(top_srcdir)/djgpp/subpipe.h\\\
|
||||||
|
subpipe.o: \\$(top_srcdir)/djgpp/subpipe.c \\$(top_srcdir)/djgpp/subpipe.h\\\
|
||||||
|
\\$(COMPILE) -c \\$<\
|
||||||
|
/^yacc:/ i\\\
|
||||||
|
yacc.bat:\\\
|
||||||
|
echo "bison\\$(EXEEXT) -y %1 %2 %3 %4 %5 %6 %7 %8 %9" >\\$@\
|
||||||
|
/^bin_SCRIPTS =/s/$/ yacc.bat/\
|
||||||
|
/^MOSTLYCLEANFILES = yacc/s/$/ yacc.bat/
|
||||||
|
|
||||||
|
|
||||||
|
# Makefile.in.in is renamed to Makefile.in-in.
|
||||||
|
/ac_config_files=/,/_ACEOF/ {
|
||||||
|
s|po/Makefile\.in|&:po/Makefile.in-in|
|
||||||
|
}
|
||||||
|
/CONFIG_FILES=/ s|po/Makefile\.in|&:po/Makefile.in-in|2
|
||||||
|
|
||||||
|
# We always use _deps and _libs instead of .deps and .libs, because
|
||||||
|
# the latter is an invalid name on 8+3 MS-DOS file system. This makes
|
||||||
|
# the generated Makefiles good for every DJGPP installation, not only
|
||||||
|
# the one where the package was configured (which could happen to be
|
||||||
|
# a Windows box, where leading dots in file names are allowed).
|
||||||
|
s,\.deps,_deps,g
|
||||||
|
s,\.libs,_libs,g
|
||||||
|
/^rmdir[ ]*\.tst/ i\
|
||||||
|
am__leading_dot=_
|
||||||
|
|
||||||
|
# Replace (command) > /dev/null with `command > /dev/null`, since
|
||||||
|
# parenthesized commands always return zero status in the ported Bash,
|
||||||
|
# even if the named command doesn't exist
|
||||||
|
/if ([^|;`]*null/{
|
||||||
|
s,(,`,
|
||||||
|
s,),,
|
||||||
|
/null[ ]*2>&1/ s,2>&1,&`,
|
||||||
|
/null.*null/ s,null.*null,&`,
|
||||||
|
/null.*null/ !{
|
||||||
|
/null[ ]*2>&1/ !s,null,&`,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# DOS-style absolute file names should be supported as well
|
||||||
|
/\*) top_srcdir=/s,/\*,[\\\\/]* | ?:[\\\\/]*,
|
||||||
|
|
||||||
|
# Prevent the spliting of subs.sed.
|
||||||
|
# The sed script: subs.sed is split into 48 lines long files.
|
||||||
|
# This will produce sed scripts called subs-$ac_sed_frag.sed, where
|
||||||
|
# $ac_sed_frag is some unique number. This will not work if the splited
|
||||||
|
# sed script contains a multiple line sed command at line #48. In this
|
||||||
|
# case the first part of the multiple line sed command will be written
|
||||||
|
# at the end of one particular subs-$ac_sed_frag.sed and the rest of the
|
||||||
|
# sed command will be written at the begining of the next subs-$ac_sed_frag.sed
|
||||||
|
# making both sed script useless.
|
||||||
|
# This matches the configure script produced by Autoconf 2.57
|
||||||
|
/ac_max_sed_lines=[0-9]/ s,=.*$,=`sed -n "$=" $tmp/subs.sed`,
|
||||||
|
|
||||||
|
# The following two items are changes needed for configuring
|
||||||
|
# and compiling across partitions.
|
||||||
|
# 1) The given srcdir value is always translated from the
|
||||||
|
# "x:" syntax into "/dev/x" syntax while we run configure.
|
||||||
|
/^[ ]*-srcdir=\*.*$/ a\
|
||||||
|
ac_optarg=`echo "$ac_optarg" | sed "s,^\\([A-Za-z]\\):,/dev/\\1,"`
|
||||||
|
/set X `ls -Lt \$srcdir/ i\
|
||||||
|
if `echo $srcdir | grep "^/dev/" - > /dev/null`; then\
|
||||||
|
srcdir=`echo "$srcdir" | sed -e "s%^/dev/%%" -e "s%/%:/%"`\
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Autoconf 2.52e generated configure scripts
|
||||||
|
# write absolute paths into Makefiles and bison.in
|
||||||
|
# making them useless for DJGPP installations for
|
||||||
|
# which the package has not been configured for.
|
||||||
|
/MISSING=/,/^$/ {
|
||||||
|
/^fi$/ a\
|
||||||
|
am_missing_run=`echo "$am_missing_run" | sed 's%/dev.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*%${top_srcdir}%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*%${top_srcdir}%'`
|
||||||
|
}
|
||||||
|
/^install_sh=/a\
|
||||||
|
install_sh=`echo "$install_sh" | sed 's%/dev.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*%${top_srcdir}%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*%${top_srcdir}%'`
|
||||||
|
|
||||||
|
# This will only work if the assumption that the
|
||||||
|
# testsuite is ran from the following path:
|
||||||
|
# ${top_srcdir}/tests/testsuite.dir
|
||||||
|
# holds. The explicit names are of no importance.
|
||||||
|
# ../../. == ${top_srcdir}
|
||||||
|
/\.)[ ]*ac_abs_builddir=/,/^esac$/ {
|
||||||
|
/^esac$/ a\
|
||||||
|
ac_abs_builddir=`echo "$ac_abs_builddir" | sed "s%/dev.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*/[^/]*%../../.%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*/[^/]*%../../.%"`
|
||||||
|
}
|
||||||
|
/\.)[ ]*ac_abs_top_builddir=/,/^esac$/ {
|
||||||
|
/^esac$/ a\
|
||||||
|
ac_abs_top_builddir=`echo "$ac_abs_top_builddir" | sed "s%/dev.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*/[^/]*%../../../%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*/[^/]*%../../../%"`
|
||||||
|
}
|
||||||
|
/\.)[ ]*ac_abs_srcdir=/,/^esac$/ {
|
||||||
|
/^esac$/ a\
|
||||||
|
ac_abs_srcdir=`echo "$ac_abs_srcdir" | sed "s%/dev.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*/[^/]*%../../.%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*/[^/]*%../../.%"`
|
||||||
|
}
|
||||||
|
/\.)[ ]*ac_abs_top_srcdir=/,/^esac$/ {
|
||||||
|
/^esac$/ a\
|
||||||
|
ac_abs_top_srcdir=`echo "$ac_abs_top_srcdir" | sed "s%/dev.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*/[^/]*%../../../%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*/[^/]*%../../../%"`
|
||||||
|
}
|
||||||
|
|
||||||
|
# Add DJGPP version information.
|
||||||
|
/^#define VERSION/ s/\$VERSION/& (DJGPP port (r1))/
|
||||||
|
|
||||||
|
# We need makeinfo to make the html formated docs.
|
||||||
|
/\$am_missing_run[ ]*makeinfo/ s,\$am_missing_run,,
|
||||||
|
|
||||||
|
# The path to the FORTRAN compiler and libraries
|
||||||
|
# shall contain no absolute path reference so it
|
||||||
|
# will be good for all djgpp installations.
|
||||||
|
/^FLIBS="\$ac_cv_flibs"/ i\
|
||||||
|
ac_djgpp_path=`echo "$DJDIR" | sed 's%\\\\\\%/%g' | tr $as_cr_LETTERS $as_cr_letters`\
|
||||||
|
ac_cv_flibs=`echo "$ac_cv_flibs" | sed "s%-L$ac_djgpp_path%-L/dev/env/DJDIR%g"`
|
||||||
|
|
||||||
|
# The following is not a valid DOS file name
|
||||||
|
s/calc++/calcxx/g
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
# This is the config.site file for configuring GNU packages
|
||||||
|
# which are to be built with DJGPP tools.
|
||||||
|
|
||||||
|
# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software Foundation,
|
||||||
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
|
||||||
|
# Include the djgpp subdirectory in PATH, so that getconf is found
|
||||||
|
PATH="$srcdir/djgpp:$PATH"
|
||||||
|
|
||||||
|
# These two variables are required, otherwise looking for
|
||||||
|
# programs along the PATH will not work.
|
||||||
|
PATH_SEPARATOR=:
|
||||||
|
PATH_EXPAND=y
|
||||||
|
|
||||||
|
# This is required in for "test -f foo" to find foo.exe
|
||||||
|
export TEST_FINDS_EXE=y
|
||||||
|
|
||||||
|
# The root of the DJGPP tree serves as the default prefix
|
||||||
|
test "x$prefix" = xNONE && prefix='/dev/env/DJDIR'
|
||||||
|
|
||||||
|
# This is required for config.status script to be run, since
|
||||||
|
# ./configure runs it by invoking ${CONFIG_SHELL-/bin/sh}
|
||||||
|
CONFIG_SHELL=${CONFIG_SHELL='sh'}
|
||||||
|
|
||||||
|
# These are set here so the generated Makefile's will be good
|
||||||
|
# for every DJGPP installation, not only the one where the
|
||||||
|
# package was configured.
|
||||||
|
# $INSTALL must be an absolute path name, otherwise config.status
|
||||||
|
# will try to prepend ./ and ../ to it when it goes into subdirs.
|
||||||
|
INSTALL=${INSTALL='/dev/env/DJDIR/bin/ginstall -c'}
|
||||||
|
RANLIB=${RANLIB='ranlib'}
|
||||||
|
GMSGFMT=${GMSGFMT='/dev/env/DJDIR/bin/msgfmt'}
|
||||||
|
MSGFMT=${MSGFMT='/dev/env/DJDIR/bin/msgfmt'}
|
||||||
|
XGETTEXT=${XGETTEXT='/dev/env/DJDIR/bin/xgettext'}
|
||||||
|
AWK=${AWK='gawk'}
|
||||||
|
|
||||||
|
# A sane default for emacs.
|
||||||
|
ac_cv_path_EMACS=${EMACS='/dev/env/DJDIR/gnu/emacs/bin/emacs'}
|
||||||
|
|
||||||
|
# A sane default for m4.
|
||||||
|
ac_cv_path_M4=${M4='/dev/env/DJDIR/bin/m4'}
|
||||||
|
|
||||||
|
# A sane default for grep.
|
||||||
|
ac_cv_path_GREP=${GREP='/dev/env/DJDIR/bin/grep'}
|
||||||
|
|
||||||
|
# A sane default for egrep.
|
||||||
|
ac_cv_path_EGREP=${EGREP='/dev/env/DJDIR/bin/egrep'}
|
||||||
|
|
||||||
|
# A sane default for fgrep.
|
||||||
|
ac_cv_path_FGREP=${FGREP='/dev/env/DJDIR/bin/fgrep'}
|
||||||
|
|
||||||
|
# A sane default for sed.
|
||||||
|
ac_cv_path_SED=${SED='/dev/env/DJDIR/bin/sed'}
|
||||||
|
|
||||||
|
# These are set here so the generated libtool will be good
|
||||||
|
# for every DJGPP installation, not only the one where the
|
||||||
|
# package was configured.
|
||||||
|
NM=${NM='nm'}
|
||||||
|
LD=${LD='ld'}
|
||||||
|
|
||||||
|
# Force the test for 'ln -s' to report 'cp -pf'.
|
||||||
|
ac_cv_prog_LN_S='cp -pf'
|
||||||
|
|
||||||
|
# There is no fork and vfork functionality.
|
||||||
|
ac_cv_func_fork=no
|
||||||
|
ac_cv_func_vfork=no
|
||||||
|
ac_cv_func_pipe=no
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
# sed script for DJGPP specific editing of config.hin
|
||||||
|
|
||||||
|
# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software Foundation,
|
||||||
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
|
||||||
|
$ a\
|
||||||
|
\
|
||||||
|
\
|
||||||
|
/* DJGPP specific defines. */\
|
||||||
|
\
|
||||||
|
#include <unistd.h>\
|
||||||
|
#define TAB_EXT ((pathconf(NULL, _PC_NAME_MAX) > 12) ? ".tab" : "_tab")\
|
||||||
|
#define OUTPUT_EXT ((pathconf(NULL, _PC_NAME_MAX) > 12) ? ".output" : ".out")\
|
||||||
|
\
|
||||||
|
#define DEFAULT_TMPDIR "/dev/env/DJDIR/tmp"
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
@echo off
|
||||||
|
Rem
|
||||||
|
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
|
||||||
|
Rem format, or else stock DOS/Windows shells will refuse to run it.
|
||||||
|
Rem
|
||||||
|
Rem This batch file unpacks the Bison distribution while simultaneously
|
||||||
|
Rem renaming some of the files whose names are invalid on DOS or conflict
|
||||||
|
Rem with other file names after truncation to DOS 8+3 namespace.
|
||||||
|
Rem
|
||||||
|
Rem Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||||
|
Rem
|
||||||
|
Rem This program is free software; you can redistribute it and/or modify
|
||||||
|
Rem it under the terms of the GNU General Public License as published by
|
||||||
|
Rem the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
Rem any later version.
|
||||||
|
Rem
|
||||||
|
Rem This program is distributed in the hope that it will be useful,
|
||||||
|
Rem but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
Rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
Rem GNU General Public License for more details.
|
||||||
|
Rem
|
||||||
|
Rem You should have received a copy of the GNU General Public License
|
||||||
|
Rem along with this program; if not, write to the Free Software Foundation,
|
||||||
|
Rem Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
Rem
|
||||||
|
Rem
|
||||||
|
Rem Invoke like this:
|
||||||
|
Rem
|
||||||
|
Rem djunpack bison-XYZ.tar.gz
|
||||||
|
Rem or
|
||||||
|
Rem djunpack bison-XYZ.tar.bz2
|
||||||
|
Rem
|
||||||
|
Rem where XYZ is the version number. If the argument includes leading
|
||||||
|
Rem directories, it MUST use backslashes, not forward slashes.
|
||||||
|
Rem
|
||||||
|
|
||||||
|
set ENVIRONMENT_SIZE_TEST_STRING=ENVIRONMENT_SIZE_TEST_STRING
|
||||||
|
if "%ENVIRONMENT_SIZE_TEST_STRING%"=="ENVIRONMENT_SIZE_TEST_STRING" GoTo EnvOk
|
||||||
|
Rem If their environment space is too small, re-exec with a larger one
|
||||||
|
command.com /e:4096 /c %0 %1
|
||||||
|
GoTo End
|
||||||
|
|
||||||
|
:EnvOk
|
||||||
|
set ENVIRONMENT_SIZE_TEST_STRING=
|
||||||
|
if "%1" == "" GoTo NoArgument
|
||||||
|
if not exist %1 GoTo NoArchive
|
||||||
|
Rem Extract top src dir from archive file.
|
||||||
|
djtar -t %1 > top_src.dir
|
||||||
|
Rem The following uses a feature of COPY whereby it does not copy
|
||||||
|
Rem empty files. We need that because the previous line will create
|
||||||
|
Rem an empty fnchange.tmp even if the command failed for some reason.
|
||||||
|
copy top_src.dir junk.tmp > nul
|
||||||
|
if not exist junk.tmp GoTo NoDjTar
|
||||||
|
del junk.tmp
|
||||||
|
sed "1{s/^.*bison-/djtar -x -p -o bison-/;s|$|djgpp/fnchange.lst %%1 > fnchange.tmp|};2,$d" top_src.dir > ext_list.bat
|
||||||
|
Rem See the comment above about the reason for using COPY.
|
||||||
|
copy ext_list.bat junk.tmp > nul
|
||||||
|
if not exist junk.tmp GoTo NoSed
|
||||||
|
del junk.tmp
|
||||||
|
Rem Extract fnchange.lst from archive.
|
||||||
|
call ext_list.bat %1
|
||||||
|
del ext_list.bat
|
||||||
|
sed "1{s|^.*bison-|s/@V@/bison-|;s|$|g|};2,$d" top_src.dir > version.sed
|
||||||
|
sed -f version.sed < fnchange.tmp > fnchange.lst
|
||||||
|
del version.sed
|
||||||
|
del fnchange.tmp
|
||||||
|
del top_src.dir
|
||||||
|
Rem unpack the source distribution
|
||||||
|
djtar -x -n fnchange.lst %1
|
||||||
|
del fnchange.lst
|
||||||
|
GoTo End
|
||||||
|
|
||||||
|
:NoSed
|
||||||
|
del junk.tmp
|
||||||
|
echo FAIL: Sed is not available.
|
||||||
|
GoTo End
|
||||||
|
:NoDjTar
|
||||||
|
del junk.tmp
|
||||||
|
echo FAIL: DJTAR is not available or no fnchange.lst file in %1.
|
||||||
|
GoTo End
|
||||||
|
:NoArchive
|
||||||
|
echo FAIL: the file %1 does not seem to exist.
|
||||||
|
echo Remember that %1 cannot use forward slashes, only backslashes.
|
||||||
|
GoTo End
|
||||||
|
:NoArgument
|
||||||
|
echo FAIL: no archive file has been specified.
|
||||||
|
echo Remember that the file name cannot use forward slashes, only backslashes.
|
||||||
|
:End
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
@V@/src/scan-gram-c.c @V@/src/c-scan-gram.c
|
||||||
|
@V@/src/scan-skel-c.c @V@/src/c-scan-skel.c
|
||||||
+285
@@ -0,0 +1,285 @@
|
|||||||
|
/* Subprocesses with pipes.
|
||||||
|
|
||||||
|
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
/* Written by Juan Manuel Guerrero <[email protected]>. */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "subpipe.h"
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <process.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include "xalloc.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef STDIN_FILENO
|
||||||
|
# define STDIN_FILENO 0
|
||||||
|
#endif
|
||||||
|
#ifndef STDOUT_FILENO
|
||||||
|
# define STDOUT_FILENO 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include "error.h"
|
||||||
|
|
||||||
|
#include "gettext.h"
|
||||||
|
#define _(Msgid) gettext (Msgid)
|
||||||
|
|
||||||
|
|
||||||
|
/* Initialize this module. */
|
||||||
|
|
||||||
|
|
||||||
|
static int old_stdin;
|
||||||
|
static int old_stdout;
|
||||||
|
static char **arguments;
|
||||||
|
static char tmp_file_name[2][L_tmpnam];
|
||||||
|
|
||||||
|
#define remove_tmp_file(fd, name) \
|
||||||
|
do { \
|
||||||
|
close ((fd)); \
|
||||||
|
if (unlink ((name))) \
|
||||||
|
error (EXIT_FAILURE, 0, _("removing of `%s' failed"), (name)); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
init_subpipe(void)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
strcpy(tmp_file_name[0], "/dev/env/TMPDIR/bnXXXXXX");
|
||||||
|
fd = mkstemp(tmp_file_name[0]);
|
||||||
|
if (fd < 0)
|
||||||
|
error(EXIT_FAILURE, 0, _("creation of a temporary file failed"));
|
||||||
|
close (fd);
|
||||||
|
|
||||||
|
strcpy(tmp_file_name[1], "/dev/env/TMPDIR/bnXXXXXX");
|
||||||
|
fd = mkstemp(tmp_file_name[1]);
|
||||||
|
if (fd < 0)
|
||||||
|
error(EXIT_FAILURE, 0, _("creation of a temporary file failed"));
|
||||||
|
close (fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Create a subprocess that is run as a filter. ARGV is the
|
||||||
|
NULL-terminated argument vector for the subprocess. Store read and
|
||||||
|
write file descriptors for communication with the subprocess into
|
||||||
|
FD[0] and FD[1]: input meant for the process can be written into
|
||||||
|
FD[0], and output from the process can be read from FD[1]. Return
|
||||||
|
the subprocess id.
|
||||||
|
|
||||||
|
Because DOS has neither fork nor pipe functionality to run the subprocess
|
||||||
|
as a filter, the filter is reproduced using temporary files. First bison's
|
||||||
|
stdout is redirected to a temporary file. After bison has produced all of
|
||||||
|
is output, this file is closed and connected to m4's stdin. All m4's output
|
||||||
|
is redirected from m4's stdout to a second temporary file and reopened as
|
||||||
|
bison's stdin. */
|
||||||
|
|
||||||
|
pid_t
|
||||||
|
create_subpipe(char const *const *argv, int fd[2])
|
||||||
|
{
|
||||||
|
int argc;
|
||||||
|
int from_in_fd; /* pipe from bison to m4. */
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
|
|
||||||
|
pid = getpid();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Save original stdin and stdout
|
||||||
|
* for later restauration.
|
||||||
|
*/
|
||||||
|
old_stdin = dup(STDIN_FILENO);
|
||||||
|
if (old_stdin < 0)
|
||||||
|
error(EXIT_FAILURE, 0, _("saving stdin failed"));
|
||||||
|
|
||||||
|
old_stdout = dup(STDOUT_FILENO);
|
||||||
|
if (old_stdout < 0)
|
||||||
|
error(EXIT_FAILURE, 0, _("saving stdout failed"));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Save argv for later use.
|
||||||
|
*/
|
||||||
|
for (argc = 0; argv[argc]; argc++)
|
||||||
|
;
|
||||||
|
argc++;
|
||||||
|
arguments = xmalloc(argc * sizeof(arguments[0]));
|
||||||
|
for (argc = 0; argv[argc]; argc++)
|
||||||
|
{
|
||||||
|
arguments[argc] = xmalloc((strlen(argv[argc]) + 1) * sizeof(arguments[0][0]));
|
||||||
|
strcpy(arguments[argc], argv[argc]);
|
||||||
|
}
|
||||||
|
arguments[argc] = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* All bison's output will be gathered in this temporary file
|
||||||
|
* and will be redirected to m4's stdin.
|
||||||
|
*/
|
||||||
|
from_in_fd = open(tmp_file_name[0], O_WRONLY | O_CREAT | O_TRUNC, S_IWUSR);
|
||||||
|
if (from_in_fd < 0)
|
||||||
|
error(EXIT_FAILURE, 0, _("opening of tmpfile failed"));
|
||||||
|
if (dup2(from_in_fd, STDOUT_FILENO) < 0)
|
||||||
|
{
|
||||||
|
remove_tmp_file(from_in_fd, tmp_file_name[0]);
|
||||||
|
error(EXIT_FAILURE, 0, _("redirecting bison's stdout to the temporary file failed"));
|
||||||
|
}
|
||||||
|
close(from_in_fd);
|
||||||
|
|
||||||
|
|
||||||
|
fd[0] = STDOUT_FILENO;
|
||||||
|
return pid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* A signal handler that just records that a signal has happened. */
|
||||||
|
static int child_interrupted;
|
||||||
|
|
||||||
|
static void
|
||||||
|
signal_catcher(int signo)
|
||||||
|
{
|
||||||
|
child_interrupted++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
end_of_output_subpipe(pid_t pid, int fd[2])
|
||||||
|
{
|
||||||
|
char *program;
|
||||||
|
int from_out_fd = open(tmp_file_name[0], O_RDONLY, S_IRUSR); /* pipe from bison to m4. */
|
||||||
|
int to_in_fd = open(tmp_file_name[1], O_WRONLY | O_CREAT | O_TRUNC, S_IWUSR); /* pipe from m4 to bison. */
|
||||||
|
int status;
|
||||||
|
void (*previous_handler)(int);
|
||||||
|
|
||||||
|
|
||||||
|
program = strrchr(arguments[0], '/');
|
||||||
|
if (program)
|
||||||
|
program++;
|
||||||
|
else
|
||||||
|
program = arguments[0];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Redirect bison's output to m4's stdin.
|
||||||
|
*/
|
||||||
|
if (from_out_fd < 0)
|
||||||
|
error(EXIT_FAILURE, 0, _("opening of tmpfile failed"));
|
||||||
|
if (dup2(from_out_fd, STDIN_FILENO) < 0)
|
||||||
|
{
|
||||||
|
remove_tmp_file(from_out_fd, tmp_file_name[0]);
|
||||||
|
error(EXIT_FAILURE, 0, _("redirecting m4's stdin from the temporary file failed"));
|
||||||
|
}
|
||||||
|
close(from_out_fd);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* All m4's output will be gathered in this temporary file
|
||||||
|
* and will be redirected to bison's stdin.
|
||||||
|
*/
|
||||||
|
if (to_in_fd < 0)
|
||||||
|
{
|
||||||
|
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||||
|
error(EXIT_FAILURE, 0, _("opening of a temporary file failed"));
|
||||||
|
}
|
||||||
|
if (dup2(to_in_fd, STDOUT_FILENO) < 0)
|
||||||
|
{
|
||||||
|
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||||
|
remove_tmp_file(to_in_fd, tmp_file_name[1]);
|
||||||
|
error(EXIT_FAILURE, 0, _("redirecting m4's stdout to a temporary file failed"));
|
||||||
|
}
|
||||||
|
close(to_in_fd);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Run m4.
|
||||||
|
*/
|
||||||
|
child_interrupted = 0;
|
||||||
|
errno = 0;
|
||||||
|
previous_handler = signal(SIGINT, signal_catcher);
|
||||||
|
status = spawnvp(P_WAIT, program, arguments);
|
||||||
|
signal(SIGINT, previous_handler);
|
||||||
|
if (child_interrupted)
|
||||||
|
{
|
||||||
|
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||||
|
remove_tmp_file(STDOUT_FILENO, tmp_file_name[1]);
|
||||||
|
error(EXIT_FAILURE, 0, _("subsidiary program `%s' interrupted"), program);
|
||||||
|
}
|
||||||
|
if (status)
|
||||||
|
{
|
||||||
|
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||||
|
remove_tmp_file(STDOUT_FILENO, tmp_file_name[1]);
|
||||||
|
error(EXIT_FAILURE, 0, _(errno == ENOENT
|
||||||
|
? "subsidiary program `%s' not found"
|
||||||
|
: status < 1
|
||||||
|
? "subsidiary program `%s' failed"
|
||||||
|
: "subsidiary program `%s' failed (status=%i, errno=%i)"), program, status, errno);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Redirect m4's output to bison's stdin.
|
||||||
|
*/
|
||||||
|
if (dup2(old_stdout, STDOUT_FILENO) < 0)
|
||||||
|
error(EXIT_FAILURE, 0, "restore of bison's stdout failed");
|
||||||
|
close(old_stdout);
|
||||||
|
to_in_fd = open(tmp_file_name[1], O_RDONLY, S_IRUSR); /* pipe from m4 to bison. */
|
||||||
|
if (to_in_fd < 0)
|
||||||
|
{
|
||||||
|
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||||
|
error(EXIT_FAILURE, 0, _("opening of tmpfile failed"));
|
||||||
|
}
|
||||||
|
if (dup2(to_in_fd, STDIN_FILENO) < 0)
|
||||||
|
{
|
||||||
|
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||||
|
remove_tmp_file(to_in_fd, tmp_file_name[1]);
|
||||||
|
error(EXIT_FAILURE, -1, "dup2");
|
||||||
|
error(EXIT_FAILURE, 0, _("redirecting bison's stdin from the temporary file failed"));
|
||||||
|
}
|
||||||
|
close(to_in_fd);
|
||||||
|
|
||||||
|
|
||||||
|
fd[1] = STDIN_FILENO;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Free resources, unlink temporary files and restore stdin and stdout. */
|
||||||
|
|
||||||
|
void
|
||||||
|
reap_subpipe(pid_t pid, char const *program)
|
||||||
|
{
|
||||||
|
int argc;
|
||||||
|
|
||||||
|
for (argc = 0; arguments[argc]; argc++)
|
||||||
|
free(arguments[argc]);
|
||||||
|
free(arguments);
|
||||||
|
|
||||||
|
if (unlink(tmp_file_name[0]))
|
||||||
|
error(EXIT_FAILURE, 0, _("removing of `%s' failed"), tmp_file_name[0]);
|
||||||
|
if (unlink(tmp_file_name[1]))
|
||||||
|
error(EXIT_FAILURE, 0, _("removing of `%s' failed"), tmp_file_name[1]);
|
||||||
|
|
||||||
|
if (dup2(old_stdin, STDIN_FILENO) < 0)
|
||||||
|
error(EXIT_FAILURE, 0, "restore of bison's stdin failed");
|
||||||
|
close(old_stdin);
|
||||||
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
/* quote.h - prototypes for quote.c
|
/* Subprocesses with pipes.
|
||||||
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
Copyright (C) 2005 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2, or (at your option)
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
@@ -13,16 +13,15 @@
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software Foundation,
|
along with this program; if not, write to the Free Software Foundation,
|
||||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
|
/* Written by Juan Manuel Guerrero <[email protected]>. */
|
||||||
|
|
||||||
#ifndef PARAMS
|
#if HAVE_SYS_TYPES_H
|
||||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
# include <sys/types.h>
|
||||||
# define PARAMS(Args) Args
|
|
||||||
# else
|
|
||||||
# define PARAMS(Args) ()
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char const *quote_n PARAMS ((int n, char const *name));
|
void init_subpipe(void);
|
||||||
char const *quote PARAMS ((char const *name));
|
pid_t create_subpipe(char const * const *, int[2]);
|
||||||
|
void end_of_output_subpipe(pid_t, int[2]);
|
||||||
|
void reap_subpipe(pid_t, char const *);
|
||||||
@@ -4,6 +4,7 @@ bison.cp
|
|||||||
bison.cps
|
bison.cps
|
||||||
bison.dvi
|
bison.dvi
|
||||||
bison.fn
|
bison.fn
|
||||||
|
bison.html
|
||||||
bison.ky
|
bison.ky
|
||||||
bison.log
|
bison.log
|
||||||
bison.pdf
|
bison.pdf
|
||||||
|
|||||||
+1087
File diff suppressed because it is too large
Load Diff
@@ -1,109 +0,0 @@
|
|||||||
Frequently Asked Questions about Bison:
|
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
|
||||||
|
|
||||||
Q1. Is Bison Y2K compliant?
|
|
||||||
|
|
||||||
A1. If you're looking for a guarantee or certification, I can't
|
|
||||||
provide it. With a little thought you can answer this one for
|
|
||||||
yourself, though. (Hint: does a parser generator rely on the
|
|
||||||
date or time for anything?) If you're still confused, see
|
|
||||||
http://www.gnu.org/software/year2000.html for more information.
|
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
|
||||||
|
|
||||||
Q2. I can't build Bison because "make" complains that "msgfmt" is not
|
|
||||||
fund. What should I do?
|
|
||||||
|
|
||||||
A2. Like most GNU packages with internationalization support, that
|
|
||||||
feature is turned on by default. If you have problems building
|
|
||||||
in the "po" subdirectory, it indicates that your system's
|
|
||||||
internationalization support is lacking. You can re-configure
|
|
||||||
Bison with "--disable-nls" to turn off this support, or you can
|
|
||||||
install GNU gettext from ftp://ftp.gnu.org/gnu/gettext/ and
|
|
||||||
re-configure Bison. See the file "ABOUT-NLS" for more
|
|
||||||
information.
|
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
|
||||||
|
|
||||||
Q3. I'm having trouble using Bison. Where can I find help?
|
|
||||||
|
|
||||||
A3. First, read the fine manual which comes with bison. Beyond that,
|
|
||||||
you can send mail to <[email protected]>. This mailing list is
|
|
||||||
intended to be populated with people who are willing to answer
|
|
||||||
questions about using and installing Bison. Please keep in mind
|
|
||||||
that (most of) the people on the list have aspects of their lives
|
|
||||||
which are not related to Bison (!), so you may not receive an
|
|
||||||
answer to your question right away. This can be frustrating, but
|
|
||||||
please try not to honk them off; remember that any help they
|
|
||||||
provide is purely voluntary and out of the kindness of their
|
|
||||||
hearts.
|
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
|
||||||
|
|
||||||
Q4. I found a bug. What should I include in the bug report?
|
|
||||||
|
|
||||||
A4. Before you send a bug report, make sure you are using the latest
|
|
||||||
version. Check ftp://ftp.gnu.org/pub/gnu/bison/ or one of its
|
|
||||||
mirrors. Be sure to include the version number in your bug
|
|
||||||
report. If the bug is present in the latest version but not in a
|
|
||||||
previous version, try to determine the most recent version which
|
|
||||||
did not contain the bug.
|
|
||||||
|
|
||||||
If the bug is parser-related, you should include the smallest
|
|
||||||
grammar you can which demonstrates the bug. The grammar file
|
|
||||||
should also be complete (i.e., I should be able to run it through
|
|
||||||
Bison without having to edit or add anything). The smaller and
|
|
||||||
simpler the grammar, the easier it will be to fix the bug.
|
|
||||||
|
|
||||||
Include information about your compilation environment, including
|
|
||||||
your operating system's name and version and your compiler's name
|
|
||||||
and version. If you have trouble compiling, you should also
|
|
||||||
include a transcript of the build session, starting with the
|
|
||||||
invocation of `configure'. Depending on the nature of the bug,
|
|
||||||
you may be asked to send additional files as well (such as
|
|
||||||
`config.h' or `config.cache').
|
|
||||||
|
|
||||||
Patches are most welcome, but not required. That is, do not
|
|
||||||
hesitate to send a bug report just because you can not provide a
|
|
||||||
fix.
|
|
||||||
|
|
||||||
Send bug reports to <[email protected]>.
|
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
|
||||||
|
|
||||||
Q5. Will Bison ever have C++ support?
|
|
||||||
|
|
||||||
A5. Yes, it's in the works. Things are very chaotic right now, but
|
|
||||||
what little information floats around is posted to the bug-bison
|
|
||||||
mailing list. If you're interested in testing C++ support when
|
|
||||||
it becomes available, please consider subscribing to the list,
|
|
||||||
especially if you are willing to beta test other releases as
|
|
||||||
well.
|
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
|
||||||
|
|
||||||
Q6. What is involved in being a beta tester?
|
|
||||||
|
|
||||||
A6. It's not terribly involved. Basically, you would download a test
|
|
||||||
release, compile it, and use it to build and run a parser or two.
|
|
||||||
After that, you would submit either a bug report or a message
|
|
||||||
saying that everything is okay. It is important to report
|
|
||||||
successes as well as failures because test releases eventually
|
|
||||||
become mainstream releases, but only if they are adequately
|
|
||||||
tested. If no one tests, development is essentially halted.
|
|
||||||
|
|
||||||
Beta testers are particularly needed for operating systems to
|
|
||||||
which I do not have access. I currently have easy access to
|
|
||||||
Linux (x86 glibc 2.1), Solaris (SPARC) 2.6 and 2.7, and HP-UX
|
|
||||||
10.20. Reports about other operating systems are especially
|
|
||||||
welcome.
|
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
|
||||||
|
|
||||||
Q7. How do I join the help-bison and bug-bison mailing lists?
|
|
||||||
|
|
||||||
A7. See http://www.gnu.org/ (the section about "GNU mailing lists")
|
|
||||||
for more information.
|
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
|
||||||
+55
-2
@@ -1,14 +1,67 @@
|
|||||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
|
## Copyright (C) 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
## This program is free software; you can redistribute it and/or modify
|
||||||
|
## it under the terms of the GNU General Public License as published by
|
||||||
|
## the Free Software Foundation; either version 2 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
## 02110-1301 USA
|
||||||
|
|
||||||
|
AM_MAKEINFOFLAGS = --no-split
|
||||||
info_TEXINFOS = bison.texinfo
|
info_TEXINFOS = bison.texinfo
|
||||||
man_MANS = bison.1
|
man_MANS = bison.1
|
||||||
bison_TEXINFOS = gpl.texi fdl.texi
|
bison_TEXINFOS = gpl.texi fdl.texi
|
||||||
|
|
||||||
EXTRA_DIST = FAQ bison.1 bison.rnh refcard.tex
|
EXTRA_DIST = bison.1 refcard.tex
|
||||||
|
|
||||||
CLEANFILES = refcard.dvi refcard.log refcard.ps
|
CLEANFILES = refcard.dvi refcard.log refcard.ps bison.fns
|
||||||
|
CLEANDIRS = *.t2d
|
||||||
|
clean-local:
|
||||||
|
rm -rf $(CLEANDIRS)
|
||||||
|
|
||||||
refcard.dvi: refcard.tex
|
refcard.dvi: refcard.tex
|
||||||
tex refcard.tex
|
tex refcard.tex
|
||||||
|
|
||||||
refcard.ps: refcard.dvi
|
refcard.ps: refcard.dvi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## -------------- ##
|
||||||
|
## Doxygenation. ##
|
||||||
|
## -------------- ##
|
||||||
|
|
||||||
|
DOXYGEN = doxygen
|
||||||
|
|
||||||
|
.PHONY: doc html
|
||||||
|
|
||||||
|
doc: html
|
||||||
|
|
||||||
|
html-local: Doxyfile
|
||||||
|
$(DOXYGEN)
|
||||||
|
|
||||||
|
edit = sed -e "s|@ID@|$$Id|" \
|
||||||
|
-e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
|
||||||
|
-e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
|
||||||
|
-e 's,@top_builddir\@,$(top_builddir),g' \
|
||||||
|
-e 's,@top_srcdir\@,$(top_srcdir),g'
|
||||||
|
|
||||||
|
EXTRA_DIST += Doxyfile.in
|
||||||
|
CLEANFILES += Doxyfile
|
||||||
|
# Sed is used to generate Doxyfile from Doxyfile.in instead of
|
||||||
|
# configure, because the former is way faster than the latter.
|
||||||
|
# Moreover, this file is updated whenever ChangeLog is touched: using
|
||||||
|
# sed instead of configure saves us a lot of time.
|
||||||
|
Doxyfile: $(top_srcdir)/ChangeLog $(srcdir)/Doxyfile.in
|
||||||
|
Id=`grep '^\$$Id' $(top_srcdir)/ChangeLog`; \
|
||||||
|
$(edit) $(srcdir)/Doxyfile.in >Doxyfile
|
||||||
|
|
||||||
|
CLEANDIRS += html latex
|
||||||
|
|||||||
+40
-42
@@ -59,6 +59,11 @@ bison \- GNU Project parser generator (yacc replacement)
|
|||||||
.B \-\-fixed-output-files
|
.B \-\-fixed-output-files
|
||||||
]
|
]
|
||||||
file
|
file
|
||||||
|
.br
|
||||||
|
.B yacc
|
||||||
|
[
|
||||||
|
.I "similar options and operands"
|
||||||
|
]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.I Bison
|
.I Bison
|
||||||
is a parser generator in the style of
|
is a parser generator in the style of
|
||||||
@@ -75,10 +80,10 @@ Unlike
|
|||||||
.IR yacc ,
|
.IR yacc ,
|
||||||
the generated files do not have fixed names, but instead use the prefix
|
the generated files do not have fixed names, but instead use the prefix
|
||||||
of the input file.
|
of the input file.
|
||||||
Moreover, if you need to put
|
Moreover, if you need to put
|
||||||
.IR C++
|
.I C++
|
||||||
code in the input file, you can end his name by a C++-like extension
|
code in the input file, you can end his name by a C++-like extension
|
||||||
(.ypp or .y++), then bison will follow your extension to name the
|
(.ypp or .y++), then bison will follow your extension to name the
|
||||||
output file (.cpp or .c++).
|
output file (.cpp or .c++).
|
||||||
For instance, a grammar description file named
|
For instance, a grammar description file named
|
||||||
.B parse.yxx
|
.B parse.yxx
|
||||||
@@ -86,10 +91,10 @@ would produce the generated parser in a file named
|
|||||||
.BR parse.tab.cxx ,
|
.BR parse.tab.cxx ,
|
||||||
instead of
|
instead of
|
||||||
.IR yacc 's
|
.IR yacc 's
|
||||||
.BR y.tab.c
|
.B y.tab.c
|
||||||
or old
|
or old
|
||||||
.IR Bison
|
.I Bison
|
||||||
versions
|
version's
|
||||||
.BR parse.tab.c .
|
.BR parse.tab.c .
|
||||||
.PP
|
.PP
|
||||||
This description of the options that can be given to
|
This description of the options that can be given to
|
||||||
@@ -122,7 +127,7 @@ Specify a prefix to use for all
|
|||||||
.I bison
|
.I bison
|
||||||
output file names. The names are
|
output file names. The names are
|
||||||
chosen as if the input file were named
|
chosen as if the input file were named
|
||||||
\fIfile-prefix\fB.c\fR.
|
\fIfile-prefix\fP\fB.c\fP.
|
||||||
.TP
|
.TP
|
||||||
.B \-d
|
.B \-d
|
||||||
.br
|
.br
|
||||||
@@ -135,10 +140,10 @@ as well as a few
|
|||||||
variable declarations.
|
variable declarations.
|
||||||
.sp
|
.sp
|
||||||
If the parser output file is named
|
If the parser output file is named
|
||||||
\fIname\fB.c\fR
|
.IB name .c
|
||||||
then this file
|
then this file
|
||||||
is named
|
is named
|
||||||
\fIname\fB.h\fR.
|
\fIname\fP\fB.h\fP.
|
||||||
.sp
|
.sp
|
||||||
This output file is essential if you wish to put the definition of
|
This output file is essential if you wish to put the definition of
|
||||||
.B yylex
|
.B yylex
|
||||||
@@ -148,29 +153,29 @@ needs to be able to refer to token type codes and the variable
|
|||||||
.BR yylval .
|
.BR yylval .
|
||||||
.TP
|
.TP
|
||||||
.BI \-\-defines= defines-file
|
.BI \-\-defines= defines-file
|
||||||
The behaviour of
|
The behavior of
|
||||||
.BI \-\-defines
|
.B \-\-defines
|
||||||
is the same than
|
is the same than
|
||||||
.BI \-d
|
.B \-d
|
||||||
option.
|
option.
|
||||||
The only difference is that it has an optionnal argument which is
|
The only difference is that it has an optional argument which is
|
||||||
the name of the output filename.
|
the name of the output filename.
|
||||||
.TP
|
.TP
|
||||||
.BI \-g
|
.BI \-g
|
||||||
.br
|
.br
|
||||||
.ns
|
.ns
|
||||||
Output a VCG definition of the LALR(1) grammar automaton computed by
|
Output a VCG definition of the LALR(1) grammar automaton computed by
|
||||||
Bison. If the grammar file is
|
Bison. If the grammar file is
|
||||||
.BR foo.y
|
.BR foo.y
|
||||||
, the VCG output file will be
|
, the VCG output file will be
|
||||||
.BR foo.vcg .
|
.BR foo.vcg .
|
||||||
.TP
|
.TP
|
||||||
.BI \-\-graph= graph-file
|
.BI \-\-graph= graph-file
|
||||||
The behaviour of
|
The behavior of
|
||||||
.BI \-\-graph
|
.BI \-\-graph
|
||||||
is the same than
|
is the same than
|
||||||
.BI \-g
|
.BI \-g
|
||||||
option. The only difference is that it has an optionnal argument which
|
option. The only difference is that it has an optional argument which
|
||||||
is the name of the output graph filename.
|
is the name of the output graph filename.
|
||||||
.TP
|
.TP
|
||||||
.B \-k
|
.B \-k
|
||||||
@@ -178,8 +183,10 @@ is the name of the output graph filename.
|
|||||||
.ns
|
.ns
|
||||||
.TP
|
.TP
|
||||||
.B \-\-token-table
|
.B \-\-token-table
|
||||||
This switch causes the \fIname\fB.tab.c\fR output to include a list of
|
This switch causes the
|
||||||
token names in order by their token numbers; this is defined in the array
|
.IB name .tab.c
|
||||||
|
output to include a list of
|
||||||
|
token names in order by their token numbers; this is defined in the array
|
||||||
.IR yytname .
|
.IR yytname .
|
||||||
Also generated
|
Also generated
|
||||||
are #defines for
|
are #defines for
|
||||||
@@ -209,9 +216,13 @@ parser file, treating it an independent source file in its own right.
|
|||||||
.ns
|
.ns
|
||||||
.TP
|
.TP
|
||||||
.B \-\-no-parser
|
.B \-\-no-parser
|
||||||
Do not generate the parser code into the output; generate only
|
Do not generate the parser code into the output; generate only
|
||||||
declarations. The generated \fIname\fB.tab.c\fR file will have only
|
declarations. The generated
|
||||||
constant declarations. In addition, a \fIname\fB.act\fR file is
|
.IB name .tab.c
|
||||||
|
file will have only
|
||||||
|
constant declarations. In addition, a
|
||||||
|
.IB name .act
|
||||||
|
file is
|
||||||
generated containing a switch statement body containing all the
|
generated containing a switch statement body containing all the
|
||||||
translated actions.
|
translated actions.
|
||||||
.TP
|
.TP
|
||||||
@@ -273,7 +284,7 @@ so that the debugging facilities are compiled.
|
|||||||
.TP
|
.TP
|
||||||
.B \-\-verbose
|
.B \-\-verbose
|
||||||
Write an extra output file containing verbose descriptions of the
|
Write an extra output file containing verbose descriptions of the
|
||||||
parser states and what is done for each type of look-ahead token in
|
parser states and what is done for each type of lookahead token in
|
||||||
that state.
|
that state.
|
||||||
.sp
|
.sp
|
||||||
This file also describes all the conflicts, both those resolved by
|
This file also describes all the conflicts, both those resolved by
|
||||||
@@ -334,29 +345,16 @@ The purpose of this switch is to imitate
|
|||||||
.IR yacc 's
|
.IR yacc 's
|
||||||
output file name conventions.
|
output file name conventions.
|
||||||
Thus, the following shell script can substitute for
|
Thus, the following shell script can substitute for
|
||||||
|
.I yacc
|
||||||
|
and is often installed as
|
||||||
.IR yacc :
|
.IR yacc :
|
||||||
.sp
|
.sp
|
||||||
.RS
|
.RS
|
||||||
.ft B
|
.ft B
|
||||||
bison \-y $*
|
bison \-y "$@"
|
||||||
.ft R
|
.ft R
|
||||||
.sp
|
.sp
|
||||||
.RE
|
.RE
|
||||||
.SH FILES
|
|
||||||
/usr/local/share/bison/bison.simple simple parser
|
|
||||||
.br
|
|
||||||
/usr/local/share/bison/bison.hairy complicated parser
|
|
||||||
.SH "ENVIRONMENT VARIABLES"
|
|
||||||
.TP
|
|
||||||
.SM BISON_SIMPLE
|
|
||||||
If this is set, it specifies the location in which the
|
|
||||||
.B bison.simple
|
|
||||||
parser can be found.
|
|
||||||
.TP
|
|
||||||
.SM BISON_HAIRY
|
|
||||||
If this is set, it specifies the location in which the
|
|
||||||
.B bison.hairy
|
|
||||||
parser can be found.
|
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.IR yacc (1)
|
.IR yacc (1)
|
||||||
.br
|
.br
|
||||||
|
|||||||
-192
@@ -1,192 +0,0 @@
|
|||||||
.!
|
|
||||||
.! RUNOFF source file for BISON.HLP
|
|
||||||
.!
|
|
||||||
.! This is a RUNOFF input file which will produce a VMS help file
|
|
||||||
.! for the VMS HELP library.
|
|
||||||
.!
|
|
||||||
.! Eric Youngdale and Wilfred J. Hansen ([email protected]).
|
|
||||||
.!
|
|
||||||
.literal
|
|
||||||
.end literal
|
|
||||||
.no paging
|
|
||||||
.no flags all
|
|
||||||
.right margin 70
|
|
||||||
.left margin 1
|
|
||||||
|
|
||||||
.indent -1
|
|
||||||
1 BISON
|
|
||||||
.skip
|
|
||||||
The BISON command invokes the GNU BISON parser generator.
|
|
||||||
.skip
|
|
||||||
.literal
|
|
||||||
BISON file-spec
|
|
||||||
.end literal
|
|
||||||
.skip
|
|
||||||
.indent -1
|
|
||||||
2 Parameters
|
|
||||||
.skip
|
|
||||||
file-spec
|
|
||||||
.skip
|
|
||||||
Here file-spec is the grammar file name, which usually ends in
|
|
||||||
.y. The parser file's name is made by replacing the .y
|
|
||||||
with _tab.c. Thus, the command bison foo.y yields
|
|
||||||
foo_tab.c.
|
|
||||||
|
|
||||||
.skip
|
|
||||||
.indent -1
|
|
||||||
2 Qualifiers
|
|
||||||
.skip
|
|
||||||
The following is the list of available qualifiers for BISON:
|
|
||||||
.literal
|
|
||||||
/DEBUG
|
|
||||||
/DEFINES
|
|
||||||
/FILE_PREFIX=prefix
|
|
||||||
/FIXED_OUTFILES
|
|
||||||
/NAME_PREFIX=prefix
|
|
||||||
/NOLINES
|
|
||||||
/NOPARSER
|
|
||||||
/OUTPUT=outfilefile
|
|
||||||
/RAW
|
|
||||||
/TOKEN_TABLE
|
|
||||||
/VERBOSE
|
|
||||||
/VERSION
|
|
||||||
/YACC
|
|
||||||
.end literal
|
|
||||||
.skip
|
|
||||||
.indent -1
|
|
||||||
2 /DEBUG
|
|
||||||
.skip
|
|
||||||
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
|
|
||||||
2 /DEFINES
|
|
||||||
.skip
|
|
||||||
Write an extra output file containing macro definitions for the token
|
|
||||||
type names defined in the grammar and the semantic value type
|
|
||||||
YYSTYPE, as well as a extern variable declarations.
|
|
||||||
.skip
|
|
||||||
If the parser output file is named "name.c" then this file
|
|
||||||
is named "name.h".
|
|
||||||
.skip
|
|
||||||
This output file is essential if you wish to put the definition of
|
|
||||||
yylex in a separate source file, because yylex needs to
|
|
||||||
be able to refer to token type codes and the variable
|
|
||||||
yylval.
|
|
||||||
.skip
|
|
||||||
.indent -1
|
|
||||||
2 /FILE_PREFIX
|
|
||||||
.skip
|
|
||||||
.literal
|
|
||||||
/FILIE_PREFIX=prefix
|
|
||||||
.end literal
|
|
||||||
.skip
|
|
||||||
Specify a prefix to use for all Bison output file names. The names are
|
|
||||||
chosen as if the input file were named prefix.c
|
|
||||||
|
|
||||||
.skip
|
|
||||||
.indent -1
|
|
||||||
2 /FIXED_OUTFILES
|
|
||||||
.skip
|
|
||||||
Equivalent to /OUTPUT=y_tab.c; the parser output file is called
|
|
||||||
y_tab.c, and the other outputs are called y.output and
|
|
||||||
y_tab.h. The purpose of this switch is to imitate Yacc's output
|
|
||||||
file name conventions. The /YACC qualifier is functionally equivalent
|
|
||||||
to /FIXED_OUTFILES. The following command definition will
|
|
||||||
work as a substitute for Yacc:
|
|
||||||
|
|
||||||
.literal
|
|
||||||
$YACC:==BISON/FIXED_OUTFILES
|
|
||||||
.end literal
|
|
||||||
.skip
|
|
||||||
.indent -1
|
|
||||||
2 /NAME_PREFIX
|
|
||||||
.skip
|
|
||||||
.literal
|
|
||||||
/NAME_PREFIX=prefix
|
|
||||||
.end literal
|
|
||||||
.skip
|
|
||||||
Rename the external symbols used in the parser so that they start with
|
|
||||||
"prefix" instead of "yy". The precise list of symbols renamed
|
|
||||||
is yyparse, yylex, yyerror, yylval, yychar and yydebug.
|
|
||||||
|
|
||||||
For example, if you use /NAME_PREFIX="c", the names become cparse,
|
|
||||||
clex, and so on.
|
|
||||||
|
|
||||||
.skip
|
|
||||||
.indent -1
|
|
||||||
2 /NOLINES
|
|
||||||
.skip
|
|
||||||
Don't put any "#line" preprocessor commands in the parser file.
|
|
||||||
Ordinarily Bison puts them in the parser file so that the C compiler
|
|
||||||
and debuggers will associate errors with your source file, the
|
|
||||||
grammar file. This option causes them to associate errors with the
|
|
||||||
parser file, treating it an independent source file in its own right.
|
|
||||||
.skip
|
|
||||||
.indent -1
|
|
||||||
2 /NOPARSER
|
|
||||||
.skip
|
|
||||||
Do not generate the parser code into the output; generate only
|
|
||||||
declarations. The generated name_tab.c file will have only
|
|
||||||
constant declarations. In addition, a name.act file is
|
|
||||||
generated containing a switch statement body containing all the
|
|
||||||
translated actions.
|
|
||||||
.skip
|
|
||||||
.indent -1
|
|
||||||
2 /OUTPUT
|
|
||||||
.skip
|
|
||||||
.literal
|
|
||||||
/OUTPUT=outfile
|
|
||||||
.end literal
|
|
||||||
.skip
|
|
||||||
Specify the name "outfile" for the parser file.
|
|
||||||
.skip
|
|
||||||
.indent -1
|
|
||||||
2 /RAW
|
|
||||||
.skip
|
|
||||||
When this switch is specified, the .tab.h file defines the tokens to
|
|
||||||
have the bison token numbers rather than the yacc compatible numbers.
|
|
||||||
To employ this switch you would have to have your own parser.
|
|
||||||
.skip
|
|
||||||
.indent -1
|
|
||||||
2 /TOKEN_TABLE
|
|
||||||
.skip
|
|
||||||
This switch causes the name_tab.c output to include a list of
|
|
||||||
token names in order by their token numbers; this is defined in the array
|
|
||||||
yytname. Also generated are #defines for YYNTOKENS, YYNNTS, YYNRULES,
|
|
||||||
and YYNSTATES.
|
|
||||||
|
|
||||||
.skip
|
|
||||||
.indent -1
|
|
||||||
2 /VERBOSE
|
|
||||||
.skip
|
|
||||||
Write an extra output file containing verbose descriptions of the
|
|
||||||
parser states and what is done for each type of look-ahead token in
|
|
||||||
that state.
|
|
||||||
.skip
|
|
||||||
This file also describes all the conflicts, both those resolved by
|
|
||||||
operator precedence and the unresolved ones.
|
|
||||||
.skip
|
|
||||||
The file's name is made by removing _tab.c or .c from
|
|
||||||
the parser output file name, and adding .output instead.
|
|
||||||
.skip
|
|
||||||
Therefore, if the input file is foo.y, then the parser file is
|
|
||||||
called foo_tab.c by default. As a consequence, the verbose
|
|
||||||
output file is called foo.output.
|
|
||||||
.skip
|
|
||||||
.indent -1
|
|
||||||
2 /VERSION
|
|
||||||
.skip
|
|
||||||
Print the version number of Bison.
|
|
||||||
|
|
||||||
.skip
|
|
||||||
.indent -1
|
|
||||||
2 /YACC
|
|
||||||
.skip
|
|
||||||
See /FIXED_OUTFILES.
|
|
||||||
.skip
|
|
||||||
.indent -1
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+3581
-1163
File diff suppressed because it is too large
Load Diff
+140
-89
@@ -1,12 +1,13 @@
|
|||||||
|
|
||||||
@node GNU Free Documentation License
|
@node GNU Free Documentation License
|
||||||
@appendixsec GNU Free Documentation License
|
@appendixsec GNU Free Documentation License
|
||||||
|
|
||||||
@cindex FDL, GNU Free Documentation License
|
@cindex FDL, GNU Free Documentation License
|
||||||
@center Version 1.1, March 2000
|
@center Version 1.2, November 2002
|
||||||
|
|
||||||
@display
|
@display
|
||||||
Copyright @copyright{} 2000 Free Software Foundation, Inc.
|
Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc.
|
||||||
59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
@@ -17,12 +18,12 @@ of this license document, but changing it is not allowed.
|
|||||||
PREAMBLE
|
PREAMBLE
|
||||||
|
|
||||||
The purpose of this License is to make a manual, textbook, or other
|
The purpose of this License is to make a manual, textbook, or other
|
||||||
written document @dfn{free} in the sense of freedom: to assure everyone
|
functional and useful document @dfn{free} in the sense of freedom: to
|
||||||
the effective freedom to copy and redistribute it, with or without
|
assure everyone the effective freedom to copy and redistribute it,
|
||||||
modifying it, either commercially or noncommercially. Secondarily,
|
with or without modifying it, either commercially or noncommercially.
|
||||||
this License preserves for the author and publisher a way to get
|
Secondarily, this License preserves for the author and publisher a way
|
||||||
credit for their work, while not being considered responsible for
|
to get credit for their work, while not being considered responsible
|
||||||
modifications made by others.
|
for modifications made by others.
|
||||||
|
|
||||||
This License is a kind of ``copyleft'', which means that derivative
|
This License is a kind of ``copyleft'', which means that derivative
|
||||||
works of the document must themselves be free in the same sense. It
|
works of the document must themselves be free in the same sense. It
|
||||||
@@ -40,57 +41,69 @@ principally for works whose purpose is instruction or reference.
|
|||||||
@item
|
@item
|
||||||
APPLICABILITY AND DEFINITIONS
|
APPLICABILITY AND DEFINITIONS
|
||||||
|
|
||||||
This License applies to any manual or other work that contains a
|
This License applies to any manual or other work, in any medium, that
|
||||||
notice placed by the copyright holder saying it can be distributed
|
contains a notice placed by the copyright holder saying it can be
|
||||||
under the terms of this License. The ``Document'', below, refers to any
|
distributed under the terms of this License. Such a notice grants a
|
||||||
such manual or work. Any member of the public is a licensee, and is
|
world-wide, royalty-free license, unlimited in duration, to use that
|
||||||
addressed as ``you''.
|
work under the conditions stated herein. The ``Document'', below,
|
||||||
|
refers to any such manual or work. Any member of the public is a
|
||||||
|
licensee, and is addressed as ``you''. You accept the license if you
|
||||||
|
copy, modify or distribute the work in a way requiring permission
|
||||||
|
under copyright law.
|
||||||
|
|
||||||
A ``Modified Version'' of the Document means any work containing the
|
A ``Modified Version'' of the Document means any work containing the
|
||||||
Document or a portion of it, either copied verbatim, or with
|
Document or a portion of it, either copied verbatim, or with
|
||||||
modifications and/or translated into another language.
|
modifications and/or translated into another language.
|
||||||
|
|
||||||
A ``Secondary Section'' is a named appendix or a front-matter section of
|
A ``Secondary Section'' is a named appendix or a front-matter section
|
||||||
the Document that deals exclusively with the relationship of the
|
of the Document that deals exclusively with the relationship of the
|
||||||
publishers or authors of the Document to the Document's overall subject
|
publishers or authors of the Document to the Document's overall
|
||||||
(or to related matters) and contains nothing that could fall directly
|
subject (or to related matters) and contains nothing that could fall
|
||||||
within that overall subject. (For example, if the Document is in part a
|
directly within that overall subject. (Thus, if the Document is in
|
||||||
textbook of mathematics, a Secondary Section may not explain any
|
part a textbook of mathematics, a Secondary Section may not explain
|
||||||
mathematics.) The relationship could be a matter of historical
|
any mathematics.) The relationship could be a matter of historical
|
||||||
connection with the subject or with related matters, or of legal,
|
connection with the subject or with related matters, or of legal,
|
||||||
commercial, philosophical, ethical or political position regarding
|
commercial, philosophical, ethical or political position regarding
|
||||||
them.
|
them.
|
||||||
|
|
||||||
The ``Invariant Sections'' are certain Secondary Sections whose titles
|
The ``Invariant Sections'' are certain Secondary Sections whose titles
|
||||||
are designated, as being those of Invariant Sections, in the notice
|
are designated, as being those of Invariant Sections, in the notice
|
||||||
that says that the Document is released under this License.
|
that says that the Document is released under this License. If a
|
||||||
|
section does not fit the above definition of Secondary then it is not
|
||||||
|
allowed to be designated as Invariant. The Document may contain zero
|
||||||
|
Invariant Sections. If the Document does not identify any Invariant
|
||||||
|
Sections then there are none.
|
||||||
|
|
||||||
The ``Cover Texts'' are certain short passages of text that are listed,
|
The ``Cover Texts'' are certain short passages of text that are listed,
|
||||||
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
|
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
|
||||||
the Document is released under this License.
|
the Document is released under this License. A Front-Cover Text may
|
||||||
|
be at most 5 words, and a Back-Cover Text may be at most 25 words.
|
||||||
|
|
||||||
A ``Transparent'' copy of the Document means a machine-readable copy,
|
A ``Transparent'' copy of the Document means a machine-readable copy,
|
||||||
represented in a format whose specification is available to the
|
represented in a format whose specification is available to the
|
||||||
general public, whose contents can be viewed and edited directly and
|
general public, that is suitable for revising the document
|
||||||
straightforwardly with generic text editors or (for images composed of
|
straightforwardly with generic text editors or (for images composed of
|
||||||
pixels) generic paint programs or (for drawings) some widely available
|
pixels) generic paint programs or (for drawings) some widely available
|
||||||
drawing editor, and that is suitable for input to text formatters or
|
drawing editor, and that is suitable for input to text formatters or
|
||||||
for automatic translation to a variety of formats suitable for input
|
for automatic translation to a variety of formats suitable for input
|
||||||
to text formatters. A copy made in an otherwise Transparent file
|
to text formatters. A copy made in an otherwise Transparent file
|
||||||
format whose markup has been designed to thwart or discourage
|
format whose markup, or absence of markup, has been arranged to thwart
|
||||||
subsequent modification by readers is not Transparent. A copy that is
|
or discourage subsequent modification by readers is not Transparent.
|
||||||
not ``Transparent'' is called ``Opaque''.
|
An image format is not Transparent if used for any substantial amount
|
||||||
|
of text. A copy that is not ``Transparent'' is called ``Opaque''.
|
||||||
|
|
||||||
Examples of suitable formats for Transparent copies include plain
|
Examples of suitable formats for Transparent copies include plain
|
||||||
@sc{ascii} without markup, Texinfo input format, La@TeX{} input format,
|
@sc{ascii} without markup, Texinfo input format, La@TeX{} input
|
||||||
@acronym{SGML} or @acronym{XML} using a publicly available
|
format, @acronym{SGML} or @acronym{XML} using a publicly available
|
||||||
@acronym{DTD}, and standard-conforming simple @acronym{HTML} designed
|
@acronym{DTD}, and standard-conforming simple @acronym{HTML},
|
||||||
for human modification. Opaque formats include PostScript,
|
PostScript or @acronym{PDF} designed for human modification. Examples
|
||||||
@acronym{PDF}, proprietary formats that can be read and edited only by
|
of transparent image formats include @acronym{PNG}, @acronym{XCF} and
|
||||||
proprietary word processors, @acronym{SGML} or @acronym{XML} for which
|
@acronym{JPG}. Opaque formats include proprietary formats that can be
|
||||||
the @acronym{DTD} and/or processing tools are not generally available,
|
read and edited only by proprietary word processors, @acronym{SGML} or
|
||||||
and the machine-generated @acronym{HTML} produced by some word
|
@acronym{XML} for which the @acronym{DTD} and/or processing tools are
|
||||||
processors for output purposes only.
|
not generally available, and the machine-generated @acronym{HTML},
|
||||||
|
PostScript or @acronym{PDF} produced by some word processors for
|
||||||
|
output purposes only.
|
||||||
|
|
||||||
The ``Title Page'' means, for a printed book, the title page itself,
|
The ``Title Page'' means, for a printed book, the title page itself,
|
||||||
plus such following pages as are needed to hold, legibly, the material
|
plus such following pages as are needed to hold, legibly, the material
|
||||||
@@ -99,6 +112,21 @@ formats which do not have any title page as such, ``Title Page'' means
|
|||||||
the text near the most prominent appearance of the work's title,
|
the text near the most prominent appearance of the work's title,
|
||||||
preceding the beginning of the body of the text.
|
preceding the beginning of the body of the text.
|
||||||
|
|
||||||
|
A section ``Entitled XYZ'' means a named subunit of the Document whose
|
||||||
|
title either is precisely XYZ or contains XYZ in parentheses following
|
||||||
|
text that translates XYZ in another language. (Here XYZ stands for a
|
||||||
|
specific section name mentioned below, such as ``Acknowledgements'',
|
||||||
|
``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title''
|
||||||
|
of such a section when you modify the Document means that it remains a
|
||||||
|
section ``Entitled XYZ'' according to this definition.
|
||||||
|
|
||||||
|
The Document may include Warranty Disclaimers next to the notice which
|
||||||
|
states that this License applies to the Document. These Warranty
|
||||||
|
Disclaimers are considered to be included by reference in this
|
||||||
|
License, but only as regards disclaiming warranties: any other
|
||||||
|
implication that these Warranty Disclaimers may have is void and has
|
||||||
|
no effect on the meaning of this License.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
VERBATIM COPYING
|
VERBATIM COPYING
|
||||||
|
|
||||||
@@ -118,9 +146,10 @@ you may publicly display copies.
|
|||||||
@item
|
@item
|
||||||
COPYING IN QUANTITY
|
COPYING IN QUANTITY
|
||||||
|
|
||||||
If you publish printed copies of the Document numbering more than 100,
|
If you publish printed copies (or copies in media that commonly have
|
||||||
and the Document's license notice requires Cover Texts, you must enclose
|
printed covers) of the Document, numbering more than 100, and the
|
||||||
the copies in covers that carry, clearly and legibly, all these Cover
|
Document's license notice requires Cover Texts, you must enclose the
|
||||||
|
copies in covers that carry, clearly and legibly, all these Cover
|
||||||
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
|
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
|
||||||
the back cover. Both covers must also clearly and legibly identify
|
the back cover. Both covers must also clearly and legibly identify
|
||||||
you as the publisher of these copies. The front cover must present
|
you as the publisher of these copies. The front cover must present
|
||||||
@@ -138,16 +167,15 @@ pages.
|
|||||||
If you publish or distribute Opaque copies of the Document numbering
|
If you publish or distribute Opaque copies of the Document numbering
|
||||||
more than 100, you must either include a machine-readable Transparent
|
more than 100, you must either include a machine-readable Transparent
|
||||||
copy along with each Opaque copy, or state in or with each Opaque copy
|
copy along with each Opaque copy, or state in or with each Opaque copy
|
||||||
a publicly-accessible computer-network location containing a complete
|
a computer-network location from which the general network-using
|
||||||
Transparent copy of the Document, free of added material, which the
|
public has access to download using public-standard network protocols
|
||||||
general network-using public has access to download anonymously at no
|
a complete Transparent copy of the Document, free of added material.
|
||||||
charge using public-standard network protocols. If you use the latter
|
If you use the latter option, you must take reasonably prudent steps,
|
||||||
option, you must take reasonably prudent steps, when you begin
|
when you begin distribution of Opaque copies in quantity, to ensure
|
||||||
distribution of Opaque copies in quantity, to ensure that this
|
that this Transparent copy will remain thus accessible at the stated
|
||||||
Transparent copy will remain thus accessible at the stated location
|
location until at least one year after the last time you distribute an
|
||||||
until at least one year after the last time you distribute an Opaque
|
Opaque copy (directly or through your agents or retailers) of that
|
||||||
copy (directly or through your agents or retailers) of that edition to
|
edition to the public.
|
||||||
the public.
|
|
||||||
|
|
||||||
It is requested, but not required, that you contact the authors of the
|
It is requested, but not required, that you contact the authors of the
|
||||||
Document well before redistributing any large number of copies, to give
|
Document well before redistributing any large number of copies, to give
|
||||||
@@ -175,7 +203,8 @@ if the original publisher of that version gives permission.
|
|||||||
List on the Title Page, as authors, one or more persons or entities
|
List on the Title Page, as authors, one or more persons or entities
|
||||||
responsible for authorship of the modifications in the Modified
|
responsible for authorship of the modifications in the Modified
|
||||||
Version, together with at least five of the principal authors of the
|
Version, together with at least five of the principal authors of the
|
||||||
Document (all of its principal authors, if it has less than five).
|
Document (all of its principal authors, if it has fewer than five),
|
||||||
|
unless they release you from this requirement.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
State on the Title page the name of the publisher of the
|
State on the Title page the name of the publisher of the
|
||||||
@@ -201,10 +230,10 @@ and required Cover Texts given in the Document's license notice.
|
|||||||
Include an unaltered copy of this License.
|
Include an unaltered copy of this License.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
Preserve the section entitled ``History'', and its title, and add to
|
Preserve the section Entitled ``History'', Preserve its Title, and add
|
||||||
it an item stating at least the title, year, new authors, and
|
to it an item stating at least the title, year, new authors, and
|
||||||
publisher of the Modified Version as given on the Title Page. If
|
publisher of the Modified Version as given on the Title Page. If
|
||||||
there is no section entitled ``History'' in the Document, create one
|
there is no section Entitled ``History'' in the Document, create one
|
||||||
stating the title, year, authors, and publisher of the Document as
|
stating the title, year, authors, and publisher of the Document as
|
||||||
given on its Title Page, then add an item describing the Modified
|
given on its Title Page, then add an item describing the Modified
|
||||||
Version as stated in the previous sentence.
|
Version as stated in the previous sentence.
|
||||||
@@ -219,10 +248,10 @@ least four years before the Document itself, or if the original
|
|||||||
publisher of the version it refers to gives permission.
|
publisher of the version it refers to gives permission.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
In any section entitled ``Acknowledgments'' or ``Dedications'',
|
For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve
|
||||||
preserve the section's title, and preserve in the section all the
|
the Title of the section, and preserve in the section all the
|
||||||
substance and tone of each of the contributor acknowledgments
|
substance and tone of each of the contributor acknowledgements and/or
|
||||||
and/or dedications given therein.
|
dedications given therein.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
Preserve all the Invariant Sections of the Document,
|
Preserve all the Invariant Sections of the Document,
|
||||||
@@ -230,12 +259,15 @@ unaltered in their text and in their titles. Section numbers
|
|||||||
or the equivalent are not considered part of the section titles.
|
or the equivalent are not considered part of the section titles.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
Delete any section entitled ``Endorsements''. Such a section
|
Delete any section Entitled ``Endorsements''. Such a section
|
||||||
may not be included in the Modified Version.
|
may not be included in the Modified Version.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
Do not retitle any existing section as ``Endorsements''
|
Do not retitle any existing section to be Entitled ``Endorsements'' or
|
||||||
or to conflict in title with any Invariant Section.
|
to conflict in title with any Invariant Section.
|
||||||
|
|
||||||
|
@item
|
||||||
|
Preserve any Warranty Disclaimers.
|
||||||
@end enumerate
|
@end enumerate
|
||||||
|
|
||||||
If the Modified Version includes new front-matter sections or
|
If the Modified Version includes new front-matter sections or
|
||||||
@@ -245,7 +277,7 @@ of these sections as invariant. To do this, add their titles to the
|
|||||||
list of Invariant Sections in the Modified Version's license notice.
|
list of Invariant Sections in the Modified Version's license notice.
|
||||||
These titles must be distinct from any other section titles.
|
These titles must be distinct from any other section titles.
|
||||||
|
|
||||||
You may add a section entitled ``Endorsements'', provided it contains
|
You may add a section Entitled ``Endorsements'', provided it contains
|
||||||
nothing but endorsements of your Modified Version by various
|
nothing but endorsements of your Modified Version by various
|
||||||
parties---for example, statements of peer review or that the text has
|
parties---for example, statements of peer review or that the text has
|
||||||
been approved by an organization as the authoritative definition of a
|
been approved by an organization as the authoritative definition of a
|
||||||
@@ -273,7 +305,7 @@ License, under the terms defined in section 4 above for modified
|
|||||||
versions, provided that you include in the combination all of the
|
versions, provided that you include in the combination all of the
|
||||||
Invariant Sections of all of the original documents, unmodified, and
|
Invariant Sections of all of the original documents, unmodified, and
|
||||||
list them all as Invariant Sections of your combined work in its
|
list them all as Invariant Sections of your combined work in its
|
||||||
license notice.
|
license notice, and that you preserve all their Warranty Disclaimers.
|
||||||
|
|
||||||
The combined work need only contain one copy of this License, and
|
The combined work need only contain one copy of this License, and
|
||||||
multiple identical Invariant Sections may be replaced with a single
|
multiple identical Invariant Sections may be replaced with a single
|
||||||
@@ -284,11 +316,11 @@ author or publisher of that section if known, or else a unique number.
|
|||||||
Make the same adjustment to the section titles in the list of
|
Make the same adjustment to the section titles in the list of
|
||||||
Invariant Sections in the license notice of the combined work.
|
Invariant Sections in the license notice of the combined work.
|
||||||
|
|
||||||
In the combination, you must combine any sections entitled ``History''
|
In the combination, you must combine any sections Entitled ``History''
|
||||||
in the various original documents, forming one section entitled
|
in the various original documents, forming one section Entitled
|
||||||
``History''; likewise combine any sections entitled ``Acknowledgments'',
|
``History''; likewise combine any sections Entitled ``Acknowledgements'',
|
||||||
and any sections entitled ``Dedications''. You must delete all sections
|
and any sections Entitled ``Dedications''. You must delete all
|
||||||
entitled ``Endorsements.''
|
sections Entitled ``Endorsements.''
|
||||||
|
|
||||||
@item
|
@item
|
||||||
COLLECTIONS OF DOCUMENTS
|
COLLECTIONS OF DOCUMENTS
|
||||||
@@ -309,18 +341,20 @@ AGGREGATION WITH INDEPENDENT WORKS
|
|||||||
|
|
||||||
A compilation of the Document or its derivatives with other separate
|
A compilation of the Document or its derivatives with other separate
|
||||||
and independent documents or works, in or on a volume of a storage or
|
and independent documents or works, in or on a volume of a storage or
|
||||||
distribution medium, does not as a whole count as a Modified Version
|
distribution medium, is called an ``aggregate'' if the copyright
|
||||||
of the Document, provided no compilation copyright is claimed for the
|
resulting from the compilation is not used to limit the legal rights
|
||||||
compilation. Such a compilation is called an ``aggregate'', and this
|
of the compilation's users beyond what the individual works permit.
|
||||||
License does not apply to the other self-contained works thus compiled
|
When the Document is included in an aggregate, this License does not
|
||||||
with the Document, on account of their being thus compiled, if they
|
apply to the other works in the aggregate which are not themselves
|
||||||
are not themselves derivative works of the Document.
|
derivative works of the Document.
|
||||||
|
|
||||||
If the Cover Text requirement of section 3 is applicable to these
|
If the Cover Text requirement of section 3 is applicable to these
|
||||||
copies of the Document, then if the Document is less than one quarter
|
copies of the Document, then if the Document is less than one half of
|
||||||
of the entire aggregate, the Document's Cover Texts may be placed on
|
the entire aggregate, the Document's Cover Texts may be placed on
|
||||||
covers that surround only the Document within the aggregate.
|
covers that bracket the Document within the aggregate, or the
|
||||||
Otherwise they must appear on covers around the whole aggregate.
|
electronic equivalent of covers if the Document is in electronic form.
|
||||||
|
Otherwise they must appear on printed covers that bracket the whole
|
||||||
|
aggregate.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
TRANSLATION
|
TRANSLATION
|
||||||
@@ -331,10 +365,17 @@ Replacing Invariant Sections with translations requires special
|
|||||||
permission from their copyright holders, but you may include
|
permission from their copyright holders, but you may include
|
||||||
translations of some or all Invariant Sections in addition to the
|
translations of some or all Invariant Sections in addition to the
|
||||||
original versions of these Invariant Sections. You may include a
|
original versions of these Invariant Sections. You may include a
|
||||||
translation of this License provided that you also include the
|
translation of this License, and all the license notices in the
|
||||||
original English version of this License. In case of a disagreement
|
Document, and any Warranty Disclaimers, provided that you also include
|
||||||
between the translation and the original English version of this
|
the original English version of this License and the original versions
|
||||||
License, the original English version will prevail.
|
of those notices and disclaimers. In case of a disagreement between
|
||||||
|
the translation and the original version of this License or a notice
|
||||||
|
or disclaimer, the original version will prevail.
|
||||||
|
|
||||||
|
If a section in the Document is Entitled ``Acknowledgements'',
|
||||||
|
``Dedications'', or ``History'', the requirement (section 4) to Preserve
|
||||||
|
its Title (section 1) will typically require changing the actual
|
||||||
|
title.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
TERMINATION
|
TERMINATION
|
||||||
@@ -377,19 +418,28 @@ license notices just after the title page:
|
|||||||
@group
|
@group
|
||||||
Copyright (C) @var{year} @var{your name}.
|
Copyright (C) @var{year} @var{your name}.
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
under the terms of the GNU Free Documentation License, Version 1.1
|
under the terms of the GNU Free Documentation License, Version 1.2
|
||||||
or any later version published by the Free Software Foundation;
|
or any later version published by the Free Software Foundation;
|
||||||
with the Invariant Sections being @var{list their titles}, with the
|
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
|
||||||
Front-Cover Texts being @var{list}, and with the Back-Cover Texts being @var{list}.
|
Texts. A copy of the license is included in the section entitled ``GNU
|
||||||
A copy of the license is included in the section entitled ``GNU
|
|
||||||
Free Documentation License''.
|
Free Documentation License''.
|
||||||
@end group
|
@end group
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
If you have no Invariant Sections, write ``with no Invariant Sections''
|
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
|
||||||
instead of saying which ones are invariant. If you have no
|
replace the ``with...Texts.'' line with this:
|
||||||
Front-Cover Texts, write ``no Front-Cover Texts'' instead of
|
|
||||||
``Front-Cover Texts being @var{list}''; likewise for Back-Cover Texts.
|
@smallexample
|
||||||
|
@group
|
||||||
|
with the Invariant Sections being @var{list their titles}, with
|
||||||
|
the Front-Cover Texts being @var{list}, and with the Back-Cover Texts
|
||||||
|
being @var{list}.
|
||||||
|
@end group
|
||||||
|
@end smallexample
|
||||||
|
|
||||||
|
If you have Invariant Sections without Cover Texts, or some other
|
||||||
|
combination of the three, merge those two alternatives to suit the
|
||||||
|
situation.
|
||||||
|
|
||||||
If your document contains nontrivial examples of program code, we
|
If your document contains nontrivial examples of program code, we
|
||||||
recommend releasing these examples in parallel under your choice of
|
recommend releasing these examples in parallel under your choice of
|
||||||
@@ -399,3 +449,4 @@ to permit their use in free software.
|
|||||||
@c Local Variables:
|
@c Local Variables:
|
||||||
@c ispell-local-pdict: "ispell-dict"
|
@c ispell-local-pdict: "ispell-dict"
|
||||||
@c End:
|
@c End:
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
@display
|
@display
|
||||||
Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
|
Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
|
||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
@@ -352,7 +352,7 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|||||||
+9
-9
@@ -35,8 +35,8 @@
|
|||||||
%
|
%
|
||||||
% You should have received a copy of the GNU General Public License
|
% You should have received a copy of the GNU General Public License
|
||||||
% along with either Flex or Bison; see the file COPYING. If not, write
|
% along with either Flex or Bison; see the file COPYING. If not, write
|
||||||
% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
% to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
% Boston, MA 02111-1307, USA.
|
% Boston, MA 02110-1301, USA.
|
||||||
%
|
%
|
||||||
% This file is intended to be processed by plain TeX (TeX82).
|
% This file is intended to be processed by plain TeX (TeX82).
|
||||||
%
|
%
|
||||||
@@ -96,9 +96,9 @@ For information, write to the:
|
|||||||
\vskip .2\baselineskip
|
\vskip .2\baselineskip
|
||||||
\centerline{Free Software Foundation, Inc.}
|
\centerline{Free Software Foundation, Inc.}
|
||||||
\vskip .2\baselineskip
|
\vskip .2\baselineskip
|
||||||
\centerline{59 Temple Place - Suite 330}
|
\centerline{51 Franklin Street, Fifth Floor}
|
||||||
\vskip .2\baselineskip
|
\vskip .2\baselineskip
|
||||||
\centerline{Boston, MA 02111-1307 USA}
|
\centerline{Boston, MA 02110-1301 USA}
|
||||||
\endgroup}
|
\endgroup}
|
||||||
|
|
||||||
%%%% smallcopyrightnotice for two column printing on one page.
|
%%%% smallcopyrightnotice for two column printing on one page.
|
||||||
@@ -121,9 +121,9 @@ For information, write to the:
|
|||||||
\vskip .2\baselineskip
|
\vskip .2\baselineskip
|
||||||
\centerline{Free Software Foundation, Inc.}
|
\centerline{Free Software Foundation, Inc.}
|
||||||
\vskip .2\baselineskip
|
\vskip .2\baselineskip
|
||||||
\centerline{59 Temple Place - Suite 330}
|
\centerline{51 Franklin Street, Fifth Floor}
|
||||||
\vskip .2\baselineskip
|
\vskip .2\baselineskip
|
||||||
\centerline{Boston, MA 02111-1307 USA}
|
\centerline{Boston, MA 02110-1301 USA}
|
||||||
\endgroup}
|
\endgroup}
|
||||||
|
|
||||||
% make \bye not \outer so that the \def\bye in the \else clause below
|
% make \bye not \outer so that the \def\bye in the \else clause below
|
||||||
@@ -458,7 +458,7 @@ as either {\tt first_column} or {\tt last_column}.
|
|||||||
\section {Variables and Types}
|
\section {Variables and Types}
|
||||||
%*****************************
|
%*****************************
|
||||||
|
|
||||||
\key{Current look ahead token.} {yychar}
|
\key{Current lookahead token.} {yychar}
|
||||||
\key{Debug mode flag.} {yydebug}
|
\key{Debug mode flag.} {yydebug}
|
||||||
\key{Data associated with the current token.} {yylval}
|
\key{Data associated with the current token.} {yylval}
|
||||||
\key{Source position of current token.} {yylloc}
|
\key{Source position of current token.} {yylloc}
|
||||||
@@ -489,8 +489,8 @@ as either {\tt first_column} or {\tt last_column}.
|
|||||||
\key{Quit parsing immediately. Return 1.} {YYABORT}
|
\key{Quit parsing immediately. Return 1.} {YYABORT}
|
||||||
\key{Quit parsing immediately. Return 0.} {YYACCEPT}
|
\key{Quit parsing immediately. Return 0.} {YYACCEPT}
|
||||||
\key{Pretend a syntax error occurred.} {YYERROR}
|
\key{Pretend a syntax error occurred.} {YYERROR}
|
||||||
\key{Value in {\tt yychar} if no look-ahead token.} {YYEMPTY}
|
\key{Value in {\tt yychar} if no lookahead token.} {YYEMPTY}
|
||||||
\key{Clear previous look ahead token.} {yyclearin}
|
\key{Clear previous lookahead token.} {yyclearin}
|
||||||
\key{Recover normally from an error.} {yyerrok}
|
\key{Recover normally from an error.} {yyerrok}
|
||||||
|
|
||||||
% **************
|
% **************
|
||||||
|
|||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
A directory of tools provided to people using CVS Bison. None of
|
||||||
|
these is distributed.
|
||||||
|
|
||||||
|
* bench.pl
|
||||||
|
A primitive Perl script to run benches. Currently its only bench is
|
||||||
|
the usual calculator: it has a lightweight processing part (but not
|
||||||
|
null), so it is really emphasizing the cost of the whole parsing
|
||||||
|
(including scanning and I/O).
|
||||||
|
|
||||||
|
Set the envvars BISON and CC to the programs and flags you want to
|
||||||
|
use. They default to bison and gcc. To run a non-installed bison
|
||||||
|
from a tarball built in _build, I suggest the following.
|
||||||
|
|
||||||
|
BISON=_build/tests/bison CC='gcc -O2' ./bench.pl
|
||||||
|
|
||||||
|
(The _build/tests/bison wrapper makes sure that _build/src/bison will
|
||||||
|
use the tarballs' skeletons, not those already installed as a
|
||||||
|
straightforward use of _build/src/bison would.)
|
||||||
|
|
||||||
|
--
|
||||||
|
|
||||||
|
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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 autoconf; see the file COPYING. If not, write to
|
||||||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
Local Variables:
|
||||||
|
mode: outline
|
||||||
|
End:
|
||||||
Executable
+413
File diff suppressed because one or more lines are too long
-300
@@ -1,300 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
|
|
||||||
# clcommit version 0.9.5
|
|
||||||
|
|
||||||
# Copyright (C) 1999, 2000, Free Software Foundation
|
|
||||||
|
|
||||||
# This script is Free Software, and it can be copied, distributed and
|
|
||||||
# modified as defined in the GNU General Public License. A copy of
|
|
||||||
# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html
|
|
||||||
|
|
||||||
# Originally by Gary V. Vaughan <[email protected]>
|
|
||||||
# Pretty much rewritten by Alexandre Oliva <[email protected]>
|
|
||||||
|
|
||||||
# This scripts eases checking in changes to CVS-maintained projects
|
|
||||||
# with ChangeLog files. It will check that there have been no
|
|
||||||
# conflicting commits in the CVS repository and print which files it
|
|
||||||
# is going to commit to stderr. A list of files to compare and to
|
|
||||||
# check in can be given in the command line. If it is not given, all
|
|
||||||
# files in the current directory (and below, unless `-l' is given) are
|
|
||||||
# considered for check in.
|
|
||||||
|
|
||||||
# The commit message will be extracted from the differences between a
|
|
||||||
# file named ChangeLog* in the commit list, or named after -C, and the
|
|
||||||
# one in the repository (unless a message was specified with `-m' or
|
|
||||||
# `-F'). An empty message is not accepted (but a blank line is). If
|
|
||||||
# the message is acceptable, it will be presented for verification
|
|
||||||
# (and possible edition) using the $PAGER environment variable (or
|
|
||||||
# `more', if it is not set, or `cat', if the `-f' switch is given).
|
|
||||||
# If $PAGER exits successfully, the modified files (at that moment)
|
|
||||||
# are checked in, unless `-n' was specified, in which case nothing is
|
|
||||||
# checked in.
|
|
||||||
|
|
||||||
# usage: clcommit [-v] [-h] [-f] [-l] [-n] [-q] [-z N] [-C ChangeLog_file]
|
|
||||||
# [-m msg|-F msg_file|-1] [--] [file|dir ...]
|
|
||||||
|
|
||||||
# -f --force don't check (unless *followed* by -n), and just
|
|
||||||
# display commit message instead of running $PAGER
|
|
||||||
# -l --local don't descend into subdirectories
|
|
||||||
# -m msg --message=msg set commit message
|
|
||||||
# --msg=msg same as -m
|
|
||||||
# -F file --file=file read commit message from file
|
|
||||||
# -1 --first extract first entry from ChangeLog, no cvs diff
|
|
||||||
# -C file --changelog=file extract commit message from specified ChangeLog
|
|
||||||
# --fast same as --force --first
|
|
||||||
# -n --dry-run don't commit anything
|
|
||||||
# -q --quiet run cvs in quiet mode
|
|
||||||
# -zN --compress=N set compression level (0-9, 0=none, 9=max)
|
|
||||||
# -v --version print version information
|
|
||||||
# -h,-? --help print short or long help message
|
|
||||||
|
|
||||||
name=clcommit
|
|
||||||
: ${CVS=cvs}
|
|
||||||
cvsopt=
|
|
||||||
updateopt=
|
|
||||||
commitopt=
|
|
||||||
dry_run=false
|
|
||||||
commit=:
|
|
||||||
update=:
|
|
||||||
log_file="${TMPDIR-/tmp}/commitlog.$$"
|
|
||||||
first=false
|
|
||||||
|
|
||||||
rm -f "$log_file"
|
|
||||||
trap 'rm -f "$log_file"; exit 1' 1 2 15
|
|
||||||
|
|
||||||
# this just eases exit handling
|
|
||||||
main_repeat=":"
|
|
||||||
while $main_repeat; do
|
|
||||||
|
|
||||||
repeat="test $# -gt 0"
|
|
||||||
while $repeat; do
|
|
||||||
case "$1" in
|
|
||||||
--fast)
|
|
||||||
shift
|
|
||||||
set fnord --force --first ${1+"$@"}
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-f|--force)
|
|
||||||
update=false
|
|
||||||
PAGER=cat
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-l|--local)
|
|
||||||
updateopt="$updateopt -l"
|
|
||||||
commitopt="$commitopt -l"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-m|--message|--msg)
|
|
||||||
if test $# = 1; then
|
|
||||||
echo "$name: missing argument for $1" >&2
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
if $first || test -f "$log_file"; then
|
|
||||||
echo "$name: you can have at most one of -m, -F and -1" >&2
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
echo "$1" > "$log_file"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-F|--file)
|
|
||||||
if $first || test -f "$log_file"; then
|
|
||||||
echo "$name: you can have at most one of -m, -F and -1" >&2
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
if test $# = 1; then
|
|
||||||
echo "$name: missing argument for $1" >&2
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
if cat < "$1" > "$log_file"; then :; else
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-1|--first)
|
|
||||||
if test -f "$log_File"; then
|
|
||||||
echo "$name: you can have at most one of -m, -F and -1" >&2
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
first=:
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-C|--[cC]hange[lL]og)
|
|
||||||
if test $# = 1; then
|
|
||||||
echo "$name: missing argument for $1" >&2
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
if test ! -f "$1"; then
|
|
||||||
echo "$name: ChangeLog file \`$1' does not exist" >&2
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
ChangeLog="$1"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-n|--dry-run)
|
|
||||||
commit=false
|
|
||||||
update=true
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-q|--quiet)
|
|
||||||
cvsopt="$cvsopt -q"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-v|--verbose)
|
|
||||||
cvsopt="$cvsopt -t"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-z|--compress)
|
|
||||||
if test $# = 1; then
|
|
||||||
echo "$name: missing argument for $1" >&2
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
case "$2" in
|
|
||||||
[0-9]) :;;
|
|
||||||
*) echo "$name: invalid argument for $1" >&2
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
cvsopt="$cvsopt -z$2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
|
|
||||||
-m*|-F*|-C*|-z*)
|
|
||||||
opt=`echo "$1" | sed '1s/^\(..\).*$/\1/;q'`
|
|
||||||
arg=`echo "$1" | sed '1s/^-[a-zA-Z0-9]//'`
|
|
||||||
shift
|
|
||||||
set -- "$opt" "$arg" ${1+"$@"}
|
|
||||||
;;
|
|
||||||
--message=*|--msg=*|--file=*|--[Cc]hange[Ll]og=*|--compress=*)
|
|
||||||
opt=`echo "$1" | sed '1s/^\(--[^=]*\)=.*/\1/;q'`
|
|
||||||
arg=`echo "$1" | sed '1s/^--[^=]*=//'`
|
|
||||||
shift
|
|
||||||
set -- "$opt" "$arg" ${1+"$@"}
|
|
||||||
;;
|
|
||||||
|
|
||||||
-v|--version)
|
|
||||||
sed '/^# '$name' version /,/^# Heavily modified by/ { s/^# //; p; }; d' < $0
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
-\?|-h)
|
|
||||||
sed '/^# usage:/,/# -h/ { s/^# //; p; }; d' < $0 &&
|
|
||||||
echo
|
|
||||||
echo "run \`$name --help | more' for full usage"
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
--help)
|
|
||||||
sed '/^# '$name' version /,/^[^#]/ { /^[^#]/ d; s/^# //; p; }; d' < $0
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
--)
|
|
||||||
shift
|
|
||||||
repeat=false
|
|
||||||
;;
|
|
||||||
-*)
|
|
||||||
echo "$name: invalid flag $1" >&2
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
repeat=false
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
# might have used break 2 within the previous loop, but so what
|
|
||||||
$repeat && break
|
|
||||||
|
|
||||||
$update && \
|
|
||||||
if echo "$name: checking for conflicts..." >&2
|
|
||||||
($CVS $cvsopt -q -n update $updateopt ${1+"$@"} 2>/dev/null \
|
|
||||||
| while read line; do
|
|
||||||
echo "$line"
|
|
||||||
echo "$line" >&3
|
|
||||||
done | grep '^C') 3>&1 >/dev/null; then
|
|
||||||
echo "$name: some conflicts were found, aborting..." >&2
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test ! -f "$log_file"; then
|
|
||||||
if test -z "$ChangeLog"; then
|
|
||||||
for f in ${1+"$@"}; do
|
|
||||||
case "$f" in
|
|
||||||
ChangeLog* | */ChangeLog*)
|
|
||||||
if test -z "$ChangeLog"; then
|
|
||||||
ChangeLog="$f"
|
|
||||||
else
|
|
||||||
echo "$name: multiple ChangeLog files: $ChangeLog and $f" >&2
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "$name: checking commit message..." >&2
|
|
||||||
if $first; then
|
|
||||||
skipping=:
|
|
||||||
sed 's,^,+,' < ${ChangeLog-ChangeLog} |
|
|
||||||
while read line; do
|
|
||||||
case "$line" in
|
|
||||||
"+2"*) if $skipping; then skipping=false; else break; fi;;
|
|
||||||
"+ "*)
|
|
||||||
echo "$name: *** Warning: lines should start with tabs, not spaces; ignoring line:" >&2
|
|
||||||
echo "$line" | sed 's/^.//' >&2;;
|
|
||||||
"+ "*)
|
|
||||||
$skipping || echo "$line" ;;
|
|
||||||
esac
|
|
||||||
done |
|
|
||||||
sed 's,^\+ ,,' > "$log_file" || break
|
|
||||||
else
|
|
||||||
$CVS $cvsopt diff -u ${ChangeLog-ChangeLog} |
|
|
||||||
while read line; do
|
|
||||||
case $line in
|
|
||||||
"--- "*) :;;
|
|
||||||
"-"*)
|
|
||||||
echo "$name: *** Warning: the following line in ChangeLog diff is suspicious:" >&2
|
|
||||||
echo "$line" | sed 's/^.//' >&2;;
|
|
||||||
"+ "*)
|
|
||||||
echo "$name: *** Warning: lines should start with tabs, not spaces; ignoring line:" >&2
|
|
||||||
echo "$line" | sed 's/^.//' >&2;;
|
|
||||||
"+") echo;;
|
|
||||||
"+ "*) echo "$line";;
|
|
||||||
esac
|
|
||||||
done |
|
|
||||||
sed -e 's,\+ ,,' -e '/./p' -e '/./d' -e '1d' -e '$d' > "$log_file" \
|
|
||||||
|| break
|
|
||||||
fi
|
|
||||||
# The sed script above removes "+TAB" from the beginning of a line, then
|
|
||||||
# deletes the first and/or the last line, when they happen to be empty
|
|
||||||
fi
|
|
||||||
|
|
||||||
if grep '[^ ]' < "$log_file" > /dev/null; then :; else
|
|
||||||
echo "$name: empty commit message, aborting" >&2
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
|
|
||||||
if grep '^$' < "$log_file" > /dev/null; then
|
|
||||||
echo "$name: *** Warning: blank lines should not appear within commit messages." >&2
|
|
||||||
echo "$name: *** They should be used to separate distinct commits." >&2
|
|
||||||
fi
|
|
||||||
|
|
||||||
${PAGER-more} "$log_file" || break
|
|
||||||
|
|
||||||
sleep 1 # give the user some time for a ^C
|
|
||||||
|
|
||||||
# Do not check for empty $log_file again, even though the user might have
|
|
||||||
# zeroed it out. If s/he did, it was probably intentional.
|
|
||||||
|
|
||||||
if $commit; then
|
|
||||||
$CVS $cvsopt commit $commitopt -F $log_file ${1+"$@"} || break
|
|
||||||
fi
|
|
||||||
|
|
||||||
main_repeat=false
|
|
||||||
done
|
|
||||||
|
|
||||||
rm -f "$log_file"
|
|
||||||
|
|
||||||
# if main_repeat was not set to `false', we failed
|
|
||||||
$main_repeat && exit 1
|
|
||||||
exit 0
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
|
## Copyright (C) 2005 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
## 02110-1301 USA
|
||||||
|
|
||||||
|
if BISON_CXX_WORKS
|
||||||
|
SUBDIRS = calc++
|
||||||
|
endif
|
||||||
|
|
||||||
|
dist_noinst_SCRIPTS = extexi
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
*.cc
|
||||||
|
*.hh
|
||||||
|
*.ll
|
||||||
|
*.output
|
||||||
|
*.stamp
|
||||||
|
*.tmp
|
||||||
|
*.yy
|
||||||
|
.deps
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
calc++
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
|
## Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
## This program is free software; you can redistribute it and/or modify
|
||||||
|
## it under the terms of the GNU General Public License as published by
|
||||||
|
## the Free Software Foundation; either version 2 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
## 02110-1301 USA
|
||||||
|
|
||||||
|
## ------------------------------------- ##
|
||||||
|
## Running the bison from this tarball. ##
|
||||||
|
## ------------------------------------- ##
|
||||||
|
|
||||||
|
BISON = $(top_builddir)/tests/bison
|
||||||
|
BISON_IN = $(top_srcdir)/tests/bison.in
|
||||||
|
|
||||||
|
$(BISON): $(BISON_IN)
|
||||||
|
cd $(top_builddir)/tests && $(MAKE) $(AM_MAKEFLAGS) bison
|
||||||
|
|
||||||
|
## ------------ ##
|
||||||
|
## Extracting. ##
|
||||||
|
## ------------ ##
|
||||||
|
|
||||||
|
doc = $(top_srcdir)/doc/bison.texinfo
|
||||||
|
extexi = $(top_srcdir)/examples/extexi
|
||||||
|
# Extract in src.
|
||||||
|
$(calc_extracted): $(doc) $(extexi)
|
||||||
|
cd $(srcdir) && \
|
||||||
|
$(AWK) -f ../extexi ../../doc/bison.texinfo -- \
|
||||||
|
calc++-parser.yy \
|
||||||
|
calc++-scanner.ll calc++.cc calc++-driver.hh calc++-driver.cc
|
||||||
|
|
||||||
|
|
||||||
|
## ------------------- ##
|
||||||
|
## Parser generation. ##
|
||||||
|
## ------------------- ##
|
||||||
|
|
||||||
|
BUILT_SOURCES = $(calc_extracted) $(calc_sources_generated)
|
||||||
|
CLEANFILES = $(srcdir)/*.output *.tmp
|
||||||
|
MAINTAINERCLEANFILES = $(srcdir)/*.stamp $(BUILT_SOURCES)
|
||||||
|
|
||||||
|
# Compile the parser and save cycles.
|
||||||
|
# This code comes from "Handling Tools that Produce Many Outputs",
|
||||||
|
# from the Automake documentation.
|
||||||
|
EXTRA_DIST = $(srcdir)/calc++-parser.stamp $(srcdir)/calc++-parser.yy
|
||||||
|
# Don't depend on $(BISON) otherwise we would rebuild these files
|
||||||
|
# in srcdir, including during distcheck, which is forbidden.
|
||||||
|
$(srcdir)/calc++-parser.stamp: $(srcdir)/calc++-parser.yy $(BISON_IN)
|
||||||
|
@rm -f calc++-parser.tmp
|
||||||
|
@touch calc++-parser.tmp
|
||||||
|
$(BISON) -d -ra -S lalr1.cc -o $(srcdir)/calc++-parser.cc \
|
||||||
|
$(srcdir)/calc++-parser.yy
|
||||||
|
@mv -f calc++-parser.tmp $@
|
||||||
|
|
||||||
|
$(calc_sources_generated): $(srcdir)/calc++-parser.stamp
|
||||||
|
@if test -f $@; then :; else \
|
||||||
|
rm -f $(srcdir)/calc++-parser.stamp && \
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) $(srcdir)/calc++-parser.stamp; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
## --------------------------- ##
|
||||||
|
## Building & testing calc++. ##
|
||||||
|
## --------------------------- ##
|
||||||
|
|
||||||
|
check_PROGRAMS = calc++
|
||||||
|
|
||||||
|
calc_sources_extracted = $(srcdir)/calc++-scanner.ll $(srcdir)/calc++.cc \
|
||||||
|
$(srcdir)/calc++-driver.hh $(srcdir)/calc++-driver.cc
|
||||||
|
calc_extracted = $(calc_sources_extracted) $(srcdir)/calc++-parser.yy
|
||||||
|
calc_sources_generated = \
|
||||||
|
$(srcdir)/stack.hh $(srcdir)/position.hh $(srcdir)/location.hh \
|
||||||
|
$(srcdir)/calc++-parser.hh $(srcdir)/calc++-parser.cc
|
||||||
|
|
||||||
|
calc___SOURCES = $(calc_sources_extracted) $(calc_sources_generated)
|
||||||
|
|
||||||
|
TESTS = test
|
||||||
|
EXTRA_DIST += $(TESTS)
|
||||||
Executable
+31
@@ -0,0 +1,31 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
test -z "$VERBOSE" && {
|
||||||
|
exec > /dev/null 2>&1
|
||||||
|
set -x
|
||||||
|
}
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
a := 1
|
||||||
|
b := 2
|
||||||
|
c := 3
|
||||||
|
d := a + b * c
|
||||||
|
d
|
||||||
|
EOF
|
||||||
|
|
||||||
|
./calc++ input
|
||||||
|
./calc++ -p input
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
a := 1
|
||||||
|
d := a + b * c
|
||||||
|
EOF
|
||||||
|
./calc++ input
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
toto := 1
|
||||||
|
toto
|
||||||
|
EOF
|
||||||
|
./calc++ -s input
|
||||||
|
|
||||||
|
rm input
|
||||||
+138
@@ -0,0 +1,138 @@
|
|||||||
|
# Extract all examples from the manual source. -*- AWK -*-
|
||||||
|
|
||||||
|
# This file is part of GNU Bison
|
||||||
|
# Copyright 1992, 2000, 2001, 2005, 2006 Free Software Foundation, Inc.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 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 script is for use with any Awk that conforms to POSIX.
|
||||||
|
# It was derived from a similar script tests/generate.awk in GNU m4.
|
||||||
|
#
|
||||||
|
# Usage: extexi input-file.texi ... -- [FILES to extract]
|
||||||
|
BEGIN {
|
||||||
|
if (!output_dir)
|
||||||
|
output_dir = ".";
|
||||||
|
for (argc = 1; argc < ARGC; ++argc)
|
||||||
|
if (ARGV[argc] == "--")
|
||||||
|
break;
|
||||||
|
for (i = argc + 1; i < ARGC; ++i)
|
||||||
|
file_wanted[ARGV[i]] = 1;
|
||||||
|
ARGC = argc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/^@node / {
|
||||||
|
if (seq > 0)
|
||||||
|
print "AT_CLEANUP";
|
||||||
|
|
||||||
|
split ($0, tmp, ",");
|
||||||
|
node = substr(tmp[1], 7);
|
||||||
|
seq = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/^@comment file: / {
|
||||||
|
if (!file_wanted[$3])
|
||||||
|
message("ignoring " $3);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
message("extracting " $3);
|
||||||
|
file = $3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/^@example$/, /^@end example$/ {
|
||||||
|
if (!file)
|
||||||
|
next;
|
||||||
|
|
||||||
|
if ($0 ~ /^@example$/)
|
||||||
|
{
|
||||||
|
input = files_output[file] ? "\n" : "";
|
||||||
|
|
||||||
|
# FNR is starting at 0 instead of 1, and
|
||||||
|
# #line report the line number of the *next* line.
|
||||||
|
# => + 2.
|
||||||
|
# Note that recent Bison support it, but not Flex.
|
||||||
|
if (file ~ /\.[chy]*$/)
|
||||||
|
input = "#line " (FNR + 1) " \"" FILENAME "\"\n";
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($0 ~ /^@end example$/)
|
||||||
|
{
|
||||||
|
if (input == "")
|
||||||
|
fatal("no contents: " file);
|
||||||
|
|
||||||
|
input = normalize(input);
|
||||||
|
# No spurious end of line: use printf.
|
||||||
|
if (files_output[file])
|
||||||
|
# The parens around the output file seem to be required
|
||||||
|
# by awk on Mac OS X Tiger (darwin 8.4.6).
|
||||||
|
printf ("%s", input) >> (output_dir "/" file);
|
||||||
|
else
|
||||||
|
printf ("%s", input) > (output_dir "/" file);
|
||||||
|
close (output_dir "/" file);
|
||||||
|
files_output[file] = 1;
|
||||||
|
|
||||||
|
file = input = "";
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
input = input $0 "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# We have to handle CONTENTS line per line, since anchors in AWK are
|
||||||
|
# referring to the whole string, not the lines.
|
||||||
|
function normalize(contents, i, lines, n, line, res) {
|
||||||
|
# Remove the Texinfo tags.
|
||||||
|
n = split (contents, lines, "\n");
|
||||||
|
# We don't want the last field which empty: it's behind the last \n.
|
||||||
|
for (i = 1; i < n; ++i)
|
||||||
|
{
|
||||||
|
line = lines[i];
|
||||||
|
|
||||||
|
# Whole line commands.
|
||||||
|
if (line ~ /^@(c |comment|dots|end (ignore|group)|ignore|group)/)
|
||||||
|
# Gperf accepts empty lines as valid input!!!
|
||||||
|
if (file ~ /\.gperf$/)
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
line = "";
|
||||||
|
|
||||||
|
gsub (/^@result\{\}/, "", line);
|
||||||
|
gsub (/^@error\{\}/, "", line);
|
||||||
|
gsub ("@[{]", "{", line);
|
||||||
|
gsub ("@}", "}", line);
|
||||||
|
gsub ("@@", "@", line);
|
||||||
|
gsub ("@comment.*", "", line);
|
||||||
|
|
||||||
|
res = res line "\n";
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function message(msg) {
|
||||||
|
if (! message_printed[msg])
|
||||||
|
{
|
||||||
|
print "extexi: " msg > "/dev/stderr";
|
||||||
|
message_printed[msg] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function fatal(msg) {
|
||||||
|
message(msg);
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
+60
-2
@@ -1,5 +1,63 @@
|
|||||||
*_.c
|
|
||||||
.deps
|
.deps
|
||||||
Makefile
|
Makefile
|
||||||
ansi2knr ansi2knr.*
|
|
||||||
Makefile.in
|
Makefile.in
|
||||||
|
argmatch.c
|
||||||
|
argmatch.h
|
||||||
|
basename.c
|
||||||
|
dirname.c
|
||||||
|
dirname.h
|
||||||
|
dup-safer.c
|
||||||
|
error.c
|
||||||
|
error.h
|
||||||
|
exit.h
|
||||||
|
exitfail.c
|
||||||
|
exitfail.h
|
||||||
|
fd-safer.c
|
||||||
|
fopen-safer.c
|
||||||
|
getopt.c
|
||||||
|
getopt.h
|
||||||
|
getopt1.c
|
||||||
|
getopt_.h
|
||||||
|
getopt_int.h
|
||||||
|
gettext.h
|
||||||
|
gnulib.mk
|
||||||
|
hash.c
|
||||||
|
hash.h
|
||||||
|
malloc.c
|
||||||
|
mbswidth.c
|
||||||
|
mbswidth.h
|
||||||
|
obstack.c
|
||||||
|
obstack.h
|
||||||
|
pipe-safer.c
|
||||||
|
quote.c
|
||||||
|
quote.h
|
||||||
|
quotearg.c
|
||||||
|
quotearg.h
|
||||||
|
stdbool.h
|
||||||
|
stdbool_.h
|
||||||
|
stdint.h
|
||||||
|
stdint_.h
|
||||||
|
stdio--.h
|
||||||
|
stdio-safer.h
|
||||||
|
stpcpy.c
|
||||||
|
stpcpy.h
|
||||||
|
strerror.c
|
||||||
|
stripslash.c
|
||||||
|
strndup.c
|
||||||
|
strndup.h
|
||||||
|
strnlen.c
|
||||||
|
strnlen.h
|
||||||
|
strtol.c
|
||||||
|
strtoul.c
|
||||||
|
strverscmp.c
|
||||||
|
strverscmp.h
|
||||||
|
unistd--.h
|
||||||
|
unistd-safer.h
|
||||||
|
unlocked-io.h
|
||||||
|
verify.h
|
||||||
|
wcwidth.h
|
||||||
|
xalloc-die.c
|
||||||
|
xalloc.h
|
||||||
|
xmalloc.c
|
||||||
|
xstrndup.c
|
||||||
|
xstrndup.h
|
||||||
|
|||||||
+20
-27
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
## Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||||
|
|
||||||
## This program is free software; you can redistribute it and/or modify
|
## 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
|
## it under the terms of the GNU General Public License as published by
|
||||||
@@ -12,41 +12,32 @@
|
|||||||
|
|
||||||
## You should have received a copy of the GNU General Public License
|
## You should have received a copy of the GNU General Public License
|
||||||
## along with this program; if not, write to the Free Software
|
## along with this program; if not, write to the Free Software
|
||||||
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
## 02111-1307 USA
|
## 02110-1301 USA
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = ansi2knr
|
AM_CFLAGS = $(WARNING_CFLAGS)
|
||||||
|
|
||||||
CFLAGS = @CFLAGS@ $(WARNING_CFLAGS)
|
BUILT_SOURCES =
|
||||||
|
EXTRA_DIST =
|
||||||
|
MOSTLYCLEANFILES =
|
||||||
|
|
||||||
|
lib_LIBRARIES = $(YACC_LIBRARY)
|
||||||
|
EXTRA_LIBRARIES = liby.a
|
||||||
noinst_LIBRARIES = libbison.a
|
noinst_LIBRARIES = libbison.a
|
||||||
|
|
||||||
# config.h is in build/., and system.h is in src/src/.
|
liby_a_SOURCES = main.c yyerror.c
|
||||||
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
|
libbison_a_SOURCES = $(lib_SOURCES)
|
||||||
# understand inner AC_LIBOBJ (i.e., from Autoconf itself, not from
|
lib_SOURCES = \
|
||||||
# configure.in).
|
get-errno.h get-errno.c \
|
||||||
EXTRA_DIST = malloc.c realloc.c strnlen.c
|
subpipe.h subpipe.c \
|
||||||
|
|
||||||
libbison_a_SOURCES = \
|
|
||||||
gettext.h \
|
|
||||||
basename.c dirname.h dirname.c \
|
|
||||||
getopt.h getopt.c getopt1.c \
|
|
||||||
hash.h hash.c \
|
|
||||||
quote.h quote.c quotearg.h quotearg.c \
|
|
||||||
readpipe.c unlocked-io.h \
|
|
||||||
xalloc.h xmalloc.c xstrdup.c xstrndup.c \
|
|
||||||
$(bitsets_sources) $(additional_bitsets_sources) $(timevars_sources)
|
$(bitsets_sources) $(additional_bitsets_sources) $(timevars_sources)
|
||||||
|
|
||||||
# Implementation of bitsets
|
# Implementation of bitsets
|
||||||
bitsets_sources = \
|
bitsets_sources = \
|
||||||
libiberty.h \
|
abitset.c abitset.h bbitset.h bitset.c bitset.h bitset_stats.c \
|
||||||
abitset.c bitset.c bitset_stats.h ebitset.c lbitset.h \
|
bitset_stats.h bitsetv.c bitsetv.h ebitset.c ebitset.h lbitset.c \
|
||||||
abitset.h bitset.h bitsetv.c ebitset.h \
|
lbitset.h libiberty.h vbitset.c vbitset.h
|
||||||
bbitset.h bitset_stats.c bitsetv.h lbitset.c
|
|
||||||
|
|
||||||
# Additional bitset operations.
|
# Additional bitset operations.
|
||||||
additional_bitsets_sources = \
|
additional_bitsets_sources = \
|
||||||
@@ -56,5 +47,7 @@ additional_bitsets_sources = \
|
|||||||
timevars_sources = \
|
timevars_sources = \
|
||||||
timevar.h timevar.c timevar.def
|
timevar.h timevar.c timevar.def
|
||||||
|
|
||||||
libbison_a_LIBADD = @LIBOBJS@ @ALLOCA@
|
libbison_a_LIBADD = $(LIBOBJS) $(ALLOCA)
|
||||||
libbison_a_DEPENDENCIES = $(libbison_a_LIBADD)
|
libbison_a_DEPENDENCIES = $(libbison_a_LIBADD)
|
||||||
|
|
||||||
|
include gnulib.mk
|
||||||
|
|||||||
+470
-295
@@ -1,5 +1,5 @@
|
|||||||
/* Array bitsets.
|
/* Array bitsets.
|
||||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
|
||||||
Contributed by Michael Hayes ([email protected]).
|
Contributed by Michael Hayes ([email protected]).
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@@ -13,77 +13,41 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software Foundation,
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "abitset.h"
|
#include "abitset.h"
|
||||||
|
#include <stddef.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/* This file implements fixed size bitsets stored as an array
|
/* This file implements fixed size bitsets stored as an array
|
||||||
of words. Any unused bits in the last word must be zero. */
|
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_N_WORDS(N) (((N) + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS)
|
||||||
#define ABITSET_WORDS(X) ((X)->a.words)
|
#define ABITSET_WORDS(X) ((X)->a.words)
|
||||||
#define ABITSET_N_BITS(X) ((X)->a.n_bits)
|
|
||||||
|
|
||||||
|
|
||||||
/* Return size in bits of bitset SRC. */
|
static bitset_bindex
|
||||||
static int
|
abitset_resize (bitset src, bitset_bindex size)
|
||||||
abitset_size (src)
|
|
||||||
bitset src;
|
|
||||||
{
|
{
|
||||||
return ABITSET_N_BITS (src);
|
/* These bitsets have a fixed size. */
|
||||||
}
|
if (BITSET_SIZE_ (src) != size)
|
||||||
|
abort ();
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
/* Find list of up to NUM bits set in BSET starting from and including
|
/* 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
|
*NEXT and store in array LIST. Return with actual number of bits
|
||||||
found and with *NEXT indicating where search stopped. */
|
found and with *NEXT indicating where search stopped. */
|
||||||
static int
|
static bitset_bindex
|
||||||
abitset_small_list (src, list, num, next)
|
abitset_small_list (bitset src, bitset_bindex *list,
|
||||||
bitset src;
|
bitset_bindex num, bitset_bindex *next)
|
||||||
bitset_bindex *list;
|
|
||||||
bitset_bindex num;
|
|
||||||
bitset_bindex *next;
|
|
||||||
{
|
{
|
||||||
bitset_bindex bitno;
|
bitset_bindex bitno;
|
||||||
bitset_bindex count;
|
bitset_bindex count;
|
||||||
@@ -96,7 +60,7 @@ abitset_small_list (src, list, num, next)
|
|||||||
if (!word)
|
if (!word)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
size = ABITSET_N_BITS (src);
|
size = BITSET_SIZE_ (src);
|
||||||
bitno = *next;
|
bitno = *next;
|
||||||
if (bitno >= size)
|
if (bitno >= size)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -139,35 +103,34 @@ abitset_small_list (src, list, num, next)
|
|||||||
|
|
||||||
/* Set bit BITNO in bitset DST. */
|
/* Set bit BITNO in bitset DST. */
|
||||||
static void
|
static void
|
||||||
abitset_set (dst, bitno)
|
abitset_set (bitset dst ATTRIBUTE_UNUSED, bitset_bindex bitno ATTRIBUTE_UNUSED)
|
||||||
bitset dst ATTRIBUTE_UNUSED;
|
|
||||||
bitset_bindex bitno ATTRIBUTE_UNUSED;
|
|
||||||
{
|
{
|
||||||
/* This should never occur for abitsets. */
|
/* This should never occur for abitsets since we should always hit
|
||||||
|
the cache. It is likely someone is trying to access outside the
|
||||||
|
bounds of the bitset. */
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Reset bit BITNO in bitset DST. */
|
/* Reset bit BITNO in bitset DST. */
|
||||||
static void
|
static void
|
||||||
abitset_reset (dst, bitno)
|
abitset_reset (bitset dst ATTRIBUTE_UNUSED,
|
||||||
bitset dst ATTRIBUTE_UNUSED;
|
bitset_bindex bitno ATTRIBUTE_UNUSED)
|
||||||
bitset_bindex bitno ATTRIBUTE_UNUSED;
|
|
||||||
{
|
{
|
||||||
/* This should never occur for abitsets. */
|
/* This should never occur for abitsets since we should always hit
|
||||||
abort ();
|
the cache. It is likely someone is trying to access outside the
|
||||||
|
bounds of the bitset. Since the bit is zero anyway, let it pass. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Test bit BITNO in bitset SRC. */
|
/* Test bit BITNO in bitset SRC. */
|
||||||
static int
|
static bool
|
||||||
abitset_test (src, bitno)
|
abitset_test (bitset src ATTRIBUTE_UNUSED,
|
||||||
bitset src ATTRIBUTE_UNUSED;
|
bitset_bindex bitno ATTRIBUTE_UNUSED)
|
||||||
bitset_bindex bitno ATTRIBUTE_UNUSED;
|
|
||||||
{
|
{
|
||||||
/* This should never occur for abitsets. */
|
/* This should never occur for abitsets since we should always
|
||||||
abort ();
|
hit the cache. */
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -175,12 +138,9 @@ abitset_test (src, bitno)
|
|||||||
from and including NEXT and store in array LIST. Return with
|
from and including NEXT and store in array LIST. Return with
|
||||||
actual number of bits found and with *NEXT indicating where search
|
actual number of bits found and with *NEXT indicating where search
|
||||||
stopped. */
|
stopped. */
|
||||||
static int
|
static bitset_bindex
|
||||||
abitset_reverse_list (src, list, num, next)
|
abitset_list_reverse (bitset src, bitset_bindex *list,
|
||||||
bitset src;
|
bitset_bindex num, bitset_bindex *next)
|
||||||
bitset_bindex *list;
|
|
||||||
bitset_bindex num;
|
|
||||||
bitset_bindex *next;
|
|
||||||
{
|
{
|
||||||
bitset_bindex bitno;
|
bitset_bindex bitno;
|
||||||
bitset_bindex rbitno;
|
bitset_bindex rbitno;
|
||||||
@@ -188,9 +148,8 @@ abitset_reverse_list (src, list, num, next)
|
|||||||
bitset_windex windex;
|
bitset_windex windex;
|
||||||
unsigned int bitcnt;
|
unsigned int bitcnt;
|
||||||
bitset_bindex bitoff;
|
bitset_bindex bitoff;
|
||||||
bitset_word word;
|
|
||||||
bitset_word *srcp = ABITSET_WORDS (src);
|
bitset_word *srcp = ABITSET_WORDS (src);
|
||||||
bitset_bindex n_bits = ABITSET_N_BITS (src);
|
bitset_bindex n_bits = BITSET_SIZE_ (src);
|
||||||
|
|
||||||
rbitno = *next;
|
rbitno = *next;
|
||||||
|
|
||||||
@@ -210,6 +169,8 @@ abitset_reverse_list (src, list, num, next)
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
bitset_word word;
|
||||||
|
|
||||||
word = srcp[windex] << (BITSET_WORD_BITS - 1 - bitcnt);
|
word = srcp[windex] << (BITSET_WORD_BITS - 1 - bitcnt);
|
||||||
for (; word; bitcnt--)
|
for (; word; bitcnt--)
|
||||||
{
|
{
|
||||||
@@ -237,12 +198,9 @@ abitset_reverse_list (src, list, num, next)
|
|||||||
/* Find list of up to NUM bits set in BSET starting from and including
|
/* 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
|
*NEXT and store in array LIST. Return with actual number of bits
|
||||||
found and with *NEXT indicating where search stopped. */
|
found and with *NEXT indicating where search stopped. */
|
||||||
static int
|
static bitset_bindex
|
||||||
abitset_list (src, list, num, next)
|
abitset_list (bitset src, bitset_bindex *list,
|
||||||
bitset src;
|
bitset_bindex num, bitset_bindex *next)
|
||||||
bitset_bindex *list;
|
|
||||||
bitset_bindex num;
|
|
||||||
bitset_bindex *next;
|
|
||||||
{
|
{
|
||||||
bitset_bindex bitno;
|
bitset_bindex bitno;
|
||||||
bitset_bindex count;
|
bitset_bindex count;
|
||||||
@@ -270,7 +228,7 @@ abitset_list (src, list, num, next)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (bitno >= ABITSET_N_BITS (src))
|
if (bitno >= BITSET_SIZE_ (src))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
windex = bitno / BITSET_WORD_BITS;
|
windex = bitno / BITSET_WORD_BITS;
|
||||||
@@ -342,309 +300,526 @@ abitset_list (src, list, num, next)
|
|||||||
|
|
||||||
/* Ensure that any unused bits within the last word are clear. */
|
/* Ensure that any unused bits within the last word are clear. */
|
||||||
static inline void
|
static inline void
|
||||||
abitset_unused_clear (dst)
|
abitset_unused_clear (bitset dst)
|
||||||
bitset dst;
|
|
||||||
{
|
{
|
||||||
unsigned int last_bit;
|
unsigned int last_bit;
|
||||||
|
|
||||||
last_bit = ABITSET_N_BITS (dst) % BITSET_WORD_BITS;
|
last_bit = BITSET_SIZE_ (dst) % BITSET_WORD_BITS;
|
||||||
if (last_bit)
|
if (last_bit)
|
||||||
ABITSET_WORDS (dst)[dst->b.csize - 1] &=
|
ABITSET_WORDS (dst)[dst->b.csize - 1] &=
|
||||||
((bitset_word) 1 << last_bit) - 1;
|
((bitset_word) 1 << last_bit) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
abitset_op1 (dst, op)
|
abitset_ones (bitset dst)
|
||||||
bitset dst;
|
|
||||||
enum bitset_ops op;
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
|
||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
unsigned int bytes;
|
size_t bytes;
|
||||||
|
|
||||||
bytes = sizeof (bitset_word) * dst->b.csize;
|
bytes = sizeof (bitset_word) * dst->b.csize;
|
||||||
|
|
||||||
switch (op)
|
memset (dstp, -1, bytes);
|
||||||
{
|
abitset_unused_clear (dst);
|
||||||
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
|
static void
|
||||||
abitset_op2 (dst, src, op)
|
abitset_zero (bitset dst)
|
||||||
bitset dst;
|
{
|
||||||
bitset src;
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
enum bitset_ops op;
|
size_t bytes;
|
||||||
|
|
||||||
|
bytes = sizeof (bitset_word) * dst->b.csize;
|
||||||
|
|
||||||
|
memset (dstp, 0, bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
abitset_empty_p (bitset dst)
|
||||||
|
{
|
||||||
|
bitset_windex i;
|
||||||
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
|
|
||||||
|
for (i = 0; i < dst->b.csize; i++)
|
||||||
|
if (dstp[i])
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
abitset_copy1 (bitset dst, bitset src)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
|
||||||
bitset_word *srcp = ABITSET_WORDS (src);
|
bitset_word *srcp = ABITSET_WORDS (src);
|
||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
bitset_windex size = dst->b.csize;
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
switch (op)
|
if (srcp == dstp)
|
||||||
{
|
return;
|
||||||
case BITSET_OP_COPY:
|
memcpy (dstp, srcp, sizeof (bitset_word) * size);
|
||||||
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
|
static void
|
||||||
abitset_op3 (dst, src1, src2, op)
|
abitset_not (bitset dst, bitset src)
|
||||||
bitset dst;
|
|
||||||
bitset src1;
|
|
||||||
bitset src2;
|
|
||||||
enum bitset_ops op;
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
bitset_windex i;
|
||||||
int changed = 0;
|
bitset_word *srcp = ABITSET_WORDS (src);
|
||||||
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
|
*dstp++ = ~(*srcp++);
|
||||||
|
abitset_unused_clear (dst);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
abitset_equal_p (bitset dst, bitset src)
|
||||||
|
{
|
||||||
|
bitset_windex i;
|
||||||
|
bitset_word *srcp = ABITSET_WORDS (src);
|
||||||
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
|
if (*srcp++ != *dstp++)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
abitset_subset_p (bitset dst, bitset src)
|
||||||
|
{
|
||||||
|
bitset_windex i;
|
||||||
|
bitset_word *srcp = ABITSET_WORDS (src);
|
||||||
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++, dstp++, srcp++)
|
||||||
|
if (*dstp != (*srcp | *dstp))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
abitset_disjoint_p (bitset dst, bitset src)
|
||||||
|
{
|
||||||
|
bitset_windex i;
|
||||||
|
bitset_word *srcp = ABITSET_WORDS (src);
|
||||||
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
|
if (*srcp++ & *dstp++)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
abitset_and (bitset dst, bitset src1, bitset src2)
|
||||||
|
{
|
||||||
|
bitset_windex i;
|
||||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
bitset_windex size = dst->b.csize;
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
switch (op)
|
for (i = 0; i < size; i++)
|
||||||
|
*dstp++ = *src1p++ & *src2p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
abitset_and_cmp (bitset dst, bitset src1, bitset src2)
|
||||||
|
{
|
||||||
|
bitset_windex i;
|
||||||
|
bool changed = false;
|
||||||
|
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||||
|
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||||
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++, dstp++)
|
||||||
{
|
{
|
||||||
case BITSET_OP_OR:
|
bitset_word tmp = *src1p++ & *src2p++;
|
||||||
for (i = 0; i < size; i++, dstp++)
|
|
||||||
|
if (*dstp != tmp)
|
||||||
{
|
{
|
||||||
bitset_word tmp = *src1p++ | *src2p++;
|
changed = true;
|
||||||
|
*dstp = tmp;
|
||||||
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;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
abitset_op4 (dst, src1, src2, src3, op)
|
abitset_andn (bitset dst, bitset src1, bitset src2)
|
||||||
bitset dst;
|
|
||||||
bitset src1;
|
|
||||||
bitset src2;
|
|
||||||
bitset src3;
|
|
||||||
enum bitset_ops op;
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
bitset_windex 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;
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
|
*dstp++ = *src1p++ & ~(*src2p++);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
abitset_andn_cmp (bitset dst, bitset src1, bitset src2)
|
||||||
|
{
|
||||||
|
bitset_windex i;
|
||||||
|
bool changed = false;
|
||||||
|
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||||
|
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||||
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++, dstp++)
|
||||||
|
{
|
||||||
|
bitset_word tmp = *src1p++ & ~(*src2p++);
|
||||||
|
|
||||||
|
if (*dstp != tmp)
|
||||||
|
{
|
||||||
|
changed = true;
|
||||||
|
*dstp = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
abitset_or (bitset dst, bitset src1, bitset src2)
|
||||||
|
{
|
||||||
|
bitset_windex i;
|
||||||
|
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||||
|
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||||
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
|
*dstp++ = *src1p++ | *src2p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
abitset_or_cmp (bitset dst, bitset src1, bitset src2)
|
||||||
|
{
|
||||||
|
bitset_windex i;
|
||||||
|
bool changed = false;
|
||||||
|
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||||
|
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||||
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++, dstp++)
|
||||||
|
{
|
||||||
|
bitset_word tmp = *src1p++ | *src2p++;
|
||||||
|
|
||||||
|
if (*dstp != tmp)
|
||||||
|
{
|
||||||
|
changed = true;
|
||||||
|
*dstp = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
abitset_xor (bitset dst, bitset src1, bitset src2)
|
||||||
|
{
|
||||||
|
bitset_windex i;
|
||||||
|
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||||
|
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||||
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
|
*dstp++ = *src1p++ ^ *src2p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
abitset_xor_cmp (bitset dst, bitset src1, bitset src2)
|
||||||
|
{
|
||||||
|
bitset_windex i;
|
||||||
|
bool changed = false;
|
||||||
|
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||||
|
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||||
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++, dstp++)
|
||||||
|
{
|
||||||
|
bitset_word tmp = *src1p++ ^ *src2p++;
|
||||||
|
|
||||||
|
if (*dstp != tmp)
|
||||||
|
{
|
||||||
|
changed = true;
|
||||||
|
*dstp = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
abitset_and_or (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
|
{
|
||||||
|
bitset_windex i;
|
||||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||||
bitset_word *src3p = ABITSET_WORDS (src3);
|
bitset_word *src3p = ABITSET_WORDS (src3);
|
||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
bitset_windex size = dst->b.csize;
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
switch (op)
|
for (i = 0; i < size; i++)
|
||||||
|
*dstp++ = (*src1p++ & *src2p++) | *src3p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
abitset_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
|
{
|
||||||
|
bitset_windex i;
|
||||||
|
bool changed = false;
|
||||||
|
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;
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++, dstp++)
|
||||||
{
|
{
|
||||||
case BITSET_OP_OR_AND:
|
bitset_word tmp = (*src1p++ & *src2p++) | *src3p++;
|
||||||
for (i = 0; i < size; i++, dstp++)
|
|
||||||
|
if (*dstp != tmp)
|
||||||
{
|
{
|
||||||
bitset_word tmp = (*src1p++ | *src2p++) & *src3p++;
|
changed = true;
|
||||||
|
*dstp = tmp;
|
||||||
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;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
abitset_andn_or (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
|
{
|
||||||
|
bitset_windex i;
|
||||||
|
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;
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
|
*dstp++ = (*src1p++ & ~(*src2p++)) | *src3p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
abitset_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
|
{
|
||||||
|
bitset_windex i;
|
||||||
|
bool changed = false;
|
||||||
|
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;
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++, dstp++)
|
||||||
|
{
|
||||||
|
bitset_word tmp = (*src1p++ & ~(*src2p++)) | *src3p++;
|
||||||
|
|
||||||
|
if (*dstp != tmp)
|
||||||
|
{
|
||||||
|
changed = true;
|
||||||
|
*dstp = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
abitset_or_and (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
|
{
|
||||||
|
bitset_windex i;
|
||||||
|
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;
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
|
*dstp++ = (*src1p++ | *src2p++) & *src3p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
abitset_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
|
{
|
||||||
|
bitset_windex i;
|
||||||
|
bool changed = false;
|
||||||
|
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;
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++, dstp++)
|
||||||
|
{
|
||||||
|
bitset_word tmp = (*src1p++ | *src2p++) & *src3p++;
|
||||||
|
|
||||||
|
if (*dstp != tmp)
|
||||||
|
{
|
||||||
|
changed = true;
|
||||||
|
*dstp = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
abitset_copy (bitset dst, bitset src)
|
||||||
|
{
|
||||||
|
if (BITSET_COMPATIBLE_ (dst, src))
|
||||||
|
abitset_copy1 (dst, src);
|
||||||
|
else
|
||||||
|
bitset_copy_ (dst, src);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Vector of operations for single word bitsets. */
|
/* Vector of operations for single word bitsets. */
|
||||||
struct bitset_ops_struct abitset_small_ops = {
|
struct bitset_vtable abitset_small_vtable = {
|
||||||
abitset_set,
|
abitset_set,
|
||||||
abitset_reset,
|
abitset_reset,
|
||||||
|
bitset_toggle_,
|
||||||
abitset_test,
|
abitset_test,
|
||||||
abitset_size,
|
abitset_resize,
|
||||||
abitset_op1,
|
bitset_size_,
|
||||||
abitset_op2,
|
bitset_count_,
|
||||||
abitset_op3,
|
abitset_empty_p,
|
||||||
abitset_op4,
|
abitset_ones,
|
||||||
|
abitset_zero,
|
||||||
|
abitset_copy,
|
||||||
|
abitset_disjoint_p,
|
||||||
|
abitset_equal_p,
|
||||||
|
abitset_not,
|
||||||
|
abitset_subset_p,
|
||||||
|
abitset_and,
|
||||||
|
abitset_and_cmp,
|
||||||
|
abitset_andn,
|
||||||
|
abitset_andn_cmp,
|
||||||
|
abitset_or,
|
||||||
|
abitset_or_cmp,
|
||||||
|
abitset_xor,
|
||||||
|
abitset_xor_cmp,
|
||||||
|
abitset_and_or,
|
||||||
|
abitset_and_or_cmp,
|
||||||
|
abitset_andn_or,
|
||||||
|
abitset_andn_or_cmp,
|
||||||
|
abitset_or_and,
|
||||||
|
abitset_or_and_cmp,
|
||||||
abitset_small_list,
|
abitset_small_list,
|
||||||
abitset_reverse_list,
|
abitset_list_reverse,
|
||||||
NULL,
|
NULL,
|
||||||
BITSET_ARRAY
|
BITSET_ARRAY
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Vector of operations for multiple word bitsets. */
|
/* Vector of operations for multiple word bitsets. */
|
||||||
struct bitset_ops_struct abitset_ops = {
|
struct bitset_vtable abitset_vtable = {
|
||||||
abitset_set,
|
abitset_set,
|
||||||
abitset_reset,
|
abitset_reset,
|
||||||
|
bitset_toggle_,
|
||||||
abitset_test,
|
abitset_test,
|
||||||
abitset_size,
|
abitset_resize,
|
||||||
abitset_op1,
|
bitset_size_,
|
||||||
abitset_op2,
|
bitset_count_,
|
||||||
abitset_op3,
|
abitset_empty_p,
|
||||||
abitset_op4,
|
abitset_ones,
|
||||||
|
abitset_zero,
|
||||||
|
abitset_copy,
|
||||||
|
abitset_disjoint_p,
|
||||||
|
abitset_equal_p,
|
||||||
|
abitset_not,
|
||||||
|
abitset_subset_p,
|
||||||
|
abitset_and,
|
||||||
|
abitset_and_cmp,
|
||||||
|
abitset_andn,
|
||||||
|
abitset_andn_cmp,
|
||||||
|
abitset_or,
|
||||||
|
abitset_or_cmp,
|
||||||
|
abitset_xor,
|
||||||
|
abitset_xor_cmp,
|
||||||
|
abitset_and_or,
|
||||||
|
abitset_and_or_cmp,
|
||||||
|
abitset_andn_or,
|
||||||
|
abitset_andn_or_cmp,
|
||||||
|
abitset_or_and,
|
||||||
|
abitset_or_and_cmp,
|
||||||
abitset_list,
|
abitset_list,
|
||||||
abitset_reverse_list,
|
abitset_list_reverse,
|
||||||
NULL,
|
NULL,
|
||||||
BITSET_ARRAY
|
BITSET_ARRAY
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int
|
size_t
|
||||||
abitset_bytes (n_bits)
|
abitset_bytes (bitset_bindex n_bits)
|
||||||
bitset_bindex n_bits;
|
|
||||||
{
|
{
|
||||||
unsigned int bytes, size;
|
bitset_windex size;
|
||||||
|
size_t bytes;
|
||||||
|
size_t header_size = offsetof (union bitset_union, a.words);
|
||||||
|
struct bitset_align_struct { char a; union bitset_union b; };
|
||||||
|
size_t bitset_alignment = offsetof (struct bitset_align_struct, b);
|
||||||
|
|
||||||
size = ABITSET_N_WORDS (n_bits);
|
size = ABITSET_N_WORDS (n_bits);
|
||||||
bytes = size * sizeof (bitset_word);
|
bytes = header_size + size * sizeof (bitset_word);
|
||||||
return sizeof (struct bitset_struct) + bytes - sizeof (bitset_word);
|
|
||||||
|
/* Align the size properly for a vector of abitset objects. */
|
||||||
|
if (header_size % bitset_alignment != 0
|
||||||
|
|| sizeof (bitset_word) % bitset_alignment != 0)
|
||||||
|
{
|
||||||
|
bytes += bitset_alignment - 1;
|
||||||
|
bytes -= bytes % bitset_alignment;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bitset
|
bitset
|
||||||
abitset_init (bset, n_bits)
|
abitset_init (bitset bset, bitset_bindex n_bits)
|
||||||
bitset bset;
|
|
||||||
bitset_bindex n_bits;
|
|
||||||
{
|
{
|
||||||
bitset_windex size;
|
bitset_windex size;
|
||||||
|
|
||||||
size = ABITSET_N_WORDS (n_bits);
|
size = ABITSET_N_WORDS (n_bits);
|
||||||
ABITSET_N_BITS (bset) = n_bits;
|
BITSET_NBITS_ (bset) = n_bits;
|
||||||
|
|
||||||
/* Use optimized routines if bitset fits within a single word.
|
/* Use optimized routines if bitset fits within a single word.
|
||||||
There is probably little merit if using caching since
|
There is probably little merit if using caching since
|
||||||
the small bitset will always fit in the cache. */
|
the small bitset will always fit in the cache. */
|
||||||
if (size == 1)
|
if (size == 1)
|
||||||
bset->b.ops = &abitset_small_ops;
|
bset->b.vtable = &abitset_small_vtable;
|
||||||
else
|
else
|
||||||
bset->b.ops = &abitset_ops;
|
bset->b.vtable = &abitset_vtable;
|
||||||
|
|
||||||
bset->b.cindex = 0;
|
bset->b.cindex = 0;
|
||||||
bset->b.csize = size;
|
bset->b.csize = size;
|
||||||
|
|||||||
+6
-6
@@ -1,5 +1,5 @@
|
|||||||
/* Functions to support abitsets.
|
/* Functions to support abitsets.
|
||||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||||
Contributed by Michael Hayes ([email protected]).
|
Contributed by Michael Hayes ([email protected]).
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@@ -14,15 +14,15 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
#ifndef _ABITSET_H
|
#ifndef _ABITSET_H
|
||||||
#define _ABITSET_H
|
#define _ABITSET_H
|
||||||
|
|
||||||
#include "bbitset.h"
|
#include "bitset.h"
|
||||||
|
|
||||||
extern int abitset_bytes PARAMS ((bitset_bindex));
|
extern size_t abitset_bytes (bitset_bindex);
|
||||||
|
|
||||||
extern bitset abitset_init PARAMS ((bitset, bitset_bindex));
|
extern bitset abitset_init (bitset, bitset_bindex);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
-504
@@ -1,504 +0,0 @@
|
|||||||
/* alloca.c -- allocate automatically reclaimed memory
|
|
||||||
(Mostly) portable public-domain implementation -- D A Gwyn
|
|
||||||
|
|
||||||
This implementation of the PWB library alloca function,
|
|
||||||
which is used to allocate space off the run-time stack so
|
|
||||||
that it is automatically reclaimed upon procedure exit,
|
|
||||||
was inspired by discussions with J. Q. Johnson of Cornell.
|
|
||||||
J.Otto Tennant <[email protected]> contributed the Cray support.
|
|
||||||
|
|
||||||
There are some preprocessor constants that can
|
|
||||||
be defined when compiling for your specific system, for
|
|
||||||
improved efficiency; however, the defaults should be okay.
|
|
||||||
|
|
||||||
The general concept of this implementation is to keep
|
|
||||||
track of all alloca-allocated blocks, and reclaim any
|
|
||||||
that are found to be deeper in the stack than the current
|
|
||||||
invocation. This heuristic does not reclaim storage as
|
|
||||||
soon as it becomes invalid, but it will do so eventually.
|
|
||||||
|
|
||||||
As a special case, alloca(0) reclaims storage without
|
|
||||||
allocating any. It is a good idea to use alloca(0) in
|
|
||||||
your main control loop, etc. to force garbage collection. */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include <config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAVE_STRING_H
|
|
||||||
# include <string.h>
|
|
||||||
#endif
|
|
||||||
#if HAVE_STDLIB_H
|
|
||||||
# include <stdlib.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef emacs
|
|
||||||
# include "blockinput.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If compiling with GCC 2, this file's not needed. */
|
|
||||||
#if !defined (__GNUC__) || __GNUC__ < 2
|
|
||||||
|
|
||||||
/* If someone has defined alloca as a macro,
|
|
||||||
there must be some other way alloca is supposed to work. */
|
|
||||||
# ifndef alloca
|
|
||||||
|
|
||||||
# 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
|
|
||||||
you
|
|
||||||
lose
|
|
||||||
-- must know STACK_DIRECTION at compile-time
|
|
||||||
# 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)
|
|
||||||
long i00afunc ();
|
|
||||||
# define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
|
|
||||||
# else
|
|
||||||
# define ADDRESS_FUNCTION(arg) &(arg)
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# if __STDC__
|
|
||||||
typedef void *pointer;
|
|
||||||
# else
|
|
||||||
typedef char *pointer;
|
|
||||||
# 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
|
|
||||||
ordinary malloc isn't protected from input signals. On the other
|
|
||||||
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 xmalloc.
|
|
||||||
|
|
||||||
Callers below should use malloc. */
|
|
||||||
|
|
||||||
# ifndef emacs
|
|
||||||
# undef malloc
|
|
||||||
# define malloc xmalloc
|
|
||||||
# endif
|
|
||||||
extern pointer malloc ();
|
|
||||||
|
|
||||||
/* Define STACK_DIRECTION if you know the direction of stack
|
|
||||||
growth for your system; otherwise it will be automatically
|
|
||||||
deduced at run-time.
|
|
||||||
|
|
||||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
|
||||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
|
||||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
|
||||||
|
|
||||||
# ifndef STACK_DIRECTION
|
|
||||||
# define STACK_DIRECTION 0 /* Direction unknown. */
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# if STACK_DIRECTION != 0
|
|
||||||
|
|
||||||
# define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
|
|
||||||
|
|
||||||
# else /* STACK_DIRECTION == 0; need run-time code. */
|
|
||||||
|
|
||||||
static int stack_dir; /* 1 or -1 once known. */
|
|
||||||
# define STACK_DIR stack_dir
|
|
||||||
|
|
||||||
static void
|
|
||||||
find_stack_direction ()
|
|
||||||
{
|
|
||||||
static char *addr = NULL; /* Address of first `dummy', once known. */
|
|
||||||
auto char dummy; /* To get stack address. */
|
|
||||||
|
|
||||||
if (addr == NULL)
|
|
||||||
{ /* Initial entry. */
|
|
||||||
addr = ADDRESS_FUNCTION (dummy);
|
|
||||||
|
|
||||||
find_stack_direction (); /* Recurse once. */
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Second entry. */
|
|
||||||
if (ADDRESS_FUNCTION (dummy) > addr)
|
|
||||||
stack_dir = 1; /* Stack grew upward. */
|
|
||||||
else
|
|
||||||
stack_dir = -1; /* Stack grew downward. */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# endif /* STACK_DIRECTION == 0 */
|
|
||||||
|
|
||||||
/* An "alloca header" is used to:
|
|
||||||
(a) chain together all alloca'ed blocks;
|
|
||||||
(b) keep track of stack depth.
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
typedef union hdr
|
|
||||||
{
|
|
||||||
char align[ALIGN_SIZE]; /* To force sizeof(header). */
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
union hdr *next; /* For chaining headers. */
|
|
||||||
char *deep; /* For stack depth measure. */
|
|
||||||
} h;
|
|
||||||
} header;
|
|
||||||
|
|
||||||
static header *last_alloca_header = NULL; /* -> last alloca header. */
|
|
||||||
|
|
||||||
/* Return a pointer to at least SIZE bytes of storage,
|
|
||||||
which will be automatically reclaimed upon exit from
|
|
||||||
the procedure that called alloca. Originally, this space
|
|
||||||
was supposed to be taken from the current stack frame of the
|
|
||||||
caller, but that method cannot be made to work for some
|
|
||||||
implementations of C, for example under Gould's UTX/32. */
|
|
||||||
|
|
||||||
pointer
|
|
||||||
alloca (size_t size)
|
|
||||||
{
|
|
||||||
auto char probe; /* Probes stack depth: */
|
|
||||||
register char *depth = ADDRESS_FUNCTION (probe);
|
|
||||||
|
|
||||||
# if STACK_DIRECTION == 0
|
|
||||||
if (STACK_DIR == 0) /* Unknown growth direction. */
|
|
||||||
find_stack_direction ();
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/* Reclaim garbage, defined as all alloca'd storage that
|
|
||||||
was allocated from deeper in the stack than currently. */
|
|
||||||
|
|
||||||
{
|
|
||||||
register header *hp; /* Traverses linked list. */
|
|
||||||
|
|
||||||
# ifdef emacs
|
|
||||||
BLOCK_INPUT;
|
|
||||||
# endif
|
|
||||||
|
|
||||||
for (hp = last_alloca_header; hp != NULL;)
|
|
||||||
if ((STACK_DIR > 0 && hp->h.deep > depth)
|
|
||||||
|| (STACK_DIR < 0 && hp->h.deep < depth))
|
|
||||||
{
|
|
||||||
register header *np = hp->h.next;
|
|
||||||
|
|
||||||
free ((pointer) hp); /* Collect garbage. */
|
|
||||||
|
|
||||||
hp = np; /* -> next header. */
|
|
||||||
}
|
|
||||||
else
|
|
||||||
break; /* Rest are not deeper. */
|
|
||||||
|
|
||||||
last_alloca_header = hp; /* -> last valid storage. */
|
|
||||||
|
|
||||||
# ifdef emacs
|
|
||||||
UNBLOCK_INPUT;
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (size == 0)
|
|
||||||
return NULL; /* No allocation required. */
|
|
||||||
|
|
||||||
/* Allocate combined header + user data storage. */
|
|
||||||
|
|
||||||
{
|
|
||||||
register pointer new = malloc (sizeof (header) + size);
|
|
||||||
/* Address of header. */
|
|
||||||
|
|
||||||
if (new == 0)
|
|
||||||
abort();
|
|
||||||
|
|
||||||
((header *) new)->h.next = last_alloca_header;
|
|
||||||
((header *) new)->h.deep = depth;
|
|
||||||
|
|
||||||
last_alloca_header = (header *) new;
|
|
||||||
|
|
||||||
/* User storage begins just after header. */
|
|
||||||
|
|
||||||
return (pointer) ((char *) new + sizeof (header));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
|
||||||
|
|
||||||
# ifdef DEBUG_I00AFUNC
|
|
||||||
# include <stdio.h>
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifndef CRAY_STACK
|
|
||||||
# define CRAY_STACK
|
|
||||||
# ifndef CRAY2
|
|
||||||
/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
|
|
||||||
struct stack_control_header
|
|
||||||
{
|
|
||||||
long shgrow:32; /* Number of times stack has grown. */
|
|
||||||
long shaseg:32; /* Size of increments to stack. */
|
|
||||||
long shhwm:32; /* High water mark of stack. */
|
|
||||||
long shsize:32; /* Current size of stack (all segments). */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* The stack segment linkage control information occurs at
|
|
||||||
the high-address end of a stack segment. (The stack
|
|
||||||
grows from low addresses to high addresses.) The initial
|
|
||||||
part of the stack segment linkage control information is
|
|
||||||
0200 (octal) words. This provides for register storage
|
|
||||||
for the routine which overflows the stack. */
|
|
||||||
|
|
||||||
struct stack_segment_linkage
|
|
||||||
{
|
|
||||||
long ss[0200]; /* 0200 overflow words. */
|
|
||||||
long sssize:32; /* Number of words in this segment. */
|
|
||||||
long ssbase:32; /* Offset to stack base. */
|
|
||||||
long:32;
|
|
||||||
long sspseg:32; /* Offset to linkage control of previous
|
|
||||||
segment of stack. */
|
|
||||||
long:32;
|
|
||||||
long sstcpt:32; /* Pointer to task common address block. */
|
|
||||||
long sscsnm; /* Private control structure number for
|
|
||||||
microtasking. */
|
|
||||||
long ssusr1; /* Reserved for user. */
|
|
||||||
long ssusr2; /* Reserved for user. */
|
|
||||||
long sstpid; /* Process ID for pid based multi-tasking. */
|
|
||||||
long ssgvup; /* Pointer to multitasking thread giveup. */
|
|
||||||
long sscray[7]; /* Reserved for Cray Research. */
|
|
||||||
long ssa0;
|
|
||||||
long ssa1;
|
|
||||||
long ssa2;
|
|
||||||
long ssa3;
|
|
||||||
long ssa4;
|
|
||||||
long ssa5;
|
|
||||||
long ssa6;
|
|
||||||
long ssa7;
|
|
||||||
long sss0;
|
|
||||||
long sss1;
|
|
||||||
long sss2;
|
|
||||||
long sss3;
|
|
||||||
long sss4;
|
|
||||||
long sss5;
|
|
||||||
long sss6;
|
|
||||||
long sss7;
|
|
||||||
};
|
|
||||||
|
|
||||||
# else /* CRAY2 */
|
|
||||||
/* The following structure defines the vector of words
|
|
||||||
returned by the STKSTAT library routine. */
|
|
||||||
struct stk_stat
|
|
||||||
{
|
|
||||||
long now; /* Current total stack size. */
|
|
||||||
long maxc; /* Amount of contiguous space which would
|
|
||||||
be required to satisfy the maximum
|
|
||||||
stack demand to date. */
|
|
||||||
long high_water; /* Stack high-water mark. */
|
|
||||||
long overflows; /* Number of stack overflow ($STKOFEN) calls. */
|
|
||||||
long hits; /* Number of internal buffer hits. */
|
|
||||||
long extends; /* Number of block extensions. */
|
|
||||||
long stko_mallocs; /* Block allocations by $STKOFEN. */
|
|
||||||
long underflows; /* Number of stack underflow calls ($STKRETN). */
|
|
||||||
long stko_free; /* Number of deallocations by $STKRETN. */
|
|
||||||
long stkm_free; /* Number of deallocations by $STKMRET. */
|
|
||||||
long segments; /* Current number of stack segments. */
|
|
||||||
long maxs; /* Maximum number of stack segments so far. */
|
|
||||||
long pad_size; /* Stack pad size. */
|
|
||||||
long current_address; /* Current stack segment address. */
|
|
||||||
long current_size; /* Current stack segment size. This
|
|
||||||
number is actually corrupted by STKSTAT to
|
|
||||||
include the fifteen word trailer area. */
|
|
||||||
long initial_address; /* Address of initial segment. */
|
|
||||||
long initial_size; /* Size of initial segment. */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* The following structure describes the data structure which trails
|
|
||||||
any stack segment. I think that the description in 'asdef' is
|
|
||||||
out of date. I only describe the parts that I am sure about. */
|
|
||||||
|
|
||||||
struct stk_trailer
|
|
||||||
{
|
|
||||||
long this_address; /* Address of this block. */
|
|
||||||
long this_size; /* Size of this block (does not include
|
|
||||||
this trailer). */
|
|
||||||
long unknown2;
|
|
||||||
long unknown3;
|
|
||||||
long link; /* Address of trailer block of previous
|
|
||||||
segment. */
|
|
||||||
long unknown5;
|
|
||||||
long unknown6;
|
|
||||||
long unknown7;
|
|
||||||
long unknown8;
|
|
||||||
long unknown9;
|
|
||||||
long unknown10;
|
|
||||||
long unknown11;
|
|
||||||
long unknown12;
|
|
||||||
long unknown13;
|
|
||||||
long unknown14;
|
|
||||||
};
|
|
||||||
|
|
||||||
# endif /* CRAY2 */
|
|
||||||
# endif /* not CRAY_STACK */
|
|
||||||
|
|
||||||
# ifdef CRAY2
|
|
||||||
/* Determine a "stack measure" for an arbitrary ADDRESS.
|
|
||||||
I doubt that "lint" will like this much. */
|
|
||||||
|
|
||||||
static long
|
|
||||||
i00afunc (long *address)
|
|
||||||
{
|
|
||||||
struct stk_stat status;
|
|
||||||
struct stk_trailer *trailer;
|
|
||||||
long *block, size;
|
|
||||||
long result = 0;
|
|
||||||
|
|
||||||
/* We want to iterate through all of the segments. The first
|
|
||||||
step is to get the stack status structure. We could do this
|
|
||||||
more quickly and more directly, perhaps, by referencing the
|
|
||||||
$LM00 common block, but I know that this works. */
|
|
||||||
|
|
||||||
STKSTAT (&status);
|
|
||||||
|
|
||||||
/* Set up the iteration. */
|
|
||||||
|
|
||||||
trailer = (struct stk_trailer *) (status.current_address
|
|
||||||
+ status.current_size
|
|
||||||
- 15);
|
|
||||||
|
|
||||||
/* There must be at least one stack segment. Therefore it is
|
|
||||||
a fatal error if "trailer" is null. */
|
|
||||||
|
|
||||||
if (trailer == 0)
|
|
||||||
abort ();
|
|
||||||
|
|
||||||
/* Discard segments that do not contain our argument address. */
|
|
||||||
|
|
||||||
while (trailer != 0)
|
|
||||||
{
|
|
||||||
block = (long *) trailer->this_address;
|
|
||||||
size = trailer->this_size;
|
|
||||||
if (block == 0 || size == 0)
|
|
||||||
abort ();
|
|
||||||
trailer = (struct stk_trailer *) trailer->link;
|
|
||||||
if ((block <= address) && (address < (block + size)))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set the result to the offset in this segment and add the sizes
|
|
||||||
of all predecessor segments. */
|
|
||||||
|
|
||||||
result = address - block;
|
|
||||||
|
|
||||||
if (trailer == 0)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (trailer->this_size <= 0)
|
|
||||||
abort ();
|
|
||||||
result += trailer->this_size;
|
|
||||||
trailer = (struct stk_trailer *) trailer->link;
|
|
||||||
}
|
|
||||||
while (trailer != 0);
|
|
||||||
|
|
||||||
/* We are done. Note that if you present a bogus address (one
|
|
||||||
not in any segment), you will get a different number back, formed
|
|
||||||
from subtracting the address of the first block. This is probably
|
|
||||||
not what you want. */
|
|
||||||
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
# 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
|
|
||||||
routine is to linearize, in some sense, stack addresses
|
|
||||||
for alloca. */
|
|
||||||
|
|
||||||
static long
|
|
||||||
i00afunc (long address)
|
|
||||||
{
|
|
||||||
long stkl = 0;
|
|
||||||
|
|
||||||
long size, pseg, this_segment, stack;
|
|
||||||
long result = 0;
|
|
||||||
|
|
||||||
struct stack_segment_linkage *ssptr;
|
|
||||||
|
|
||||||
/* Register B67 contains the address of the end of the
|
|
||||||
current stack segment. If you (as a subprogram) store
|
|
||||||
your registers on the stack and find that you are past
|
|
||||||
the contents of B67, you have overflowed the segment.
|
|
||||||
|
|
||||||
B67 also points to the stack segment linkage control
|
|
||||||
area, which is what we are really interested in. */
|
|
||||||
|
|
||||||
stkl = CRAY_STACKSEG_END ();
|
|
||||||
ssptr = (struct stack_segment_linkage *) stkl;
|
|
||||||
|
|
||||||
/* If one subtracts 'size' from the end of the segment,
|
|
||||||
one has the address of the first word of the segment.
|
|
||||||
|
|
||||||
If this is not the first segment, 'pseg' will be
|
|
||||||
nonzero. */
|
|
||||||
|
|
||||||
pseg = ssptr->sspseg;
|
|
||||||
size = ssptr->sssize;
|
|
||||||
|
|
||||||
this_segment = stkl - size;
|
|
||||||
|
|
||||||
/* It is possible that calling this routine itself caused
|
|
||||||
a stack overflow. Discard stack segments which do not
|
|
||||||
contain the target address. */
|
|
||||||
|
|
||||||
while (!(this_segment <= address && address <= stkl))
|
|
||||||
{
|
|
||||||
# ifdef DEBUG_I00AFUNC
|
|
||||||
fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
|
|
||||||
# endif
|
|
||||||
if (pseg == 0)
|
|
||||||
break;
|
|
||||||
stkl = stkl - pseg;
|
|
||||||
ssptr = (struct stack_segment_linkage *) stkl;
|
|
||||||
size = ssptr->sssize;
|
|
||||||
pseg = ssptr->sspseg;
|
|
||||||
this_segment = stkl - size;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = address - this_segment;
|
|
||||||
|
|
||||||
/* If you subtract pseg from the current end of the stack,
|
|
||||||
you get the address of the previous stack segment's end.
|
|
||||||
This seems a little convoluted to me, but I'll bet you save
|
|
||||||
a cycle somewhere. */
|
|
||||||
|
|
||||||
while (pseg != 0)
|
|
||||||
{
|
|
||||||
# ifdef DEBUG_I00AFUNC
|
|
||||||
fprintf (stderr, "%011o %011o\n", pseg, size);
|
|
||||||
# endif
|
|
||||||
stkl = stkl - pseg;
|
|
||||||
ssptr = (struct stack_segment_linkage *) stkl;
|
|
||||||
size = ssptr->sssize;
|
|
||||||
pseg = ssptr->sspseg;
|
|
||||||
result += size;
|
|
||||||
}
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
# endif /* not CRAY2 */
|
|
||||||
# endif /* CRAY */
|
|
||||||
|
|
||||||
# endif /* no alloca */
|
|
||||||
#endif /* not GCC version 2 */
|
|
||||||
-309
@@ -1,309 +0,0 @@
|
|||||||
/* 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
@@ -1,129 +0,0 @@
|
|||||||
/* 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_ */
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
/* 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;
|
|
||||||
}
|
|
||||||
+222
-150
@@ -1,5 +1,5 @@
|
|||||||
/* Base bitset stuff.
|
/* Base bitset stuff.
|
||||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
|
||||||
Contributed by Michael Hayes ([email protected]).
|
Contributed by Michael Hayes ([email protected]).
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@@ -14,168 +14,81 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
#ifndef _BBITSET_H
|
#ifndef _BBITSET_H
|
||||||
#define _BBITSET_H
|
#define _BBITSET_H
|
||||||
|
|
||||||
#include "libiberty.h"
|
#include "libiberty.h"
|
||||||
|
|
||||||
#ifdef HAVE_LIMITS_H
|
#include <stdbool.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#endif
|
#include <stddef.h>
|
||||||
|
|
||||||
/* Currently we support three flavours of bitsets:
|
/* Currently we support five flavours of bitsets:
|
||||||
BITSET_ARRAY: Array of bits (fixed size, faster).
|
BITSET_ARRAY: Array of bits (fixed size, fast for dense bitsets).
|
||||||
BITSET_LIST: Linked list of array of bits (variable size, least storage
|
Memory for bit array and bitset structure allocated
|
||||||
for large very sparse sets).
|
contiguously.
|
||||||
BITSET_TABLE: Expandable table of pointers to array of bits
|
BITSET_LIST: Linked list of arrays of bits (variable size, least storage
|
||||||
(variable size, less storage for large sparse sets).
|
for large very sparse sets).
|
||||||
|
BITSET_TABLE: Expandable table of pointers to arrays of bits
|
||||||
BITSET_STATS: Wrapper bitset for internal use only.
|
(variable size, less storage for large sparse sets).
|
||||||
|
Faster than BITSET_LIST for random access.
|
||||||
|
BITSET_VARRAY: Variable array of bits (variable size, fast for
|
||||||
|
dense bitsets).
|
||||||
|
BITSET_STATS: Wrapper bitset for internal use only. Used for gathering
|
||||||
|
statistics and/or better run-time checking.
|
||||||
*/
|
*/
|
||||||
enum bitset_type {BITSET_ARRAY, BITSET_LIST, BITSET_TABLE, BITSET_TYPE_NUM,
|
enum bitset_type {BITSET_ARRAY, BITSET_LIST, BITSET_TABLE, BITSET_VARRAY,
|
||||||
BITSET_STATS};
|
BITSET_TYPE_NUM, BITSET_STATS};
|
||||||
#define BITSET_TYPE_NAMES {"abitset", "lbitset", "ebitset"}
|
#define BITSET_TYPE_NAMES {"abitset", "lbitset", "ebitset", "vbitset"}
|
||||||
|
|
||||||
|
extern const char * const bitset_type_names[];
|
||||||
|
|
||||||
enum bitset_alloc_type {BITSET_MALLOC, BITSET_OBALLOC};
|
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. */
|
/* Data type used to store a word of bits. */
|
||||||
typedef unsigned long bitset_word;
|
typedef unsigned long int bitset_word;
|
||||||
#define BITSET_WORD_BITS ((unsigned) (CHAR_BIT * sizeof (bitset_word)))
|
#define BITSET_WORD_BITS ((unsigned int) (CHAR_BIT * sizeof (bitset_word)))
|
||||||
|
|
||||||
/* Bit index. In theory we might need a type wider than size_t, but
|
/* 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
|
in practice we lose at most a factor of CHAR_BIT by going with
|
||||||
size_t, and that is good enough. */
|
size_t, and that is good enough. If this type is changed to be
|
||||||
|
wider than size_t, the code needs to be modified to check for
|
||||||
|
overflow when converting bit counts to byte or word counts.
|
||||||
|
The bit and word index types must be unsigned. */
|
||||||
typedef size_t bitset_bindex;
|
typedef size_t bitset_bindex;
|
||||||
|
|
||||||
/* Word index. */
|
/* Word index. */
|
||||||
typedef size_t bitset_windex;
|
typedef size_t bitset_windex;
|
||||||
|
|
||||||
#define BITSET_INDEX_MAX ((bitset_word) 1 << (BITSET_WORD_BITS - 1))
|
/* Maximum values for commonly-used unsigned types. BITSET_SIZE_MAX
|
||||||
|
always equals SIZE_MAX, but some older systems lack SIZE_MAX. */
|
||||||
|
#define BITSET_BINDEX_MAX ((bitset_bindex) -1)
|
||||||
|
|
||||||
|
/* Limit max word index to the maximum value of a signed integer
|
||||||
|
to simplify cache disabling. */
|
||||||
|
#define BITSET_WINDEX_MAX (((bitset_windex) -1) >> 1)
|
||||||
|
#define BITSET_SIZE_MAX ((size_t) -1)
|
||||||
|
|
||||||
#define BITSET_MSB ((bitset_word) 1 << (BITSET_WORD_BITS - 1))
|
#define BITSET_MSB ((bitset_word) 1 << (BITSET_WORD_BITS - 1))
|
||||||
|
|
||||||
#define BITSET_LIST_SIZE 1024
|
#define BITSET_LIST_SIZE 1024
|
||||||
|
|
||||||
enum bitset_ops {BITSET_OP_ZERO, BITSET_OP_ONES,
|
enum bitset_ops {BITSET_OP_ZERO, BITSET_OP_ONES,
|
||||||
BITSET_OP_COPY, BITSET_OP_NOT,
|
BITSET_OP_COPY, BITSET_OP_NOT,
|
||||||
BITSET_OP_EMPTY_P, BITSET_OP_EQUAL_P,
|
BITSET_OP_EMPTY_P, BITSET_OP_EQUAL_P,
|
||||||
BITSET_OP_SUBSET_P, BITSET_OP_DISJOINT_P,
|
BITSET_OP_SUBSET_P, BITSET_OP_DISJOINT_P,
|
||||||
BITSET_OP_AND, BITSET_OP_OR, BITSET_OP_XOR, BITSET_OP_ANDN,
|
BITSET_OP_AND, BITSET_OP_OR, BITSET_OP_XOR, BITSET_OP_ANDN,
|
||||||
BITSET_OP_OR_AND, BITSET_OP_AND_OR, BITSET_OP_ANDN_OR};
|
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 bbitset_struct
|
||||||
{
|
{
|
||||||
struct bitset_ops_struct *ops;
|
const struct bitset_vtable *vtable;
|
||||||
bitset_windex cindex; /* Cache word index. */
|
bitset_windex cindex; /* Cache word index. */
|
||||||
bitset_windex csize; /* Cache size in words. */
|
bitset_windex csize; /* Cache size in words. */
|
||||||
bitset_word *cdata; /* Cache data pointer. */
|
bitset_word *cdata; /* Cache data pointer. */
|
||||||
|
bitset_bindex n_bits; /* Number of bits. */
|
||||||
/* Perhaps we could sacrifice another word to indicate
|
/* Perhaps we could sacrifice another word to indicate
|
||||||
that the bitset is known to be zero, that a bit has been set
|
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.
|
in the cache, and that a bit has been cleared in the cache.
|
||||||
@@ -184,33 +97,64 @@ struct bbitset_struct
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct bitset_struct *bitset;
|
typedef union bitset_union *bitset;
|
||||||
|
|
||||||
|
|
||||||
|
/* Private accessor macros to bitset structure. */
|
||||||
|
#define BITSET_VTABLE_(SRC) (SRC)->b.vtable
|
||||||
|
#define BITSET_CINDEX_(SRC) (SRC)->b.cindex
|
||||||
|
#define BITSET_CDATA_(SRC) (SRC)->b.cdata
|
||||||
|
#define BITSET_CSIZE_(SRC) (SRC)->b.csize
|
||||||
|
#define BITSET_NBITS_(SRC) (SRC)->b.n_bits
|
||||||
|
|
||||||
|
|
||||||
/* The contents of this structure should be considered private. */
|
/* The contents of this structure should be considered private. */
|
||||||
struct bitset_ops_struct
|
struct bitset_vtable
|
||||||
{
|
{
|
||||||
void (*set) PARAMS ((struct bitset_struct *, bitset_bindex));
|
void (*set) (bitset, bitset_bindex);
|
||||||
void (*reset) PARAMS ((struct bitset_struct *, bitset_bindex));
|
void (*reset) (bitset, bitset_bindex);
|
||||||
int (*test) PARAMS ((struct bitset_struct *, bitset_bindex));
|
bool (*toggle) (bitset, bitset_bindex);
|
||||||
int (*size) PARAMS ((struct bitset_struct *));
|
bool (*test) (bitset, bitset_bindex);
|
||||||
int (*op1) PARAMS ((struct bitset_struct *, enum bitset_ops));
|
bitset_bindex (*resize) (bitset, bitset_bindex);
|
||||||
int (*op2) PARAMS ((struct bitset_struct *, struct bitset_struct *,
|
bitset_bindex (*size) (bitset);
|
||||||
enum bitset_ops));
|
bitset_bindex (*count) (bitset);
|
||||||
int (*op3) PARAMS ((struct bitset_struct *, struct bitset_struct *,
|
|
||||||
struct bitset_struct *, enum bitset_ops));
|
bool (*empty_p) (bitset);
|
||||||
int (*op4) PARAMS ((struct bitset_struct *, struct bitset_struct *,
|
void (*ones) (bitset);
|
||||||
struct bitset_struct *, struct bitset_struct *,
|
void (*zero) (bitset);
|
||||||
enum bitset_ops));
|
|
||||||
int (*list) PARAMS ((struct bitset_struct *, bitset_bindex *,
|
void (*copy) (bitset, bitset);
|
||||||
bitset_bindex, bitset_bindex *));
|
bool (*disjoint_p) (bitset, bitset);
|
||||||
int (*reverse_list) PARAMS ((struct bitset_struct *, bitset_bindex *,
|
bool (*equal_p) (bitset, bitset);
|
||||||
bitset_bindex, bitset_bindex *));
|
void (*not_) (bitset, bitset);
|
||||||
void (*free) PARAMS ((struct bitset_struct *));
|
bool (*subset_p) (bitset, bitset);
|
||||||
|
|
||||||
|
void (*and_) (bitset, bitset, bitset);
|
||||||
|
bool (*and_cmp) (bitset, bitset, bitset);
|
||||||
|
void (*andn) (bitset, bitset, bitset);
|
||||||
|
bool (*andn_cmp) (bitset, bitset, bitset);
|
||||||
|
void (*or_) (bitset, bitset, bitset);
|
||||||
|
bool (*or_cmp) (bitset, bitset, bitset);
|
||||||
|
void (*xor_) (bitset, bitset, bitset);
|
||||||
|
bool (*xor_cmp) (bitset, bitset, bitset);
|
||||||
|
|
||||||
|
void (*and_or) (bitset, bitset, bitset, bitset);
|
||||||
|
bool (*and_or_cmp) (bitset, bitset, bitset, bitset);
|
||||||
|
void (*andn_or) (bitset, bitset, bitset, bitset);
|
||||||
|
bool (*andn_or_cmp) (bitset, bitset, bitset, bitset);
|
||||||
|
void (*or_and) (bitset, bitset, bitset, bitset);
|
||||||
|
bool (*or_and_cmp) (bitset, bitset, bitset, bitset);
|
||||||
|
|
||||||
|
bitset_bindex (*list) (bitset, bitset_bindex *, bitset_bindex,
|
||||||
|
bitset_bindex *);
|
||||||
|
bitset_bindex (*list_reverse) (bitset, bitset_bindex *, bitset_bindex,
|
||||||
|
bitset_bindex *);
|
||||||
|
void (*free) (bitset);
|
||||||
enum bitset_type type;
|
enum bitset_type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BITSET_COMPATIBLE_(BSET1, BSET2) ((BSET1)->b.ops == (BSET2)->b.ops)
|
#define BITSET_COMPATIBLE_(BSET1, BSET2) \
|
||||||
|
((BSET1)->b.vtable == (BSET2)->b.vtable)
|
||||||
|
|
||||||
#define BITSET_CHECK2_(DST, SRC) \
|
#define BITSET_CHECK2_(DST, SRC) \
|
||||||
if (!BITSET_COMPATIBLE_ (DST, SRC)) abort ();
|
if (!BITSET_COMPATIBLE_ (DST, SRC)) abort ();
|
||||||
@@ -224,7 +168,135 @@ if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
|
|||||||
|| !BITSET_COMPATIBLE_ (DST, SRC3)) abort ();
|
|| !BITSET_COMPATIBLE_ (DST, SRC3)) abort ();
|
||||||
|
|
||||||
|
|
||||||
extern int bitset_op4 PARAMS ((bitset, bitset, bitset, bitset,
|
/* Redefine number of bits in bitset DST. */
|
||||||
enum bitset_ops op));
|
#define BITSET_RESIZE_(DST, SIZE) (DST)->b.vtable->resize (DST, SIZE)
|
||||||
|
|
||||||
|
/* Return size in bits of bitset SRC. */
|
||||||
|
#define BITSET_SIZE_(SRC) (SRC)->b.vtable->size (SRC)
|
||||||
|
|
||||||
|
/* Return number of bits set in bitset SRC. */
|
||||||
|
#define BITSET_COUNT_(SRC) (SRC)->b.vtable->count (SRC)
|
||||||
|
|
||||||
|
/* Return type of bitset SRC. */
|
||||||
|
#define BITSET_TYPE_(DST) (DST)->b.vtable->type
|
||||||
|
|
||||||
|
/* Set bit BITNO in bitset DST. */
|
||||||
|
#define BITSET_SET_(DST, BITNO) (DST)->b.vtable->set (DST, BITNO)
|
||||||
|
|
||||||
|
/* Reset bit BITNO in bitset DST. */
|
||||||
|
#define BITSET_RESET_(DST, BITNO) (DST)->b.vtable->reset (DST, BITNO)
|
||||||
|
|
||||||
|
/* Toggle bit BITNO in bitset DST. */
|
||||||
|
#define BITSET_TOGGLE_(DST, BITNO) (DST)->b.vtable->toggle (DST, BITNO)
|
||||||
|
|
||||||
|
/* Return non-zero if bit BITNO in bitset SRC is set. */
|
||||||
|
#define BITSET_TEST_(SRC, BITNO) (SRC)->b.vtable->test (SRC, BITNO)
|
||||||
|
|
||||||
|
/* Free bitset SRC. */
|
||||||
|
#define BITSET_FREE_(SRC)\
|
||||||
|
((SRC)->b.vtable->free ? (SRC)->b.vtable->free (SRC) :(void)0)
|
||||||
|
|
||||||
|
|
||||||
|
/* Return SRC == 0. */
|
||||||
|
#define BITSET_EMPTY_P_(SRC) (SRC)->b.vtable->empty_p (SRC)
|
||||||
|
|
||||||
|
/* DST = ~0. */
|
||||||
|
#define BITSET_ONES_(DST) (DST)->b.vtable->ones (DST)
|
||||||
|
|
||||||
|
/* DST = 0. */
|
||||||
|
#define BITSET_ZERO_(DST) (DST)->b.vtable->zero (DST)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* DST = SRC. */
|
||||||
|
#define BITSET_COPY_(DST, SRC) (SRC)->b.vtable->copy (DST, SRC)
|
||||||
|
|
||||||
|
/* Return DST & SRC == 0. */
|
||||||
|
#define BITSET_DISJOINT_P_(DST, SRC) (SRC)->b.vtable->disjoint_p (DST, SRC)
|
||||||
|
|
||||||
|
/* Return DST == SRC. */
|
||||||
|
#define BITSET_EQUAL_P_(DST, SRC) (SRC)->b.vtable->equal_p (DST, SRC)
|
||||||
|
|
||||||
|
/* DST = ~SRC. */
|
||||||
|
#define BITSET_NOT_(DST, SRC) (SRC)->b.vtable->not_ (DST, SRC)
|
||||||
|
|
||||||
|
/* Return DST == DST | SRC. */
|
||||||
|
#define BITSET_SUBSET_P_(DST, SRC) (SRC)->b.vtable->subset_p (DST, SRC)
|
||||||
|
|
||||||
|
|
||||||
|
/* DST = SRC1 & SRC2. */
|
||||||
|
#define BITSET_AND_(DST, SRC1, SRC2) (SRC1)->b.vtable->and_ (DST, SRC1, SRC2)
|
||||||
|
#define BITSET_AND_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->and_cmp (DST, SRC1, SRC2)
|
||||||
|
|
||||||
|
/* DST = SRC1 & ~SRC2. */
|
||||||
|
#define BITSET_ANDN_(DST, SRC1, SRC2) (SRC1)->b.vtable->andn (DST, SRC1, SRC2)
|
||||||
|
#define BITSET_ANDN_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->andn_cmp (DST, SRC1, SRC2)
|
||||||
|
|
||||||
|
/* DST = SRC1 | SRC2. */
|
||||||
|
#define BITSET_OR_(DST, SRC1, SRC2) (SRC1)->b.vtable->or_ (DST, SRC1, SRC2)
|
||||||
|
#define BITSET_OR_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->or_cmp (DST, SRC1, SRC2)
|
||||||
|
|
||||||
|
/* DST = SRC1 ^ SRC2. */
|
||||||
|
#define BITSET_XOR_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor_ (DST, SRC1, SRC2)
|
||||||
|
#define BITSET_XOR_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor_cmp (DST, SRC1, SRC2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* DST = (SRC1 & SRC2) | SRC3. Return non-zero if
|
||||||
|
DST != (SRC1 & SRC2) | SRC3. */
|
||||||
|
#define BITSET_AND_OR_(DST, SRC1, SRC2, SRC3) \
|
||||||
|
(SRC1)->b.vtable->and_or (DST, SRC1, SRC2, SRC3)
|
||||||
|
#define BITSET_AND_OR_CMP_(DST, SRC1, SRC2, SRC3) \
|
||||||
|
(SRC1)->b.vtable->and_or_cmp (DST, SRC1, SRC2, SRC3)
|
||||||
|
|
||||||
|
/* DST = (SRC1 & ~SRC2) | SRC3. Return non-zero if
|
||||||
|
DST != (SRC1 & ~SRC2) | SRC3. */
|
||||||
|
#define BITSET_ANDN_OR_(DST, SRC1, SRC2, SRC3) \
|
||||||
|
(SRC1)->b.vtable->andn_or (DST, SRC1, SRC2, SRC3)
|
||||||
|
#define BITSET_ANDN_OR_CMP_(DST, SRC1, SRC2, SRC3) \
|
||||||
|
(SRC1)->b.vtable->andn_or_cmp (DST, SRC1, SRC2, SRC3)
|
||||||
|
|
||||||
|
/* DST = (SRC1 | SRC2) & SRC3. Return non-zero if
|
||||||
|
DST != (SRC1 | SRC2) & SRC3. */
|
||||||
|
#define BITSET_OR_AND_(DST, SRC1, SRC2, SRC3) \
|
||||||
|
(SRC1)->b.vtable->or_and (DST, SRC1, SRC2, SRC3)
|
||||||
|
#define BITSET_OR_AND_CMP_(DST, SRC1, SRC2, SRC3) \
|
||||||
|
(SRC1)->b.vtable->or_and_cmp (DST, SRC1, SRC2, SRC3)
|
||||||
|
|
||||||
|
|
||||||
|
/* 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.vtable->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_LIST_REVERSE_(BSET, LIST, NUM, NEXT) \
|
||||||
|
(BSET)->b.vtable->list_reverse (BSET, LIST, NUM, NEXT)
|
||||||
|
|
||||||
|
|
||||||
|
/* Private functions for bitset implementations. */
|
||||||
|
|
||||||
|
extern bool bitset_toggle_ (bitset, bitset_bindex);
|
||||||
|
|
||||||
|
extern bitset_bindex bitset_count_ (bitset);
|
||||||
|
|
||||||
|
extern bitset_bindex bitset_size_ (bitset);
|
||||||
|
|
||||||
|
extern bool bitset_copy_ (bitset, bitset);
|
||||||
|
|
||||||
|
extern void bitset_and_or_ (bitset, bitset, bitset, bitset);
|
||||||
|
|
||||||
|
extern bool bitset_and_or_cmp_ (bitset, bitset, bitset, bitset);
|
||||||
|
|
||||||
|
extern void bitset_andn_or_ (bitset, bitset, bitset, bitset);
|
||||||
|
|
||||||
|
extern bool bitset_andn_or_cmp_ (bitset, bitset, bitset, bitset);
|
||||||
|
|
||||||
|
extern void bitset_or_and_ (bitset, bitset, bitset, bitset);
|
||||||
|
|
||||||
|
extern bool bitset_or_and_cmp_ (bitset, bitset, bitset, bitset);
|
||||||
|
|
||||||
#endif /* _BBITSET_H */
|
#endif /* _BBITSET_H */
|
||||||
|
|||||||
+215
-319
@@ -1,5 +1,5 @@
|
|||||||
/* General bitsets.
|
/* General bitsets.
|
||||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||||
Contributed by Michael Hayes ([email protected]).
|
Contributed by Michael Hayes ([email protected]).
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@@ -13,38 +13,41 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software Foundation,
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include "bitset.h"
|
#include "bitset.h"
|
||||||
#include "abitset.h"
|
#include "abitset.h"
|
||||||
#include "lbitset.h"
|
#include "lbitset.h"
|
||||||
#include "ebitset.h"
|
#include "ebitset.h"
|
||||||
|
#include "vbitset.h"
|
||||||
#include "bitset_stats.h"
|
#include "bitset_stats.h"
|
||||||
#include "obstack.h"
|
#include "obstack.h"
|
||||||
|
|
||||||
static void bitset_print PARAMS ((FILE *, bitset, int));
|
const char * const bitset_type_names[] = BITSET_TYPE_NAMES;
|
||||||
|
|
||||||
|
|
||||||
/* Return number of bytes required to create a N_BIT bitset
|
/* Return number of bytes required to create a N_BIT bitset
|
||||||
of TYPE. The bitset may grow to require more bytes than this. */
|
of TYPE. The bitset may grow to require more bytes than this. */
|
||||||
int
|
size_t
|
||||||
bitset_bytes (type, n_bits)
|
bitset_bytes (enum bitset_type type, bitset_bindex n_bits)
|
||||||
enum bitset_type type;
|
|
||||||
bitset_bindex n_bits;
|
|
||||||
{
|
{
|
||||||
unsigned int bytes;
|
size_t bytes;
|
||||||
|
|
||||||
if (bitset_stats_enabled)
|
if (bitset_stats_enabled)
|
||||||
return bitset_stats_bytes ();
|
return bitset_stats_bytes ();
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
|
||||||
case BITSET_ARRAY:
|
case BITSET_ARRAY:
|
||||||
bytes = abitset_bytes (n_bits);
|
bytes = abitset_bytes (n_bits);
|
||||||
break;
|
break;
|
||||||
@@ -57,8 +60,9 @@ bitset_bytes (type, n_bits)
|
|||||||
bytes = ebitset_bytes (n_bits);
|
bytes = ebitset_bytes (n_bits);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
case BITSET_VARRAY:
|
||||||
abort ();
|
bytes = vbitset_bytes (n_bits);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bytes;
|
return bytes;
|
||||||
@@ -67,16 +71,16 @@ bitset_bytes (type, n_bits)
|
|||||||
|
|
||||||
/* Initialise bitset BSET of TYPE for N_BITS. */
|
/* Initialise bitset BSET of TYPE for N_BITS. */
|
||||||
bitset
|
bitset
|
||||||
bitset_init (bset, n_bits, type)
|
bitset_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
|
||||||
bitset bset;
|
|
||||||
bitset_bindex n_bits;
|
|
||||||
enum bitset_type type;
|
|
||||||
{
|
{
|
||||||
if (bitset_stats_enabled)
|
if (bitset_stats_enabled)
|
||||||
return bitset_stats_init (bset, n_bits, type);
|
return bitset_stats_init (bset, n_bits, type);
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
|
||||||
case BITSET_ARRAY:
|
case BITSET_ARRAY:
|
||||||
return abitset_init (bset, n_bits);
|
return abitset_init (bset, n_bits);
|
||||||
|
|
||||||
@@ -86,8 +90,8 @@ bitset_init (bset, n_bits, type)
|
|||||||
case BITSET_TABLE:
|
case BITSET_TABLE:
|
||||||
return ebitset_init (bset, n_bits);
|
return ebitset_init (bset, n_bits);
|
||||||
|
|
||||||
default:
|
case BITSET_VARRAY:
|
||||||
abort ();
|
return vbitset_init (bset, n_bits);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,48 +100,45 @@ bitset_init (bset, n_bits, type)
|
|||||||
specified by ATTR. For variable size bitsets, N_BITS is only a
|
specified by ATTR. For variable size bitsets, N_BITS is only a
|
||||||
hint and may be zero. */
|
hint and may be zero. */
|
||||||
enum bitset_type
|
enum bitset_type
|
||||||
bitset_type_choose (n_bits, attr)
|
bitset_type_choose (bitset_bindex n_bits ATTRIBUTE_UNUSED, unsigned int attr)
|
||||||
bitset_bindex n_bits ATTRIBUTE_UNUSED;
|
|
||||||
unsigned int attr;
|
|
||||||
{
|
{
|
||||||
enum bitset_type type;
|
|
||||||
|
|
||||||
/* Check attributes. */
|
/* Check attributes. */
|
||||||
if (attr & BITSET_FIXED && attr & BITSET_VARIABLE)
|
if (attr & BITSET_FIXED && attr & BITSET_VARIABLE)
|
||||||
abort ();
|
abort ();
|
||||||
if (attr & BITSET_SPARSE && attr & BITSET_DENSE)
|
if (attr & BITSET_SPARSE && attr & BITSET_DENSE)
|
||||||
abort ();
|
abort ();
|
||||||
|
|
||||||
/* Note that sometimes we will be asked for a zero length
|
/* Choose the type of bitset. Note that sometimes we will be asked
|
||||||
fixed size bitset. */
|
for a zero length fixed size bitset. */
|
||||||
|
|
||||||
/* Choose the type of bitset. */
|
|
||||||
|
|
||||||
type = BITSET_ARRAY;
|
/* If no attributes selected, choose a good compromise. */
|
||||||
/* Currently, the simple bitsets do not support a variable size. */
|
if (!attr)
|
||||||
if (attr & BITSET_VARIABLE || attr & BITSET_SPARSE)
|
return BITSET_VARRAY;
|
||||||
{
|
|
||||||
type = BITSET_LIST;
|
|
||||||
if (attr & BITSET_DENSE || attr & BITSET_GREEDY)
|
|
||||||
type = BITSET_TABLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return type;
|
if (attr & BITSET_SPARSE)
|
||||||
|
return BITSET_LIST;
|
||||||
|
|
||||||
|
if (attr & BITSET_FIXED)
|
||||||
|
return BITSET_ARRAY;
|
||||||
|
|
||||||
|
if (attr & BITSET_GREEDY)
|
||||||
|
return BITSET_TABLE;
|
||||||
|
|
||||||
|
return BITSET_VARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Create a bitset of N_BITS of type TYPE. */
|
/* Create a bitset of N_BITS of type TYPE. */
|
||||||
bitset
|
bitset
|
||||||
bitset_alloc (n_bits, type)
|
bitset_alloc (bitset_bindex n_bits, enum bitset_type type)
|
||||||
bitset_bindex n_bits;
|
|
||||||
enum bitset_type type;
|
|
||||||
{
|
{
|
||||||
unsigned int bytes;
|
size_t bytes;
|
||||||
bitset bset;
|
bitset bset;
|
||||||
|
|
||||||
bytes = bitset_bytes (type, n_bits);
|
bytes = bitset_bytes (type, n_bits);
|
||||||
|
|
||||||
bset = (bitset) xcalloc (1, bytes);
|
bset = xcalloc (1, bytes);
|
||||||
|
|
||||||
/* The cache is disabled until some elements are allocated. If we
|
/* The cache is disabled until some elements are allocated. If we
|
||||||
have variable length arrays, then we may need to allocate a dummy
|
have variable length arrays, then we may need to allocate a dummy
|
||||||
@@ -149,12 +150,10 @@ bitset_alloc (n_bits, type)
|
|||||||
|
|
||||||
/* Create a bitset of N_BITS of type TYPE. */
|
/* Create a bitset of N_BITS of type TYPE. */
|
||||||
bitset
|
bitset
|
||||||
bitset_obstack_alloc (bobstack, n_bits, type)
|
bitset_obstack_alloc (struct obstack *bobstack,
|
||||||
struct obstack *bobstack;
|
bitset_bindex n_bits, enum bitset_type type)
|
||||||
bitset_bindex n_bits;
|
|
||||||
enum bitset_type type;
|
|
||||||
{
|
{
|
||||||
unsigned int bytes;
|
size_t bytes;
|
||||||
bitset bset;
|
bitset bset;
|
||||||
|
|
||||||
bytes = bitset_bytes (type, n_bits);
|
bytes = bitset_bytes (type, n_bits);
|
||||||
@@ -169,9 +168,7 @@ bitset_obstack_alloc (bobstack, n_bits, type)
|
|||||||
/* Create a bitset of N_BITS and with attribute hints specified by
|
/* Create a bitset of N_BITS and with attribute hints specified by
|
||||||
ATTR. */
|
ATTR. */
|
||||||
bitset
|
bitset
|
||||||
bitset_create (n_bits, attr)
|
bitset_create (bitset_bindex n_bits, unsigned int attr)
|
||||||
bitset_bindex n_bits;
|
|
||||||
unsigned int attr;
|
|
||||||
{
|
{
|
||||||
enum bitset_type type;
|
enum bitset_type type;
|
||||||
|
|
||||||
@@ -183,8 +180,7 @@ bitset_create (n_bits, attr)
|
|||||||
|
|
||||||
/* Free bitset BSET. */
|
/* Free bitset BSET. */
|
||||||
void
|
void
|
||||||
bitset_free (bset)
|
bitset_free (bitset bset)
|
||||||
bitset bset;
|
|
||||||
{
|
{
|
||||||
BITSET_FREE_ (bset);
|
BITSET_FREE_ (bset);
|
||||||
free (bset);
|
free (bset);
|
||||||
@@ -193,8 +189,7 @@ bitset_free (bset)
|
|||||||
|
|
||||||
/* Free bitset BSET allocated on obstack. */
|
/* Free bitset BSET allocated on obstack. */
|
||||||
void
|
void
|
||||||
bitset_obstack_free (bset)
|
bitset_obstack_free (bitset bset)
|
||||||
bitset bset;
|
|
||||||
{
|
{
|
||||||
BITSET_FREE_ (bset);
|
BITSET_FREE_ (bset);
|
||||||
}
|
}
|
||||||
@@ -202,117 +197,106 @@ bitset_obstack_free (bset)
|
|||||||
|
|
||||||
/* Return bitset type. */
|
/* Return bitset type. */
|
||||||
enum bitset_type
|
enum bitset_type
|
||||||
bitset_type_get (bset)
|
bitset_type_get (bitset bset)
|
||||||
bitset bset;
|
|
||||||
{
|
{
|
||||||
enum bitset_type type;
|
enum bitset_type type;
|
||||||
|
|
||||||
type = BITSET_TYPE_ (bset);
|
type = BITSET_TYPE_ (bset);
|
||||||
if (type != BITSET_STATS)
|
if (type != BITSET_STATS)
|
||||||
return type;
|
return type;
|
||||||
|
|
||||||
return bitset_stats_type_get (bset);
|
return bitset_stats_type_get (bset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Return name of bitset type. */
|
||||||
|
const char *
|
||||||
|
bitset_type_name_get (bitset bset)
|
||||||
|
{
|
||||||
|
enum bitset_type type;
|
||||||
|
|
||||||
|
type = bitset_type_get (bset);
|
||||||
|
|
||||||
|
return bitset_type_names[type];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Find next bit set in SRC starting from and including BITNO.
|
/* Find next bit set in SRC starting from and including BITNO.
|
||||||
Return -1 if SRC empty. */
|
Return BITSET_BINDEX_MAX if SRC empty. */
|
||||||
int
|
bitset_bindex
|
||||||
bitset_next (src, bitno)
|
bitset_next (bitset src, bitset_bindex bitno)
|
||||||
bitset src;
|
|
||||||
bitset_bindex bitno;
|
|
||||||
{
|
{
|
||||||
bitset_bindex val;
|
bitset_bindex val;
|
||||||
bitset_bindex next = bitno;
|
bitset_bindex next = bitno;
|
||||||
|
|
||||||
if (!bitset_list (src, &val, 1, &next))
|
if (!bitset_list (src, &val, 1, &next))
|
||||||
return -1;
|
return BITSET_BINDEX_MAX;
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Return true if both bitsets are of the same type and size. */
|
||||||
|
extern bool
|
||||||
|
bitset_compatible_p (bitset bset1, bitset bset2)
|
||||||
|
{
|
||||||
|
return BITSET_COMPATIBLE_ (bset1, bset2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Find previous bit set in SRC starting from and including BITNO.
|
/* Find previous bit set in SRC starting from and including BITNO.
|
||||||
Return -1 if SRC empty. */
|
Return BITSET_BINDEX_MAX if SRC empty. */
|
||||||
int
|
bitset_bindex
|
||||||
bitset_prev (src, bitno)
|
bitset_prev (bitset src, bitset_bindex bitno)
|
||||||
bitset src;
|
|
||||||
bitset_bindex bitno;
|
|
||||||
{
|
{
|
||||||
bitset_bindex val;
|
bitset_bindex val;
|
||||||
bitset_bindex next = bitno;
|
bitset_bindex next = bitno;
|
||||||
|
|
||||||
if (!bitset_reverse_list (src, &val, 1, &next))
|
if (!bitset_list_reverse (src, &val, 1, &next))
|
||||||
return -1;
|
return BITSET_BINDEX_MAX;
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Find first set bit. */
|
/* Find first set bit. */
|
||||||
int
|
bitset_bindex
|
||||||
bitset_first (src)
|
bitset_first (bitset src)
|
||||||
bitset src;
|
|
||||||
{
|
{
|
||||||
return bitset_next (src, 0);
|
return bitset_next (src, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Find last set bit. */
|
/* Find last set bit. */
|
||||||
int
|
bitset_bindex
|
||||||
bitset_last (src)
|
bitset_last (bitset src)
|
||||||
bitset src;
|
|
||||||
{
|
{
|
||||||
return bitset_prev (src, 0);
|
return bitset_prev (src, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Return non-zero if BITNO in SRC is the only set bit. */
|
/* Is BITNO in SRC the only set bit? */
|
||||||
int
|
bool
|
||||||
bitset_only_set_p (src, bitno)
|
bitset_only_set_p (bitset src, bitset_bindex bitno)
|
||||||
bitset src;
|
|
||||||
bitset_bindex bitno;
|
|
||||||
{
|
{
|
||||||
bitset_bindex val[2];
|
bitset_bindex val[2];
|
||||||
bitset_bindex next = 0;
|
bitset_bindex next = 0;
|
||||||
|
|
||||||
if (bitset_list (src, val, 2, &next) != 1)
|
if (bitset_list (src, val, 2, &next) != 1)
|
||||||
return 0;
|
return false;
|
||||||
return val[0] == bitno;
|
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. */
|
/* Print contents of bitset BSET to FILE. */
|
||||||
static void
|
static void
|
||||||
bitset_print (file, bset, verbose)
|
bitset_print (FILE *file, bitset bset, bool verbose)
|
||||||
FILE *file;
|
|
||||||
bitset bset;
|
|
||||||
int verbose;
|
|
||||||
{
|
{
|
||||||
unsigned int i, pos;
|
unsigned int pos;
|
||||||
|
bitset_bindex i;
|
||||||
bitset_iterator iter;
|
bitset_iterator iter;
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
fprintf (file, "n_bits = %d, set = {", bitset_size (bset));
|
fprintf (file, "n_bits = %lu, set = {",
|
||||||
|
(unsigned long int) bitset_size (bset));
|
||||||
|
|
||||||
pos = 30;
|
pos = 30;
|
||||||
BITSET_FOR_EACH (iter, bset, i, 0)
|
BITSET_FOR_EACH (iter, bset, i, 0)
|
||||||
@@ -323,7 +307,7 @@ bitset_print (file, bset, verbose)
|
|||||||
pos = 0;
|
pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf (file, "%d ", i);
|
fprintf (file, "%lu ", (unsigned long int) i);
|
||||||
pos += 1 + (i >= 10) + (i >= 100);
|
pos += 1 + (i >= 10) + (i >= 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -332,17 +316,80 @@ bitset_print (file, bset, verbose)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* DST = SRC. Return non-zero if DST != SRC. */
|
/* Dump bitset BSET to FILE. */
|
||||||
int
|
void
|
||||||
bitset_copy (dst, src)
|
bitset_dump (FILE *file, bitset bset)
|
||||||
bitset dst;
|
|
||||||
bitset src;
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
bitset_print (file, bset, false);
|
||||||
bitset_iterator iter;
|
}
|
||||||
|
|
||||||
if (BITSET_COMPATIBLE_ (dst, src))
|
|
||||||
return BITSET_COPY_ (dst, src);
|
/* Release memory associated with bitsets. */
|
||||||
|
void
|
||||||
|
bitset_release_memory (void)
|
||||||
|
{
|
||||||
|
lbitset_release_memory ();
|
||||||
|
ebitset_release_memory ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Toggle bit BITNO in bitset BSET and the new value of the bit. */
|
||||||
|
bool
|
||||||
|
bitset_toggle_ (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 false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bitset_set (bset, bitno);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Return number of bits in bitset SRC. */
|
||||||
|
bitset_bindex
|
||||||
|
bitset_size_ (bitset src)
|
||||||
|
{
|
||||||
|
return BITSET_NBITS_ (src);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Return number of bits set in bitset SRC. */
|
||||||
|
bitset_bindex
|
||||||
|
bitset_count_ (bitset src)
|
||||||
|
{
|
||||||
|
bitset_bindex list[BITSET_LIST_SIZE];
|
||||||
|
bitset_bindex next;
|
||||||
|
bitset_bindex num;
|
||||||
|
bitset_bindex 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 = SRC. Return true if DST != SRC.
|
||||||
|
This is a fallback for the case where SRC and DST are different
|
||||||
|
bitset types. */
|
||||||
|
bool
|
||||||
|
bitset_copy_ (bitset dst, bitset src)
|
||||||
|
{
|
||||||
|
bitset_bindex i;
|
||||||
|
bitset_iterator iter;
|
||||||
|
|
||||||
/* Convert bitset types. We assume that the DST bitset
|
/* Convert bitset types. We assume that the DST bitset
|
||||||
is large enough to hold the SRC bitset. */
|
is large enough to hold the SRC bitset. */
|
||||||
@@ -352,188 +399,45 @@ bitset_copy (dst, src)
|
|||||||
bitset_set (dst, i);
|
bitset_set (dst, i);
|
||||||
};
|
};
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* 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
|
/* This is a fallback for implementations that do not support
|
||||||
four operand operations. */
|
four operand operations. */
|
||||||
int
|
static inline bool
|
||||||
bitset_op4 (dst, src1, src2, src3, op)
|
bitset_op4_cmp (bitset dst, bitset src1, bitset src2, bitset src3,
|
||||||
bitset dst;
|
enum bitset_ops op)
|
||||||
bitset src1;
|
|
||||||
bitset src2;
|
|
||||||
bitset src3;
|
|
||||||
enum bitset_ops op;
|
|
||||||
{
|
{
|
||||||
int changed = 0;
|
bool changed = false;
|
||||||
|
bool stats_enabled_save;
|
||||||
bitset tmp;
|
bitset tmp;
|
||||||
|
|
||||||
/* Create temporary bitset. */
|
/* Create temporary bitset. */
|
||||||
|
stats_enabled_save = bitset_stats_enabled;
|
||||||
|
bitset_stats_enabled = false;
|
||||||
tmp = bitset_alloc (0, bitset_type_get (dst));
|
tmp = bitset_alloc (0, bitset_type_get (dst));
|
||||||
|
bitset_stats_enabled = stats_enabled_save;
|
||||||
|
|
||||||
switch (op)
|
switch (op)
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
|
||||||
case BITSET_OP_OR_AND:
|
case BITSET_OP_OR_AND:
|
||||||
BITSET_OR_ (tmp, src1, src2);
|
bitset_or (tmp, src1, src2);
|
||||||
changed = BITSET_AND_ (dst, src3, tmp);
|
changed = bitset_and_cmp (dst, src3, tmp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BITSET_OP_AND_OR:
|
case BITSET_OP_AND_OR:
|
||||||
BITSET_AND_ (tmp, src1, src2);
|
bitset_and (tmp, src1, src2);
|
||||||
changed = BITSET_OR_ (dst, src3, tmp);
|
changed = bitset_or_cmp (dst, src3, tmp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BITSET_OP_ANDN_OR:
|
case BITSET_OP_ANDN_OR:
|
||||||
BITSET_ANDN_ (tmp, src1, src2);
|
bitset_andn (tmp, src1, src2);
|
||||||
changed = BITSET_OR_ (dst, src3, tmp);
|
changed = bitset_or_cmp (dst, src3, tmp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
abort ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bitset_free (tmp);
|
bitset_free (tmp);
|
||||||
@@ -541,69 +445,61 @@ bitset_op4 (dst, src1, src2, src3, op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* DST = (SRC1 | SRC2) & SRC3. Return non-zero if
|
/* DST = (SRC1 & SRC2) | SRC3. */
|
||||||
DST != (SRC1 | SRC2) & SRC3. */
|
void
|
||||||
int
|
bitset_and_or_ (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
bitset_or_and (dst, src1, src2, src3)
|
|
||||||
bitset dst;
|
|
||||||
bitset src1;
|
|
||||||
bitset src2;
|
|
||||||
bitset src3;
|
|
||||||
{
|
{
|
||||||
return BITSET_OR_AND_ (dst, src1, src2, src3);
|
bitset_and_or_cmp_ (dst, src1, src2, src3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* DST = (SRC1 & SRC2) | SRC3. Return non-zero if
|
/* DST = (SRC1 & SRC2) | SRC3. Return non-zero if
|
||||||
DST != (SRC1 & SRC2) | SRC3. */
|
DST != (SRC1 & SRC2) | SRC3. */
|
||||||
int
|
bool
|
||||||
bitset_and_or (dst, src1, src2, src3)
|
bitset_and_or_cmp_ (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
bitset dst;
|
|
||||||
bitset src1;
|
|
||||||
bitset src2;
|
|
||||||
bitset src3;
|
|
||||||
{
|
{
|
||||||
return BITSET_AND_OR_ (dst, src1, src2, src3);
|
return bitset_op4_cmp (dst, src1, src2, src3, BITSET_OP_AND_OR);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* DST = (SRC1 & ~SRC2) | SRC3. */
|
||||||
|
void
|
||||||
|
bitset_andn_or_ (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
|
{
|
||||||
|
bitset_andn_or_cmp_ (dst, src1, src2, src3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* DST = (SRC1 & ~SRC2) | SRC3. Return non-zero if
|
/* DST = (SRC1 & ~SRC2) | SRC3. Return non-zero if
|
||||||
DST != (SRC1 & ~SRC2) | SRC3. */
|
DST != (SRC1 & ~SRC2) | SRC3. */
|
||||||
int
|
bool
|
||||||
bitset_andn_or (dst, src1, src2, src3)
|
bitset_andn_or_cmp_ (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
bitset dst;
|
|
||||||
bitset src1;
|
|
||||||
bitset src2;
|
|
||||||
bitset src3;
|
|
||||||
{
|
{
|
||||||
return BITSET_ANDN_OR_ (dst, src1, src2, src3);
|
return bitset_op4_cmp (dst, src1, src2, src3, BITSET_OP_ANDN_OR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Dump bitset BSET to FILE. */
|
/* DST = (SRC1 | SRC2) & SRC3. */
|
||||||
void
|
void
|
||||||
bitset_dump (file, bset)
|
bitset_or_and_ (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
FILE *file;
|
|
||||||
bitset bset;
|
|
||||||
{
|
{
|
||||||
bitset_print (file, bset, 0);
|
bitset_or_and_cmp_ (dst, src1, src2, src3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* DST = (SRC1 | SRC2) & SRC3. Return non-zero if
|
||||||
|
DST != (SRC1 | SRC2) & SRC3. */
|
||||||
|
bool
|
||||||
|
bitset_or_and_cmp_ (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
|
{
|
||||||
|
return bitset_op4_cmp (dst, src1, src2, src3, BITSET_OP_OR_AND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Function to be called from debugger to print bitset. */
|
/* Function to be called from debugger to print bitset. */
|
||||||
void
|
void
|
||||||
debug_bitset (bset)
|
debug_bitset (bitset bset)
|
||||||
bitset bset;
|
|
||||||
{
|
{
|
||||||
if (bset)
|
if (bset)
|
||||||
bitset_print (stderr, bset, 1);
|
bitset_print (stderr, bset, true);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Release memory associated with bitsets. */
|
|
||||||
void
|
|
||||||
bitset_release_memory ()
|
|
||||||
{
|
|
||||||
lbitset_release_memory ();
|
|
||||||
ebitset_release_memory ();
|
|
||||||
}
|
}
|
||||||
|
|||||||
+222
-159
@@ -1,5 +1,5 @@
|
|||||||
/* Generic bitsets.
|
/* Generic bitsets.
|
||||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||||
Contributed by Michael Hayes ([email protected]).
|
Contributed by Michael Hayes ([email protected]).
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@@ -14,10 +14,10 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
#ifndef _BITSET_H
|
#ifndef _BITSET_H
|
||||||
#define _BITSET_H
|
#define _BITSET_H
|
||||||
|
|
||||||
/* This file is the public interface to the bitset abstract data type.
|
/* This file is the public interface to the bitset abstract data type.
|
||||||
Only use the functions and macros defined in this file. */
|
Only use the functions and macros defined in this file. */
|
||||||
@@ -26,22 +26,62 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||||||
#include "obstack.h"
|
#include "obstack.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#if USE_UNLOCKED_IO
|
||||||
|
# include "unlocked-io.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Attributes used to select a bitset implementation. */
|
/* Attributes used to select a bitset implementation. */
|
||||||
enum bitset_attr {BITSET_FIXED = 1, /* Bitset size fixed. */
|
enum bitset_attr {BITSET_FIXED = 1, /* Bitset size fixed. */
|
||||||
BITSET_VARIABLE = 2, /* Bitset size variable. */
|
BITSET_VARIABLE = 2, /* Bitset size variable. */
|
||||||
BITSET_DENSE = 4, /* Bitset dense. */
|
BITSET_DENSE = 4, /* Bitset dense. */
|
||||||
BITSET_SPARSE = 8, /* Bitset sparse. */
|
BITSET_SPARSE = 8, /* Bitset sparse. */
|
||||||
BITSET_FRUGAL = 16, /* Prefer most compact. */
|
BITSET_FRUGAL = 16, /* Prefer most compact. */
|
||||||
BITSET_GREEDY = 32}; /* Prefer fastest. */
|
BITSET_GREEDY = 32}; /* Prefer fastest at memory expense. */
|
||||||
|
|
||||||
typedef unsigned int bitset_attrs;
|
typedef unsigned int bitset_attrs;
|
||||||
|
|
||||||
/* The contents of the structure should be considered to be private.
|
/* The contents of the union should be considered to be private.
|
||||||
While I would like to make this structure opaque, it needs to be
|
While I would like to make this union opaque, it needs to be
|
||||||
visible for the inline bit set/test functions. */
|
visible for the inline bit set/test functions, and for delegation
|
||||||
struct bitset_struct
|
to the proper implementation. */
|
||||||
|
union bitset_union
|
||||||
{
|
{
|
||||||
struct bbitset_struct b;
|
/* This must be the first member of every other structure that is a
|
||||||
|
member of this union. */
|
||||||
|
struct bbitset_struct b; /* Base bitset data. */
|
||||||
|
|
||||||
|
struct abitset_struct
|
||||||
|
{
|
||||||
|
struct bbitset_struct b;
|
||||||
|
bitset_word words[1]; /* The array of bits. */
|
||||||
|
} a;
|
||||||
|
|
||||||
|
struct ebitset_struct
|
||||||
|
{
|
||||||
|
struct bbitset_struct b;
|
||||||
|
bitset_windex size; /* Number of elements. */
|
||||||
|
struct ebitset_elt_struct **elts; /* Expanding array of ptrs to elts. */
|
||||||
|
} e;
|
||||||
|
|
||||||
|
struct lbitset_struct
|
||||||
|
{
|
||||||
|
struct bbitset_struct b;
|
||||||
|
struct lbitset_elt_struct *head; /* First element in linked list. */
|
||||||
|
struct lbitset_elt_struct *tail; /* Last element in linked list. */
|
||||||
|
} l;
|
||||||
|
|
||||||
|
struct bitset_stats_struct
|
||||||
|
{
|
||||||
|
struct bbitset_struct b;
|
||||||
|
bitset bset;
|
||||||
|
} s;
|
||||||
|
|
||||||
|
struct vbitset_struct
|
||||||
|
{
|
||||||
|
struct bbitset_struct b;
|
||||||
|
bitset_windex size; /* Allocated size of array. */
|
||||||
|
} v;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -51,61 +91,52 @@ typedef struct
|
|||||||
{
|
{
|
||||||
bitset_bindex list[BITSET_LIST_SIZE];
|
bitset_bindex list[BITSET_LIST_SIZE];
|
||||||
bitset_bindex next;
|
bitset_bindex next;
|
||||||
int num;
|
bitset_bindex num;
|
||||||
int i;
|
bitset_bindex i;
|
||||||
} bitset_iterator;
|
} bitset_iterator;
|
||||||
|
|
||||||
|
|
||||||
/* Return bytes required for bitset of desired type and size. */
|
/* Return bytes required for bitset of desired type and size. */
|
||||||
extern int bitset_bytes PARAMS ((enum bitset_type, bitset_bindex));
|
extern size_t bitset_bytes (enum bitset_type, bitset_bindex);
|
||||||
|
|
||||||
/* Initialise a bitset with desired type and size. */
|
/* Initialise a bitset with desired type and size. */
|
||||||
extern bitset bitset_init PARAMS ((bitset, bitset_bindex, enum bitset_type));
|
extern bitset bitset_init (bitset, bitset_bindex, enum bitset_type);
|
||||||
|
|
||||||
/* Select an implementation type based on the desired bitset size
|
/* Select an implementation type based on the desired bitset size
|
||||||
and attributes. */
|
and attributes. */
|
||||||
extern enum bitset_type bitset_type_choose PARAMS ((bitset_bindex,
|
extern enum bitset_type bitset_type_choose (bitset_bindex, bitset_attrs);
|
||||||
bitset_attrs));
|
|
||||||
|
|
||||||
/* Create a bitset of desired type and size. The bitset is zeroed. */
|
/* Create a bitset of desired type and size. The bitset is zeroed. */
|
||||||
extern bitset bitset_alloc PARAMS ((bitset_bindex, enum bitset_type));
|
extern bitset bitset_alloc (bitset_bindex, enum bitset_type);
|
||||||
|
|
||||||
/* Free bitset. */
|
/* Free bitset. */
|
||||||
extern void bitset_free PARAMS ((bitset));
|
extern void bitset_free (bitset);
|
||||||
|
|
||||||
/* Create a bitset of desired type and size using an obstack. The
|
/* Create a bitset of desired type and size using an obstack. The
|
||||||
bitset is zeroed. */
|
bitset is zeroed. */
|
||||||
extern bitset bitset_obstack_alloc PARAMS ((struct obstack *bobstack,
|
extern bitset bitset_obstack_alloc (struct obstack *bobstack,
|
||||||
bitset_bindex, enum bitset_type));
|
bitset_bindex, enum bitset_type);
|
||||||
|
|
||||||
/* Free bitset allocated on obstack. */
|
/* Free bitset allocated on obstack. */
|
||||||
extern void bitset_obstack_free PARAMS ((bitset));
|
extern void bitset_obstack_free (bitset);
|
||||||
|
|
||||||
/* Create a bitset of desired size and attributes. The bitset is zeroed. */
|
/* Create a bitset of desired size and attributes. The bitset is zeroed. */
|
||||||
extern bitset bitset_create PARAMS ((bitset_bindex, bitset_attrs));
|
extern bitset bitset_create (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. */
|
/* Return bitset type. */
|
||||||
extern enum bitset_type bitset_type_get PARAMS ((bitset));
|
extern enum bitset_type bitset_type_get (bitset);
|
||||||
|
|
||||||
|
/* Return bitset type name. */
|
||||||
|
extern const char *bitset_type_name_get (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. */
|
/* Set bit BITNO in bitset BSET. */
|
||||||
static inline void bitset_set (bset, bitno)
|
static inline void
|
||||||
bitset bset;
|
bitset_set (bitset bset, bitset_bindex bitno)
|
||||||
bitset_bindex bitno;
|
|
||||||
{
|
{
|
||||||
bitset_windex index = bitno / BITSET_WORD_BITS;
|
bitset_windex windex = bitno / BITSET_WORD_BITS;
|
||||||
bitset_windex offset = index - bset->b.cindex;
|
bitset_windex offset = windex - bset->b.cindex;
|
||||||
|
|
||||||
if (offset < bset->b.csize)
|
if (offset < bset->b.csize)
|
||||||
bset->b.cdata[offset] |= ((bitset_word) 1 << (bitno % BITSET_WORD_BITS));
|
bset->b.cdata[offset] |= ((bitset_word) 1 << (bitno % BITSET_WORD_BITS));
|
||||||
else
|
else
|
||||||
@@ -114,13 +145,12 @@ static inline void bitset_set (bset, bitno)
|
|||||||
|
|
||||||
|
|
||||||
/* Reset bit BITNO in bitset BSET. */
|
/* Reset bit BITNO in bitset BSET. */
|
||||||
static inline void bitset_reset (bset, bitno)
|
static inline void
|
||||||
bitset bset;
|
bitset_reset (bitset bset, bitset_bindex bitno)
|
||||||
bitset_bindex bitno;
|
|
||||||
{
|
{
|
||||||
bitset_windex index = bitno / BITSET_WORD_BITS;
|
bitset_windex windex = bitno / BITSET_WORD_BITS;
|
||||||
bitset_windex offset = index - bset->b.cindex;
|
bitset_windex offset = windex - bset->b.cindex;
|
||||||
|
|
||||||
if (offset < bset->b.csize)
|
if (offset < bset->b.csize)
|
||||||
bset->b.cdata[offset] &= ~((bitset_word) 1 << (bitno % BITSET_WORD_BITS));
|
bset->b.cdata[offset] &= ~((bitset_word) 1 << (bitno % BITSET_WORD_BITS));
|
||||||
else
|
else
|
||||||
@@ -129,201 +159,234 @@ static inline void bitset_reset (bset, bitno)
|
|||||||
|
|
||||||
|
|
||||||
/* Test bit BITNO in bitset BSET. */
|
/* Test bit BITNO in bitset BSET. */
|
||||||
static inline int bitset_test (bset, bitno)
|
static inline bool
|
||||||
bitset bset;
|
bitset_test (bitset bset, bitset_bindex bitno)
|
||||||
bitset_bindex bitno;
|
|
||||||
{
|
{
|
||||||
bitset_windex index = bitno / BITSET_WORD_BITS;
|
bitset_windex windex = bitno / BITSET_WORD_BITS;
|
||||||
bitset_windex offset = index - bset->b.cindex;
|
bitset_windex offset = windex - bset->b.cindex;
|
||||||
|
|
||||||
if (offset < bset->b.csize)
|
if (offset < bset->b.csize)
|
||||||
return (bset->b.cdata[offset] >> (bitno % BITSET_WORD_BITS)) & 1;
|
return (bset->b.cdata[offset] >> (bitno % BITSET_WORD_BITS)) & 1;
|
||||||
else
|
else
|
||||||
return BITSET_TEST_ (bset, bitno);
|
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. */
|
/* Toggle bit BITNO in bitset BSET and return non-zero if now set. */
|
||||||
extern int bitset_toggle PARAMS ((bitset, bitset_bindex));
|
#define bitset_toggle(bset, bitno) BITSET_TOGGLE_ (bset, bitno)
|
||||||
|
|
||||||
/* DST = 0. */
|
/* Return size in bits of bitset SRC. */
|
||||||
extern int bitset_zero PARAMS ((bitset));
|
#define bitset_size(SRC) BITSET_SIZE_ (SRC)
|
||||||
|
|
||||||
|
/* Change size of bitset. */
|
||||||
|
extern void bitset_resize (bitset, bitset_bindex);
|
||||||
|
|
||||||
|
/* Return number of bits set in bitset SRC. */
|
||||||
|
#define bitset_count(SRC) BITSET_COUNT_ (SRC)
|
||||||
|
|
||||||
|
|
||||||
|
/* Return SRC == 0. */
|
||||||
|
#define bitset_empty_p(SRC) BITSET_EMPTY_P_ (SRC)
|
||||||
|
|
||||||
/* DST = ~0. */
|
/* DST = ~0. */
|
||||||
extern int bitset_ones PARAMS ((bitset));
|
#define bitset_ones(DST) BITSET_ONES_ (DST)
|
||||||
|
|
||||||
/* Return non-zero if all bits in bitset SRC are reset. */
|
/* DST = 0. */
|
||||||
extern int bitset_empty_p PARAMS ((bitset));
|
#define bitset_zero(DST) BITSET_ZERO_ (DST)
|
||||||
|
|
||||||
/* Return DST == DST | SRC. */
|
|
||||||
extern int bitset_subset_p PARAMS ((bitset, bitset));
|
|
||||||
|
|
||||||
/* Return DST == SRC. */
|
|
||||||
extern int bitset_equal_p PARAMS ((bitset, bitset));
|
/* DST = SRC. */
|
||||||
|
#define bitset_copy(DST, SRC) BITSET_COPY_ (DST, SRC)
|
||||||
|
|
||||||
/* Return DST & SRC == 0. */
|
/* Return DST & SRC == 0. */
|
||||||
extern int bitset_disjoint_p PARAMS ((bitset, bitset));
|
#define bitset_disjoint_p(DST, SRC) BITSET_DISJOINT_P_ (DST, SRC)
|
||||||
|
|
||||||
/* DST == SRC. */
|
/* Return DST == SRC. */
|
||||||
extern int bitset_copy PARAMS ((bitset, bitset));
|
#define bitset_equal_p(DST, SRC) BITSET_EQUAL_P_ (DST, SRC)
|
||||||
|
|
||||||
/* DST = ~SRC. */
|
/* DST = ~SRC. */
|
||||||
extern int bitset_not PARAMS ((bitset, bitset));
|
#define bitset_not(DST, SRC) BITSET_NOT_ (DST, SRC)
|
||||||
|
|
||||||
/* DST = SRC1 | SRC2. Return non-zero if DST != SRC1 | SRC2. */
|
/* Return DST == DST | SRC. */
|
||||||
extern int bitset_or PARAMS ((bitset, bitset, bitset));
|
#define bitset_subset_p(DST, SRC) BITSET_SUBSET_P_ (DST, SRC)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* DST = SRC1 & SRC2. */
|
||||||
|
#define bitset_and(DST, SRC1, SRC2) BITSET_AND_ (DST, SRC1, SRC2)
|
||||||
|
|
||||||
/* DST = SRC1 & SRC2. Return non-zero if DST != SRC1 & SRC2. */
|
/* DST = SRC1 & SRC2. Return non-zero if DST != SRC1 & SRC2. */
|
||||||
extern int bitset_and PARAMS ((bitset, bitset, bitset));
|
#define bitset_and_cmp(DST, SRC1, SRC2) BITSET_AND_CMP_ (DST, SRC1, SRC2)
|
||||||
|
|
||||||
/* DST = SRC1 ^ SRC2. Return non-zero if DST != SRC1 ^ SRC2. */
|
/* DST = SRC1 & ~SRC2. */
|
||||||
extern int bitset_xor PARAMS ((bitset, bitset, bitset));
|
#define bitset_andn(DST, SRC1, SRC2) BITSET_ANDN_ (DST, SRC1, SRC2)
|
||||||
|
|
||||||
/* DST = SRC1 & ~SRC2. Return non-zero if DST != SRC1 & ~SRC2. */
|
/* DST = SRC1 & ~SRC2. Return non-zero if DST != SRC1 & ~SRC2. */
|
||||||
extern int bitset_andn PARAMS ((bitset, bitset, bitset));
|
#define bitset_andn_cmp(DST, SRC1, SRC2) BITSET_ANDN_CMP_ (DST, SRC1, SRC2)
|
||||||
|
|
||||||
/* DST = (SRC1 | SRC2) & SRC3. Return non-zero if
|
/* DST = SRC1 | SRC2. */
|
||||||
DST != (SRC1 | SRC2) & SRC3. */
|
#define bitset_or(DST, SRC1, SRC2) BITSET_OR_ (DST, SRC1, SRC2)
|
||||||
extern int bitset_or_and PARAMS ((bitset, bitset, bitset, bitset));
|
|
||||||
|
/* DST = SRC1 | SRC2. Return non-zero if DST != SRC1 | SRC2. */
|
||||||
|
#define bitset_or_cmp(DST, SRC1, SRC2) BITSET_OR_CMP_ (DST, SRC1, SRC2)
|
||||||
|
|
||||||
|
/* DST = SRC1 ^ SRC2. */
|
||||||
|
#define bitset_xor(DST, SRC1, SRC2) BITSET_XOR_ (DST, SRC1, SRC2)
|
||||||
|
|
||||||
|
/* DST = SRC1 ^ SRC2. Return non-zero if DST != SRC1 ^ SRC2. */
|
||||||
|
#define bitset_xor_cmp(DST, SRC1, SRC2) BITSET_XOR_CMP_ (DST, SRC1, SRC2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* DST = (SRC1 & SRC2) | SRC3. */
|
||||||
|
#define bitset_and_or(DST, SRC1, SRC2, SRC3) \
|
||||||
|
BITSET_AND_OR_ (DST, SRC1, SRC2, SRC3)
|
||||||
|
|
||||||
/* DST = (SRC1 & SRC2) | SRC3. Return non-zero if
|
/* DST = (SRC1 & SRC2) | SRC3. Return non-zero if
|
||||||
DST != (SRC1 & SRC2) | SRC3. */
|
DST != (SRC1 & SRC2) | SRC3. */
|
||||||
extern int bitset_and_or PARAMS ((bitset, bitset, bitset, bitset));
|
#define bitset_and_or_cmp(DST, SRC1, SRC2, SRC3) \
|
||||||
|
BITSET_AND_OR_CMP_ (DST, SRC1, SRC2, SRC3)
|
||||||
|
|
||||||
|
/* DST = (SRC1 & ~SRC2) | SRC3. */
|
||||||
|
#define bitset_andn_or(DST, SRC1, SRC2, SRC3) \
|
||||||
|
BITSET_ANDN_OR_ (DST, SRC1, SRC2, SRC3)
|
||||||
|
|
||||||
/* DST = (SRC1 & ~SRC2) | SRC3. Return non-zero if
|
/* DST = (SRC1 & ~SRC2) | SRC3. Return non-zero if
|
||||||
DST != (SRC1 & ~SRC2) | SRC3. */
|
DST != (SRC1 & ~SRC2) | SRC3. */
|
||||||
extern int bitset_andn_or PARAMS ((bitset, bitset, bitset, bitset));
|
#define bitset_andn_or_cmp(DST, SRC1, SRC2, SRC3) \
|
||||||
|
BITSET_ANDN_OR_CMP_ (DST, SRC1, SRC2, SRC3)
|
||||||
|
|
||||||
/* Find next bit set in BSET starting from and including BITNO. */
|
/* DST = (SRC1 | SRC2) & SRC3. */
|
||||||
extern int bitset_next PARAMS ((bitset, bitset_bindex));
|
#define bitset_or_and(DST, SRC1, SRC2, SRC3)\
|
||||||
|
BITSET_OR_AND_ (DST, SRC1, SRC2, SRC3)
|
||||||
|
|
||||||
/* Find previous bit set in BSET starting from and including BITNO. */
|
/* DST = (SRC1 | SRC2) & SRC3. Return non-zero if
|
||||||
extern int bitset_prev PARAMS ((bitset, bitset_bindex));
|
DST != (SRC1 | SRC2) & SRC3. */
|
||||||
|
#define bitset_or_and_cmp(DST, SRC1, SRC2, SRC3)\
|
||||||
|
BITSET_OR_AND_CMP_ (DST, SRC1, SRC2, SRC3)
|
||||||
|
|
||||||
/* Return non-zero if BITNO in SRC is the only set bit. */
|
/* Find list of up to NUM bits set in BSET starting from and including
|
||||||
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
|
*NEXT. Return with actual number of bits found and with *NEXT
|
||||||
indicating where search stopped. */
|
indicating where search stopped. */
|
||||||
#define bitset_list(BSET, LIST, NUM, NEXT) \
|
#define bitset_list(BSET, LIST, NUM, NEXT) \
|
||||||
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
|
/* 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
|
including NEXT. Return with actual number of bits found and with
|
||||||
*NEXT indicating where search stopped. */
|
*NEXT indicating where search stopped. */
|
||||||
#define bitset_reverse_list(BSET, LIST, NUM, NEXT) \
|
#define bitset_list_reverse(BSET, LIST, NUM, NEXT) \
|
||||||
BITSET_REVERSE_LIST_ (BSET, LIST, NUM, NEXT)
|
BITSET_LIST_REVERSE_ (BSET, LIST, NUM, NEXT)
|
||||||
|
|
||||||
|
/* Return true if both bitsets are of the same type and size. */
|
||||||
|
extern bool bitset_compatible_p (bitset bset1, bitset bset2);
|
||||||
|
|
||||||
|
/* Find next set bit from the given bit index. */
|
||||||
|
extern bitset_bindex bitset_next (bitset, bitset_bindex);
|
||||||
|
|
||||||
|
/* Find previous set bit from the given bit index. */
|
||||||
|
extern bitset_bindex bitset_prev (bitset, bitset_bindex);
|
||||||
|
|
||||||
/* Find first set bit. */
|
/* Find first set bit. */
|
||||||
extern int bitset_first PARAMS ((bitset));
|
extern bitset_bindex bitset_first (bitset);
|
||||||
|
|
||||||
/* Find last set bit. */
|
/* Find last set bit. */
|
||||||
extern int bitset_last PARAMS ((bitset));
|
extern bitset_bindex bitset_last (bitset);
|
||||||
|
|
||||||
|
/* Return nonzero if this is the only set bit. */
|
||||||
|
extern bool bitset_only_set_p (bitset, bitset_bindex);
|
||||||
|
|
||||||
/* Dump bitset. */
|
/* Dump bitset. */
|
||||||
extern void bitset_dump PARAMS ((FILE *, bitset));
|
extern void bitset_dump (FILE *, bitset);
|
||||||
|
|
||||||
/* Loop over all elements of BSET, starting with MIN, setting BIT
|
/* Loop over all elements of BSET, starting with MIN, setting INDEX
|
||||||
to the index of each set bit. */
|
to the index of each set bit. For example, the following will print
|
||||||
#define BITSET_FOR_EACH(ITER, BSET, BIT, MIN) \
|
the bits set in a bitset:
|
||||||
|
|
||||||
|
bitset_bindex i;
|
||||||
|
bitset_iterator iter;
|
||||||
|
|
||||||
|
BITSET_FOR_EACH (iter, src, i, 0)
|
||||||
|
{
|
||||||
|
printf ("%lu ", (unsigned long int) i);
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
#define BITSET_FOR_EACH(ITER, BSET, INDEX, MIN) \
|
||||||
for (ITER.next = (MIN), ITER.num = BITSET_LIST_SIZE; \
|
for (ITER.next = (MIN), ITER.num = BITSET_LIST_SIZE; \
|
||||||
(ITER.num == BITSET_LIST_SIZE) \
|
(ITER.num == BITSET_LIST_SIZE) \
|
||||||
&& (ITER.num = bitset_list (BSET, ITER.list, \
|
&& (ITER.num = bitset_list (BSET, ITER.list, \
|
||||||
BITSET_LIST_SIZE, &ITER.next));) \
|
BITSET_LIST_SIZE, &ITER.next));) \
|
||||||
for (ITER.i = 0; (BIT) = ITER.list[ITER.i], ITER.i < ITER.num; ITER.i++)
|
for (ITER.i = 0; \
|
||||||
|
ITER.i < ITER.num && ((INDEX) = ITER.list[ITER.i], 1); \
|
||||||
|
ITER.i++)
|
||||||
|
|
||||||
|
|
||||||
/* Loop over all elements of BSET, in reverse order starting with
|
/* Loop over all elements of BSET, in reverse order starting with
|
||||||
MIN, setting BIT to the index of each set bit. */
|
MIN, setting INDEX to the index of each set bit. For example, the
|
||||||
#define BITSET_FOR_EACH_REVERSE(ITER, BSET, BIT, MIN) \
|
following will print the bits set in a bitset in reverse order:
|
||||||
|
|
||||||
|
bitset_bindex i;
|
||||||
|
bitset_iterator iter;
|
||||||
|
|
||||||
|
BITSET_FOR_EACH_REVERSE (iter, src, i, 0)
|
||||||
|
{
|
||||||
|
printf ("%lu ", (unsigned long int) i);
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
#define BITSET_FOR_EACH_REVERSE(ITER, BSET, INDEX, MIN) \
|
||||||
for (ITER.next = (MIN), ITER.num = BITSET_LIST_SIZE; \
|
for (ITER.next = (MIN), ITER.num = BITSET_LIST_SIZE; \
|
||||||
(ITER.num == BITSET_LIST_SIZE) \
|
(ITER.num == BITSET_LIST_SIZE) \
|
||||||
&& (ITER.num = bitset_list_reverse (BSET, ITER.list, \
|
&& (ITER.num = bitset_list_reverse (BSET, ITER.list, \
|
||||||
BITSET_LIST_SIZE, &ITER.next));) \
|
BITSET_LIST_SIZE, &ITER.next));) \
|
||||||
for (ITER.i = 0; (BIT) = ITER.list[ITER.i], ITER.i < ITER.num; ITER.i++)
|
for (ITER.i = 0; \
|
||||||
|
ITER.i < ITER.num && ((INDEX) = ITER.list[ITER.i], 1); \
|
||||||
|
ITER.i++)
|
||||||
|
|
||||||
|
|
||||||
/* Define set operations in terms of logical operations. */
|
/* Define set operations in terms of logical operations. */
|
||||||
|
|
||||||
#define bitset_diff(DST, SRC1, SRC2) bitset_andn (DST, SRC1, SRC2)
|
#define bitset_diff(DST, SRC1, SRC2) bitset_andn (DST, SRC1, SRC2)
|
||||||
|
#define bitset_diff_cmp(DST, SRC1, SRC2) bitset_andn_cmp (DST, SRC1, SRC2)
|
||||||
|
|
||||||
#define bitset_intersection(DST, SRC1, SRC2) bitset_and (DST, SRC1, SRC2)
|
#define bitset_intersection(DST, SRC1, SRC2) bitset_and (DST, SRC1, SRC2)
|
||||||
|
#define bitset_intersection_cmp(DST, SRC1, SRC2) bitset_and_cmp (DST, SRC1, SRC2)
|
||||||
|
|
||||||
#define bitset_union(DST, SRC1, SRC2) bitset_or (DST, SRC1, SRC2)
|
#define bitset_union(DST, SRC1, SRC2) bitset_or (DST, SRC1, SRC2)
|
||||||
|
#define bitset_union_cmp(DST, SRC1, SRC2) bitset_or_cmp (DST, SRC1, SRC2)
|
||||||
|
|
||||||
|
/* Symmetrical difference. */
|
||||||
|
#define bitset_symdiff(DST, SRC1, SRC2) bitset_xor (DST, SRC1, SRC2)
|
||||||
|
#define bitset_symdiff_cmp(DST, SRC1, SRC2) bitset_xor_cmp (DST, SRC1, SRC2)
|
||||||
|
|
||||||
|
/* Union of difference. */
|
||||||
#define bitset_diff_union(DST, SRC1, SRC2, SRC3) \
|
#define bitset_diff_union(DST, SRC1, SRC2, SRC3) \
|
||||||
bitset_andn_or (DST, SRC1, SRC2, SRC3)
|
bitset_andn_or (DST, SRC1, SRC2, SRC3)
|
||||||
|
#define bitset_diff_union_cmp(DST, SRC1, SRC2, SRC3) \
|
||||||
|
bitset_andn_or_cmp (DST, SRC1, SRC2, SRC3)
|
||||||
|
|
||||||
|
|
||||||
/* Release any memory tied up with bitsets. */
|
/* Release any memory tied up with bitsets. */
|
||||||
extern void bitset_release_memory PARAMS ((void));
|
extern void bitset_release_memory (void);
|
||||||
|
|
||||||
/* Enable bitset stats gathering. */
|
/* Enable bitset stats gathering. */
|
||||||
extern void bitset_stats_enable PARAMS ((void));
|
extern void bitset_stats_enable (void);
|
||||||
|
|
||||||
/* Disable bitset stats gathering. */
|
/* Disable bitset stats gathering. */
|
||||||
extern void bitset_stats_disable PARAMS ((void));
|
extern void bitset_stats_disable (void);
|
||||||
|
|
||||||
/* Read bitset stats file of accummulated stats. */
|
/* Read bitset stats file of accummulated stats. */
|
||||||
void bitset_stats_read PARAMS ((const char *filename));
|
void bitset_stats_read (const char *file_name);
|
||||||
|
|
||||||
/* Write bitset stats file of accummulated stats. */
|
/* Write bitset stats file of accummulated stats. */
|
||||||
void bitset_stats_write PARAMS ((const char *filename));
|
void bitset_stats_write (const char *file_name);
|
||||||
|
|
||||||
/* Dump bitset stats. */
|
/* Dump bitset stats. */
|
||||||
extern void bitset_stats_dump PARAMS ((FILE *));
|
extern void bitset_stats_dump (FILE *);
|
||||||
|
|
||||||
/* Function to debug bitset from debugger. */
|
/* Function to debug bitset from debugger. */
|
||||||
extern void debug_bitset PARAMS ((bitset));
|
extern void debug_bitset (bitset);
|
||||||
|
|
||||||
/* Function to debug bitset stats from debugger. */
|
/* Function to debug bitset stats from debugger. */
|
||||||
extern void debug_bitset_stats PARAMS ((void));
|
extern void debug_bitset_stats (void);
|
||||||
|
|
||||||
#endif /* _BITSET_H */
|
#endif /* _BITSET_H */
|
||||||
|
|
||||||
|
|||||||
+308
-208
@@ -1,5 +1,5 @@
|
|||||||
/* Bitset statistics.
|
/* Bitset statistics.
|
||||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@@ -13,26 +13,25 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software Foundation,
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
*/
|
|
||||||
|
|
||||||
/* This file is a wrapper bitset implementation for the other bitset
|
/* This file is a wrapper bitset implementation for the other bitset
|
||||||
implementations. It provides bitset compatibility checking and
|
implementations. It provides bitset compatibility checking and
|
||||||
statistics gathering without having to instrument the bitset
|
statistics gathering without having to instrument the bitset
|
||||||
implementations. When statistics gathering is enabled, the bitset
|
implementations. When statistics gathering is enabled, the bitset
|
||||||
operations get vectored through here and we then call the appropriate
|
operations get vectored through here and we then call the appropriate
|
||||||
routines.
|
routines. */
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "bbitset.h"
|
#include "bbitset.h"
|
||||||
#include "abitset.h"
|
#include "abitset.h"
|
||||||
#include "ebitset.h"
|
#include "ebitset.h"
|
||||||
#include "lbitset.h"
|
#include "lbitset.h"
|
||||||
|
#include "vbitset.h"
|
||||||
#include "bitset_stats.h"
|
#include "bitset_stats.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -49,45 +48,32 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Accessor macros. */
|
/* Accessor macros. */
|
||||||
#define BITSET_STATS_ALLOCS_INC(TYPE) \
|
#define BITSET_STATS_ALLOCS_INC(TYPE) \
|
||||||
bitset_stats_info->types[(TYPE)].allocs++
|
bitset_stats_info->types[(TYPE)].allocs++
|
||||||
#define BITSET_STATS_FREES_INC(BSET) \
|
#define BITSET_STATS_FREES_INC(BSET) \
|
||||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].frees++
|
bitset_stats_info->types[BITSET_TYPE_ (BSET)].frees++
|
||||||
#define BITSET_STATS_SETS_INC(BSET) \
|
#define BITSET_STATS_SETS_INC(BSET) \
|
||||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].sets++
|
bitset_stats_info->types[BITSET_TYPE_ (BSET)].sets++
|
||||||
#define BITSET_STATS_CACHE_SETS_INC(BSET) \
|
#define BITSET_STATS_CACHE_SETS_INC(BSET) \
|
||||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_sets++
|
bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_sets++
|
||||||
#define BITSET_STATS_RESETS_INC(BSET) \
|
#define BITSET_STATS_RESETS_INC(BSET) \
|
||||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].resets++
|
bitset_stats_info->types[BITSET_TYPE_ (BSET)].resets++
|
||||||
#define BITSET_STATS_CACHE_RESETS_INC(BSET) \
|
#define BITSET_STATS_CACHE_RESETS_INC(BSET) \
|
||||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_resets++
|
bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_resets++
|
||||||
#define BITSET_STATS_TESTS_INC(BSET) \
|
#define BITSET_STATS_TESTS_INC(BSET) \
|
||||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].tests++
|
bitset_stats_info->types[BITSET_TYPE_ (BSET)].tests++
|
||||||
#define BITSET_STATS_CACHE_TESTS_INC(BSET) \
|
#define BITSET_STATS_CACHE_TESTS_INC(BSET) \
|
||||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_tests++
|
bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_tests++
|
||||||
#define BITSET_STATS_LISTS_INC(BSET) \
|
#define BITSET_STATS_LISTS_INC(BSET) \
|
||||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].lists++
|
bitset_stats_info->types[BITSET_TYPE_ (BSET)].lists++
|
||||||
#define BITSET_STATS_LIST_COUNTS_INC(BSET, I) \
|
#define BITSET_STATS_LIST_COUNTS_INC(BSET, I) \
|
||||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_counts[(I)]++
|
bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_counts[(I)]++
|
||||||
#define BITSET_STATS_LIST_SIZES_INC(BSET, I) \
|
#define BITSET_STATS_LIST_SIZES_INC(BSET, I) \
|
||||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_sizes[(I)]++
|
bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_sizes[(I)]++
|
||||||
#define BITSET_STATS_LIST_DENSITY_INC(BSET, I) \
|
#define BITSET_STATS_LIST_DENSITY_INC(BSET, I) \
|
||||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_density[(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
|
struct bitset_type_info_struct
|
||||||
{
|
{
|
||||||
unsigned int allocs;
|
unsigned int allocs;
|
||||||
@@ -113,44 +99,13 @@ struct bitset_stats_info_struct
|
|||||||
|
|
||||||
struct bitset_stats_info_struct bitset_stats_info_data;
|
struct bitset_stats_info_struct bitset_stats_info_data;
|
||||||
struct bitset_stats_info_struct *bitset_stats_info;
|
struct bitset_stats_info_struct *bitset_stats_info;
|
||||||
int bitset_stats_enabled = 0;
|
bool bitset_stats_enabled = false;
|
||||||
|
|
||||||
|
|
||||||
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. */
|
/* Print a percentage histogram with message MSG to FILE. */
|
||||||
static void
|
static void
|
||||||
bitset_percent_histogram_print (file, name, msg, n_bins, bins)
|
bitset_percent_histogram_print (FILE *file, const char *name, const char *msg,
|
||||||
FILE *file;
|
unsigned int n_bins, unsigned int *bins)
|
||||||
const char *name;
|
|
||||||
const char *msg;
|
|
||||||
unsigned int n_bins;
|
|
||||||
unsigned int *bins;
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int total;
|
unsigned int total;
|
||||||
@@ -164,7 +119,7 @@ bitset_percent_histogram_print (file, name, msg, n_bins, bins)
|
|||||||
|
|
||||||
fprintf (file, "%s %s", name, msg);
|
fprintf (file, "%s %s", name, msg);
|
||||||
for (i = 0; i < n_bins; i++)
|
for (i = 0; i < n_bins; i++)
|
||||||
fprintf (file, "%.0f-%.0f%%\t%8d (%5.1f%%)\n",
|
fprintf (file, "%.0f-%.0f%%\t%8u (%5.1f%%)\n",
|
||||||
i * 100.0 / n_bins,
|
i * 100.0 / n_bins,
|
||||||
(i + 1) * 100.0 / n_bins, bins[i],
|
(i + 1) * 100.0 / n_bins, bins[i],
|
||||||
(100.0 * bins[i]) / total);
|
(100.0 * bins[i]) / total);
|
||||||
@@ -173,17 +128,12 @@ bitset_percent_histogram_print (file, name, msg, n_bins, bins)
|
|||||||
|
|
||||||
/* Print a log histogram with message MSG to FILE. */
|
/* Print a log histogram with message MSG to FILE. */
|
||||||
static void
|
static void
|
||||||
bitset_log_histogram_print (file, name, msg, n_bins, bins)
|
bitset_log_histogram_print (FILE *file, const char *name, const char *msg,
|
||||||
FILE *file;
|
unsigned int n_bins, unsigned int *bins)
|
||||||
const char *name;
|
|
||||||
const char *msg;
|
|
||||||
unsigned int n_bins;
|
|
||||||
unsigned int *bins;
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int total;
|
unsigned int total;
|
||||||
unsigned int max_width;
|
unsigned int max_width;
|
||||||
unsigned int last_bin;
|
|
||||||
|
|
||||||
total = 0;
|
total = 0;
|
||||||
for (i = 0; i < n_bins; i++)
|
for (i = 0; i < n_bins; i++)
|
||||||
@@ -192,51 +142,52 @@ bitset_log_histogram_print (file, name, msg, n_bins, bins)
|
|||||||
if (!total)
|
if (!total)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* Determine number of useful bins. */
|
||||||
for (i = n_bins; i > 3 && ! bins[i - 1]; i--)
|
for (i = n_bins; i > 3 && ! bins[i - 1]; i--)
|
||||||
continue;
|
continue;
|
||||||
last_bin = i - 1;
|
n_bins = i;
|
||||||
|
|
||||||
/* 2 * ceil (log10 (2) * (N - 1)) + 1. */
|
/* 2 * ceil (log10 (2) * (N - 1)) + 1. */
|
||||||
max_width = 2 * (unsigned int) (0.30103 * (n_bins - 1) + 0.9999) + 1;
|
max_width = 2 * (unsigned int) (0.30103 * (n_bins - 1) + 0.9999) + 1;
|
||||||
|
|
||||||
fprintf (file, "%s %s", name, msg);
|
fprintf (file, "%s %s", name, msg);
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
fprintf (file, "%*d\t%8d (%5.1f%%)\n",
|
fprintf (file, "%*d\t%8u (%5.1f%%)\n",
|
||||||
max_width, i, bins[i], 100.0 * bins[i] / total);
|
max_width, i, bins[i], 100.0 * bins[i] / total);
|
||||||
|
|
||||||
for (; i <= last_bin; i++)
|
for (; i < n_bins; i++)
|
||||||
fprintf (file, "%*d-%d\t%8d (%5.1f%%)\n",
|
fprintf (file, "%*lu-%lu\t%8u (%5.1f%%)\n",
|
||||||
max_width - ((unsigned int) (0.30103 * (i) + 0.9999) + 1),
|
max_width - ((unsigned int) (0.30103 * (i) + 0.9999) + 1),
|
||||||
1 << (i - 1), (1 << i) - 1, bins[i],
|
1UL << (i - 1),
|
||||||
|
(1UL << i) - 1,
|
||||||
|
bins[i],
|
||||||
(100.0 * bins[i]) / total);
|
(100.0 * bins[i]) / total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Print bitset statistics to FILE. */
|
/* Print bitset statistics to FILE. */
|
||||||
static void
|
static void
|
||||||
bitset_stats_print_1 (file, name, stats)
|
bitset_stats_print_1 (FILE *file, const char *name,
|
||||||
FILE *file;
|
struct bitset_type_info_struct *stats)
|
||||||
const char *name;
|
|
||||||
struct bitset_type_info_struct *stats;
|
|
||||||
{
|
{
|
||||||
if (!stats)
|
if (!stats)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fprintf (file, "%s:\n", name);
|
fprintf (file, "%s:\n", name);
|
||||||
fprintf (file, _("%d bitset_allocs, %d freed (%.2f%%).\n"),
|
fprintf (file, _("%u bitset_allocs, %u freed (%.2f%%).\n"),
|
||||||
stats->allocs, stats->frees,
|
stats->allocs, stats->frees,
|
||||||
stats->allocs ? 100.0 * stats->frees / stats->allocs : 0);
|
stats->allocs ? 100.0 * stats->frees / stats->allocs : 0);
|
||||||
fprintf (file, _("%d bitset_sets, %d cached (%.2f%%)\n"),
|
fprintf (file, _("%u bitset_sets, %u cached (%.2f%%)\n"),
|
||||||
stats->sets, stats->cache_sets,
|
stats->sets, stats->cache_sets,
|
||||||
stats->sets ? 100.0 * stats->cache_sets / stats->sets : 0);
|
stats->sets ? 100.0 * stats->cache_sets / stats->sets : 0);
|
||||||
fprintf (file, _("%d bitset_resets, %d cached (%.2f%%)\n"),
|
fprintf (file, _("%u bitset_resets, %u cached (%.2f%%)\n"),
|
||||||
stats->resets, stats->cache_resets,
|
stats->resets, stats->cache_resets,
|
||||||
stats->resets ? 100.0 * stats->cache_resets / stats->resets : 0);
|
stats->resets ? 100.0 * stats->cache_resets / stats->resets : 0);
|
||||||
fprintf (file, _("%d bitset_tests, %d cached (%.2f%%)\n"),
|
fprintf (file, _("%u bitset_tests, %u cached (%.2f%%)\n"),
|
||||||
stats->tests, stats->cache_tests,
|
stats->tests, stats->cache_tests,
|
||||||
stats->tests ? 100.0 * stats->cache_tests / stats->tests : 0);
|
stats->tests ? 100.0 * stats->cache_tests / stats->tests : 0);
|
||||||
|
|
||||||
fprintf (file, _("%d bitset_lists\n"), stats->lists);
|
fprintf (file, _("%u bitset_lists\n"), stats->lists);
|
||||||
|
|
||||||
bitset_log_histogram_print (file, name, _("count log histogram\n"),
|
bitset_log_histogram_print (file, name, _("count log histogram\n"),
|
||||||
BITSET_LOG_COUNT_BINS, stats->list_counts);
|
BITSET_LOG_COUNT_BINS, stats->list_counts);
|
||||||
@@ -251,12 +202,9 @@ bitset_stats_print_1 (file, name, stats)
|
|||||||
|
|
||||||
/* Print all bitset statistics to FILE. */
|
/* Print all bitset statistics to FILE. */
|
||||||
static void
|
static void
|
||||||
bitset_stats_print (file, verbose)
|
bitset_stats_print (FILE *file, bool verbose ATTRIBUTE_UNUSED)
|
||||||
FILE *file;
|
|
||||||
int verbose ATTRIBUTE_UNUSED;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
static const char *names[] = BITSET_TYPE_NAMES;
|
|
||||||
|
|
||||||
if (!bitset_stats_info)
|
if (!bitset_stats_info)
|
||||||
return;
|
return;
|
||||||
@@ -264,44 +212,44 @@ bitset_stats_print (file, verbose)
|
|||||||
fprintf (file, _("Bitset statistics:\n\n"));
|
fprintf (file, _("Bitset statistics:\n\n"));
|
||||||
|
|
||||||
if (bitset_stats_info->runs > 1)
|
if (bitset_stats_info->runs > 1)
|
||||||
fprintf (file, _("Accumulated runs = %d\n"), bitset_stats_info->runs);
|
fprintf (file, _("Accumulated runs = %u\n"), bitset_stats_info->runs);
|
||||||
|
|
||||||
for (i = 0; i < BITSET_TYPE_NUM; i++)
|
for (i = 0; i < BITSET_TYPE_NUM; i++)
|
||||||
bitset_stats_print_1 (file, names[i], &bitset_stats_info->types[i]);
|
bitset_stats_print_1 (file, bitset_type_names[i],
|
||||||
|
&bitset_stats_info->types[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Initialise bitset statistics logging. */
|
/* Initialise bitset statistics logging. */
|
||||||
void
|
void
|
||||||
bitset_stats_enable ()
|
bitset_stats_enable (void)
|
||||||
{
|
{
|
||||||
if (!bitset_stats_info)
|
if (!bitset_stats_info)
|
||||||
bitset_stats_info = &bitset_stats_info_data;
|
bitset_stats_info = &bitset_stats_info_data;
|
||||||
bitset_stats_enabled = 1;
|
bitset_stats_enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
bitset_stats_disable ()
|
bitset_stats_disable (void)
|
||||||
{
|
{
|
||||||
bitset_stats_enabled = 0;
|
bitset_stats_enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Read bitset statistics file. */
|
/* Read bitset statistics file. */
|
||||||
void
|
void
|
||||||
bitset_stats_read (filename)
|
bitset_stats_read (const char *file_name)
|
||||||
const char *filename;
|
|
||||||
{
|
{
|
||||||
FILE *file;
|
FILE *file;
|
||||||
|
|
||||||
if (!bitset_stats_info)
|
if (!bitset_stats_info)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!filename)
|
|
||||||
filename = BITSET_STATS_FILE;
|
|
||||||
|
|
||||||
file = fopen (filename, "r");
|
if (!file_name)
|
||||||
|
file_name = BITSET_STATS_FILE;
|
||||||
|
|
||||||
|
file = fopen (file_name, "r");
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
if (fread (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
|
if (fread (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
|
||||||
@@ -312,7 +260,8 @@ bitset_stats_read (filename)
|
|||||||
else
|
else
|
||||||
fprintf (stderr, _("Bad stats file size.\n"));
|
fprintf (stderr, _("Bad stats file size.\n"));
|
||||||
}
|
}
|
||||||
fclose (file);
|
if (fclose (file) != 0)
|
||||||
|
perror (_("Could not read stats file."));
|
||||||
}
|
}
|
||||||
bitset_stats_info_data.runs++;
|
bitset_stats_info_data.runs++;
|
||||||
}
|
}
|
||||||
@@ -320,24 +269,24 @@ bitset_stats_read (filename)
|
|||||||
|
|
||||||
/* Write bitset statistics file. */
|
/* Write bitset statistics file. */
|
||||||
void
|
void
|
||||||
bitset_stats_write (filename)
|
bitset_stats_write (const char *file_name)
|
||||||
const char *filename;
|
|
||||||
{
|
{
|
||||||
FILE *file;
|
FILE *file;
|
||||||
|
|
||||||
if (!bitset_stats_info)
|
if (!bitset_stats_info)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!filename)
|
if (!file_name)
|
||||||
filename = BITSET_STATS_FILE;
|
file_name = BITSET_STATS_FILE;
|
||||||
|
|
||||||
file = fopen (filename, "w");
|
file = fopen (file_name, "w");
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
if (fwrite (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
|
if (fwrite (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
|
||||||
1, file) != 1)
|
1, file) != 1)
|
||||||
perror (_("Could not write stats file."));
|
perror (_("Could not write stats file."));
|
||||||
fclose (file);
|
if (fclose (file) != 0)
|
||||||
|
perror (_("Could not write stats file."));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
perror (_("Could not open stats file for writing."));
|
perror (_("Could not open stats file for writing."));
|
||||||
@@ -346,10 +295,9 @@ bitset_stats_write (filename)
|
|||||||
|
|
||||||
/* Dump bitset statistics to FILE. */
|
/* Dump bitset statistics to FILE. */
|
||||||
void
|
void
|
||||||
bitset_stats_dump (file)
|
bitset_stats_dump (FILE *file)
|
||||||
FILE *file;
|
|
||||||
{
|
{
|
||||||
bitset_stats_print (file, 0);
|
bitset_stats_print (file, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -357,19 +305,17 @@ bitset_stats_dump (file)
|
|||||||
void
|
void
|
||||||
debug_bitset_stats (void)
|
debug_bitset_stats (void)
|
||||||
{
|
{
|
||||||
bitset_stats_print (stderr, 1);
|
bitset_stats_print (stderr, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
bitset_stats_set (dst, bitno)
|
bitset_stats_set (bitset dst, bitset_bindex bitno)
|
||||||
bitset dst;
|
|
||||||
bitset_bindex bitno;
|
|
||||||
{
|
{
|
||||||
bitset bset = dst->s.bset;
|
bitset bset = dst->s.bset;
|
||||||
bitset_windex wordno = bitno / BITSET_WORD_BITS;
|
bitset_windex wordno = bitno / BITSET_WORD_BITS;
|
||||||
bitset_windex offset = wordno - bset->b.cindex;
|
bitset_windex offset = wordno - bset->b.cindex;
|
||||||
|
|
||||||
BITSET_STATS_SETS_INC (bset);
|
BITSET_STATS_SETS_INC (bset);
|
||||||
|
|
||||||
if (offset < bset->b.csize)
|
if (offset < bset->b.csize)
|
||||||
@@ -383,14 +329,12 @@ bitset_stats_set (dst, bitno)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
bitset_stats_reset (dst, bitno)
|
bitset_stats_reset (bitset dst, bitset_bindex bitno)
|
||||||
bitset dst;
|
|
||||||
bitset_bindex bitno;
|
|
||||||
{
|
{
|
||||||
bitset bset = dst->s.bset;
|
bitset bset = dst->s.bset;
|
||||||
bitset_windex wordno = bitno / BITSET_WORD_BITS;
|
bitset_windex wordno = bitno / BITSET_WORD_BITS;
|
||||||
bitset_windex offset = wordno - bset->b.cindex;
|
bitset_windex offset = wordno - bset->b.cindex;
|
||||||
|
|
||||||
BITSET_STATS_RESETS_INC (bset);
|
BITSET_STATS_RESETS_INC (bset);
|
||||||
|
|
||||||
if (offset < bset->b.csize)
|
if (offset < bset->b.csize)
|
||||||
@@ -404,17 +348,22 @@ bitset_stats_reset (dst, bitno)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static bool
|
||||||
bitset_stats_test (src, bitno)
|
bitset_stats_toggle (bitset src, bitset_bindex bitno)
|
||||||
bitset src;
|
{
|
||||||
bitset_bindex bitno;
|
return BITSET_TOGGLE_ (src->s.bset, bitno);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
bitset_stats_test (bitset src, bitset_bindex bitno)
|
||||||
{
|
{
|
||||||
bitset bset = src->s.bset;
|
bitset bset = src->s.bset;
|
||||||
bitset_windex wordno = bitno / BITSET_WORD_BITS;
|
bitset_windex wordno = bitno / BITSET_WORD_BITS;
|
||||||
bitset_windex offset = wordno - bset->b.cindex;
|
bitset_windex offset = wordno - bset->b.cindex;
|
||||||
|
|
||||||
BITSET_STATS_TESTS_INC (bset);
|
BITSET_STATS_TESTS_INC (bset);
|
||||||
|
|
||||||
if (offset < bset->b.csize)
|
if (offset < bset->b.csize)
|
||||||
{
|
{
|
||||||
BITSET_STATS_CACHE_TESTS_INC (bset);
|
BITSET_STATS_CACHE_TESTS_INC (bset);
|
||||||
@@ -425,74 +374,203 @@ bitset_stats_test (src, bitno)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static bitset_bindex
|
||||||
bitset_stats_size (src)
|
bitset_stats_resize (bitset src, bitset_bindex size)
|
||||||
bitset src;
|
{
|
||||||
|
return BITSET_RESIZE_ (src->s.bset, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bitset_bindex
|
||||||
|
bitset_stats_size (bitset src)
|
||||||
{
|
{
|
||||||
return BITSET_SIZE_ (src->s.bset);
|
return BITSET_SIZE_ (src->s.bset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static bitset_bindex
|
||||||
bitset_stats_op1 (dst, op)
|
bitset_stats_count (bitset src)
|
||||||
bitset dst;
|
|
||||||
enum bitset_ops op;
|
|
||||||
{
|
{
|
||||||
return BITSET_OP1_ (dst->s.bset, op);
|
return BITSET_COUNT_ (src->s.bset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static bool
|
||||||
bitset_stats_op2 (dst, src, op)
|
bitset_stats_empty_p (bitset dst)
|
||||||
bitset dst;
|
{
|
||||||
bitset src;
|
return BITSET_EMPTY_P_ (dst->s.bset);
|
||||||
enum bitset_ops op;
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
bitset_stats_ones (bitset dst)
|
||||||
|
{
|
||||||
|
BITSET_ONES_ (dst->s.bset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
bitset_stats_zero (bitset dst)
|
||||||
|
{
|
||||||
|
BITSET_ZERO_ (dst->s.bset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
bitset_stats_copy (bitset dst, bitset src)
|
||||||
{
|
{
|
||||||
BITSET_CHECK2_ (dst, src);
|
BITSET_CHECK2_ (dst, src);
|
||||||
return BITSET_OP2_ (dst->s.bset, src->s.bset, op);
|
BITSET_COPY_ (dst->s.bset, src->s.bset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static bool
|
||||||
bitset_stats_op3 (dst, src1, src2, op)
|
bitset_stats_disjoint_p (bitset dst, bitset src)
|
||||||
bitset dst;
|
{
|
||||||
bitset src1;
|
BITSET_CHECK2_ (dst, src);
|
||||||
bitset src2;
|
return BITSET_DISJOINT_P_ (dst->s.bset, src->s.bset);
|
||||||
enum bitset_ops op;
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
bitset_stats_equal_p (bitset dst, bitset src)
|
||||||
|
{
|
||||||
|
BITSET_CHECK2_ (dst, src);
|
||||||
|
return BITSET_EQUAL_P_ (dst->s.bset, src->s.bset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
bitset_stats_not (bitset dst, bitset src)
|
||||||
|
{
|
||||||
|
BITSET_CHECK2_ (dst, src);
|
||||||
|
BITSET_NOT_ (dst->s.bset, src->s.bset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
bitset_stats_subset_p (bitset dst, bitset src)
|
||||||
|
{
|
||||||
|
BITSET_CHECK2_ (dst, src);
|
||||||
|
return BITSET_SUBSET_P_ (dst->s.bset, src->s.bset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
bitset_stats_and (bitset dst, bitset src1, bitset src2)
|
||||||
{
|
{
|
||||||
BITSET_CHECK3_ (dst, src1, src2);
|
BITSET_CHECK3_ (dst, src1, src2);
|
||||||
return BITSET_OP3_ (dst->s.bset, src1->s.bset, src2->s.bset, op);
|
BITSET_AND_ (dst->s.bset, src1->s.bset, src2->s.bset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static bool
|
||||||
bitset_stats_op4 (dst, src1, src2, src3, op)
|
bitset_stats_and_cmp (bitset dst, bitset src1, bitset src2)
|
||||||
bitset dst;
|
{
|
||||||
bitset src1;
|
BITSET_CHECK3_ (dst, src1, src2);
|
||||||
bitset src2;
|
return BITSET_AND_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset);
|
||||||
bitset src3;
|
}
|
||||||
enum bitset_ops op;
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
bitset_stats_andn (bitset dst, bitset src1, bitset src2)
|
||||||
|
{
|
||||||
|
BITSET_CHECK3_ (dst, src1, src2);
|
||||||
|
BITSET_ANDN_ (dst->s.bset, src1->s.bset, src2->s.bset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
bitset_stats_andn_cmp (bitset dst, bitset src1, bitset src2)
|
||||||
|
{
|
||||||
|
BITSET_CHECK3_ (dst, src1, src2);
|
||||||
|
return BITSET_ANDN_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
bitset_stats_or (bitset dst, bitset src1, bitset src2)
|
||||||
|
{
|
||||||
|
BITSET_CHECK3_ (dst, src1, src2);
|
||||||
|
BITSET_OR_ (dst->s.bset, src1->s.bset, src2->s.bset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
bitset_stats_or_cmp (bitset dst, bitset src1, bitset src2)
|
||||||
|
{
|
||||||
|
BITSET_CHECK3_ (dst, src1, src2);
|
||||||
|
return BITSET_OR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
bitset_stats_xor (bitset dst, bitset src1, bitset src2)
|
||||||
|
{
|
||||||
|
BITSET_CHECK3_ (dst, src1, src2);
|
||||||
|
BITSET_XOR_ (dst->s.bset, src1->s.bset, src2->s.bset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
bitset_stats_xor_cmp (bitset dst, bitset src1, bitset src2)
|
||||||
|
{
|
||||||
|
BITSET_CHECK3_ (dst, src1, src2);
|
||||||
|
return BITSET_XOR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
bitset_stats_and_or (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
{
|
{
|
||||||
BITSET_CHECK4_ (dst, src1, src2, src3);
|
BITSET_CHECK4_ (dst, src1, src2, src3);
|
||||||
|
BITSET_AND_OR_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);
|
||||||
/* 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
|
static bool
|
||||||
bitset_stats_list (bset, list, num, next)
|
bitset_stats_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
bitset bset;
|
{
|
||||||
bitset_bindex *list;
|
BITSET_CHECK4_ (dst, src1, src2, src3);
|
||||||
bitset_bindex num;
|
return BITSET_AND_OR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);
|
||||||
bitset_bindex *next;
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
bitset_stats_andn_or (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
|
{
|
||||||
|
BITSET_CHECK4_ (dst, src1, src2, src3);
|
||||||
|
BITSET_ANDN_OR_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
bitset_stats_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
|
{
|
||||||
|
BITSET_CHECK4_ (dst, src1, src2, src3);
|
||||||
|
return BITSET_ANDN_OR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
bitset_stats_or_and (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
|
{
|
||||||
|
BITSET_CHECK4_ (dst, src1, src2, src3);
|
||||||
|
BITSET_OR_AND_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
bitset_stats_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
|
{
|
||||||
|
BITSET_CHECK4_ (dst, src1, src2, src3);
|
||||||
|
return BITSET_OR_AND_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bitset_bindex
|
||||||
|
bitset_stats_list (bitset bset, bitset_bindex *list,
|
||||||
|
bitset_bindex num, bitset_bindex *next)
|
||||||
{
|
{
|
||||||
bitset_bindex count;
|
bitset_bindex count;
|
||||||
bitset_bindex tmp;
|
bitset_bindex tmp;
|
||||||
@@ -501,17 +579,17 @@ bitset_stats_list (bset, list, num, next)
|
|||||||
enum bitset_type type;
|
enum bitset_type type;
|
||||||
|
|
||||||
count = BITSET_LIST_ (bset->s.bset, list, num, next);
|
count = BITSET_LIST_ (bset->s.bset, list, num, next);
|
||||||
|
|
||||||
type = BITSET_TYPE_ (bset->s.bset);
|
type = BITSET_TYPE_ (bset->s.bset);
|
||||||
BITSET_STATS_LISTS_INC (bset->s.bset);
|
BITSET_STATS_LISTS_INC (bset->s.bset);
|
||||||
|
|
||||||
/* Log histogram of number of set bits. */
|
/* Log histogram of number of set bits. */
|
||||||
for (i = 0, tmp = count; tmp; tmp >>= 1, i++)
|
for (i = 0, tmp = count; tmp; tmp >>= 1, i++)
|
||||||
continue;
|
continue;
|
||||||
if (i >= BITSET_LOG_COUNT_BINS)
|
if (i >= BITSET_LOG_COUNT_BINS)
|
||||||
i = BITSET_LOG_COUNT_BINS - 1;
|
i = BITSET_LOG_COUNT_BINS - 1;
|
||||||
BITSET_STATS_LIST_COUNTS_INC (bset->s.bset, i);
|
BITSET_STATS_LIST_COUNTS_INC (bset->s.bset, i);
|
||||||
|
|
||||||
/* Log histogram of number of bits in set. */
|
/* Log histogram of number of bits in set. */
|
||||||
size = BITSET_SIZE_ (bset->s.bset);
|
size = BITSET_SIZE_ (bset->s.bset);
|
||||||
for (i = 0, tmp = size; tmp; tmp >>= 1, i++)
|
for (i = 0, tmp = size; tmp; tmp >>= 1, i++)
|
||||||
@@ -519,7 +597,7 @@ bitset_stats_list (bset, list, num, next)
|
|||||||
if (i >= BITSET_LOG_SIZE_BINS)
|
if (i >= BITSET_LOG_SIZE_BINS)
|
||||||
i = BITSET_LOG_SIZE_BINS - 1;
|
i = BITSET_LOG_SIZE_BINS - 1;
|
||||||
BITSET_STATS_LIST_SIZES_INC (bset->s.bset, i);
|
BITSET_STATS_LIST_SIZES_INC (bset->s.bset, i);
|
||||||
|
|
||||||
/* Histogram of fraction of bits set. */
|
/* Histogram of fraction of bits set. */
|
||||||
i = size ? (count * BITSET_DENSITY_BINS) / size : 0;
|
i = size ? (count * BITSET_DENSITY_BINS) / size : 0;
|
||||||
if (i >= BITSET_DENSITY_BINS)
|
if (i >= BITSET_DENSITY_BINS)
|
||||||
@@ -529,37 +607,54 @@ bitset_stats_list (bset, list, num, next)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static bitset_bindex
|
||||||
bitset_stats_reverse_list (bset, list, num, next)
|
bitset_stats_list_reverse (bitset bset, bitset_bindex *list,
|
||||||
bitset bset;
|
bitset_bindex num, bitset_bindex *next)
|
||||||
bitset_bindex *list;
|
|
||||||
bitset_bindex num;
|
|
||||||
bitset_bindex *next;
|
|
||||||
{
|
{
|
||||||
return BITSET_REVERSE_LIST_ (bset->s.bset, list, num, next);
|
return BITSET_LIST_REVERSE_ (bset->s.bset, list, num, next);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
bitset_stats_free (bset)
|
bitset_stats_free (bitset bset)
|
||||||
bitset bset;
|
|
||||||
{
|
{
|
||||||
BITSET_STATS_FREES_INC (bset->s.bset);
|
BITSET_STATS_FREES_INC (bset->s.bset);
|
||||||
BITSET_FREE_ (bset->s.bset);
|
BITSET_FREE_ (bset->s.bset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct bitset_ops_struct bitset_stats_ops = {
|
struct bitset_vtable bitset_stats_vtable = {
|
||||||
bitset_stats_set,
|
bitset_stats_set,
|
||||||
bitset_stats_reset,
|
bitset_stats_reset,
|
||||||
|
bitset_stats_toggle,
|
||||||
bitset_stats_test,
|
bitset_stats_test,
|
||||||
|
bitset_stats_resize,
|
||||||
bitset_stats_size,
|
bitset_stats_size,
|
||||||
bitset_stats_op1,
|
bitset_stats_count,
|
||||||
bitset_stats_op2,
|
bitset_stats_empty_p,
|
||||||
bitset_stats_op3,
|
bitset_stats_ones,
|
||||||
bitset_stats_op4,
|
bitset_stats_zero,
|
||||||
|
bitset_stats_copy,
|
||||||
|
bitset_stats_disjoint_p,
|
||||||
|
bitset_stats_equal_p,
|
||||||
|
bitset_stats_not,
|
||||||
|
bitset_stats_subset_p,
|
||||||
|
bitset_stats_and,
|
||||||
|
bitset_stats_and_cmp,
|
||||||
|
bitset_stats_andn,
|
||||||
|
bitset_stats_andn_cmp,
|
||||||
|
bitset_stats_or,
|
||||||
|
bitset_stats_or_cmp,
|
||||||
|
bitset_stats_xor,
|
||||||
|
bitset_stats_xor_cmp,
|
||||||
|
bitset_stats_and_or,
|
||||||
|
bitset_stats_and_or_cmp,
|
||||||
|
bitset_stats_andn_or,
|
||||||
|
bitset_stats_andn_or_cmp,
|
||||||
|
bitset_stats_or_and,
|
||||||
|
bitset_stats_or_and_cmp,
|
||||||
bitset_stats_list,
|
bitset_stats_list,
|
||||||
bitset_stats_reverse_list,
|
bitset_stats_list_reverse,
|
||||||
bitset_stats_free,
|
bitset_stats_free,
|
||||||
BITSET_STATS
|
BITSET_STATS
|
||||||
};
|
};
|
||||||
@@ -567,64 +662,69 @@ struct bitset_ops_struct bitset_stats_ops = {
|
|||||||
|
|
||||||
/* Return enclosed bitset type. */
|
/* Return enclosed bitset type. */
|
||||||
enum bitset_type
|
enum bitset_type
|
||||||
bitset_stats_type_get (bset)
|
bitset_stats_type_get (bitset bset)
|
||||||
bitset bset;
|
|
||||||
{
|
{
|
||||||
return BITSET_TYPE_ (bset->s.bset);
|
return BITSET_TYPE_ (bset->s.bset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int bitset_stats_bytes (void)
|
size_t
|
||||||
|
bitset_stats_bytes (void)
|
||||||
{
|
{
|
||||||
return sizeof (struct bitset_struct);
|
return sizeof (struct bitset_stats_struct);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bitset
|
bitset
|
||||||
bitset_stats_init (bset, n_bits, type)
|
bitset_stats_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
|
||||||
bitset bset;
|
|
||||||
bitset_bindex n_bits;
|
|
||||||
enum bitset_type type;
|
|
||||||
{
|
{
|
||||||
unsigned int bytes;
|
size_t bytes;
|
||||||
bitset sbset;
|
bitset sbset;
|
||||||
|
|
||||||
bset->b.ops = &bitset_stats_ops;
|
bset->b.vtable = &bitset_stats_vtable;
|
||||||
|
|
||||||
/* Disable cache. */
|
/* Disable cache. */
|
||||||
bset->b.cindex = 0;
|
bset->b.cindex = 0;
|
||||||
bset->b.csize = 0;
|
bset->b.csize = 0;
|
||||||
bset->b.cdata = 0;
|
bset->b.cdata = 0;
|
||||||
|
|
||||||
|
BITSET_NBITS_ (bset) = n_bits;
|
||||||
|
|
||||||
/* Set up the actual bitset implementation that
|
/* Set up the actual bitset implementation that
|
||||||
we are a wrapper over. */
|
we are a wrapper over. */
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
|
||||||
case BITSET_ARRAY:
|
case BITSET_ARRAY:
|
||||||
bytes = abitset_bytes (n_bits);
|
bytes = abitset_bytes (n_bits);
|
||||||
sbset = (bitset) xcalloc (1, bytes);
|
sbset = xcalloc (1, bytes);
|
||||||
abitset_init (sbset, n_bits);
|
abitset_init (sbset, n_bits);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BITSET_LIST:
|
case BITSET_LIST:
|
||||||
bytes = lbitset_bytes (n_bits);
|
bytes = lbitset_bytes (n_bits);
|
||||||
sbset = (bitset) xcalloc (1, bytes);
|
sbset = xcalloc (1, bytes);
|
||||||
lbitset_init (sbset, n_bits);
|
lbitset_init (sbset, n_bits);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BITSET_TABLE:
|
case BITSET_TABLE:
|
||||||
bytes = ebitset_bytes (n_bits);
|
bytes = ebitset_bytes (n_bits);
|
||||||
sbset = (bitset) xcalloc (1, bytes);
|
sbset = xcalloc (1, bytes);
|
||||||
ebitset_init (sbset, n_bits);
|
ebitset_init (sbset, n_bits);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
case BITSET_VARRAY:
|
||||||
abort ();
|
bytes = vbitset_bytes (n_bits);
|
||||||
|
sbset = xcalloc (1, bytes);
|
||||||
|
vbitset_init (sbset, n_bits);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
bset->s.bset = sbset;
|
bset->s.bset = sbset;
|
||||||
|
|
||||||
BITSET_STATS_ALLOCS_INC (type);
|
BITSET_STATS_ALLOCS_INC (type);
|
||||||
|
|
||||||
return bset;
|
return bset;
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-8
@@ -1,5 +1,5 @@
|
|||||||
/* Functions to support bitset statistics.
|
/* Functions to support bitset statistics.
|
||||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@@ -14,20 +14,19 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
#ifndef _BITSET_STATS_H
|
#ifndef _BITSET_STATS_H
|
||||||
#define _BITSET_STATS_H
|
#define _BITSET_STATS_H
|
||||||
|
|
||||||
#include "bbitset.h"
|
#include "bbitset.h"
|
||||||
|
|
||||||
extern int bitset_stats_enabled;
|
extern bool bitset_stats_enabled;
|
||||||
|
|
||||||
extern enum bitset_type bitset_stats_type_get PARAMS ((bitset));
|
extern enum bitset_type bitset_stats_type_get (bitset);
|
||||||
|
|
||||||
extern int bitset_stats_bytes PARAMS ((void));
|
extern size_t bitset_stats_bytes (void);
|
||||||
|
|
||||||
extern bitset bitset_stats_init PARAMS ((bitset, bitset_bindex,
|
extern bitset bitset_stats_init (bitset, bitset_bindex, enum bitset_type);
|
||||||
enum bitset_type));
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+17
-20
@@ -1,25 +1,22 @@
|
|||||||
/* Bitset vectors.
|
/* Bitset vectors.
|
||||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
Copyright (C) 2001, 2002, 2004, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison.
|
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.
|
||||||
|
|
||||||
Bison is free software; you can redistribute it and/or modify it under
|
This program is distributed in the hope that it will be useful,
|
||||||
the terms of the GNU General Public License as published by the Free
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
Software Foundation; either version 2, or (at your option) any later
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
version.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
Bison is distributed in the hope that it will be useful, but WITHOUT ANY
|
You should have received a copy of the GNU General Public License
|
||||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
along with this program; if not, write to the Free Software Foundation,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
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, 59 Temple Place - Suite 330, Boston, MA
|
|
||||||
02111-1307, USA. */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -32,8 +29,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|||||||
void
|
void
|
||||||
bitsetv_matrix_dump (FILE * out, const char *title, bitsetv bset)
|
bitsetv_matrix_dump (FILE * out, const char *title, bitsetv bset)
|
||||||
{
|
{
|
||||||
size_t i, j;
|
bitset_bindex i, j;
|
||||||
size_t hsize = bitset_size (bset[0]);
|
bitset_bindex hsize = bitset_size (bset[0]);
|
||||||
|
|
||||||
/* Title. */
|
/* Title. */
|
||||||
fprintf (out, "%s BEGIN\n", title);
|
fprintf (out, "%s BEGIN\n", title);
|
||||||
@@ -45,7 +42,7 @@ bitsetv_matrix_dump (FILE * out, const char *title, bitsetv bset)
|
|||||||
putc ('\n', out);
|
putc ('\n', out);
|
||||||
fputs (" ", out);
|
fputs (" ", out);
|
||||||
for (i = 0; i < hsize; ++i)
|
for (i = 0; i < hsize; ++i)
|
||||||
fprintf (out, "%d", i % 10);
|
fprintf (out, "%d", (int) (i % 10));
|
||||||
putc ('\n', out);
|
putc ('\n', out);
|
||||||
|
|
||||||
/* Bar. */
|
/* Bar. */
|
||||||
@@ -57,7 +54,7 @@ bitsetv_matrix_dump (FILE * out, const char *title, bitsetv bset)
|
|||||||
/* Contents. */
|
/* Contents. */
|
||||||
for (i = 0; bset[i]; ++i)
|
for (i = 0; bset[i]; ++i)
|
||||||
{
|
{
|
||||||
fprintf (out, "%2d|", i);
|
fprintf (out, "%2lu|", (unsigned long int) i);
|
||||||
for (j = 0; j < hsize; ++j)
|
for (j = 0; j < hsize; ++j)
|
||||||
fputs (bitset_test (bset[i], j) ? "1" : " ", out);
|
fputs (bitset_test (bset[i], j) ? "1" : " ", out);
|
||||||
fputs ("|\n", out);
|
fputs ("|\n", out);
|
||||||
|
|||||||
+3
-4
@@ -1,5 +1,5 @@
|
|||||||
/* Bitset vectors.
|
/* Bitset vectors.
|
||||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||||
Contributed by Akim Demaille (akim@freefriends.org).
|
Contributed by Akim Demaille (akim@freefriends.org).
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@@ -14,7 +14,7 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
#ifndef _BITSETV_PRINT_H
|
#ifndef _BITSETV_PRINT_H
|
||||||
#define _BITSETV_PRINT_H
|
#define _BITSETV_PRINT_H
|
||||||
@@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||||||
#include "bitsetv.h"
|
#include "bitsetv.h"
|
||||||
|
|
||||||
/* Dump vector of bitsets as a matrix. */
|
/* Dump vector of bitsets as a matrix. */
|
||||||
extern void bitsetv_matrix_dump PARAMS ((FILE *, const char *,
|
extern void bitsetv_matrix_dump (FILE *, const char *, bitsetv);
|
||||||
bitsetv));
|
|
||||||
|
|
||||||
#endif /* _BITSETV_H */
|
#endif /* _BITSETV_H */
|
||||||
|
|||||||
+58
-68
@@ -1,25 +1,22 @@
|
|||||||
/* Bitset vectors.
|
/* Bitset vectors.
|
||||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GCC.
|
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.
|
||||||
|
|
||||||
GCC is free software; you can redistribute it and/or modify it under
|
This program is distributed in the hope that it will be useful,
|
||||||
the terms of the GNU General Public License as published by the Free
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
Software Foundation; either version 2, or (at your option) any later
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
version.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
You should have received a copy of the GNU General Public License
|
||||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
along with this program; if not, write to the Free Software Foundation,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with GCC; see the file COPYING. If not, write to the Free
|
|
||||||
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|
||||||
02111-1307, USA. */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -29,30 +26,33 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|||||||
/* Create a vector of N_VECS bitsets, each of N_BITS, and of
|
/* Create a vector of N_VECS bitsets, each of N_BITS, and of
|
||||||
type TYPE. */
|
type TYPE. */
|
||||||
bitset *
|
bitset *
|
||||||
bitsetv_alloc (n_vecs, n_bits, type)
|
bitsetv_alloc (bitset_bindex n_vecs, bitset_bindex n_bits,
|
||||||
unsigned int n_vecs;
|
enum bitset_type type)
|
||||||
unsigned int n_bits;
|
|
||||||
enum bitset_type type;
|
|
||||||
{
|
{
|
||||||
unsigned int vector_bytes;
|
size_t vector_bytes;
|
||||||
unsigned int bytes;
|
size_t bytes;
|
||||||
bitset *bsetv;
|
bitset *bsetv;
|
||||||
unsigned int i;
|
bitset_bindex i;
|
||||||
|
|
||||||
/* Determine number of bytes for each set. */
|
/* Determine number of bytes for each set. */
|
||||||
bytes = bitset_bytes (type, n_bits);
|
bytes = bitset_bytes (type, n_bits);
|
||||||
|
|
||||||
|
/* If size calculation overflows, memory is exhausted. */
|
||||||
|
if (BITSET_SIZE_MAX / (sizeof (bitset) + bytes) <= n_vecs)
|
||||||
|
xalloc_die ();
|
||||||
|
|
||||||
/* Allocate vector table at head of bitset array. */
|
/* Allocate vector table at head of bitset array. */
|
||||||
vector_bytes = (n_vecs + 1) * sizeof (bitset);
|
vector_bytes = (n_vecs + 1) * sizeof (bitset) + bytes - 1;
|
||||||
bsetv = (bitset *) xcalloc (1, vector_bytes + bytes * n_vecs);
|
vector_bytes -= vector_bytes % bytes;
|
||||||
|
bsetv = xcalloc (1, vector_bytes + bytes * n_vecs);
|
||||||
|
|
||||||
for (i = 0; i < n_vecs; i++)
|
for (i = 0; i < n_vecs; i++)
|
||||||
{
|
{
|
||||||
bsetv[i] = (bitset) ((char *) bsetv + vector_bytes + i * bytes);
|
bsetv[i] = (bitset) (void *) ((char *) bsetv + vector_bytes + i * bytes);
|
||||||
|
|
||||||
bitset_init (bsetv[i], n_bits, type);
|
bitset_init (bsetv[i], n_bits, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Null terminate table. */
|
/* Null terminate table. */
|
||||||
bsetv[i] = 0;
|
bsetv[i] = 0;
|
||||||
return bsetv;
|
return bsetv;
|
||||||
@@ -62,13 +62,10 @@ bitsetv_alloc (n_vecs, n_bits, type)
|
|||||||
/* Create a vector of N_VECS bitsets, each of N_BITS, and with
|
/* Create a vector of N_VECS bitsets, each of N_BITS, and with
|
||||||
attribute hints specified by ATTR. */
|
attribute hints specified by ATTR. */
|
||||||
bitset *
|
bitset *
|
||||||
bitsetv_create (n_vecs, n_bits, attr)
|
bitsetv_create (bitset_bindex n_vecs, bitset_bindex n_bits, unsigned int attr)
|
||||||
unsigned int n_vecs;
|
|
||||||
unsigned int n_bits;
|
|
||||||
unsigned int attr;
|
|
||||||
{
|
{
|
||||||
enum bitset_type type;
|
enum bitset_type type;
|
||||||
|
|
||||||
type = bitset_type_choose (n_bits, attr);
|
type = bitset_type_choose (n_bits, attr);
|
||||||
return bitsetv_alloc (n_vecs, n_bits, type);
|
return bitsetv_alloc (n_vecs, n_bits, type);
|
||||||
}
|
}
|
||||||
@@ -76,10 +73,9 @@ bitsetv_create (n_vecs, n_bits, attr)
|
|||||||
|
|
||||||
/* Free bitset vector BSETV. */
|
/* Free bitset vector BSETV. */
|
||||||
void
|
void
|
||||||
bitsetv_free (bsetv)
|
bitsetv_free (bitsetv bsetv)
|
||||||
bitset *bsetv;
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
bitset_bindex i;
|
||||||
|
|
||||||
for (i = 0; bsetv[i]; i++)
|
for (i = 0; bsetv[i]; i++)
|
||||||
BITSET_FREE_ (bsetv[i]);
|
BITSET_FREE_ (bsetv[i]);
|
||||||
@@ -89,11 +85,10 @@ bitsetv_free (bsetv)
|
|||||||
|
|
||||||
/* Zero a vector of bitsets. */
|
/* Zero a vector of bitsets. */
|
||||||
void
|
void
|
||||||
bitsetv_zero (bsetv)
|
bitsetv_zero (bitsetv bsetv)
|
||||||
struct bitset_struct **bsetv;
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
bitset_bindex i;
|
||||||
|
|
||||||
for (i = 0; bsetv[i]; i++)
|
for (i = 0; bsetv[i]; i++)
|
||||||
bitset_zero (bsetv[i]);
|
bitset_zero (bsetv[i]);
|
||||||
}
|
}
|
||||||
@@ -101,11 +96,10 @@ bitsetv_zero (bsetv)
|
|||||||
|
|
||||||
/* Set a vector of bitsets to ones. */
|
/* Set a vector of bitsets to ones. */
|
||||||
void
|
void
|
||||||
bitsetv_ones (bsetv)
|
bitsetv_ones (bitsetv bsetv)
|
||||||
bitset *bsetv;
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
bitset_bindex i;
|
||||||
|
|
||||||
for (i = 0; bsetv[i]; i++)
|
for (i = 0; bsetv[i]; i++)
|
||||||
bitset_ones (bsetv[i]);
|
bitset_ones (bsetv[i]);
|
||||||
}
|
}
|
||||||
@@ -114,27 +108,26 @@ bitsetv_ones (bsetv)
|
|||||||
/* Given a vector BSETV of N bitsets of size N, modify its contents to
|
/* Given a vector BSETV of N bitsets of size N, modify its contents to
|
||||||
be the transitive closure of what was given. */
|
be the transitive closure of what was given. */
|
||||||
void
|
void
|
||||||
bitsetv_transitive_closure (bsetv)
|
bitsetv_transitive_closure (bitsetv bsetv)
|
||||||
bitset *bsetv;
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
bitset_bindex i;
|
||||||
unsigned int j;
|
bitset_bindex j;
|
||||||
|
|
||||||
for (i = 0; bsetv[i]; i++)
|
for (i = 0; bsetv[i]; i++)
|
||||||
for (j = 0; bsetv[j]; j++)
|
for (j = 0; bsetv[j]; j++)
|
||||||
if (bitset_test (bsetv[j], i))
|
if (bitset_test (bsetv[j], i))
|
||||||
bitset_or (bsetv[j], bsetv[j], bsetv[i]);
|
bitset_or (bsetv[j], bsetv[j], bsetv[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Given a vector BSETV of N bitsets of size N, modify its contents to
|
/* Given a vector BSETV of N bitsets of size N, modify its contents to
|
||||||
be the reflexive transitive closure of what was given. This is
|
be the reflexive transitive closure of what was given. This is
|
||||||
the same as transitive closure but with all bits on the diagonal
|
the same as transitive closure but with all bits on the diagonal
|
||||||
of the bit matrix set. */
|
of the bit matrix set. */
|
||||||
void
|
void
|
||||||
bitsetv_reflexive_transitive_closure (bitsetv bsetv)
|
bitsetv_reflexive_transitive_closure (bitsetv bsetv)
|
||||||
{
|
{
|
||||||
int i;
|
bitset_bindex i;
|
||||||
|
|
||||||
bitsetv_transitive_closure (bsetv);
|
bitsetv_transitive_closure (bsetv);
|
||||||
for (i = 0; bsetv[i]; i++)
|
for (i = 0; bsetv[i]; i++)
|
||||||
@@ -145,35 +138,32 @@ bitsetv_reflexive_transitive_closure (bitsetv bsetv)
|
|||||||
/* Dump the contents of a bitset vector BSETV with N_VECS elements to
|
/* Dump the contents of a bitset vector BSETV with N_VECS elements to
|
||||||
FILE. */
|
FILE. */
|
||||||
void
|
void
|
||||||
bitsetv_dump (file, title, subtitle, bsetv)
|
bitsetv_dump (FILE *file, char const *title, char const *subtitle,
|
||||||
FILE *file;
|
bitsetv bsetv)
|
||||||
const char *title, *subtitle;
|
|
||||||
bitset *bsetv;
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
bitset_windex i;
|
||||||
|
|
||||||
fprintf (file, "%s\n", title);
|
fprintf (file, "%s\n", title);
|
||||||
for (i = 0; bsetv[i]; i++)
|
for (i = 0; bsetv[i]; i++)
|
||||||
{
|
{
|
||||||
fprintf (file, "%s %d\n", subtitle, i);
|
fprintf (file, "%s %lu\n", subtitle, (unsigned long int) i);
|
||||||
bitset_dump (file, bsetv[i]);
|
bitset_dump (file, bsetv[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf (file, "\n");
|
fprintf (file, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
debug_bitsetv (bsetv)
|
debug_bitsetv (bitsetv bsetv)
|
||||||
bitset *bsetv;
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
bitset_windex i;
|
||||||
|
|
||||||
for (i = 0; bsetv[i]; i++)
|
for (i = 0; bsetv[i]; i++)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%d: ", i);
|
fprintf (stderr, "%lu: ", (unsigned long int) i);
|
||||||
debug_bitset (bsetv[i]);
|
debug_bitset (bsetv[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf (stderr, "\n");
|
fprintf (stderr, "\n");
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-15
@@ -1,5 +1,5 @@
|
|||||||
/* Bitset vectors.
|
/* Bitset vectors.
|
||||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@@ -14,7 +14,7 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
#ifndef _BITSETV_H
|
#ifndef _BITSETV_H
|
||||||
#define _BITSETV_H
|
#define _BITSETV_H
|
||||||
@@ -25,38 +25,35 @@ typedef bitset * bitsetv;
|
|||||||
|
|
||||||
/* Create a vector of N_VECS bitsets, each of N_BITS, and of
|
/* Create a vector of N_VECS bitsets, each of N_BITS, and of
|
||||||
type TYPE. */
|
type TYPE. */
|
||||||
extern bitsetv bitsetv_alloc PARAMS ((unsigned int, unsigned int,
|
extern bitsetv bitsetv_alloc (bitset_bindex, bitset_bindex, enum bitset_type);
|
||||||
enum bitset_type));
|
|
||||||
|
|
||||||
/* Create a vector of N_VECS bitsets, each of N_BITS, and with
|
/* Create a vector of N_VECS bitsets, each of N_BITS, and with
|
||||||
attribute hints specified by ATTR. */
|
attribute hints specified by ATTR. */
|
||||||
extern bitsetv bitsetv_create PARAMS ((unsigned int, unsigned int,
|
extern bitsetv bitsetv_create (bitset_bindex, bitset_bindex, unsigned int);
|
||||||
unsigned int));
|
|
||||||
|
|
||||||
/* Free vector of bitsets. */
|
/* Free vector of bitsets. */
|
||||||
extern void bitsetv_free PARAMS ((bitsetv));
|
extern void bitsetv_free (bitsetv);
|
||||||
|
|
||||||
/* Zero vector of bitsets. */
|
/* Zero vector of bitsets. */
|
||||||
extern void bitsetv_zero PARAMS ((bitsetv));
|
extern void bitsetv_zero (bitsetv);
|
||||||
|
|
||||||
/* Set vector of bitsets. */
|
/* Set vector of bitsets. */
|
||||||
extern void bitsetv_ones PARAMS ((bitsetv));
|
extern void bitsetv_ones (bitsetv);
|
||||||
|
|
||||||
/* Given a vector BSETV of N bitsets of size N, modify its contents to
|
/* Given a vector BSETV of N bitsets of size N, modify its contents to
|
||||||
be the transitive closure of what was given. */
|
be the transitive closure of what was given. */
|
||||||
extern void bitsetv_transitive_closure PARAMS ((bitsetv));
|
extern void bitsetv_transitive_closure (bitsetv);
|
||||||
|
|
||||||
/* Given a vector BSETV of N bitsets of size N, modify its contents to
|
/* Given a vector BSETV of N bitsets of size N, modify its contents to
|
||||||
be the reflexive transitive closure of what was given. This is
|
be the reflexive transitive closure of what was given. This is
|
||||||
the same as transitive closure but with all bits on the diagonal
|
the same as transitive closure but with all bits on the diagonal
|
||||||
of the bit matrix set. */
|
of the bit matrix set. */
|
||||||
extern void bitsetv_reflexive_transitive_closure PARAMS ((bitsetv));
|
extern void bitsetv_reflexive_transitive_closure (bitsetv);
|
||||||
|
|
||||||
/* Dump vector of bitsets. */
|
/* Dump vector of bitsets. */
|
||||||
extern void bitsetv_dump PARAMS ((FILE *, const char *,
|
extern void bitsetv_dump (FILE *, const char *, const char *, bitsetv);
|
||||||
const char *, bitsetv));
|
|
||||||
|
|
||||||
/* Function to debug vector of bitsets from debugger. */
|
/* Function to debug vector of bitsets from debugger. */
|
||||||
extern void debug_bitsetv PARAMS ((bitsetv));
|
extern void debug_bitsetv (bitsetv);
|
||||||
|
|
||||||
#endif /* _BITSETV_H */
|
#endif /* _BITSETV_H */
|
||||||
|
|||||||
-105
@@ -1,105 +0,0 @@
|
|||||||
/* dirname.c -- return all but the last element in a path
|
|
||||||
Copyright 1990, 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 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"
|
|
||||||
#include "xalloc.h"
|
|
||||||
|
|
||||||
/* Return the length of `dirname (PATH)', or zero if PATH is
|
|
||||||
in the working directory. Works properly even if
|
|
||||||
there are trailing slashes (by effectively ignoring them). */
|
|
||||||
size_t
|
|
||||||
dir_len (char const *path)
|
|
||||||
{
|
|
||||||
size_t prefix_length = FILESYSTEM_PREFIX_LEN (path);
|
|
||||||
size_t length;
|
|
||||||
|
|
||||||
/* Strip the basename and any redundant slashes before it. */
|
|
||||||
for (length = base_name (path) - path; prefix_length < length; length--)
|
|
||||||
if (! ISSLASH (path[length - 1]))
|
|
||||||
return length;
|
|
||||||
|
|
||||||
/* But don't strip the only slash from "/". */
|
|
||||||
return prefix_length + ISSLASH (path[prefix_length]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return the leading directories part of PATH,
|
|
||||||
allocated with xmalloc.
|
|
||||||
Works properly even if there are trailing slashes
|
|
||||||
(by effectively ignoring them). */
|
|
||||||
|
|
||||||
char *
|
|
||||||
dir_name (char const *path)
|
|
||||||
{
|
|
||||||
size_t length = dir_len (path);
|
|
||||||
int append_dot = (length == FILESYSTEM_PREFIX_LEN (path));
|
|
||||||
char *newpath = xmalloc (length + append_dot + 1);
|
|
||||||
memcpy (newpath, path, length);
|
|
||||||
if (append_dot)
|
|
||||||
newpath[length++] = '.';
|
|
||||||
newpath[length] = 0;
|
|
||||||
return newpath;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef TEST_DIRNAME
|
|
||||||
/*
|
|
||||||
|
|
||||||
Run the test like this (expect no output):
|
|
||||||
gcc -DHAVE_CONFIG_H -DTEST_DIRNAME -I.. -O -Wall \
|
|
||||||
basename.c dirname.c xmalloc.c
|
|
||||||
sed -n '/^BEGIN-DATA$/,/^END-DATA$/p' dirname.c|grep -v DATA|./a.out
|
|
||||||
|
|
||||||
BEGIN-DATA
|
|
||||||
foo//// .
|
|
||||||
bar/foo//// bar
|
|
||||||
foo/ .
|
|
||||||
/ /
|
|
||||||
. .
|
|
||||||
a .
|
|
||||||
END-DATA
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
# define MAX_BUFF_LEN 1024
|
|
||||||
# include <stdio.h>
|
|
||||||
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
char buff[MAX_BUFF_LEN + 1];
|
|
||||||
|
|
||||||
buff[MAX_BUFF_LEN] = 0;
|
|
||||||
while (fgets (buff, MAX_BUFF_LEN, stdin) && buff[0])
|
|
||||||
{
|
|
||||||
char path[MAX_BUFF_LEN];
|
|
||||||
char expected_result[MAX_BUFF_LEN];
|
|
||||||
char const *result;
|
|
||||||
sscanf (buff, "%s %s", path, expected_result);
|
|
||||||
result = dir_name (path);
|
|
||||||
if (strcmp (result, expected_result))
|
|
||||||
printf ("%s: got %s, expected %s\n", path, result, expected_result);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
/* Copyright (C) 1998, 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. */
|
|
||||||
|
|
||||||
#ifndef DIRNAME_H_
|
|
||||||
# define DIRNAME_H_ 1
|
|
||||||
|
|
||||||
# ifndef PARAMS
|
|
||||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
|
||||||
# define PARAMS(Args) Args
|
|
||||||
# else
|
|
||||||
# define PARAMS(Args) ()
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifndef DIRECTORY_SEPARATOR
|
|
||||||
# define DIRECTORY_SEPARATOR '/'
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifndef ISSLASH
|
|
||||||
# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifndef FILESYSTEM_PREFIX_LEN
|
|
||||||
# define FILESYSTEM_PREFIX_LEN(Filename) 0
|
|
||||||
# endif
|
|
||||||
|
|
||||||
char *base_name PARAMS ((char const *path));
|
|
||||||
char *dir_name PARAMS ((char const *path));
|
|
||||||
size_t base_len PARAMS ((char const *path));
|
|
||||||
size_t dir_len PARAMS ((char const *path));
|
|
||||||
|
|
||||||
int strip_trailing_slashes PARAMS ((char *path));
|
|
||||||
|
|
||||||
#endif /* not DIRNAME_H_ */
|
|
||||||
+525
-421
File diff suppressed because it is too large
Load Diff
+7
-7
@@ -1,5 +1,5 @@
|
|||||||
/* Functions to support ebitsets.
|
/* Functions to support ebitsets.
|
||||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@@ -14,17 +14,17 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
#ifndef _EBITSET_H
|
#ifndef _EBITSET_H
|
||||||
#define _EBITSET_H
|
#define _EBITSET_H
|
||||||
|
|
||||||
#include "bbitset.h"
|
#include "bitset.h"
|
||||||
|
|
||||||
extern int ebitset_bytes PARAMS ((bitset_bindex));
|
extern size_t ebitset_bytes (bitset_bindex);
|
||||||
|
|
||||||
extern bitset ebitset_init PARAMS ((bitset, bitset_bindex));
|
extern bitset ebitset_init (bitset, bitset_bindex);
|
||||||
|
|
||||||
extern void ebitset_release_memory PARAMS ((void));
|
extern void ebitset_release_memory (void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
-400
@@ -1,400 +0,0 @@
|
|||||||
/* Error handler for noninteractive utilities
|
|
||||||
Copyright (C) 1990-1998, 2000, 2001 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library. Its master source is NOT part of
|
|
||||||
the C library, however. The master source lives in /gd/gnu/lib.
|
|
||||||
|
|
||||||
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]>. */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include <config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#if HAVE_LIBINTL_H
|
|
||||||
# include <libintl.h>
|
|
||||||
#endif
|
|
||||||
#ifdef _LIBC
|
|
||||||
# include <wchar.h>
|
|
||||||
# define mbsrtowcs __mbsrtowcs
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC
|
|
||||||
# if __STDC__
|
|
||||||
# include <stdarg.h>
|
|
||||||
# define VA_START(args, lastarg) va_start(args, lastarg)
|
|
||||||
# else
|
|
||||||
# include <varargs.h>
|
|
||||||
# define VA_START(args, lastarg) va_start(args)
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
# define va_alist a1, a2, a3, a4, a5, a6, a7, a8
|
|
||||||
# define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if STDC_HEADERS || _LIBC
|
|
||||||
# include <stdlib.h>
|
|
||||||
# include <string.h>
|
|
||||||
#else
|
|
||||||
void exit ();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "error.h"
|
|
||||||
#include "unlocked-io.h"
|
|
||||||
|
|
||||||
#ifndef _
|
|
||||||
# define _(String) String
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If NULL, error will flush stdout, then print on stderr the program
|
|
||||||
name, a colon and a space. Otherwise, error will call this
|
|
||||||
function without parameters instead. */
|
|
||||||
void (*error_print_progname) (
|
|
||||||
#if __STDC__ - 0
|
|
||||||
void
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
|
|
||||||
/* This variable is incremented each time `error' is called. */
|
|
||||||
unsigned int error_message_count;
|
|
||||||
|
|
||||||
#ifdef _LIBC
|
|
||||||
/* In the GNU C library, there is a predefined variable for this. */
|
|
||||||
|
|
||||||
# define program_name program_invocation_name
|
|
||||||
# include <errno.h>
|
|
||||||
|
|
||||||
/* In GNU libc we want do not want to use the common name `error' directly.
|
|
||||||
Instead make it a weak alias. */
|
|
||||||
extern void __error (int status, int errnum, const char *message, ...)
|
|
||||||
__attribute__ ((__format__ (__printf__, 3, 4)));
|
|
||||||
extern void __error_at_line (int status, int errnum, const char *file_name,
|
|
||||||
unsigned int line_number, const char *message,
|
|
||||||
...)
|
|
||||||
__attribute__ ((__format__ (__printf__, 5, 6)));;
|
|
||||||
# define error __error
|
|
||||||
# define error_at_line __error_at_line
|
|
||||||
|
|
||||||
# ifdef USE_IN_LIBIO
|
|
||||||
# include <libio/iolibio.h>
|
|
||||||
# define fflush(s) _IO_fflush (s)
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#else /* not _LIBC */
|
|
||||||
|
|
||||||
# if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P
|
|
||||||
# ifndef HAVE_DECL_STRERROR_R
|
|
||||||
"this configure-time declaration test was not run"
|
|
||||||
# endif
|
|
||||||
char *strerror_r ();
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/* The calling program should define program_name and set it to the
|
|
||||||
name of the executing program. */
|
|
||||||
extern char *program_name;
|
|
||||||
|
|
||||||
# if HAVE_STRERROR_R || defined strerror_r
|
|
||||||
# define __strerror_r strerror_r
|
|
||||||
# else
|
|
||||||
# if HAVE_STRERROR
|
|
||||||
# ifndef HAVE_DECL_STRERROR
|
|
||||||
"this configure-time declaration test was not run"
|
|
||||||
# endif
|
|
||||||
# if !HAVE_DECL_STRERROR
|
|
||||||
char *strerror ();
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
static char *
|
|
||||||
private_strerror (int errnum)
|
|
||||||
{
|
|
||||||
extern char *sys_errlist[];
|
|
||||||
extern int sys_nerr;
|
|
||||||
|
|
||||||
if (errnum > 0 && errnum <= sys_nerr)
|
|
||||||
return _(sys_errlist[errnum]);
|
|
||||||
return _("Unknown system error");
|
|
||||||
}
|
|
||||||
# define strerror private_strerror
|
|
||||||
# endif /* HAVE_STRERROR */
|
|
||||||
# endif /* HAVE_STRERROR_R || defined strerror_r */
|
|
||||||
#endif /* not _LIBC */
|
|
||||||
|
|
||||||
static void
|
|
||||||
print_errno_message (int errnum)
|
|
||||||
{
|
|
||||||
char const *s;
|
|
||||||
|
|
||||||
#if defined HAVE_STRERROR_R || _LIBC
|
|
||||||
char errbuf[1024];
|
|
||||||
# if STRERROR_R_CHAR_P || _LIBC
|
|
||||||
s = __strerror_r (errnum, errbuf, sizeof errbuf);
|
|
||||||
# else
|
|
||||||
if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0)
|
|
||||||
s = errbuf;
|
|
||||||
else
|
|
||||||
s = 0;
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
s = strerror (errnum);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !_LIBC
|
|
||||||
if (! s)
|
|
||||||
s = _("Unknown system error");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if _LIBC && USE_IN_LIBIO
|
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
|
||||||
{
|
|
||||||
__fwprintf (stderr, L": %s", s);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fprintf (stderr, ": %s", s);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef VA_START
|
|
||||||
static void
|
|
||||||
error_tail (int status, int errnum, const char *message, va_list args)
|
|
||||||
{
|
|
||||||
# if HAVE_VPRINTF || _LIBC
|
|
||||||
# if _LIBC && USE_IN_LIBIO
|
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
|
||||||
{
|
|
||||||
# define ALLOCA_LIMIT 2000
|
|
||||||
size_t len = strlen (message) + 1;
|
|
||||||
wchar_t *wmessage = NULL;
|
|
||||||
mbstate_t st;
|
|
||||||
size_t res;
|
|
||||||
const char *tmp;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (len < ALLOCA_LIMIT)
|
|
||||||
wmessage = (wchar_t *) alloca (len * sizeof (wchar_t));
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (wmessage != NULL && len / 2 < ALLOCA_LIMIT)
|
|
||||||
wmessage = NULL;
|
|
||||||
|
|
||||||
wmessage = (wchar_t *) realloc (wmessage,
|
|
||||||
len * sizeof (wchar_t));
|
|
||||||
|
|
||||||
if (wmessage == NULL)
|
|
||||||
{
|
|
||||||
fputws_unlocked (L"out of memory\n", stderr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
memset (&st, '\0', sizeof (st));
|
|
||||||
tmp =message;
|
|
||||||
}
|
|
||||||
while ((res = mbsrtowcs (wmessage, &tmp, len, &st)) == len);
|
|
||||||
|
|
||||||
if (res == (size_t) -1)
|
|
||||||
/* The string cannot be converted. */
|
|
||||||
wmessage = (wchar_t *) L"???";
|
|
||||||
|
|
||||||
__vfwprintf (stderr, wmessage, args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
# endif
|
|
||||||
vfprintf (stderr, message, args);
|
|
||||||
# else
|
|
||||||
_doprnt (message, args, stderr);
|
|
||||||
# endif
|
|
||||||
va_end (args);
|
|
||||||
|
|
||||||
++error_message_count;
|
|
||||||
if (errnum)
|
|
||||||
print_errno_message (errnum);
|
|
||||||
# if _LIBC && USE_IN_LIBIO
|
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
|
||||||
putwc (L'\n', stderr);
|
|
||||||
else
|
|
||||||
# endif
|
|
||||||
putc ('\n', stderr);
|
|
||||||
fflush (stderr);
|
|
||||||
if (status)
|
|
||||||
exit (status);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Print the program name and error message MESSAGE, which is a printf-style
|
|
||||||
format string with optional args.
|
|
||||||
If ERRNUM is nonzero, print its corresponding system error message.
|
|
||||||
Exit with status STATUS if it is nonzero. */
|
|
||||||
/* VARARGS */
|
|
||||||
void
|
|
||||||
#if defined VA_START && __STDC__
|
|
||||||
error (int status, int errnum, const char *message, ...)
|
|
||||||
#else
|
|
||||||
error (status, errnum, message, va_alist)
|
|
||||||
int status;
|
|
||||||
int errnum;
|
|
||||||
char *message;
|
|
||||||
va_dcl
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
#ifdef VA_START
|
|
||||||
va_list args;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fflush (stdout);
|
|
||||||
#ifdef _LIBC
|
|
||||||
# ifdef USE_IN_LIBIO
|
|
||||||
_IO_flockfile (stderr);
|
|
||||||
# else
|
|
||||||
__flockfile (stderr);
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
if (error_print_progname)
|
|
||||||
(*error_print_progname) ();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#if _LIBC && USE_IN_LIBIO
|
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
|
||||||
__fwprintf (stderr, L"%s: ", program_name);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
fprintf (stderr, "%s: ", program_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef VA_START
|
|
||||||
VA_START (args, message);
|
|
||||||
error_tail (status, errnum, message, args);
|
|
||||||
#else
|
|
||||||
fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
|
|
||||||
|
|
||||||
++error_message_count;
|
|
||||||
if (errnum)
|
|
||||||
print_errno_message (errnum);
|
|
||||||
putc ('\n', stderr);
|
|
||||||
fflush (stderr);
|
|
||||||
if (status)
|
|
||||||
exit (status);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _LIBC
|
|
||||||
# ifdef USE_IN_LIBIO
|
|
||||||
_IO_funlockfile (stderr);
|
|
||||||
# else
|
|
||||||
__funlockfile (stderr);
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sometimes we want to have at most one error per line. This
|
|
||||||
variable controls whether this mode is selected or not. */
|
|
||||||
int error_one_per_line;
|
|
||||||
|
|
||||||
void
|
|
||||||
#if defined VA_START && __STDC__
|
|
||||||
error_at_line (int status, int errnum, const char *file_name,
|
|
||||||
unsigned int line_number, const char *message, ...)
|
|
||||||
#else
|
|
||||||
error_at_line (status, errnum, file_name, line_number, message, va_alist)
|
|
||||||
int status;
|
|
||||||
int errnum;
|
|
||||||
const char *file_name;
|
|
||||||
unsigned int line_number;
|
|
||||||
char *message;
|
|
||||||
va_dcl
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
#ifdef VA_START
|
|
||||||
va_list args;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (error_one_per_line)
|
|
||||||
{
|
|
||||||
static const char *old_file_name;
|
|
||||||
static unsigned int old_line_number;
|
|
||||||
|
|
||||||
if (old_line_number == line_number
|
|
||||||
&& (file_name == old_file_name
|
|
||||||
|| strcmp (old_file_name, file_name) == 0))
|
|
||||||
/* Simply return and print nothing. */
|
|
||||||
return;
|
|
||||||
|
|
||||||
old_file_name = file_name;
|
|
||||||
old_line_number = line_number;
|
|
||||||
}
|
|
||||||
|
|
||||||
fflush (stdout);
|
|
||||||
#ifdef _LIBC
|
|
||||||
# ifdef USE_IN_LIBIO
|
|
||||||
_IO_flockfile (stderr);
|
|
||||||
# else
|
|
||||||
__flockfile (stderr);
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
if (error_print_progname)
|
|
||||||
(*error_print_progname) ();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#if _LIBC && USE_IN_LIBIO
|
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
|
||||||
__fwprintf (stderr, L"%s: ", program_name);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
fprintf (stderr, "%s:", program_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file_name != NULL)
|
|
||||||
{
|
|
||||||
#if _LIBC && USE_IN_LIBIO
|
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
|
||||||
__fwprintf (stderr, L"%s:%d: ", file_name, line_number);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
fprintf (stderr, "%s:%d: ", file_name, line_number);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef VA_START
|
|
||||||
VA_START (args, message);
|
|
||||||
error_tail (status, errnum, message, args);
|
|
||||||
#else
|
|
||||||
fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
|
|
||||||
|
|
||||||
++error_message_count;
|
|
||||||
if (errnum)
|
|
||||||
print_errno_message (errnum);
|
|
||||||
putc ('\n', stderr);
|
|
||||||
fflush (stderr);
|
|
||||||
if (status)
|
|
||||||
exit (status);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _LIBC
|
|
||||||
# ifdef USE_IN_LIBIO
|
|
||||||
_IO_funlockfile (stderr);
|
|
||||||
# else
|
|
||||||
__funlockfile (stderr);
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _LIBC
|
|
||||||
/* Make the weak alias. */
|
|
||||||
# undef error
|
|
||||||
# undef error_at_line
|
|
||||||
weak_alias (__error, error)
|
|
||||||
weak_alias (__error_at_line, error_at_line)
|
|
||||||
#endif
|
|
||||||
-78
@@ -1,78 +0,0 @@
|
|||||||
/* Declaration for error-reporting function
|
|
||||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
|
|
||||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
|
||||||
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
|
||||||
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#ifndef _ERROR_H
|
|
||||||
#define _ERROR_H 1
|
|
||||||
|
|
||||||
#ifndef __attribute__
|
|
||||||
/* This feature is available in gcc versions 2.5 and later. */
|
|
||||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
|
|
||||||
# define __attribute__(Spec) /* empty */
|
|
||||||
# endif
|
|
||||||
/* The __-protected variants of `format' and `printf' attributes
|
|
||||||
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
|
|
||||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
|
|
||||||
# define __format__ format
|
|
||||||
# define __printf__ printf
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (__STDC__) && __STDC__
|
|
||||||
|
|
||||||
/* Print a message with `fprintf (stderr, FORMAT, ...)';
|
|
||||||
if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
|
|
||||||
If STATUS is nonzero, terminate the program with `exit (STATUS)'. */
|
|
||||||
|
|
||||||
extern void error (int status, int errnum, const char *format, ...)
|
|
||||||
__attribute__ ((__format__ (__printf__, 3, 4)));
|
|
||||||
|
|
||||||
extern void error_at_line (int status, int errnum, const char *fname,
|
|
||||||
unsigned int lineno, const char *format, ...)
|
|
||||||
__attribute__ ((__format__ (__printf__, 5, 6)));
|
|
||||||
|
|
||||||
/* If NULL, error will flush stdout, then print on stderr the program
|
|
||||||
name, a colon and a space. Otherwise, error will call this
|
|
||||||
function without parameters instead. */
|
|
||||||
extern void (*error_print_progname) (void);
|
|
||||||
|
|
||||||
#else
|
|
||||||
void error ();
|
|
||||||
void error_at_line ();
|
|
||||||
extern void (*error_print_progname) ();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This variable is incremented each time `error' is called. */
|
|
||||||
extern unsigned int error_message_count;
|
|
||||||
|
|
||||||
/* Sometimes we want to have at most one error per line. This
|
|
||||||
variable controls whether this mode is selected or not. */
|
|
||||||
extern int error_one_per_line;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* error.h */
|
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/* get-errno.c - get and set errno.
|
||||||
|
|
||||||
|
Copyright (C) 2002, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
|
/* Written by Paul Eggert. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include "get-errno.h"
|
||||||
|
|
||||||
|
/* Get and set errno. A source file that needs to set or get errno,
|
||||||
|
but doesn't need to test for specific errno values, can use these
|
||||||
|
functions to avoid namespace pollution. For example, a file that
|
||||||
|
defines EQUAL should not include <errno.h>, since <errno.h> might
|
||||||
|
define EQUAL; such a file can include <get-errno.h> instead. */
|
||||||
|
|
||||||
|
int
|
||||||
|
get_errno (void)
|
||||||
|
{
|
||||||
|
return errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_errno (int e)
|
||||||
|
{
|
||||||
|
errno = e;
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
/* Copyright (C) 2001 Free Software Foundation, Inc.
|
/* get-errno.h - get and set errno.
|
||||||
|
|
||||||
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -12,20 +14,7 @@
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software Foundation,
|
along with this program; if not, write to the Free Software Foundation,
|
||||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
extern int get_errno (void);
|
||||||
# include <config.h>
|
extern void set_errno (int);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAVE_STRING_H
|
|
||||||
# include <string.h>
|
|
||||||
#else
|
|
||||||
# include <strings.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char *
|
|
||||||
strchr (const char *s, int c)
|
|
||||||
{
|
|
||||||
return index (s, c);
|
|
||||||
}
|
|
||||||
-1036
File diff suppressed because it is too large
Load Diff
-189
@@ -1,189 +0,0 @@
|
|||||||
/* Declarations for getopt.
|
|
||||||
|
|
||||||
Copyright (C) 1989-1994, 1996-1999, 2001, 2002 Free Software Foundation,
|
|
||||||
Inc.
|
|
||||||
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#ifndef _GETOPT_H
|
|
||||||
|
|
||||||
#ifndef __need_getopt
|
|
||||||
# define _GETOPT_H 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If __GNU_LIBRARY__ is not already defined, either we are being used
|
|
||||||
standalone, or this is the first header included in the source file.
|
|
||||||
If we are being used with glibc, we need to include <features.h>, but
|
|
||||||
that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
|
|
||||||
not defined, include <stdlib.h>, which will pull in <features.h> for us
|
|
||||||
if it's from glibc (and will declare getopt). Fall back on <ctype.h> if
|
|
||||||
<stdlib.h> might not exist. (Why ctype.h? It's guaranteed to exist and it
|
|
||||||
doesn't flood the namespace with stuff the way some other headers do.) */
|
|
||||||
#if !defined __GNU_LIBRARY__
|
|
||||||
# if HAVE_STDLIB_H || STDC_HEADERS
|
|
||||||
# include <stdlib.h>
|
|
||||||
# else
|
|
||||||
# include <ctype.h>
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* For communication from `getopt' to the caller.
|
|
||||||
When `getopt' finds an option that takes an argument,
|
|
||||||
the argument value is returned here.
|
|
||||||
Also, when `ordering' is RETURN_IN_ORDER,
|
|
||||||
each non-option ARGV-element is returned here. */
|
|
||||||
|
|
||||||
extern char *optarg;
|
|
||||||
|
|
||||||
/* Index in ARGV of the next element to be scanned.
|
|
||||||
This is used for communication to and from the caller
|
|
||||||
and for communication between successive calls to `getopt'.
|
|
||||||
|
|
||||||
On entry to `getopt', zero means this is the first call; initialize.
|
|
||||||
|
|
||||||
When `getopt' returns -1, this is the index of the first of the
|
|
||||||
non-option elements that the caller should itself scan.
|
|
||||||
|
|
||||||
Otherwise, `optind' communicates from one call to the next
|
|
||||||
how much of ARGV has been scanned so far. */
|
|
||||||
|
|
||||||
extern int optind;
|
|
||||||
|
|
||||||
/* Callers store zero here to inhibit the error message `getopt' prints
|
|
||||||
for unrecognized options. */
|
|
||||||
|
|
||||||
extern int opterr;
|
|
||||||
|
|
||||||
/* Set to an option character which was unrecognized. */
|
|
||||||
|
|
||||||
extern int optopt;
|
|
||||||
|
|
||||||
#ifndef __need_getopt
|
|
||||||
/* Describe the long-named options requested by the application.
|
|
||||||
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
|
|
||||||
of `struct option' terminated by an element containing a name which is
|
|
||||||
zero.
|
|
||||||
|
|
||||||
The field `has_arg' is:
|
|
||||||
no_argument (or 0) if the option does not take an argument,
|
|
||||||
required_argument (or 1) if the option requires an argument,
|
|
||||||
optional_argument (or 2) if the option takes an optional argument.
|
|
||||||
|
|
||||||
If the field `flag' is not NULL, it points to a variable that is set
|
|
||||||
to the value given in the field `val' when the option is found, but
|
|
||||||
left unchanged if the option is not found.
|
|
||||||
|
|
||||||
To have a long-named option do something other than set an `int' to
|
|
||||||
a compiled-in constant, such as set a value from `optarg', set the
|
|
||||||
option's `flag' field to zero and its `val' field to a nonzero
|
|
||||||
value (the equivalent single-letter option character, if there is
|
|
||||||
one). For long options that have a zero `flag' field, `getopt'
|
|
||||||
returns the contents of the `val' field. */
|
|
||||||
|
|
||||||
struct option
|
|
||||||
{
|
|
||||||
# if (defined __STDC__ && __STDC__) || defined __cplusplus
|
|
||||||
const char *name;
|
|
||||||
# else
|
|
||||||
char *name;
|
|
||||||
# endif
|
|
||||||
/* has_arg can't be an enum because some compilers complain about
|
|
||||||
type mismatches in all the code that assumes it is an int. */
|
|
||||||
int has_arg;
|
|
||||||
int *flag;
|
|
||||||
int val;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Names for the values of the `has_arg' field of `struct option'. */
|
|
||||||
|
|
||||||
# define no_argument 0
|
|
||||||
# define required_argument 1
|
|
||||||
# define optional_argument 2
|
|
||||||
#endif /* need getopt */
|
|
||||||
|
|
||||||
|
|
||||||
/* Get definitions and prototypes for functions to process the
|
|
||||||
arguments in ARGV (ARGC of them, minus the program name) for
|
|
||||||
options given in OPTS.
|
|
||||||
|
|
||||||
Return the option character from OPTS just read. Return -1 when
|
|
||||||
there are no more options. For unrecognized options, or options
|
|
||||||
missing arguments, `optopt' is set to the option letter, and '?' is
|
|
||||||
returned.
|
|
||||||
|
|
||||||
The OPTS string is a list of characters which are recognized option
|
|
||||||
letters, optionally followed by colons, specifying that that letter
|
|
||||||
takes an argument, to be placed in `optarg'.
|
|
||||||
|
|
||||||
If a letter in OPTS is followed by two colons, its argument is
|
|
||||||
optional. This behavior is specific to the GNU `getopt'.
|
|
||||||
|
|
||||||
The argument `--' causes premature termination of argument
|
|
||||||
scanning, explicitly telling `getopt' that there are no more
|
|
||||||
options.
|
|
||||||
|
|
||||||
If OPTS begins with `--', then non-option arguments are treated as
|
|
||||||
arguments to the option '\0'. This behavior is specific to the GNU
|
|
||||||
`getopt'. */
|
|
||||||
|
|
||||||
#if (defined __STDC__ && __STDC__) || defined __cplusplus
|
|
||||||
# if defined HAVE_DECL_GETOPT && !HAVE_DECL_GETOPT
|
|
||||||
# ifdef __GNU_LIBRARY__
|
|
||||||
/* Many other libraries have conflicting prototypes for getopt, with
|
|
||||||
differences in the consts, in stdlib.h. To avoid compilation
|
|
||||||
errors, only prototype getopt for the GNU C library. */
|
|
||||||
extern int getopt (int __argc, char *const *__argv, const char *__shortopts);
|
|
||||||
# else /* not __GNU_LIBRARY__ */
|
|
||||||
extern int getopt ();
|
|
||||||
# endif /* __GNU_LIBRARY__ */
|
|
||||||
# endif /* defined HAVE_DECL_GETOPT && !HAVE_DECL_GETOPT */
|
|
||||||
|
|
||||||
# ifndef __need_getopt
|
|
||||||
extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts,
|
|
||||||
const struct option *__longopts, int *__longind);
|
|
||||||
extern int getopt_long_only (int __argc, char *const *__argv,
|
|
||||||
const char *__shortopts,
|
|
||||||
const struct option *__longopts, int *__longind);
|
|
||||||
|
|
||||||
/* Internal only. Users should not call this directly. */
|
|
||||||
extern int _getopt_internal (int __argc, char *const *__argv,
|
|
||||||
const char *__shortopts,
|
|
||||||
const struct option *__longopts, int *__longind,
|
|
||||||
int __long_only);
|
|
||||||
# endif
|
|
||||||
#else /* not __STDC__ */
|
|
||||||
extern int getopt ();
|
|
||||||
# ifndef __need_getopt
|
|
||||||
extern int getopt_long ();
|
|
||||||
extern int getopt_long_only ();
|
|
||||||
|
|
||||||
extern int _getopt_internal ();
|
|
||||||
# endif
|
|
||||||
#endif /* __STDC__ */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Make sure we later can get all the definitions and declarations. */
|
|
||||||
#undef __need_getopt
|
|
||||||
|
|
||||||
#endif /* getopt.h */
|
|
||||||
-178
@@ -1,178 +0,0 @@
|
|||||||
/* getopt_long and getopt_long_only entry points for GNU getopt.
|
|
||||||
Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98, 2002
|
|
||||||
Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include <config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "getopt.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
/* Comment out all this code if we are using the GNU C Library, and are not
|
|
||||||
actually compiling the library itself. This code is part of the GNU C
|
|
||||||
Library, but also included in many other GNU distributions. Compiling
|
|
||||||
and linking in this code is a waste when using the GNU C library
|
|
||||||
(especially if it is a shared library). Rather than having every GNU
|
|
||||||
program understand `configure --with-gnu-libc' and omit the object files,
|
|
||||||
it is simpler to just do this in the source for each such file. */
|
|
||||||
|
|
||||||
#define GETOPT_INTERFACE_VERSION 2
|
|
||||||
#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
|
|
||||||
#include <gnu-versions.h>
|
|
||||||
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
|
|
||||||
#define ELIDE_CODE
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ELIDE_CODE
|
|
||||||
|
|
||||||
|
|
||||||
/* This needs to come after some library #include
|
|
||||||
to get __GNU_LIBRARY__ defined. */
|
|
||||||
#ifdef __GNU_LIBRARY__
|
|
||||||
#include <stdlib.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NULL
|
|
||||||
#define NULL 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
|
||||||
getopt_long (argc, argv, options, long_options, opt_index)
|
|
||||||
int argc;
|
|
||||||
char *const *argv;
|
|
||||||
const char *options;
|
|
||||||
const struct option *long_options;
|
|
||||||
int *opt_index;
|
|
||||||
{
|
|
||||||
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
|
|
||||||
If an option that starts with '-' (not '--') doesn't match a long option,
|
|
||||||
but does match a short option, it is parsed as a short option
|
|
||||||
instead. */
|
|
||||||
|
|
||||||
int
|
|
||||||
getopt_long_only (argc, argv, options, long_options, opt_index)
|
|
||||||
int argc;
|
|
||||||
char *const *argv;
|
|
||||||
const char *options;
|
|
||||||
const struct option *long_options;
|
|
||||||
int *opt_index;
|
|
||||||
{
|
|
||||||
return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* Not ELIDE_CODE. */
|
|
||||||
|
|
||||||
#ifdef TEST
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int
|
|
||||||
main (argc, argv)
|
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
|
||||||
int c;
|
|
||||||
int digit_optind = 0;
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
int this_option_optind = optind ? optind : 1;
|
|
||||||
int option_index = 0;
|
|
||||||
static struct option long_options[] =
|
|
||||||
{
|
|
||||||
{"add", 1, 0, 0},
|
|
||||||
{"append", 0, 0, 0},
|
|
||||||
{"delete", 1, 0, 0},
|
|
||||||
{"verbose", 0, 0, 0},
|
|
||||||
{"create", 0, 0, 0},
|
|
||||||
{"file", 1, 0, 0},
|
|
||||||
{0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
c = getopt_long (argc, argv, "abc:d:0123456789",
|
|
||||||
long_options, &option_index);
|
|
||||||
if (c == -1)
|
|
||||||
break;
|
|
||||||
|
|
||||||
switch (c)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
printf ("option %s", long_options[option_index].name);
|
|
||||||
if (optarg)
|
|
||||||
printf (" with arg %s", optarg);
|
|
||||||
printf ("\n");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '0':
|
|
||||||
case '1':
|
|
||||||
case '2':
|
|
||||||
case '3':
|
|
||||||
case '4':
|
|
||||||
case '5':
|
|
||||||
case '6':
|
|
||||||
case '7':
|
|
||||||
case '8':
|
|
||||||
case '9':
|
|
||||||
if (digit_optind != 0 && digit_optind != this_option_optind)
|
|
||||||
printf ("digits occur in two different argv-elements.\n");
|
|
||||||
digit_optind = this_option_optind;
|
|
||||||
printf ("option %c\n", c);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'a':
|
|
||||||
printf ("option a\n");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'b':
|
|
||||||
printf ("option b\n");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'c':
|
|
||||||
printf ("option c with value `%s'\n", optarg);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'd':
|
|
||||||
printf ("option d with value `%s'\n", optarg);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '?':
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
printf ("?? getopt returned character code 0%o ??\n", c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (optind < argc)
|
|
||||||
{
|
|
||||||
printf ("non-option ARGV-elements: ");
|
|
||||||
while (optind < argc)
|
|
||||||
printf ("%s ", argv[optind++]);
|
|
||||||
printf ("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
exit (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* TEST */
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
/* Convenience header for conditional use of GNU <libintl.h>.
|
|
||||||
Copyright (C) 1995-1998, 2000-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, 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 _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
|
|
||||||
|
|
||||||
/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
|
|
||||||
chokes if dcgettext is defined as a macro. So include it now, to make
|
|
||||||
later inclusions of <locale.h> a NOP. We don't include <libintl.h>
|
|
||||||
as well because people using "gettext.h" will not include <libintl.h>,
|
|
||||||
and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
|
|
||||||
is OK. */
|
|
||||||
#if defined(__sun)
|
|
||||||
# include <locale.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Disabled NLS.
|
|
||||||
The casts to 'const char *' serve the purpose of producing warnings
|
|
||||||
for invalid uses of the value returned from these functions.
|
|
||||||
On pre-ANSI systems without 'const', the config.h file is supposed to
|
|
||||||
contain "#define const". */
|
|
||||||
# define gettext(Msgid) ((const char *) (Msgid))
|
|
||||||
# define dgettext(Domainname, Msgid) ((const char *) (Msgid))
|
|
||||||
# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid))
|
|
||||||
# define ngettext(Msgid1, Msgid2, N) \
|
|
||||||
((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
|
|
||||||
# define dngettext(Domainname, Msgid1, Msgid2, N) \
|
|
||||||
((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
|
|
||||||
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
|
|
||||||
((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
|
|
||||||
# define textdomain(Domainname) ((const char *) (Domainname))
|
|
||||||
# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
|
|
||||||
# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset))
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* A pseudo function call that serves as a marker for the automated
|
|
||||||
extraction of messages, but does not call gettext(). The run-time
|
|
||||||
translation is done at a different place in the code.
|
|
||||||
The argument, String, should be a literal string. Concatenated strings
|
|
||||||
and other string expressions won't work.
|
|
||||||
The macro's expansion is not parenthesized, so that it is suitable as
|
|
||||||
initializer for static 'char[]' or 'const char[]' variables. */
|
|
||||||
#define gettext_noop(String) String
|
|
||||||
|
|
||||||
#endif /* _LIBGETTEXT_H */
|
|
||||||
-1047
File diff suppressed because it is too large
Load Diff
-93
@@ -1,93 +0,0 @@
|
|||||||
/* hash - hashing table processing.
|
|
||||||
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
|
|
||||||
Written by Jim Meyering <meyering@ascend.com>, 1998.
|
|
||||||
|
|
||||||
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. */
|
|
||||||
|
|
||||||
/* A generic hash table package. */
|
|
||||||
|
|
||||||
/* Make sure USE_OBSTACK is defined to 1 if you want the allocator to use
|
|
||||||
obstacks instead of malloc, and recompile `hash.c' with same setting. */
|
|
||||||
|
|
||||||
#ifndef HASH_H_
|
|
||||||
# define HASH_H_
|
|
||||||
|
|
||||||
# ifndef PARAMS
|
|
||||||
# if PROTOTYPES || __STDC__
|
|
||||||
# define PARAMS(Args) Args
|
|
||||||
# else
|
|
||||||
# define PARAMS(Args) ()
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
typedef unsigned (*Hash_hasher) PARAMS ((const void *, unsigned));
|
|
||||||
typedef bool (*Hash_comparator) PARAMS ((const void *, const void *));
|
|
||||||
typedef void (*Hash_data_freer) PARAMS ((void *));
|
|
||||||
typedef bool (*Hash_processor) PARAMS ((void *, void *));
|
|
||||||
|
|
||||||
struct hash_entry
|
|
||||||
{
|
|
||||||
void *data;
|
|
||||||
struct hash_entry *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct hash_tuning
|
|
||||||
{
|
|
||||||
/* This structure is mainly used for `hash_initialize', see the block
|
|
||||||
documentation of `hash_reset_tuning' for more complete comments. */
|
|
||||||
|
|
||||||
float shrink_threshold; /* ratio of used buckets to trigger a shrink */
|
|
||||||
float shrink_factor; /* ratio of new smaller size to original size */
|
|
||||||
float growth_threshold; /* ratio of used buckets to trigger a growth */
|
|
||||||
float growth_factor; /* ratio of new bigger size to original size */
|
|
||||||
bool is_n_buckets; /* if CANDIDATE really means table size */
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct hash_tuning Hash_tuning;
|
|
||||||
|
|
||||||
struct hash_table;
|
|
||||||
|
|
||||||
typedef struct hash_table Hash_table;
|
|
||||||
|
|
||||||
/* Information and lookup. */
|
|
||||||
unsigned hash_get_n_buckets PARAMS ((const Hash_table *));
|
|
||||||
unsigned hash_get_n_buckets_used PARAMS ((const Hash_table *));
|
|
||||||
unsigned hash_get_n_entries PARAMS ((const Hash_table *));
|
|
||||||
unsigned hash_get_max_bucket_length PARAMS ((const Hash_table *));
|
|
||||||
bool hash_table_ok PARAMS ((const Hash_table *));
|
|
||||||
void hash_print_statistics PARAMS ((const Hash_table *, FILE *));
|
|
||||||
void *hash_lookup PARAMS ((const Hash_table *, const void *));
|
|
||||||
|
|
||||||
/* Walking. */
|
|
||||||
void *hash_get_first PARAMS ((const Hash_table *));
|
|
||||||
void *hash_get_next PARAMS ((const Hash_table *, const void *));
|
|
||||||
unsigned hash_get_entries PARAMS ((const Hash_table *, void **, unsigned));
|
|
||||||
unsigned hash_do_for_each PARAMS ((const Hash_table *, Hash_processor, void *));
|
|
||||||
|
|
||||||
/* Allocation and clean-up. */
|
|
||||||
unsigned hash_string PARAMS ((const char *, unsigned));
|
|
||||||
void hash_reset_tuning PARAMS ((Hash_tuning *));
|
|
||||||
Hash_table *hash_initialize PARAMS ((unsigned, const Hash_tuning *,
|
|
||||||
Hash_hasher, Hash_comparator,
|
|
||||||
Hash_data_freer));
|
|
||||||
void hash_clear PARAMS ((Hash_table *));
|
|
||||||
void hash_free PARAMS ((Hash_table *));
|
|
||||||
|
|
||||||
/* Insertion and deletion. */
|
|
||||||
bool hash_rehash PARAMS ((Hash_table *, unsigned));
|
|
||||||
void *hash_insert PARAMS ((Hash_table *, const void *));
|
|
||||||
void *hash_delete PARAMS ((Hash_table *, const void *));
|
|
||||||
|
|
||||||
#endif
|
|
||||||
+436
-356
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user