mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-09-01 22:18:40 +00:00
Compare commits
526
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b85481146a | ||
|
|
b219268ad8 | ||
|
|
a05fafb944 | ||
|
|
c20cd1facb | ||
|
|
8a9566d401 | ||
|
|
b756bb754c | ||
|
|
0c76a0c911 | ||
|
|
71cd15d49b | ||
|
|
8c6d399ada | ||
|
|
2b7ed18a60 | ||
|
|
34a89c5066 | ||
|
|
969e2ed98b | ||
|
|
0dd1580afc | ||
|
|
b98ec53ee4 | ||
|
|
b4cbf822eb | ||
|
|
c47dc59adc | ||
|
|
83c1796f41 | ||
|
|
cf44a9aea7 | ||
|
|
5c0a0514da | ||
|
|
1207eeacc2 | ||
|
|
8e521837dc | ||
|
|
08e49d20f0 | ||
|
|
e91ff6ce3d | ||
|
|
7655146399 | ||
|
|
216eb8c9f2 | ||
|
|
78ab8f674f | ||
|
|
133c20e252 | ||
|
|
9515e8a7f8 | ||
|
|
23c5a17453 | ||
|
|
5fbb0954b8 | ||
|
|
4f940944da | ||
|
|
69991a5827 | ||
|
|
20c37f213a | ||
|
|
3ded9a63e3 | ||
|
|
e0c471a9e6 | ||
|
|
6b44f458f2 | ||
|
|
01c56de45c | ||
|
|
8b3ba7ff05 | ||
|
|
d1a6f01efb | ||
|
|
c2a6d50e58 | ||
|
|
f294a2c217 | ||
|
|
4358321afa | ||
|
|
45a44d49bf | ||
|
|
fecc10cd95 | ||
|
|
01e5c81773 | ||
|
|
eaff5ee3c5 | ||
|
|
aef1ffd56f | ||
|
|
51dec47b37 | ||
|
|
007a50a493 | ||
|
|
491bdd7ae5 | ||
|
|
73b0698996 | ||
|
|
06446ccf94 | ||
|
|
62a3e4f0c5 | ||
|
|
355e7c1cd1 | ||
|
|
bb88b0fc9e | ||
|
|
9a636f47ce | ||
|
|
0e95c1ddc1 | ||
|
|
df33b92836 | ||
|
|
680e8701b5 | ||
|
|
817e9f41d1 | ||
|
|
5123689ba0 | ||
|
|
f3849179e5 | ||
|
|
bd02036a4e | ||
|
|
db8837cbe1 | ||
|
|
72a23c9797 | ||
|
|
280a38c306 | ||
|
|
03b31c0ce8 | ||
|
|
8b3df748a3 | ||
|
|
e601aa1d35 | ||
|
|
b0299a2ebb | ||
|
|
d7e1f00c13 | ||
|
|
cc9305dd68 | ||
|
|
b0940840ac | ||
|
|
643a599471 | ||
|
|
b4c4ccc2b3 | ||
|
|
bba97eb2c1 | ||
|
|
c3b407f430 | ||
|
|
c307773eec | ||
|
|
a31932aa0b | ||
|
|
aa96fda183 | ||
|
|
588db0a892 | ||
|
|
4416fcdb02 | ||
|
|
11652ab3dc | ||
|
|
26b23c1a49 | ||
|
|
18bcecb07d | ||
|
|
fa770c8662 | ||
|
|
d9b739c32f | ||
|
|
9901390012 | ||
|
|
e966383bf4 | ||
|
|
cd6a695eb9 | ||
|
|
0f8d586a9f | ||
|
|
8d6c48b983 | ||
|
|
b4e4c0d14a | ||
|
|
e53c632297 | ||
|
|
21db0b2a65 | ||
|
|
5b041382df | ||
|
|
9ffbeca717 | ||
|
|
cf3b4b64d0 | ||
|
|
fd6748e22c | ||
|
|
9651150243 | ||
|
|
642cb8f829 | ||
|
|
3c31a486e7 | ||
|
|
0d8bed5636 | ||
|
|
01228b70de | ||
|
|
9208d17fa9 | ||
|
|
af27eacb6a | ||
|
|
e69bfebb45 | ||
|
|
bcae0fce72 | ||
|
|
9101a31079 | ||
|
|
c3937ec780 | ||
|
|
fff9bf0b8d | ||
|
|
64dba31e7f | ||
|
|
c1a29a5b2d | ||
|
|
374f5a14de | ||
|
|
bfcf1f3af0 | ||
|
|
65ccf9fc1d | ||
|
|
d0039cbcf8 | ||
|
|
345cea780a | ||
|
|
564801f795 | ||
|
|
b23e820381 | ||
|
|
e5352bc7bf | ||
|
|
914feea9d0 | ||
|
|
f0250de62e | ||
|
|
ef01750240 | ||
|
|
7651439487 | ||
|
|
550245801e | ||
|
|
f9abaa2c4c | ||
|
|
0e721e7569 | ||
|
|
0fb1ffb1bf | ||
|
|
b86796bf87 | ||
|
|
602bbf31c1 | ||
|
|
d8a0245ce7 | ||
|
|
34ba97434f | ||
|
|
ed86e78c90 | ||
|
|
dfdb1797c3 | ||
|
|
7086e7071e | ||
|
|
98254360e3 | ||
|
|
a75c057f10 | ||
|
|
dc2546ac9f | ||
|
|
ad950f8307 | ||
|
|
2794679661 | ||
|
|
06b00abcdd | ||
|
|
70e7d534a9 | ||
|
|
0b3551fbee | ||
|
|
abe017f60d | ||
|
|
381fb12e1e | ||
|
|
10b6b2be55 | ||
|
|
6f38107f80 | ||
|
|
0179dd6542 | ||
|
|
45119af166 | ||
|
|
e4e1a4dcb4 | ||
|
|
80cce3da95 | ||
|
|
842e86794f | ||
|
|
3309b786a3 | ||
|
|
4bda3f10ca | ||
|
|
bd16a5dcf5 | ||
|
|
4162fa07ae | ||
|
|
b418ecd84f | ||
|
|
8d69a1a3ae | ||
|
|
616429b508 | ||
|
|
9b2d067768 | ||
|
|
69e2658bf6 | ||
|
|
4aacc3a71d | ||
|
|
762a801e00 | ||
|
|
4bb2bc3f61 | ||
|
|
9f007dfecc | ||
|
|
6b45a3ca82 | ||
|
|
50997c6eeb | ||
|
|
0d76958cf7 | ||
|
|
11ee57d90c | ||
|
|
ea6cfe9ebd | ||
|
|
3f3eed2770 | ||
|
|
be2a1a68ef | ||
|
|
8e86444744 | ||
|
|
beda758b1f | ||
|
|
5ece6d436f | ||
|
|
5bb18f9a19 | ||
|
|
894dd62eb2 | ||
|
|
2992e1e967 | ||
|
|
82841af7d0 | ||
|
|
318b76e913 | ||
|
|
30d2f3d50f | ||
|
|
30f8c3953f | ||
|
|
29ae55f112 | ||
|
|
2b548aa648 | ||
|
|
bb0146c2a9 | ||
|
|
4518a4baae | ||
|
|
bec30531f7 | ||
|
|
fc6edc45c0 | ||
|
|
5e5d541531 | ||
|
|
52d1aeee3d | ||
|
|
44ea3fbdf5 | ||
|
|
338963d177 | ||
|
|
e1dd105c0a | ||
|
|
a10778dc32 | ||
|
|
d9e9746c06 | ||
|
|
c57b2479ff | ||
|
|
b85810aec0 | ||
|
|
cae601224e | ||
|
|
ae40480115 | ||
|
|
22312b71e0 | ||
|
|
a67cef01b1 | ||
|
|
e9f87b5b7d | ||
|
|
2b25d624f6 | ||
|
|
3460813bdb | ||
|
|
73784c645d | ||
|
|
25d810906c | ||
|
|
a9b8959efa | ||
|
|
e2742e46ba | ||
|
|
1109455ce9 | ||
|
|
7ea5e9779b | ||
|
|
fab5b110fb | ||
|
|
aed7fd9b97 | ||
|
|
24fad99e2b | ||
|
|
a4b36db458 | ||
|
|
1239777d4f | ||
|
|
9b3add5beb | ||
|
|
3cd5bcdd19 | ||
|
|
b5b61c616b | ||
|
|
8c9a50bee1 | ||
|
|
d99361e657 | ||
|
|
b9cecb91a0 | ||
|
|
aea13e9790 | ||
|
|
931394cbc1 | ||
|
|
704a47c475 | ||
|
|
091e20bbee | ||
|
|
cce7171088 | ||
|
|
82c035a823 | ||
|
|
8419d367e1 | ||
|
|
375d580671 | ||
|
|
f51cb8ff8c | ||
|
|
29e8831621 | ||
|
|
b9f71f19cc | ||
|
|
1a2b5d37e1 | ||
|
|
1cca533e2e | ||
|
|
c03ae96659 | ||
|
|
5a670b1ed9 | ||
|
|
ad949da96b | ||
|
|
0e78e603f6 | ||
|
|
213e640e1e | ||
|
|
e7b8bef1b1 | ||
|
|
b68e774421 | ||
|
|
78d5bae94e | ||
|
|
ff44279401 | ||
|
|
610ab194c8 | ||
|
|
29d29c8fff | ||
|
|
7c6b64d023 | ||
|
|
3d4daee374 | ||
|
|
9e7f6bbd59 | ||
|
|
255ef6389e | ||
|
|
0d8a73638f | ||
|
|
5499894828 | ||
|
|
3db472b9eb | ||
|
|
b365aa0589 | ||
|
|
30171f79ab | ||
|
|
75142d452b | ||
|
|
b7c49edf13 | ||
|
|
ec2da99ffe | ||
|
|
8adfa272f7 | ||
|
|
80dac38c5e | ||
|
|
2cec70b9f1 | ||
|
|
13ca549a75 | ||
|
|
5092aba5a7 | ||
|
|
11e2becaac | ||
|
|
dac3c91005 | ||
|
|
d0b0fefa03 | ||
|
|
adc8c84856 | ||
|
|
14d293acb2 | ||
|
|
f499b06243 | ||
|
|
d945f5cd8e | ||
|
|
d200e455d0 | ||
|
|
f9507c28ae | ||
|
|
065fbd27af | ||
|
|
1b177bd731 | ||
|
|
7742ddebf1 | ||
|
|
1fa140687e | ||
|
|
b9752825a0 | ||
|
|
776209d6c7 | ||
|
|
dee049eb91 | ||
|
|
275fc3ad0f | ||
|
|
897668ee8d | ||
|
|
ab3399e0c6 | ||
|
|
4947ebdb4c | ||
|
|
c527b2d483 | ||
|
|
23a1adea4a | ||
|
|
3877f72ba2 | ||
|
|
331dbc1bb7 | ||
|
|
be750e4c49 | ||
|
|
709ae8c6ee | ||
|
|
f87685c324 | ||
|
|
837491d810 | ||
|
|
796d61fbdd | ||
|
|
64d15509b6 | ||
|
|
367c7a47d4 | ||
|
|
fbc8ecb7ef | ||
|
|
f0440388e9 | ||
|
|
a79986b830 | ||
|
|
bcb05e75f5 | ||
|
|
4ec8e00f60 | ||
|
|
5ee2aaf2fa | ||
|
|
a64d6fe0c3 | ||
|
|
1a4648ff0d | ||
|
|
8165afc445 | ||
|
|
9c2c67e6fe | ||
|
|
93ede233f5 | ||
|
|
2666f92821 | ||
|
|
428046f8d4 | ||
|
|
ea52d7066d | ||
|
|
3f96f4dc41 | ||
|
|
51576fb3c6 | ||
|
|
50d780b566 | ||
|
|
2648a72df7 | ||
|
|
92790e5bf0 | ||
|
|
927c155774 | ||
|
|
b7575ffe6f | ||
|
|
02a81e05f9 | ||
|
|
ed8e1f68e9 | ||
|
|
cb581495e6 | ||
|
|
2e729273d6 | ||
|
|
107f7dfbd0 | ||
|
|
9b53a24f31 | ||
|
|
dbfb6dcd33 | ||
|
|
c79cea6dff | ||
|
|
c3a8cbaaad | ||
|
|
c3995d9998 | ||
|
|
c25fb64881 | ||
|
|
710ddc4f18 | ||
|
|
e83d80b8ed | ||
|
|
fbbf9b3bb9 | ||
|
|
971d51580b | ||
|
|
f64b50a08c | ||
|
|
5edafffd36 | ||
|
|
0279f8e90c | ||
|
|
190c4f5f0a | ||
|
|
2a73b93df4 | ||
|
|
74392f6a54 | ||
|
|
37c82725c8 | ||
|
|
6a164e0c96 | ||
|
|
7215de245c | ||
|
|
80e25d4d46 | ||
|
|
0ab3728b12 | ||
|
|
78af9bbcd3 | ||
|
|
bdef2a413a | ||
|
|
3735969c7d | ||
|
|
49701457c2 | ||
|
|
0edad74997 | ||
|
|
5449dd0f25 | ||
|
|
a870c5670e | ||
|
|
75addd5e5f | ||
|
|
80df876864 | ||
|
|
f693ad146e | ||
|
|
74ffbcb6bf | ||
|
|
07708e1946 | ||
|
|
448b17aa3c | ||
|
|
92b16366dd | ||
|
|
076ab0334d | ||
|
|
3843c413d0 | ||
|
|
4316896018 | ||
|
|
b2872512f1 | ||
|
|
23cbcc6c19 | ||
|
|
03ec521cc5 | ||
|
|
3a7456dd96 | ||
|
|
1cbcf2e795 | ||
|
|
841822701a | ||
|
|
3f6f053ce5 | ||
|
|
7a5350baa0 | ||
|
|
5e893e1c88 | ||
|
|
35687a9d8c | ||
|
|
d954473dee | ||
|
|
9839bbe557 | ||
|
|
9f136c0720 | ||
|
|
b608206eca | ||
|
|
52afa962d1 | ||
|
|
e74dc3213f | ||
|
|
768fca8336 | ||
|
|
a17e599f81 | ||
|
|
a04bc34180 | ||
|
|
c8ea038e69 | ||
|
|
aa2aab3c16 | ||
|
|
b178c8ccc4 | ||
|
|
f67d13aa6c | ||
|
|
c2713865e3 | ||
|
|
9887c18aca | ||
|
|
4d4f699ca4 | ||
|
|
80a6975034 | ||
|
|
fe96109760 | ||
|
|
e3e4e81446 | ||
|
|
630e182b7b | ||
|
|
81b51460c9 | ||
|
|
3067fbef53 | ||
|
|
7d27c823de | ||
|
|
2729e106a7 | ||
|
|
c2bea5f96f | ||
|
|
f11966ffc5 | ||
|
|
2c8a9dfa1d | ||
|
|
f4e421e6e4 | ||
|
|
7093d0f541 | ||
|
|
fd51e5ffa2 | ||
|
|
7d13ff5f2f | ||
|
|
892a39950d | ||
|
|
68f1e3edc3 | ||
|
|
d2d1b42b07 | ||
|
|
760b53a84b | ||
|
|
002389585a | ||
|
|
396452de26 | ||
|
|
600f9b0ccc | ||
|
|
04a76783ab | ||
|
|
147e184ccc | ||
|
|
84b113cd22 | ||
|
|
426cf563bd | ||
|
|
ec93a21372 | ||
|
|
c7925b99cb | ||
|
|
5b5d192929 | ||
|
|
8850be4b1c | ||
|
|
9113b58f6f | ||
|
|
4a38e61393 | ||
|
|
4b35e1c1dd | ||
|
|
d2b04478d4 | ||
|
|
2c4c30aa95 | ||
|
|
576890b7ee | ||
|
|
cb487d7d0d | ||
|
|
6013d43f59 | ||
|
|
cb4956ee99 | ||
|
|
648185ab4a | ||
|
|
b3324f97a8 | ||
|
|
68254a0303 | ||
|
|
d2079671fb | ||
|
|
04d843a2a8 | ||
|
|
eeeb962b2f | ||
|
|
e0327bc8b4 | ||
|
|
000f1a3cb2 | ||
|
|
26cfe0be87 | ||
|
|
a12f5cabb2 | ||
|
|
f6bd542788 | ||
|
|
a220f55509 | ||
|
|
2ca209c11d | ||
|
|
0e41b407b9 | ||
|
|
e0c40012bd | ||
|
|
5e147124b5 | ||
|
|
a034c8b849 | ||
|
|
b83f0407c6 | ||
|
|
c64a20f3dc | ||
|
|
5b0d29bb52 | ||
|
|
722c4bfec2 | ||
|
|
6255b43511 | ||
|
|
b29b2ed560 | ||
|
|
b497173564 | ||
|
|
a81b1d4ad4 | ||
|
|
c1ecb3c1f5 | ||
|
|
cc72668cfb | ||
|
|
fbe01355c8 | ||
|
|
81e895c01e | ||
|
|
d38d6e7c76 | ||
|
|
6bb1878b51 | ||
|
|
d9ec2d0749 | ||
|
|
720e5c1bc3 | ||
|
|
fb9087861f | ||
|
|
125ecb5684 | ||
|
|
d8cf039f97 | ||
|
|
7bec0760a8 | ||
|
|
c87d4863f6 | ||
|
|
9bfe901c33 | ||
|
|
97db7bd4a1 | ||
|
|
2c5f66eda7 | ||
|
|
300f275f23 | ||
|
|
f59c437a25 | ||
|
|
6986fd9e3b | ||
|
|
4bc30f78dc | ||
|
|
08a946e008 | ||
|
|
f047348491 | ||
|
|
e41dc70020 | ||
|
|
652a871c29 | ||
|
|
b2ed6e5826 | ||
|
|
edad70670f | ||
|
|
3feec03433 | ||
|
|
ddcd5fdff6 | ||
|
|
bb527fc271 | ||
|
|
a845a69707 | ||
|
|
f004bf6ac4 | ||
|
|
de326cc0de | ||
|
|
90b4416b5b | ||
|
|
9703cc49e0 | ||
|
|
d803322e27 | ||
|
|
3d76b07def | ||
|
|
09b503c8e1 | ||
|
|
0f37a9942f | ||
|
|
fa63c49821 | ||
|
|
d39d93b834 | ||
|
|
9edcd89542 | ||
|
|
7da99edea7 | ||
|
|
ba9dda1a2e | ||
|
|
337c5bd131 | ||
|
|
c73a41af8e | ||
|
|
0df87bb609 | ||
|
|
e4d3d4de4c | ||
|
|
6d7d248e72 | ||
|
|
e9e4c32114 | ||
|
|
5f7e08323a | ||
|
|
e3f1699f55 | ||
|
|
65be086611 | ||
|
|
e4d910bf0f | ||
|
|
1964ad8c34 | ||
|
|
951366c145 | ||
|
|
9f4503d6e9 | ||
|
|
d8988b2fff | ||
|
|
92fcb5efbe | ||
|
|
6468d18e5c | ||
|
|
6b7e85b994 | ||
|
|
cd5aafcf8c | ||
|
|
037ca2f14c | ||
|
|
270a173cf3 | ||
|
|
561f9a30af | ||
|
|
f987e9d257 | ||
|
|
de76abc1e9 | ||
|
|
4a0d893695 | ||
|
|
0846f581e8 | ||
|
|
490abf53b1 | ||
|
|
3c1a79b314 | ||
|
|
5d52e7d045 | ||
|
|
004b178558 | ||
|
|
3bcfa9dedd | ||
|
|
631aa1d3dc | ||
|
|
ee006e3a4c | ||
|
|
9449f6d3a8 | ||
|
|
c07c873533 | ||
|
|
f6ec6d13dc |
@@ -11,3 +11,11 @@ patches
|
|||||||
releases
|
releases
|
||||||
*.flc
|
*.flc
|
||||||
autom4te.cache
|
autom4te.cache
|
||||||
|
intl
|
||||||
|
Makefile.in
|
||||||
|
configure
|
||||||
|
config.hin
|
||||||
|
aclocal.m4
|
||||||
|
ABOUT-NLS
|
||||||
|
INSTALL
|
||||||
|
COPYING
|
||||||
|
|||||||
@@ -1,182 +0,0 @@
|
|||||||
Basic Installation
|
|
||||||
==================
|
|
||||||
|
|
||||||
These are generic installation instructions.
|
|
||||||
|
|
||||||
The `configure' shell script attempts to guess correct values for
|
|
||||||
various system-dependent variables used during compilation. It uses
|
|
||||||
those values to create a `Makefile' in each directory of the package.
|
|
||||||
It may also create one or more `.h' files containing system-dependent
|
|
||||||
definitions. Finally, it creates a shell script `config.status' that
|
|
||||||
you can run in the future to recreate the current configuration, a file
|
|
||||||
`config.cache' that saves the results of its tests to speed up
|
|
||||||
reconfiguring, and a file `config.log' containing compiler output
|
|
||||||
(useful mainly for debugging `configure').
|
|
||||||
|
|
||||||
If you need to do unusual things to compile the package, please try
|
|
||||||
to figure out how `configure' could check whether to do them, and mail
|
|
||||||
diffs or instructions to the address given in the `README' so they can
|
|
||||||
be considered for the next release. If at some point `config.cache'
|
|
||||||
contains results you don't want to keep, you may remove or edit it.
|
|
||||||
|
|
||||||
The file `configure.in' is used to create `configure' by a program
|
|
||||||
called `autoconf'. You only need `configure.in' if you want to change
|
|
||||||
it or regenerate `configure' using a newer version of `autoconf'.
|
|
||||||
|
|
||||||
The simplest way to compile this package is:
|
|
||||||
|
|
||||||
1. `cd' to the directory containing the package's source code and type
|
|
||||||
`./configure' to configure the package for your system. If you're
|
|
||||||
using `csh' on an old version of System V, you might need to type
|
|
||||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
|
||||||
`configure' itself.
|
|
||||||
|
|
||||||
Running `configure' takes awhile. While running, it prints some
|
|
||||||
messages telling which features it is checking for.
|
|
||||||
|
|
||||||
2. Type `make' to compile the package.
|
|
||||||
|
|
||||||
3. Optionally, type `make check' to run any self-tests that come with
|
|
||||||
the package.
|
|
||||||
|
|
||||||
4. Type `make install' to install the programs and any data files and
|
|
||||||
documentation.
|
|
||||||
|
|
||||||
5. You can remove the program binaries and object files from the
|
|
||||||
source code directory by typing `make clean'. To also remove the
|
|
||||||
files that `configure' created (so you can compile the package for
|
|
||||||
a different kind of computer), type `make distclean'. There is
|
|
||||||
also a `make maintainer-clean' target, but that is intended mainly
|
|
||||||
for the package's developers. If you use it, you may have to get
|
|
||||||
all sorts of other programs in order to regenerate files that came
|
|
||||||
with the distribution.
|
|
||||||
|
|
||||||
Compilers and Options
|
|
||||||
=====================
|
|
||||||
|
|
||||||
Some systems require unusual options for compilation or linking that
|
|
||||||
the `configure' script does not know about. You can give `configure'
|
|
||||||
initial values for variables by setting them in the environment. Using
|
|
||||||
a Bourne-compatible shell, you can do that on the command line like
|
|
||||||
this:
|
|
||||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
|
||||||
|
|
||||||
Or on systems that have the `env' program, you can do it like this:
|
|
||||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
|
||||||
|
|
||||||
Compiling For Multiple Architectures
|
|
||||||
====================================
|
|
||||||
|
|
||||||
You can compile the package for more than one kind of computer at the
|
|
||||||
same time, by placing the object files for each architecture in their
|
|
||||||
own directory. To do this, you must use a version of `make' that
|
|
||||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
|
||||||
directory where you want the object files and executables to go and run
|
|
||||||
the `configure' script. `configure' automatically checks for the
|
|
||||||
source code in the directory that `configure' is in and in `..'.
|
|
||||||
|
|
||||||
If you have to use a `make' that does not supports the `VPATH'
|
|
||||||
variable, you have to compile the package for one architecture at a time
|
|
||||||
in the source code directory. After you have installed the package for
|
|
||||||
one architecture, use `make distclean' before reconfiguring for another
|
|
||||||
architecture.
|
|
||||||
|
|
||||||
Installation Names
|
|
||||||
==================
|
|
||||||
|
|
||||||
By default, `make install' will install the package's files in
|
|
||||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
|
||||||
installation prefix other than `/usr/local' by giving `configure' the
|
|
||||||
option `--prefix=PATH'.
|
|
||||||
|
|
||||||
You can specify separate installation prefixes for
|
|
||||||
architecture-specific files and architecture-independent files. If you
|
|
||||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
|
||||||
PATH as the prefix for installing programs and libraries.
|
|
||||||
Documentation and other data files will still use the regular prefix.
|
|
||||||
|
|
||||||
In addition, if you use an unusual directory layout you can give
|
|
||||||
options like `--bindir=PATH' to specify different values for particular
|
|
||||||
kinds of files. Run `configure --help' for a list of the directories
|
|
||||||
you can set and what kinds of files go in them.
|
|
||||||
|
|
||||||
If the package supports it, you can cause programs to be installed
|
|
||||||
with an extra prefix or suffix on their names by giving `configure' the
|
|
||||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
|
||||||
|
|
||||||
Optional Features
|
|
||||||
=================
|
|
||||||
|
|
||||||
Some packages pay attention to `--enable-FEATURE' options to
|
|
||||||
`configure', where FEATURE indicates an optional part of the package.
|
|
||||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
|
||||||
is something like `gnu-as' or `x' (for the X Window System). The
|
|
||||||
`README' should mention any `--enable-' and `--with-' options that the
|
|
||||||
package recognizes.
|
|
||||||
|
|
||||||
For packages that use the X Window System, `configure' can usually
|
|
||||||
find the X include and library files automatically, but if it doesn't,
|
|
||||||
you can use the `configure' options `--x-includes=DIR' and
|
|
||||||
`--x-libraries=DIR' to specify their locations.
|
|
||||||
|
|
||||||
Specifying the System Type
|
|
||||||
==========================
|
|
||||||
|
|
||||||
There may be some features `configure' can not figure out
|
|
||||||
automatically, but needs to determine by the type of host the package
|
|
||||||
will run on. Usually `configure' can figure that out, but if it prints
|
|
||||||
a message saying it can not guess the host type, give it the
|
|
||||||
`--host=TYPE' option. TYPE can either be a short name for the system
|
|
||||||
type, such as `sun4', or a canonical name with three fields:
|
|
||||||
CPU-COMPANY-SYSTEM
|
|
||||||
|
|
||||||
See the file `config.sub' for the possible values of each field. If
|
|
||||||
`config.sub' isn't included in this package, then this package doesn't
|
|
||||||
need to know the host type.
|
|
||||||
|
|
||||||
If you are building compiler tools for cross-compiling, you can also
|
|
||||||
use the `--target=TYPE' option to select the type of system they will
|
|
||||||
produce code for and the `--build=TYPE' option to select the type of
|
|
||||||
system on which you are compiling the package.
|
|
||||||
|
|
||||||
Sharing Defaults
|
|
||||||
================
|
|
||||||
|
|
||||||
If you want to set default values for `configure' scripts to share,
|
|
||||||
you can create a site shell script called `config.site' that gives
|
|
||||||
default values for variables like `CC', `cache_file', and `prefix'.
|
|
||||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
|
||||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
|
||||||
`CONFIG_SITE' environment variable to the location of the site script.
|
|
||||||
A warning: not all `configure' scripts look for a site script.
|
|
||||||
|
|
||||||
Operation Controls
|
|
||||||
==================
|
|
||||||
|
|
||||||
`configure' recognizes the following options to control how it
|
|
||||||
operates.
|
|
||||||
|
|
||||||
`--cache-file=FILE'
|
|
||||||
Use and save the results of the tests in FILE instead of
|
|
||||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
|
||||||
debugging `configure'.
|
|
||||||
|
|
||||||
`--help'
|
|
||||||
Print a summary of the options to `configure', and exit.
|
|
||||||
|
|
||||||
`--quiet'
|
|
||||||
`--silent'
|
|
||||||
`-q'
|
|
||||||
Do not print messages saying which checks are being made. To
|
|
||||||
suppress all normal output, redirect it to `/dev/null' (any error
|
|
||||||
messages will still be shown).
|
|
||||||
|
|
||||||
`--srcdir=DIR'
|
|
||||||
Look for the package's source code in directory DIR. Usually
|
|
||||||
`configure' can determine that directory automatically.
|
|
||||||
|
|
||||||
`--version'
|
|
||||||
Print the version of Autoconf used to generate the `configure'
|
|
||||||
script, and exit.
|
|
||||||
|
|
||||||
`configure' also accepts some other, not widely useful, options.
|
|
||||||
+20
-3
@@ -1,11 +1,28 @@
|
|||||||
|
## Copyright 2001, 2002 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
## This program is free software; you can redistribute it and/or modify
|
||||||
|
## it under the terms of the GNU General Public License as published by
|
||||||
|
## the Free Software Foundation; either version 2 of the License, or
|
||||||
|
## (at your option) any later version.
|
||||||
|
|
||||||
|
## This program is distributed in the hope that it will be useful,
|
||||||
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
## GNU General Public License for more details.
|
||||||
|
|
||||||
|
## You should have received a copy of the GNU General Public License
|
||||||
|
## along with this program; if not, write to the Free Software
|
||||||
|
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||||
|
## 02111-1307 USA
|
||||||
|
|
||||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
AUTOMAKE_OPTIONS = 1.5 check-news readme-alpha dist-bzip2
|
AUTOMAKE_OPTIONS = 1.6 check-news readme-alpha dist-bzip2
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
SUBDIRS = config intl po lib src doc m4 tests
|
SUBDIRS = config intl po lib data src doc m4 tests
|
||||||
|
|
||||||
EXTRA_DIST = REFERENCES configure.bat OChangeLog Makefile.maint GNUmakefile
|
EXTRA_DIST = config/config.rpath REFERENCES configure.bat OChangeLog Makefile.maint GNUmakefile
|
||||||
|
|
||||||
DISTCLEANFILES = intl/libintl.h
|
DISTCLEANFILES = intl/libintl.h
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,200 @@
|
|||||||
Bison News
|
Bison News
|
||||||
----------
|
----------
|
||||||
|
|
||||||
Changes in version 1.29d:
|
Changes in version 1.49a:
|
||||||
|
|
||||||
|
* Undefined token
|
||||||
|
The undefined token was systematically mapped to 2 which prevented
|
||||||
|
the use of 2 from the user. This is no longer the case.
|
||||||
|
|
||||||
|
* Undefined token
|
||||||
|
If yylex returned a code out of range, yyparse could die. This is
|
||||||
|
no longer the case.
|
||||||
|
|
||||||
|
* Error token
|
||||||
|
According to POSIX, the error token should be numbered as 256.
|
||||||
|
Bison extends this requirement by making it a preference: *if* the
|
||||||
|
user specified that one of her tokens is numbered 256, then error
|
||||||
|
will be mapped onto another number.
|
||||||
|
|
||||||
|
* Large grammars
|
||||||
|
Are now supported (large token numbers, large grammar size (= sum of
|
||||||
|
the LHS and RHS lengths), large LALR tables).
|
||||||
|
|
||||||
|
* The initial rule is explicit.
|
||||||
|
Bison used to play hacks with the initial rule, which the user does
|
||||||
|
not write. It is now explicit, and visible in the reports and
|
||||||
|
graphs as rule 0.
|
||||||
|
|
||||||
|
* Useless rules are actually removed.
|
||||||
|
Before, Bison reported the useless rules, but, although not used,
|
||||||
|
included them in the parsers.
|
||||||
|
|
||||||
|
* False `Token not used' report fixed.
|
||||||
|
On a grammar such as
|
||||||
|
|
||||||
|
%token useless useful
|
||||||
|
%%
|
||||||
|
exp: '0' %prec useful;
|
||||||
|
|
||||||
|
where a token was used to set the precedence of the last rule,
|
||||||
|
bison reported both `useful' and `useless' as useless tokens.
|
||||||
|
|
||||||
|
* Revert the C++ namespace changes introduced in 1.31, as they caused too
|
||||||
|
many portability hassles.
|
||||||
|
|
||||||
|
* Items overflow
|
||||||
|
Bison no longer dumps core when there are too many items, it just
|
||||||
|
dies.
|
||||||
|
|
||||||
|
* Token end-of-file
|
||||||
|
The token end of file may be specified by the user, in which case,
|
||||||
|
the user symbol is used in the reports, the graphs, and the verbose
|
||||||
|
error messages instead of `$', which remains being the defaults.
|
||||||
|
For instance
|
||||||
|
%token YYEOF 0
|
||||||
|
or
|
||||||
|
%token YYEOF 0 "end of file"
|
||||||
|
|
||||||
|
Changes in version 1.35, 2002-03-25:
|
||||||
|
|
||||||
|
* C Skeleton
|
||||||
|
Some projects use Bison's C parser with C++ compilers, and define
|
||||||
|
YYSTYPE as a class. The recent adjustment of C parsers for data
|
||||||
|
alignment and 64 bit architectures made this impossible.
|
||||||
|
|
||||||
|
Because for the time being no real solution for C++ parser
|
||||||
|
generation exists, kludges were implemented in the parser to
|
||||||
|
maintain this use. In the future, when Bison has C++ parsers, this
|
||||||
|
kludge will be disabled.
|
||||||
|
|
||||||
|
This kludge also addresses some C++ problems when the stack was
|
||||||
|
extended.
|
||||||
|
|
||||||
|
|
||||||
|
Changes in version 1.34, 2002-03-12:
|
||||||
|
|
||||||
|
* File name clashes are detected
|
||||||
|
$ bison foo.y -d -o foo.x
|
||||||
|
fatal error: header and parser would both be named `foo.x'
|
||||||
|
|
||||||
|
* A missing `;' at the end of a rule triggers a warning
|
||||||
|
In accordance with POSIX, and in agreement with other
|
||||||
|
Yacc implementations, Bison will mandate this semicolon in the near
|
||||||
|
future. This eases the implementation of a Bison parser of Bison
|
||||||
|
grammars by making this grammar LALR(1) instead of LR(2). To
|
||||||
|
facilitate the transition, this release introduces a warning.
|
||||||
|
|
||||||
|
* Revert the C++ namespace changes introduced in 1.31, as they caused too
|
||||||
|
many portability hassles.
|
||||||
|
|
||||||
|
* DJGPP support added.
|
||||||
|
|
||||||
|
* Fix test suite portability problems.
|
||||||
|
|
||||||
|
Changes in version 1.33, 2002-02-07:
|
||||||
|
|
||||||
|
* Fix C++ issues
|
||||||
|
Groff could not be compiled for the definition of size_t was lacking
|
||||||
|
under some conditions.
|
||||||
|
|
||||||
|
* Catch invalid @n
|
||||||
|
As is done with $n.
|
||||||
|
|
||||||
|
Changes in version 1.32, 2002-01-23:
|
||||||
|
|
||||||
|
* Fix Yacc output file names
|
||||||
|
|
||||||
|
* Portability fixes
|
||||||
|
|
||||||
|
* Italian, Dutch translations
|
||||||
|
|
||||||
|
Changes in version 1.31, 2002-01-14:
|
||||||
|
|
||||||
|
* Many Bug Fixes
|
||||||
|
|
||||||
|
* GNU Gettext and %expect
|
||||||
|
GNU Gettext asserts 10 s/r conflicts, but there are 7. Now that
|
||||||
|
Bison dies on incorrect %expectations, we fear there will be
|
||||||
|
too many bug reports for Gettext, so _for the time being_, %expect
|
||||||
|
does not trigger an error when the input file is named `plural.y'.
|
||||||
|
|
||||||
|
* Use of alloca in parsers
|
||||||
|
If YYSTACK_USE_ALLOCA is defined to 0, then the parsers will use
|
||||||
|
malloc exclusively. Since 1.29, but was not NEWS'ed.
|
||||||
|
|
||||||
|
alloca is used only when compiled with GCC, to avoid portability
|
||||||
|
problems as on AIX.
|
||||||
|
|
||||||
|
* When the generated parser lacks debugging code, YYDEBUG is now 0
|
||||||
|
(as POSIX requires) instead of being undefined.
|
||||||
|
|
||||||
|
* User Actions
|
||||||
|
Bison has always permitted actions such as { $$ = $1 }: it adds the
|
||||||
|
ending semicolon. Now if in Yacc compatibility mode, the semicolon
|
||||||
|
is no longer output: one has to write { $$ = $1; }.
|
||||||
|
|
||||||
|
* Better C++ compliance
|
||||||
|
The output parsers try to respect C++ namespaces.
|
||||||
|
[This turned out to be a failed experiment, and it was reverted later.]
|
||||||
|
|
||||||
|
* Reduced Grammars
|
||||||
|
Fixed bugs when reporting useless nonterminals.
|
||||||
|
|
||||||
|
* 64 bit hosts
|
||||||
|
The parsers work properly on 64 bit hosts.
|
||||||
|
|
||||||
|
* Error messages
|
||||||
|
Some calls to strerror resulted in scrambled or missing error messages.
|
||||||
|
|
||||||
|
* %expect
|
||||||
|
When the number of shift/reduce conflicts is correct, don't issue
|
||||||
|
any warning.
|
||||||
|
|
||||||
|
* The verbose report includes the rule line numbers.
|
||||||
|
|
||||||
|
* Rule line numbers are fixed in traces.
|
||||||
|
|
||||||
|
* Swedish translation
|
||||||
|
|
||||||
|
* Parse errors
|
||||||
|
Verbose parse error messages from the parsers are better looking.
|
||||||
|
Before: parse error: unexpected `'/'', expecting `"number"' or `'-'' or `'(''
|
||||||
|
Now: parse error: unexpected '/', expecting "number" or '-' or '('
|
||||||
|
|
||||||
|
* Fixed parser memory leaks.
|
||||||
|
When the generated parser was using malloc to extend its stacks, the
|
||||||
|
previous allocations were not freed.
|
||||||
|
|
||||||
|
* Fixed verbose output file.
|
||||||
|
Some newlines were missing.
|
||||||
|
Some conflicts in state descriptions were missing.
|
||||||
|
|
||||||
|
* Fixed conflict report.
|
||||||
|
Option -v was needed to get the result.
|
||||||
|
|
||||||
|
* %expect
|
||||||
|
Was not used.
|
||||||
|
Mismatches are errors, not warnings.
|
||||||
|
|
||||||
|
* Fixed incorrect processing of some invalid input.
|
||||||
|
|
||||||
|
* Fixed CPP guards: 9foo.h uses BISON_9FOO_H instead of 9FOO_H.
|
||||||
|
|
||||||
|
* Fixed some typos in the documentation.
|
||||||
|
|
||||||
|
* %token MY_EOF 0 is supported.
|
||||||
|
Before, MY_EOF was silently renumbered as 257.
|
||||||
|
|
||||||
|
* doc/refcard.tex is updated.
|
||||||
|
|
||||||
|
* %output, %file-prefix, %name-prefix.
|
||||||
|
New.
|
||||||
|
|
||||||
|
* --output
|
||||||
|
New, aliasing `--output-file'.
|
||||||
|
|
||||||
|
Changes in version 1.30, 2001-10-26:
|
||||||
|
|
||||||
* `--defines' and `--graph' have now an optionnal argument which is the
|
* `--defines' and `--graph' have now an optionnal argument which is the
|
||||||
output file name. `-d' and `-g' do not change, they do not take any
|
output file name. `-d' and `-g' do not change, they do not take any
|
||||||
@@ -10,11 +203,9 @@ Changes in version 1.29d:
|
|||||||
* `%source_extension' and `%header_extension' are removed, failed
|
* `%source_extension' and `%header_extension' are removed, failed
|
||||||
experiment.
|
experiment.
|
||||||
|
|
||||||
* The test suite is more portable.
|
* Portability fixes.
|
||||||
|
|
||||||
* Better portability.
|
Changes in version 1.29, 2001-09-07:
|
||||||
|
|
||||||
Changes in version 1.29:
|
|
||||||
|
|
||||||
* The output file does not define const, as this caused problems when used
|
* The output file does not define const, as this caused problems when used
|
||||||
with common autoconfiguration schemes. If you still use ancient compilers
|
with common autoconfiguration schemes. If you still use ancient compilers
|
||||||
@@ -45,8 +236,11 @@ Changes in version 1.29:
|
|||||||
* New directives.
|
* New directives.
|
||||||
`%yacc', `%fixed_output_files', `%defines', `%no_parser', `%verbose',
|
`%yacc', `%fixed_output_files', `%defines', `%no_parser', `%verbose',
|
||||||
`%debug', `%source_extension' and `%header_extension'.
|
`%debug', `%source_extension' and `%header_extension'.
|
||||||
|
|
||||||
|
* @$
|
||||||
|
Automatic location tracking.
|
||||||
|
|
||||||
Changes in version 1.28:
|
Changes in version 1.28, 1999-07-06:
|
||||||
|
|
||||||
* Should compile better now with K&R compilers.
|
* Should compile better now with K&R compilers.
|
||||||
|
|
||||||
@@ -78,7 +272,7 @@ Changes in version 1.26:
|
|||||||
* Generated parsers should now work even on operating systems which do
|
* Generated parsers should now work even on operating systems which do
|
||||||
not provide alloca().
|
not provide alloca().
|
||||||
|
|
||||||
Changes in version 1.25:
|
Changes in version 1.25, 1995-10-16:
|
||||||
|
|
||||||
* Errors in the input grammar are not fatal; Bison keeps reading
|
* Errors in the input grammar are not fatal; Bison keeps reading
|
||||||
the grammar file, and reports all the errors found in it.
|
the grammar file, and reports all the errors found in it.
|
||||||
@@ -119,3 +313,28 @@ Changes in version 1.22:
|
|||||||
Changes in version 1.20:
|
Changes in version 1.20:
|
||||||
|
|
||||||
Output file does not redefine const for C++.
|
Output file does not redefine const for C++.
|
||||||
|
|
||||||
|
Local Variables:
|
||||||
|
mode: outline
|
||||||
|
End:
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of GNU Autoconf.
|
||||||
|
|
||||||
|
GNU Autoconf is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
GNU Autoconf is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with autoconf; see the file COPYING. If not, write to
|
||||||
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA.
|
||||||
|
|||||||
+60
@@ -0,0 +1,60 @@
|
|||||||
|
These notes intend to help people working on the CVS versions of
|
||||||
|
Bison. Only the sources are installed in the CVS repository (to ease
|
||||||
|
the maintenance, merges etc.), therefore you will have to the
|
||||||
|
maintainer tools we depend upon:
|
||||||
|
|
||||||
|
- Automake 1.6 or 1.6.1
|
||||||
|
- Autoconf 2.53a or better
|
||||||
|
ftp://alpha.gnu.org/gnu/autoconf/autoconf-2.53a.tar.gz (992 kB)
|
||||||
|
ftp://alpha.gnu.org/gnu/autoconf/autoconf-2.53a.tar.bz2 (756 kB)
|
||||||
|
- Gettext 0.10.1
|
||||||
|
|
||||||
|
Only building the initial full source tree will be a bit painful,
|
||||||
|
later, a plain `cvs update -P & make' should be sufficient.
|
||||||
|
|
||||||
|
* First CVS checkout
|
||||||
|
|
||||||
|
Obviously, if you are reading these notes, you did manage to check out
|
||||||
|
Bison from CVS. For the records, you will find all the relevant
|
||||||
|
information on:
|
||||||
|
|
||||||
|
http://savannah.gnu.org/cvs/?group_id=56
|
||||||
|
|
||||||
|
The next step is asking the installation of all the missing files:
|
||||||
|
|
||||||
|
$ ./bootstrap
|
||||||
|
|
||||||
|
And there you are! Just
|
||||||
|
|
||||||
|
$ ./configure && make && make check
|
||||||
|
|
||||||
|
At this point, there should be no difference between your local copy,
|
||||||
|
and the CVS master copy:
|
||||||
|
|
||||||
|
$ cvs diff
|
||||||
|
|
||||||
|
should output no difference, except maybe the date in po/*.po files.
|
||||||
|
|
||||||
|
Enjoy!
|
||||||
|
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of GNU Autoconf.
|
||||||
|
|
||||||
|
GNU Autoconf is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
GNU Autoconf is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with autoconf; see the file COPYING. If not, write to
|
||||||
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA.
|
||||||
@@ -1,27 +1,53 @@
|
|||||||
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:
|
||||||
|
|
||||||
Akim Demaille akim@epita.fr
|
Airy Andre Airy.Andre@edf.fr
|
||||||
|
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]
|
||||||
|
Arnold Robbins [email protected]
|
||||||
|
Benoit Perrot [email protected]
|
||||||
|
Bruce Lilly [email protected]
|
||||||
|
Cris van Pelt [email protected]
|
||||||
Daniel Hagerty [email protected]
|
Daniel Hagerty [email protected]
|
||||||
David J. MacKenzie [email protected]
|
David J. MacKenzie [email protected]
|
||||||
|
Dick Streefland [email protected]
|
||||||
|
Enrico Scholz [email protected]
|
||||||
|
Evgeny Stambulchik [email protected]
|
||||||
Fabrice Bauzac [email protected]
|
Fabrice Bauzac [email protected]
|
||||||
|
Florian Krohm [email protected]
|
||||||
|
H. Merijn Brand [email protected]
|
||||||
Hans Aberg [email protected]
|
Hans Aberg [email protected]
|
||||||
Jesse Thilo [email protected]
|
Jesse Thilo [email protected]
|
||||||
Jim Meyering [email protected]
|
Jim Meyering [email protected]
|
||||||
Juan Manuel Guerrero [email protected]
|
Juan Manuel Guerrero [email protected]
|
||||||
|
Kees Zeelenberg [email protected]
|
||||||
Keith Browne [email protected]
|
Keith Browne [email protected]
|
||||||
Laurent Mascherpa [email protected]
|
Laurent Mascherpa [email protected]
|
||||||
|
Magnus Fromreide [email protected]
|
||||||
Marc Autret [email protected]
|
Marc Autret [email protected]
|
||||||
|
Michael Hayes [email protected]
|
||||||
|
Mike Castle [email protected]
|
||||||
Neil Booth [email protected]
|
Neil Booth [email protected]
|
||||||
|
Nelson H. F. Beebe [email protected]
|
||||||
|
Nicolas Burrus [email protected]
|
||||||
|
Nicolas Tisserand [email protected]
|
||||||
Noah Friedman [email protected]
|
Noah Friedman [email protected]
|
||||||
Pascal Bart [email protected]
|
Pascal Bart [email protected]
|
||||||
Paul Eggert [email protected]
|
Paul Eggert [email protected]
|
||||||
|
Per Allansson [email protected]
|
||||||
|
Peter Hámorský [email protected]
|
||||||
Piotr Gackiewicz [email protected]
|
Piotr Gackiewicz [email protected]
|
||||||
Richard Stallman [email protected]
|
Richard Stallman [email protected]
|
||||||
Robert Anisko [email protected]
|
Robert Anisko [email protected]
|
||||||
Shura [email protected]
|
Shura [email protected]
|
||||||
|
Tim Josling [email protected]
|
||||||
|
Tom Lane [email protected]
|
||||||
|
Tom Tromey [email protected]
|
||||||
|
Wayne Green [email protected]
|
||||||
|
Wolfram Wagner [email protected]
|
||||||
|
Wwp [email protected]
|
||||||
|
|
||||||
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.
|
||||||
|
|||||||
@@ -1,28 +1,476 @@
|
|||||||
-*- outline -*-
|
-*- outline -*-
|
||||||
|
|
||||||
* src/reader.c
|
|
||||||
Complete parse_skel_decl () with parse_dquoted_param (). []
|
|
||||||
Check and cleanup for CPP-out code. []
|
|
||||||
|
|
||||||
* src/output.c
|
* URGENT: Prologue
|
||||||
Synchronize `#line' directive with user file. [ok]
|
The %union is declared after the user C declarations. It can be
|
||||||
|
a problem if YYSTYPE is declared after the user part.
|
||||||
|
|
||||||
Cleanup dirty CPP-out code. []
|
Actually, the real problem seems that the %union ought to be output
|
||||||
** Output sub-skeleton files. []
|
where it was defined. For instance, in gettext/intl/plural.y, we
|
||||||
Useful for %no_parser. []
|
have:
|
||||||
*** New skeleton. []
|
|
||||||
|
|
||||||
* src/getargs.c src/lex.c
|
%{
|
||||||
Synchronize percent and command line options. [ok]
|
...
|
||||||
|
#include "gettextP.h"
|
||||||
|
...
|
||||||
|
%}
|
||||||
|
|
||||||
* src/macrotab.[ch]
|
%union {
|
||||||
Removing warnings when compiling. (gcc-warnings). [ok]
|
unsigned long int num;
|
||||||
|
enum operator op;
|
||||||
|
struct expression *exp;
|
||||||
|
}
|
||||||
|
|
||||||
|
%{
|
||||||
|
...
|
||||||
|
static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
|
||||||
|
...
|
||||||
|
%}
|
||||||
|
|
||||||
|
Where the first part defines struct expression, the second uses it to
|
||||||
|
define YYSTYPE, and the last uses YYSTYPE. Only this order is valid.
|
||||||
|
|
||||||
|
Note that we have the same problem with GCC.
|
||||||
|
|
||||||
|
I suggest splitting the prologue into pre-prologue and post-prologue.
|
||||||
|
The reason is that:
|
||||||
|
|
||||||
|
1. we keep language independance as it is the skeleton that joins the
|
||||||
|
two prologues (there is no need for the engine to encode union yystype
|
||||||
|
and to output it inside the prologue, which breaks the language
|
||||||
|
independance of the generator)
|
||||||
|
|
||||||
|
2. that makes it possible to have several %union in input. I think
|
||||||
|
this is a pleasant (but useless currently) feature, but in the future,
|
||||||
|
I want a means to %include other bits of grammars, and _then_ it will
|
||||||
|
be important for the various bits to define their needs in %union.
|
||||||
|
|
||||||
|
When implementing multiple-%union support, bare the following in mind:
|
||||||
|
|
||||||
|
- when --yacc, this must be flagged as an error. Don't make it fatal
|
||||||
|
though.
|
||||||
|
|
||||||
|
- The #line must now appear *inside* the definition of yystype.
|
||||||
|
Something like
|
||||||
|
|
||||||
|
{
|
||||||
|
#line 12 "foo.y"
|
||||||
|
int ival;
|
||||||
|
#line 23 "foo.y"
|
||||||
|
char *sval;
|
||||||
|
}
|
||||||
|
|
||||||
|
* Language independent actions
|
||||||
|
|
||||||
|
Currently bison, the generator, transforms $1, $$ and so forth into
|
||||||
|
direct C code, manipulating the stacks. This is problematic, because
|
||||||
|
(i) it means that if we want more languages, we need to update the
|
||||||
|
generator, and (ii), it forces names everywhere (e.g., the C++
|
||||||
|
skeleton would be happy to use other naming schemes, and actually,
|
||||||
|
even other accessing schemes).
|
||||||
|
|
||||||
|
Therefore we want
|
||||||
|
|
||||||
|
1. the generator to replace $1, etc. by M4 macro invocations
|
||||||
|
(b4_dollar(1), b4_at(3), b4_dollar_dollar) etc.
|
||||||
|
|
||||||
|
2. the skeletons to define these macros.
|
||||||
|
|
||||||
|
But currently the actions are double-quoted, to protect them from M4
|
||||||
|
evaluation. So we need to:
|
||||||
|
|
||||||
|
3. stop quoting them
|
||||||
|
|
||||||
|
4. change the [ and ] in the actions into @<:@ and @:>@
|
||||||
|
|
||||||
|
5. extend the postprocessor to maps these back onto [ and ].
|
||||||
|
|
||||||
|
* Coding system independence
|
||||||
|
Paul notes:
|
||||||
|
|
||||||
|
Currently Bison assumes 8-bit bytes (i.e. that UCHAR_MAX is
|
||||||
|
255). It also assumes that the 8-bit character encoding is
|
||||||
|
the same for the invocation of 'bison' as it is for the
|
||||||
|
invocation of 'cc', but this is not necessarily true when
|
||||||
|
people run bison on an ASCII host and then use cc on an EBCDIC
|
||||||
|
host. I don't think these topics are worth our time
|
||||||
|
addressing (unless we find a gung-ho volunteer for EBCDIC or
|
||||||
|
PDP-10 ports :-) but they should probably be documented
|
||||||
|
somewhere.
|
||||||
|
|
||||||
|
* Using enums instead of int for tokens.
|
||||||
|
Paul suggests:
|
||||||
|
|
||||||
|
#ifndef YYTOKENTYPE
|
||||||
|
# if defined (__STDC__) || defined (__cplusplus)
|
||||||
|
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||||
|
know about them. */
|
||||||
|
enum yytokentype {
|
||||||
|
FOO = 256,
|
||||||
|
BAR,
|
||||||
|
...
|
||||||
|
};
|
||||||
|
/* POSIX requires `int' for tokens in interfaces. */
|
||||||
|
# define YYTOKENTYPE int
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#define FOO 256
|
||||||
|
#define BAR 257
|
||||||
|
...
|
||||||
|
|
||||||
|
* Output directory
|
||||||
|
Akim:
|
||||||
|
|
||||||
|
| I consider this to be a bug in bison:
|
||||||
|
|
|
||||||
|
| /tmp % mkdir src
|
||||||
|
| /tmp % cp ~/src/bison/tests/calc.y src
|
||||||
|
| /tmp % mkdir build && cd build
|
||||||
|
| /tmp/build % bison ../src/calc.y
|
||||||
|
| /tmp/build % cd ..
|
||||||
|
| /tmp % ls -l build src
|
||||||
|
| build:
|
||||||
|
| total 0
|
||||||
|
|
|
||||||
|
| src:
|
||||||
|
| total 32
|
||||||
|
| -rw-r--r-- 1 akim lrde 27553 oct 2 16:31 calc.tab.c
|
||||||
|
| -rw-r--r-- 1 akim lrde 3335 oct 2 16:31 calc.y
|
||||||
|
|
|
||||||
|
|
|
||||||
|
| Would it be safe to change this behavior to something more reasonable?
|
||||||
|
| Do you think some people depend upon this?
|
||||||
|
|
||||||
|
Jim:
|
||||||
|
|
||||||
|
Is it that behavior documented?
|
||||||
|
If so, then it's probably not reasonable to change it.
|
||||||
|
I've Cc'd the automake list, because some of automake's
|
||||||
|
rules use bison through $(YACC) -- though I'll bet they
|
||||||
|
all use it in yacc-compatible mode.
|
||||||
|
|
||||||
|
Pavel:
|
||||||
|
|
||||||
|
Hello, Jim and others!
|
||||||
|
|
||||||
|
> Is it that behavior documented?
|
||||||
|
> If so, then it's probably not reasonable to change it.
|
||||||
|
> I've Cc'd the automake list, because some of automake's
|
||||||
|
> rules use bison through $(YACC) -- though I'll bet they
|
||||||
|
> all use it in yacc-compatible mode.
|
||||||
|
|
||||||
|
Yes, Automake currently used bison in Automake-compatible mode, but it
|
||||||
|
would be fair for Automake to switch to the native mode as long as the
|
||||||
|
processed files are distributed and "missing" emulates bison.
|
||||||
|
|
||||||
|
In any case, the makefiles should specify the output file explicitly
|
||||||
|
instead of relying on weird defaults.
|
||||||
|
|
||||||
|
> | src:
|
||||||
|
> | total 32
|
||||||
|
> | -rw-r--r-- 1 akim lrde 27553 oct 2 16:31 calc.tab.c
|
||||||
|
> | -rw-r--r-- 1 akim lrde 3335 oct 2 16:31 calc.y
|
||||||
|
|
||||||
|
This is not _that_ ugly as it seems - with Automake you want to put
|
||||||
|
sources where they belong - to the source directory.
|
||||||
|
|
||||||
|
> | This is not _that_ ugly as it seems - with Automake you want to put
|
||||||
|
> | sources where they belong - to the source directory.
|
||||||
|
>
|
||||||
|
> The difference source/build you are referring to is based on Automake
|
||||||
|
> concepts. They have no sense at all for tools such as bison or gcc
|
||||||
|
> etc. They have input and output. I do not want them to try to grasp
|
||||||
|
> source/build. I want them to behave uniformly: output *here*.
|
||||||
|
|
||||||
|
I realize that.
|
||||||
|
|
||||||
|
It's unfortunate that the native mode of Bison behaves in a less uniform
|
||||||
|
way than the yacc mode. I agree with your point. Bison maintainters may
|
||||||
|
want to fix it along with the documentation.
|
||||||
|
|
||||||
|
|
||||||
|
* Unit rules
|
||||||
|
Maybe we could expand unit rules, i.e., transform
|
||||||
|
|
||||||
|
exp: arith | bool;
|
||||||
|
arith: exp '+' exp;
|
||||||
|
bool: exp '&' exp;
|
||||||
|
|
||||||
|
into
|
||||||
|
|
||||||
|
exp: exp '+' exp | exp '&' exp;
|
||||||
|
|
||||||
|
when there are no actions. This can significantly speed up some
|
||||||
|
grammars.
|
||||||
|
|
||||||
|
* Stupid error messages
|
||||||
|
An example shows it easily:
|
||||||
|
|
||||||
|
src/bison/tests % ./testsuite -k calc,location,error-verbose -l
|
||||||
|
GNU Bison 1.49a test suite test groups:
|
||||||
|
|
||||||
|
NUM: FILENAME:LINE TEST-GROUP-NAME
|
||||||
|
KEYWORDS
|
||||||
|
|
||||||
|
51: calc.at:440 Calculator --locations --yyerror-verbose
|
||||||
|
52: calc.at:442 Calculator --defines --locations --name-prefix=calc --verbose --yacc --yyerror-verbose
|
||||||
|
54: calc.at:445 Calculator --debug --defines --locations --name-prefix=calc --verbose --yacc --yyerror-verbose
|
||||||
|
src/bison/tests % ./testsuite 51 -d
|
||||||
|
## --------------------------- ##
|
||||||
|
## GNU Bison 1.49a test suite. ##
|
||||||
|
## --------------------------- ##
|
||||||
|
51: calc.at:440 ok
|
||||||
|
## ---------------------------- ##
|
||||||
|
## All 1 tests were successful. ##
|
||||||
|
## ---------------------------- ##
|
||||||
|
src/bison/tests % cd ./testsuite.dir/51
|
||||||
|
tests/testsuite.dir/51 % echo "()" | ./calc
|
||||||
|
1.2-1.3: parse error, unexpected ')', expecting error or "number" or '-' or '('
|
||||||
|
|
||||||
|
* yyerror, yyprint interface
|
||||||
|
It should be improved, in particular when using Bison features such as
|
||||||
|
locations, and YYPARSE_PARAMS. For the time being, it is recommended
|
||||||
|
to #define yyerror and yyprint to steal internal variables...
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
|
* Memory leaks in the generator
|
||||||
|
A round of memory leak clean ups would be most welcome. Dmalloc,
|
||||||
|
Checker GCC, Electric Fence, or Valgrind: you chose your tool.
|
||||||
|
|
||||||
|
* Memory leaks in the parser
|
||||||
|
The same applies to the generated parsers. In particular, this is
|
||||||
|
critical for user data: when aborting a parsing, when handling the
|
||||||
|
error token etc., we often throw away yylval without giving a chance
|
||||||
|
of cleaning it up to the user.
|
||||||
|
|
||||||
|
* --graph
|
||||||
|
Show reductions. []
|
||||||
|
|
||||||
|
* Broken options ?
|
||||||
|
** %no-lines [ok]
|
||||||
|
** %no-parser []
|
||||||
|
** %pure-parser []
|
||||||
|
** %semantic-parser []
|
||||||
|
** %token-table []
|
||||||
|
** Options which could use parse_dquoted_param ().
|
||||||
|
Maybe transfered in lex.c.
|
||||||
|
*** %skeleton [ok]
|
||||||
|
*** %output []
|
||||||
|
*** %file-prefix []
|
||||||
|
*** %name-prefix []
|
||||||
|
|
||||||
|
** Skeleton strategy. []
|
||||||
|
Must we keep %no-parser?
|
||||||
|
%token-table?
|
||||||
|
*** New skeletons. []
|
||||||
|
|
||||||
* src/print_graph.c
|
* src/print_graph.c
|
||||||
Find the best graph parameters. []
|
Find the best graph parameters. []
|
||||||
|
|
||||||
* doc/bison.texinfo
|
* doc/bison.texinfo
|
||||||
Echo modifications of prologue and epilogue. []
|
** Update
|
||||||
Add informations about YYERROR_VERBOSE. []
|
informations about ERROR_VERBOSE. []
|
||||||
Add explainations about skeleton muscles. []
|
** Add explainations about
|
||||||
Add explainations about %skeleton. []
|
skeleton muscles. []
|
||||||
|
%skeleton. []
|
||||||
|
|
||||||
|
* testsuite
|
||||||
|
** tests/pure-parser.at []
|
||||||
|
New tests.
|
||||||
|
|
||||||
|
* Debugging parsers
|
||||||
|
|
||||||
|
From Greg McGary:
|
||||||
|
|
||||||
|
akim demaille <[email protected]> writes:
|
||||||
|
|
||||||
|
> With great pleasure! Nonetheless, things which are debatable
|
||||||
|
> (or not, but just `big') should be discuss in `public': something
|
||||||
|
> like help- or [email protected] is just fine. Jesse and I are there,
|
||||||
|
> but there is also Jim and some other people.
|
||||||
|
|
||||||
|
I have no idea whether it qualifies as big or controversial, so I'll
|
||||||
|
just summarize for you. I proposed this change years ago and was
|
||||||
|
surprised that it was met with utter indifference!
|
||||||
|
|
||||||
|
This debug feature is for the programs/grammars one develops with
|
||||||
|
bison, not for debugging bison itself. I find that the YYDEBUG
|
||||||
|
output comes in a very inconvenient format for my purposes.
|
||||||
|
When debugging gcc, for instance, what I want is to see a trace of
|
||||||
|
the sequence of reductions and the line#s for the semantic actions
|
||||||
|
so I can follow what's happening. Single-step in gdb doesn't cut it
|
||||||
|
because to move from one semantic action to the next takes you through
|
||||||
|
lots of internal machinery of the parser, which is uninteresting.
|
||||||
|
|
||||||
|
The change I made was to the format of the debug output, so that it
|
||||||
|
comes out in the format of C error messages, digestible by emacs
|
||||||
|
compile mode, like so:
|
||||||
|
|
||||||
|
grammar.y:1234: foo: bar(0x123456) baz(0x345678)
|
||||||
|
|
||||||
|
where "foo: bar baz" is the reduction rule, whose semantic action
|
||||||
|
appears on line 1234 of the bison grammar file grammar.y. The hex
|
||||||
|
numbers on the rhs tokens are the parse-stack values associated with
|
||||||
|
those tokens. Of course, yytype might be something totally
|
||||||
|
incompatible with that representation, but for the most part, yytype
|
||||||
|
values are single words (scalars or pointers). In the case of gcc,
|
||||||
|
they're most often pointers to tree nodes. Come to think of it, the
|
||||||
|
right thing to do is to make the printing of stack values be
|
||||||
|
user-definable. It would also be useful to include the filename &
|
||||||
|
line# of the file being parsed, but the main filename & line# should
|
||||||
|
continue to be that of grammar.y
|
||||||
|
|
||||||
|
Anyway, this feature has saved my life on numerous occasions. The way
|
||||||
|
I customarily use it is to first run bison with the traces on, isolate
|
||||||
|
the sequence of reductions that interests me, put those traces in a
|
||||||
|
buffer and force it into compile-mode, then visit each of those lines
|
||||||
|
in the grammar and set breakpoints with C-x SPACE. Then, I can run
|
||||||
|
again under the control of gdb and stop at each semantic action.
|
||||||
|
With the hex addresses of tree nodes, I can inspect the values
|
||||||
|
associated with any rhs token.
|
||||||
|
|
||||||
|
You like?
|
||||||
|
|
||||||
|
* input synclines
|
||||||
|
Some users create their foo.y files, and equip them with #line. Bison
|
||||||
|
should recognize these, and preserve them.
|
||||||
|
|
||||||
|
* BTYacc
|
||||||
|
See if we can integrate backtracking in Bison. Contact the BTYacc
|
||||||
|
maintainers.
|
||||||
|
|
||||||
|
* Automaton report
|
||||||
|
Display more clearly the lookaheads for each item.
|
||||||
|
|
||||||
|
* RR conflicts
|
||||||
|
See if we can use precedence between rules to solve RR conflicts. See
|
||||||
|
what POSIX says.
|
||||||
|
|
||||||
|
* Precedence
|
||||||
|
It is unfortunate that there is a total order for precedence. It
|
||||||
|
makes it impossible to have modular precedence information. We should
|
||||||
|
move to partial orders.
|
||||||
|
|
||||||
|
* Parsing grammars
|
||||||
|
Rewrite the reader in Bison.
|
||||||
|
|
||||||
|
* Problems with aliases
|
||||||
|
From: "Baum, Nathan I" <[email protected]>
|
||||||
|
Subject: Token Alias Bug
|
||||||
|
To: "'[email protected]'" <[email protected]>
|
||||||
|
|
||||||
|
I've noticed a bug in bison. Sadly, our eternally wise sysadmins won't let
|
||||||
|
us use CVS, so I can't find out if it's been fixed already...
|
||||||
|
|
||||||
|
Basically, I made a program (in flex) that went through a .y file looking
|
||||||
|
for "..."-tokens, and then outputed a %token
|
||||||
|
line for it. For single-character ""-tokens, I reasoned, I could just use
|
||||||
|
[%token 'A' "A"]. However, this causes Bison to output a [#define 'A' 65],
|
||||||
|
which cppp chokes on, not unreasonably. (And even if cppp didn't choke, I
|
||||||
|
obviously wouldn't want (char)'A' to be replaced with (int)65 throughout my
|
||||||
|
code.
|
||||||
|
|
||||||
|
Bison normally forgoes outputing a #define for a character token. However,
|
||||||
|
it always outputs an aliased token -- even if the token is an alias for a
|
||||||
|
character token. We don't want that. The problem is in /output.c/, as I
|
||||||
|
recall. When it outputs the token definitions, it checks for a character
|
||||||
|
token, and then checks for an alias token. If the character token check is
|
||||||
|
placed after the alias check, then it works correctly.
|
||||||
|
|
||||||
|
Alias tokens seem to be something of a kludge. What about an [%alias "..."]
|
||||||
|
command...
|
||||||
|
|
||||||
|
%alias T_IF "IF"
|
||||||
|
|
||||||
|
Hmm. I can't help thinking... What about a --generate-lex option that
|
||||||
|
creates an .l file for the alias tokens used... (Or an option to make a
|
||||||
|
gperf file, etc...)
|
||||||
|
|
||||||
|
* Presentation of the report file
|
||||||
|
From: "Baum, Nathan I" <[email protected]>
|
||||||
|
Subject: Token Alias Bug
|
||||||
|
To: "'[email protected]'" <[email protected]>
|
||||||
|
|
||||||
|
I've also noticed something, that whilst not *wrong*, is inconvienient: I
|
||||||
|
use the verbose mode to help find the causes of unresolved shift/reduce
|
||||||
|
conflicts. However, this mode insists on starting the .output file with a
|
||||||
|
list of *resolved* conflicts, something I find quite useless. Might it be
|
||||||
|
possible to define a -v mode, and a -vv mode -- Where the -vv mode shows
|
||||||
|
everything, but the -v mode only tells you what you need for examining
|
||||||
|
conflicts? (Or, perhaps, a "*** This state has N conflicts ***" marker above
|
||||||
|
each state with conflicts.)
|
||||||
|
|
||||||
|
|
||||||
|
* $undefined
|
||||||
|
From Hans:
|
||||||
|
- If the Bison generated parser experiences an undefined number in the
|
||||||
|
character range, that character is written out in diagnostic messages, an
|
||||||
|
addition to the $undefined value.
|
||||||
|
|
||||||
|
Suggest: Change the name $undefined to undefined; looks better in outputs.
|
||||||
|
|
||||||
|
* Default Action
|
||||||
|
From Hans:
|
||||||
|
- For use with my C++ parser, I transported the "switch (yyn)" statement
|
||||||
|
that Bison writes to the bison.simple skeleton file. This way, I can remove
|
||||||
|
the current default rule $$ = $1 implementation, which causes a double
|
||||||
|
assignment to $$ which may not be OK under C++, replacing it with a
|
||||||
|
"default:" part within the switch statement.
|
||||||
|
|
||||||
|
Note that the default rule $$ = $1, when typed, is perfectly OK under C,
|
||||||
|
but in the C++ implementation I made, this rule is different from
|
||||||
|
$<type_name>$ = $<type_name>1. I therefore think that one should implement
|
||||||
|
a Bison option where every typed default rule is explicitly written out
|
||||||
|
(same typed ruled can of course be grouped together).
|
||||||
|
|
||||||
|
* Pre and post actions.
|
||||||
|
From: Florian Krohm <[email protected]>
|
||||||
|
Subject: YYACT_EPILOGUE
|
||||||
|
To: [email protected]
|
||||||
|
X-Sent: 1 week, 4 days, 14 hours, 38 minutes, 11 seconds ago
|
||||||
|
|
||||||
|
The other day I had the need for explicitly building the parse tree. I
|
||||||
|
used %locations for that and defined YYLLOC_DEFAULT to call a function
|
||||||
|
that returns the tree node for the production. Easy. But I also needed
|
||||||
|
to assign the S-attribute to the tree node. That cannot be done in
|
||||||
|
YYLLOC_DEFAULT, because it is invoked before the action is executed.
|
||||||
|
The way I solved this was to define a macro YYACT_EPILOGUE that would
|
||||||
|
be invoked after the action. For reasons of symmetry I also added
|
||||||
|
YYACT_PROLOGUE. Although I had no use for that I can envision how it
|
||||||
|
might come in handy for debugging purposes.
|
||||||
|
All is needed is to add
|
||||||
|
|
||||||
|
#if YYLSP_NEEDED
|
||||||
|
YYACT_EPILOGUE (yyval, (yyvsp - yylen), yylen, yyloc, (yylsp - yylen));
|
||||||
|
#else
|
||||||
|
YYACT_EPILOGUE (yyval, (yyvsp - yylen), yylen);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
at the proper place to bison.simple. Ditto for YYACT_PROLOGUE.
|
||||||
|
|
||||||
|
I was wondering what you think about adding YYACT_PROLOGUE/EPILOGUE
|
||||||
|
to bison. If you're interested, I'll work on a patch.
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of GNU Autoconf.
|
||||||
|
|
||||||
|
GNU Autoconf is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
GNU Autoconf is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with autoconf; see the file COPYING. If not, write to
|
||||||
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA.
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
echo "Bootstrapping CVS Bison..."
|
||||||
|
|
||||||
|
# This will run gettextize which will patch some files, and cause
|
||||||
|
# autoconf to choke (because for instance intl/Makefile is registered
|
||||||
|
# several times).
|
||||||
|
autoreconf --verbose --install --force
|
||||||
|
|
||||||
|
# gettextize modified these files: restore them.
|
||||||
|
for f in m4/Makefile.am Makefile.am configure.in
|
||||||
|
do
|
||||||
|
if test -f "$f~"; then
|
||||||
|
mv -f "$f~" "$f"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
rm -f po/Makevars.template
|
||||||
|
|
||||||
|
# Since some files were restored, some files must probably be remade.
|
||||||
|
# But automake could not install all of its files, so pass --install
|
||||||
|
# for it.
|
||||||
|
autoreconf --verbose --install
|
||||||
+292
@@ -0,0 +1,292 @@
|
|||||||
|
/* config.hin. Generated from configure.in by autoheader. */
|
||||||
|
|
||||||
|
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
|
||||||
|
systems. This function is required for `alloca.c' support on those systems.
|
||||||
|
*/
|
||||||
|
#undef CRAY_STACKSEG_END
|
||||||
|
|
||||||
|
/* Define if using `alloca.c'. */
|
||||||
|
#undef C_ALLOCA
|
||||||
|
|
||||||
|
/* Define to 1 if translation of program messages to the user's native
|
||||||
|
language is requested. */
|
||||||
|
#undef ENABLE_NLS
|
||||||
|
|
||||||
|
/* Define if you have `alloca', as a function or macro. */
|
||||||
|
#undef HAVE_ALLOCA
|
||||||
|
|
||||||
|
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
|
||||||
|
#undef HAVE_ALLOCA_H
|
||||||
|
|
||||||
|
/* Define if you have the <argz.h> header file. */
|
||||||
|
#undef HAVE_ARGZ_H
|
||||||
|
|
||||||
|
/* Define if you have the <ctype.h> header file. */
|
||||||
|
#undef HAVE_CTYPE_H
|
||||||
|
|
||||||
|
/* Define if backslash-a works in C strings. */
|
||||||
|
#undef HAVE_C_BACKSLASH_A
|
||||||
|
|
||||||
|
/* Define if you have the `dcgettext' function. */
|
||||||
|
#undef HAVE_DCGETTEXT
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `memchr', and to 0 if you don't.
|
||||||
|
*/
|
||||||
|
#undef HAVE_DECL_MEMCHR
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `stpcpy', and to 0 if you don't.
|
||||||
|
*/
|
||||||
|
#undef HAVE_DECL_STPCPY
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
#undef HAVE_DECL_STRERROR_R
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `strndup', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
#undef HAVE_DECL_STRNDUP
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `strnlen', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
#undef HAVE_DECL_STRNLEN
|
||||||
|
|
||||||
|
/* Define if the malloc check has been performed. */
|
||||||
|
#undef HAVE_DONE_WORKING_MALLOC_CHECK
|
||||||
|
|
||||||
|
/* Define if the realloc check has been performed. */
|
||||||
|
#undef HAVE_DONE_WORKING_REALLOC_CHECK
|
||||||
|
|
||||||
|
/* Define if you have the `doprnt' function. */
|
||||||
|
#undef HAVE_DOPRNT
|
||||||
|
|
||||||
|
/* Define if you have the `feof_unlocked' function. */
|
||||||
|
#undef HAVE_FEOF_UNLOCKED
|
||||||
|
|
||||||
|
/* Define if you have the `fgets_unlocked' function. */
|
||||||
|
#undef HAVE_FGETS_UNLOCKED
|
||||||
|
|
||||||
|
/* Define if you have the `getcwd' function. */
|
||||||
|
#undef HAVE_GETCWD
|
||||||
|
|
||||||
|
/* Define if you have the `getegid' function. */
|
||||||
|
#undef HAVE_GETEGID
|
||||||
|
|
||||||
|
/* Define if you have the `geteuid' function. */
|
||||||
|
#undef HAVE_GETEUID
|
||||||
|
|
||||||
|
/* Define if you have the `getgid' function. */
|
||||||
|
#undef HAVE_GETGID
|
||||||
|
|
||||||
|
/* Define if you have the `getpagesize' function. */
|
||||||
|
#undef HAVE_GETPAGESIZE
|
||||||
|
|
||||||
|
/* Define if the GNU gettext() function is already present or preinstalled. */
|
||||||
|
#undef HAVE_GETTEXT
|
||||||
|
|
||||||
|
/* Define if you have the `getuid' function. */
|
||||||
|
#undef HAVE_GETUID
|
||||||
|
|
||||||
|
/* Define if you have the iconv() function. */
|
||||||
|
#undef HAVE_ICONV
|
||||||
|
|
||||||
|
/* Define if you have the <inttypes.h> header file. */
|
||||||
|
#undef HAVE_INTTYPES_H
|
||||||
|
|
||||||
|
/* Define if you have the `isascii' function. */
|
||||||
|
#undef HAVE_ISASCII
|
||||||
|
|
||||||
|
/* Define if you have the `iswprint' function. */
|
||||||
|
#undef HAVE_ISWPRINT
|
||||||
|
|
||||||
|
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
|
||||||
|
#undef HAVE_LANGINFO_CODESET
|
||||||
|
|
||||||
|
/* Define if your <locale.h> file defines LC_MESSAGES. */
|
||||||
|
#undef HAVE_LC_MESSAGES
|
||||||
|
|
||||||
|
/* Define if you have the <limits.h> header file. */
|
||||||
|
#undef HAVE_LIMITS_H
|
||||||
|
|
||||||
|
/* Define if you have the <locale.h> header file. */
|
||||||
|
#undef HAVE_LOCALE_H
|
||||||
|
|
||||||
|
/* Define if you have the <malloc.h> header file. */
|
||||||
|
#undef HAVE_MALLOC_H
|
||||||
|
|
||||||
|
/* Define to 1 if mbrtowc and mbstate_t are properly declared. */
|
||||||
|
#undef HAVE_MBRTOWC
|
||||||
|
|
||||||
|
/* Define if you have the `mbsinit' function. */
|
||||||
|
#undef HAVE_MBSINIT
|
||||||
|
|
||||||
|
/* Define if you have the `memchr' function. */
|
||||||
|
#undef HAVE_MEMCHR
|
||||||
|
|
||||||
|
/* Define if you have the <memory.h> header file. */
|
||||||
|
#undef HAVE_MEMORY_H
|
||||||
|
|
||||||
|
/* Define if you have the `mempcpy' function. */
|
||||||
|
#undef HAVE_MEMPCPY
|
||||||
|
|
||||||
|
/* Define if you have the `mkstemp' function. */
|
||||||
|
#undef HAVE_MKSTEMP
|
||||||
|
|
||||||
|
/* Define if you have a working `mmap' system call. */
|
||||||
|
#undef HAVE_MMAP
|
||||||
|
|
||||||
|
/* Define if you have the `munmap' function. */
|
||||||
|
#undef HAVE_MUNMAP
|
||||||
|
|
||||||
|
/* Define if you have the <nl_types.h> header file. */
|
||||||
|
#undef HAVE_NL_TYPES_H
|
||||||
|
|
||||||
|
/* Define if you have the `putenv' function. */
|
||||||
|
#undef HAVE_PUTENV
|
||||||
|
|
||||||
|
/* Define if you have the `setenv' function. */
|
||||||
|
#undef HAVE_SETENV
|
||||||
|
|
||||||
|
/* Define if you have the `setlocale' function. */
|
||||||
|
#undef HAVE_SETLOCALE
|
||||||
|
|
||||||
|
/* Define if you have the <stddef.h> header file. */
|
||||||
|
#undef HAVE_STDDEF_H
|
||||||
|
|
||||||
|
/* Define if you have the <stdint.h> header file. */
|
||||||
|
#undef HAVE_STDINT_H
|
||||||
|
|
||||||
|
/* Define if you have the <stdlib.h> header file. */
|
||||||
|
#undef HAVE_STDLIB_H
|
||||||
|
|
||||||
|
/* Define if you have the `stpcpy' function. */
|
||||||
|
#undef HAVE_STPCPY
|
||||||
|
|
||||||
|
/* Define if you have the `strcasecmp' function. */
|
||||||
|
#undef HAVE_STRCASECMP
|
||||||
|
|
||||||
|
/* Define if you have the `strchr' function. */
|
||||||
|
#undef HAVE_STRCHR
|
||||||
|
|
||||||
|
/* Define if you have the `strdup' function. */
|
||||||
|
#undef HAVE_STRDUP
|
||||||
|
|
||||||
|
/* Define if you have the `strerror' function. */
|
||||||
|
#undef HAVE_STRERROR
|
||||||
|
|
||||||
|
/* Define if you have the `strerror_r' function. */
|
||||||
|
#undef HAVE_STRERROR_R
|
||||||
|
|
||||||
|
/* Define if you have the <strings.h> header file. */
|
||||||
|
#undef HAVE_STRINGS_H
|
||||||
|
|
||||||
|
/* Define if you have the <string.h> header file. */
|
||||||
|
#undef HAVE_STRING_H
|
||||||
|
|
||||||
|
/* Define if you have the `strndup' function. */
|
||||||
|
#undef HAVE_STRNDUP
|
||||||
|
|
||||||
|
/* Define if you have the `strnlen' function. */
|
||||||
|
#undef HAVE_STRNLEN
|
||||||
|
|
||||||
|
/* Define if you have the `strspn' function. */
|
||||||
|
#undef HAVE_STRSPN
|
||||||
|
|
||||||
|
/* Define if you have the `strtoul' function. */
|
||||||
|
#undef HAVE_STRTOUL
|
||||||
|
|
||||||
|
/* Define if you have the <sys/param.h> header file. */
|
||||||
|
#undef HAVE_SYS_PARAM_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stat.h> header file. */
|
||||||
|
#undef HAVE_SYS_STAT_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/types.h> header file. */
|
||||||
|
#undef HAVE_SYS_TYPES_H
|
||||||
|
|
||||||
|
/* Define if you have the `tsearch' function. */
|
||||||
|
#undef HAVE_TSEARCH
|
||||||
|
|
||||||
|
/* Define if you have the <unistd.h> header file. */
|
||||||
|
#undef HAVE_UNISTD_H
|
||||||
|
|
||||||
|
/* Define if you have the `vprintf' function. */
|
||||||
|
#undef HAVE_VPRINTF
|
||||||
|
|
||||||
|
/* Define if you have the <wchar.h> header file. */
|
||||||
|
#undef HAVE_WCHAR_H
|
||||||
|
|
||||||
|
/* Define if you have the <wctype.h> header file. */
|
||||||
|
#undef HAVE_WCTYPE_H
|
||||||
|
|
||||||
|
/* Define to 1 if `strerror_r' returns a string. */
|
||||||
|
#undef HAVE_WORKING_STRERROR_R
|
||||||
|
|
||||||
|
/* Define if you have the `__argz_count' function. */
|
||||||
|
#undef HAVE___ARGZ_COUNT
|
||||||
|
|
||||||
|
/* Define if you have the `__argz_next' function. */
|
||||||
|
#undef HAVE___ARGZ_NEXT
|
||||||
|
|
||||||
|
/* Define if you have the `__argz_stringify' function. */
|
||||||
|
#undef HAVE___ARGZ_STRINGIFY
|
||||||
|
|
||||||
|
/* Define as const if the declaration of iconv() needs const. */
|
||||||
|
#undef ICONV_CONST
|
||||||
|
|
||||||
|
/* Name of package */
|
||||||
|
#undef PACKAGE
|
||||||
|
|
||||||
|
/* Define if compiler has function prototypes */
|
||||||
|
#undef PROTOTYPES
|
||||||
|
|
||||||
|
/* If using the C implementation of alloca, define 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 */
|
||||||
|
#undef STACK_DIRECTION
|
||||||
|
|
||||||
|
/* Define if you have the ANSI C header files. */
|
||||||
|
#undef STDC_HEADERS
|
||||||
|
|
||||||
|
/* Version number of package */
|
||||||
|
#undef VERSION
|
||||||
|
|
||||||
|
/* Define if using the dmalloc debugging malloc package */
|
||||||
|
#undef WITH_DMALLOC
|
||||||
|
|
||||||
|
/* Define to 1 for GNU C library extensions. */
|
||||||
|
#undef _GNU_SOURCE
|
||||||
|
|
||||||
|
/* Define if on MINIX. */
|
||||||
|
#undef _MINIX
|
||||||
|
|
||||||
|
/* Define if the system does not provide POSIX.1 features except with this
|
||||||
|
defined. */
|
||||||
|
#undef _POSIX_1_SOURCE
|
||||||
|
|
||||||
|
/* Define if you need to in order for `stat' and other things to work. */
|
||||||
|
#undef _POSIX_SOURCE
|
||||||
|
|
||||||
|
/* Define to empty if `const' does not conform to ANSI C. */
|
||||||
|
#undef const
|
||||||
|
|
||||||
|
/* Define as `__inline' if that's what the C compiler calls it, or to nothing
|
||||||
|
if it is not supported. */
|
||||||
|
#undef inline
|
||||||
|
|
||||||
|
/* Define to rpl_malloc if the replacement function should be used. */
|
||||||
|
#undef malloc
|
||||||
|
|
||||||
|
/* Define to a type if <wchar.h> does not define. */
|
||||||
|
#undef mbstate_t
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> does not define. */
|
||||||
|
#undef off_t
|
||||||
|
|
||||||
|
/* Define to rpl_realloc if the replacement function should be used. */
|
||||||
|
#undef realloc
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||||
|
#undef size_t
|
||||||
@@ -1,2 +1,9 @@
|
|||||||
Makefile
|
Makefile
|
||||||
*.t
|
*.t
|
||||||
|
Makefile.in
|
||||||
|
mkinstalldirs
|
||||||
|
missing
|
||||||
|
config.sub
|
||||||
|
config.guess
|
||||||
|
mdate-sh
|
||||||
|
texinfo.tex
|
||||||
|
|||||||
+29
-4
@@ -31,7 +31,16 @@ if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
|||||||
fi
|
fi
|
||||||
# `libtool' can also be set to `yes' or `no'.
|
# `libtool' can also be set to `yes' or `no'.
|
||||||
|
|
||||||
depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`}
|
if test -z "$depfile"; then
|
||||||
|
base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
|
||||||
|
dir=`echo "$object" | sed 's,/.*$,/,'`
|
||||||
|
if test "$dir" = "$object"; then
|
||||||
|
dir=
|
||||||
|
fi
|
||||||
|
# FIXME: should be _deps on DOS.
|
||||||
|
depfile="$dir.deps/$base"
|
||||||
|
fi
|
||||||
|
|
||||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||||
|
|
||||||
rm -f "$tmpdepfile"
|
rm -f "$tmpdepfile"
|
||||||
@@ -204,8 +213,9 @@ tru64)
|
|||||||
# dependencies in `foo.d' instead, so we check for that too.
|
# dependencies in `foo.d' instead, so we check for that too.
|
||||||
# Subdirectories are respected.
|
# Subdirectories are respected.
|
||||||
|
|
||||||
tmpdepfile1="$object.d"
|
base=`echo "$object" | sed -e 's/\.o$/.d/' -e 's/\.lo$/.d/'`
|
||||||
tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'`
|
tmpdepfile1="$base.o.d"
|
||||||
|
tmpdepfile2="$base.d"
|
||||||
if test "$libtool" = yes; then
|
if test "$libtool" = yes; then
|
||||||
"$@" -Wc,-MD
|
"$@" -Wc,-MD
|
||||||
else
|
else
|
||||||
@@ -314,7 +324,7 @@ makedepend)
|
|||||||
if test "$stat" != 0; then exit $stat; fi
|
if test "$stat" != 0; then exit $stat; fi
|
||||||
rm -f "$depfile"
|
rm -f "$depfile"
|
||||||
cat < "$tmpdepfile" > "$depfile"
|
cat < "$tmpdepfile" > "$depfile"
|
||||||
tail +3 "$tmpdepfile" | tr ' ' '
|
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||||
' | \
|
' | \
|
||||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||||
## correctly. Breaking it into two sed invocations is a workaround.
|
## correctly. Breaking it into two sed invocations is a workaround.
|
||||||
@@ -382,6 +392,21 @@ msvisualcpp)
|
|||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
for arg
|
||||||
|
do
|
||||||
|
case "$arg" in
|
||||||
|
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||||
|
set fnord "$@"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
set fnord "$@" "$arg"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
"$@" -E |
|
"$@" -E |
|
||||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
|
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
|
||||||
) &
|
) &
|
||||||
|
|||||||
+16
-16
@@ -109,7 +109,7 @@ then
|
|||||||
echo "install: no input file specified"
|
echo "install: no input file specified"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
true
|
:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ x"$dir_arg" != x ]; then
|
if [ x"$dir_arg" != x ]; then
|
||||||
@@ -120,7 +120,7 @@ if [ x"$dir_arg" != x ]; then
|
|||||||
instcmd=:
|
instcmd=:
|
||||||
chmodcmd=""
|
chmodcmd=""
|
||||||
else
|
else
|
||||||
instcmd=mkdir
|
instcmd=$mkdirprog
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ else
|
|||||||
|
|
||||||
if [ -f $src -o -d $src ]
|
if [ -f $src -o -d $src ]
|
||||||
then
|
then
|
||||||
true
|
:
|
||||||
else
|
else
|
||||||
echo "install: $src does not exist"
|
echo "install: $src does not exist"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -141,7 +141,7 @@ else
|
|||||||
echo "install: no destination specified"
|
echo "install: no destination specified"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
true
|
:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If destination is a directory, append the input filename; if your system
|
# If destination is a directory, append the input filename; if your system
|
||||||
@@ -151,7 +151,7 @@ else
|
|||||||
then
|
then
|
||||||
dst="$dst"/`basename $src`
|
dst="$dst"/`basename $src`
|
||||||
else
|
else
|
||||||
true
|
:
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
|||||||
# Skip lots of stat calls in the usual case.
|
# Skip lots of stat calls in the usual case.
|
||||||
if [ ! -d "$dstdir" ]; then
|
if [ ! -d "$dstdir" ]; then
|
||||||
defaultIFS='
|
defaultIFS='
|
||||||
'
|
'
|
||||||
IFS="${IFS-${defaultIFS}}"
|
IFS="${IFS-${defaultIFS}}"
|
||||||
|
|
||||||
oIFS="${IFS}"
|
oIFS="${IFS}"
|
||||||
@@ -183,7 +183,7 @@ while [ $# -ne 0 ] ; do
|
|||||||
then
|
then
|
||||||
$mkdirprog "${pathcomp}"
|
$mkdirprog "${pathcomp}"
|
||||||
else
|
else
|
||||||
true
|
:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pathcomp="${pathcomp}/"
|
pathcomp="${pathcomp}/"
|
||||||
@@ -194,10 +194,10 @@ if [ x"$dir_arg" != x ]
|
|||||||
then
|
then
|
||||||
$doit $instcmd $dst &&
|
$doit $instcmd $dst &&
|
||||||
|
|
||||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi &&
|
||||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi &&
|
||||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi &&
|
||||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi
|
||||||
else
|
else
|
||||||
|
|
||||||
# If we're going to rename the final executable, determine the name now.
|
# If we're going to rename the final executable, determine the name now.
|
||||||
@@ -216,7 +216,7 @@ else
|
|||||||
then
|
then
|
||||||
dstfile=`basename $dst`
|
dstfile=`basename $dst`
|
||||||
else
|
else
|
||||||
true
|
:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Make a temp file name in the proper directory.
|
# Make a temp file name in the proper directory.
|
||||||
@@ -235,10 +235,10 @@ else
|
|||||||
# ignore errors from any of these, just make sure not to ignore
|
# ignore errors from any of these, just make sure not to ignore
|
||||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||||
|
|
||||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi &&
|
||||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi &&
|
||||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi &&
|
||||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi &&
|
||||||
|
|
||||||
# Now rename the file to the real destination.
|
# Now rename the file to the real destination.
|
||||||
|
|
||||||
|
|||||||
@@ -1,92 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# Get modification time of a file or directory and pretty-print it.
|
|
||||||
# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
|
||||||
# written by Ulrich Drepper <[email protected]>, June 1995
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software Foundation,
|
|
||||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
# Prevent date giving response in another language.
|
|
||||||
LANG=C
|
|
||||||
export LANG
|
|
||||||
LC_ALL=C
|
|
||||||
export LC_ALL
|
|
||||||
LC_TIME=C
|
|
||||||
export LC_TIME
|
|
||||||
|
|
||||||
# Get the extended ls output of the file or directory.
|
|
||||||
# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
|
|
||||||
if ls -L /dev/null 1>/dev/null 2>&1; then
|
|
||||||
set - x`ls -L -l -d $1`
|
|
||||||
else
|
|
||||||
set - x`ls -l -d $1`
|
|
||||||
fi
|
|
||||||
# The month is at least the fourth argument
|
|
||||||
# (3 shifts here, the next inside the loop).
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
|
|
||||||
# Find the month. Next argument is day, followed by the year or time.
|
|
||||||
month=
|
|
||||||
until test $month
|
|
||||||
do
|
|
||||||
shift
|
|
||||||
case $1 in
|
|
||||||
Jan) month=January; nummonth=1;;
|
|
||||||
Feb) month=February; nummonth=2;;
|
|
||||||
Mar) month=March; nummonth=3;;
|
|
||||||
Apr) month=April; nummonth=4;;
|
|
||||||
May) month=May; nummonth=5;;
|
|
||||||
Jun) month=June; nummonth=6;;
|
|
||||||
Jul) month=July; nummonth=7;;
|
|
||||||
Aug) month=August; nummonth=8;;
|
|
||||||
Sep) month=September; nummonth=9;;
|
|
||||||
Oct) month=October; nummonth=10;;
|
|
||||||
Nov) month=November; nummonth=11;;
|
|
||||||
Dec) month=December; nummonth=12;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
day=$2
|
|
||||||
|
|
||||||
# Here we have to deal with the problem that the ls output gives either
|
|
||||||
# the time of day or the year.
|
|
||||||
case $3 in
|
|
||||||
*:*) set `date`; eval year=\$$#
|
|
||||||
case $2 in
|
|
||||||
Jan) nummonthtod=1;;
|
|
||||||
Feb) nummonthtod=2;;
|
|
||||||
Mar) nummonthtod=3;;
|
|
||||||
Apr) nummonthtod=4;;
|
|
||||||
May) nummonthtod=5;;
|
|
||||||
Jun) nummonthtod=6;;
|
|
||||||
Jul) nummonthtod=7;;
|
|
||||||
Aug) nummonthtod=8;;
|
|
||||||
Sep) nummonthtod=9;;
|
|
||||||
Oct) nummonthtod=10;;
|
|
||||||
Nov) nummonthtod=11;;
|
|
||||||
Dec) nummonthtod=12;;
|
|
||||||
esac
|
|
||||||
# For the first six month of the year the time notation can also
|
|
||||||
# be used for files modified in the last year.
|
|
||||||
if (expr $nummonth \> $nummonthtod) > /dev/null;
|
|
||||||
then
|
|
||||||
year=`expr $year - 1`
|
|
||||||
fi;;
|
|
||||||
*) year=$3;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# The result.
|
|
||||||
echo $day $month $year
|
|
||||||
-6288
File diff suppressed because it is too large
Load Diff
+31
-18
@@ -1,5 +1,7 @@
|
|||||||
# Configure template for GNU Bison. -*-Autoconf-*-
|
# Configure template for GNU Bison. -*-Autoconf-*-
|
||||||
#
|
#
|
||||||
|
# Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||||
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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 of the License, or
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
@@ -16,30 +18,35 @@
|
|||||||
# 02111-1307 USA
|
# 02111-1307 USA
|
||||||
|
|
||||||
# We need a recent Autoconf to run a recent Autotest.
|
# We need a recent Autoconf to run a recent Autotest.
|
||||||
AC_PREREQ(2.52e)
|
AC_PREREQ(2.53)
|
||||||
|
|
||||||
AC_INIT([GNU Bison], [1.29d], [[email protected]])
|
AC_INIT([GNU Bison], [1.49a], [[email protected]])
|
||||||
AC_CONFIG_AUX_DIR(config)
|
AC_CONFIG_AUX_DIR(config)
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE([bison], [1.29d])
|
AM_INIT_AUTOMAKE([bison], [1.49a])
|
||||||
AM_CONFIG_HEADER(config.h:config.hin)
|
AM_CONFIG_HEADER(config.h:config.hin)
|
||||||
|
|
||||||
# Initialize the test suite.
|
# Initialize the test suite.
|
||||||
AC_CONFIG_TESTDIR(tests)
|
AC_CONFIG_TESTDIR(tests)
|
||||||
|
AC_CONFIG_FILES([tests/Makefile tests/atlocal])
|
||||||
AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
|
AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
|
||||||
|
# Needed by tests/atlocal.in.
|
||||||
|
AC_SUBST([GCC])
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
|
AM_PROG_LEX
|
||||||
|
AC_PROG_YACC
|
||||||
AC_MINIX
|
AC_MINIX
|
||||||
AC_ISC_POSIX
|
AC_ISC_POSIX
|
||||||
AM_PROG_CC_STDC
|
AM_PROG_CC_STDC
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
# GNU M4 is needed to build the testsuite.
|
AM_MISSING_PROG([AUTOM4TE], [autom4te])
|
||||||
BISON_AC_PROG_GNU_M4
|
BISON_PROG_GNU_M4
|
||||||
if test "$ac_cv_prog_gnu_m4" != yes; then
|
if test x"$ac_cv_prog_gnu_m4" != xyes; then
|
||||||
missing_dir=`cd $ac_aux_dir && pwd`
|
AC_MSG_ERROR([GNU M4 1.4 is required])
|
||||||
M4="$missing_dir/missing m4"
|
|
||||||
fi
|
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)],
|
||||||
@@ -49,6 +56,9 @@ AC_ARG_ENABLE(gcc-warnings,
|
|||||||
esac],
|
esac],
|
||||||
[enableval=no])
|
[enableval=no])
|
||||||
if test "${enableval}" = yes; then
|
if test "${enableval}" = yes; then
|
||||||
|
BISON_WARNING(-Werror)
|
||||||
|
AC_SUBST([WERROR_CFLAGS], [$WARNING_CFLAGS])
|
||||||
|
WARNING_CFLAGS=
|
||||||
BISON_WARNING(-Wall)
|
BISON_WARNING(-Wall)
|
||||||
BISON_WARNING(-W)
|
BISON_WARNING(-W)
|
||||||
BISON_WARNING(-Wbad-function-cast)
|
BISON_WARNING(-Wbad-function-cast)
|
||||||
@@ -61,7 +71,6 @@ if test "${enableval}" = yes; then
|
|||||||
BISON_WARNING(-Wshadow)
|
BISON_WARNING(-Wshadow)
|
||||||
BISON_WARNING(-Wstrict-prototypes)
|
BISON_WARNING(-Wstrict-prototypes)
|
||||||
BISON_WARNING(-Wwrite-strings)
|
BISON_WARNING(-Wwrite-strings)
|
||||||
CFLAGS="$CFLAGS $WARNING_CFLAGS"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Checks for libraries.
|
# Checks for libraries.
|
||||||
@@ -82,26 +91,30 @@ AM_C_PROTOTYPES
|
|||||||
|
|
||||||
# Checks for library functions.
|
# Checks for library functions.
|
||||||
AC_FUNC_ALLOCA
|
AC_FUNC_ALLOCA
|
||||||
AC_CHECK_FUNCS(mkstemp setlocale)
|
AC_FUNC_OBSTACK
|
||||||
AC_CHECK_DECLS([stpcpy, strndup, strnlen, memchr])
|
AC_FUNC_ERROR_AT_LINE
|
||||||
AC_REPLACE_FUNCS(stpcpy strndup strnlen strspn memchr)
|
AC_FUNC_STRNLEN
|
||||||
|
UTILS_FUNC_MKSTEMP
|
||||||
|
AC_CHECK_FUNCS(setlocale)
|
||||||
|
AC_CHECK_DECLS([free, stpcpy, strchr, strspn, strnlen, malloc, memchr, memrchr])
|
||||||
|
AC_REPLACE_FUNCS(stpcpy strchr strspn memchr memrchr)
|
||||||
jm_FUNC_MALLOC
|
jm_FUNC_MALLOC
|
||||||
jm_FUNC_REALLOC
|
jm_FUNC_REALLOC
|
||||||
jm_PREREQ_QUOTEARG
|
jm_PREREQ_QUOTEARG
|
||||||
jm_PREREQ_ERROR
|
jm_PREREQ_ERROR
|
||||||
AM_WITH_DMALLOC
|
AM_WITH_DMALLOC
|
||||||
|
|
||||||
ALL_LINGUAS="de es et fr ja nl tr ru"
|
ALL_LINGUAS="de es et fr it ja nl ru sv tr"
|
||||||
AM_GNU_GETTEXT
|
AM_GNU_GETTEXT(, need-ngettext)
|
||||||
|
|
||||||
# This is necessary so that .o files in LIBOBJS are also built via
|
# This is necessary so that .o files in LIBOBJS are also built via
|
||||||
# the ANSI2KNR-filtering rules.
|
# the ANSI2KNR-filtering rules.
|
||||||
LIBOBJS=`echo $LIBOBJS|sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'`
|
LIB@&t@OBJS=`echo $LIB@&t@OBJS|sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'`
|
||||||
AC_SUBST(LIBOBJS)
|
AC_SUBST(LIB@&t@OBJS)
|
||||||
|
|
||||||
AC_OUTPUT([Makefile
|
AC_OUTPUT([Makefile
|
||||||
config/Makefile
|
config/Makefile
|
||||||
intl/Makefile po/Makefile.in
|
intl/Makefile po/Makefile.in
|
||||||
|
data/Makefile
|
||||||
lib/Makefile src/Makefile doc/Makefile
|
lib/Makefile src/Makefile doc/Makefile
|
||||||
m4/Makefile
|
m4/Makefile])
|
||||||
tests/Makefile])
|
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Makefile.in
|
||||||
|
Makefile
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
## Copyright 2002 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
## This program is free software; you can redistribute it and/or modify
|
||||||
|
## it under the terms of the GNU General Public License as published by
|
||||||
|
## the Free Software Foundation; either version 2 of the License, or
|
||||||
|
## (at your option) any later version.
|
||||||
|
|
||||||
|
## This program is distributed in the hope that it will be useful,
|
||||||
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
## GNU General Public License for more details.
|
||||||
|
|
||||||
|
## You should have received a copy of the GNU General Public License
|
||||||
|
## along with this program; if not, write to the Free Software
|
||||||
|
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||||
|
## 02111-1307 USA
|
||||||
|
|
||||||
|
dist_pkgdata_DATA = bison.simple bison.hairy bison.c++
|
||||||
|
|
||||||
|
m4sugardir = $(pkgdatadir)/m4sugar
|
||||||
|
dist_m4sugar_DATA = m4sugar/m4sugar.m4 m4sugar/version.m4
|
||||||
+878
@@ -0,0 +1,878 @@
|
|||||||
|
m4_divert(-1)
|
||||||
|
|
||||||
|
# b4_sint_type(MAX)
|
||||||
|
# -----------------
|
||||||
|
# Return the smallest signed int type able to handle the number MAX.
|
||||||
|
m4_define([b4_sint_type],
|
||||||
|
[m4_if(m4_eval([$1 <= 127]), [1], [signed char],
|
||||||
|
m4_eval([$1 <= 32767]), [1], [signed short],
|
||||||
|
m4_eval([$1 <= 2147483647]), [1], [signed int],
|
||||||
|
[m4_fatal([no signed int type for $1])])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_uint_type(MAX)
|
||||||
|
# -----------------
|
||||||
|
# Return the smallest unsigned int type able to handle the number MAX.
|
||||||
|
m4_define([b4_uint_type],
|
||||||
|
[m4_if(m4_eval([$1 <= 255]), [1], [unsigned char],
|
||||||
|
m4_eval([$1 <= 65535]), [1], [unsigned short],
|
||||||
|
m4_eval([$1 <= 4294967295]), [1], [unsigned int],
|
||||||
|
[m4_fatal([no unsigned int type for $1])])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_token_defines(TOKEN-NAME, TOKEN-NUMBER)
|
||||||
|
# ------------------------------------------
|
||||||
|
# Output the definition of this token as #define.
|
||||||
|
m4_define([b4_token_define],
|
||||||
|
[#define $1 $2
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_token_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||||
|
# -------------------------------------------------------
|
||||||
|
# Output the definition of the tokens as #define.
|
||||||
|
m4_define([b4_token_defines],
|
||||||
|
[m4_map([b4_token_define], [$@])])
|
||||||
|
|
||||||
|
m4_define_default([b4_input_suffix], [.y])
|
||||||
|
|
||||||
|
m4_define_default([b4_output_parser_suffix],
|
||||||
|
[m4_translit(b4_input_suffix, [yY], [cC])])
|
||||||
|
|
||||||
|
m4_define_default([b4_output_parser_name],
|
||||||
|
[b4_output_prefix[]b4_output_infix[]b4_output_parser_suffix[]])
|
||||||
|
|
||||||
|
|
||||||
|
m4_define_default([b4_output_header_suffix],
|
||||||
|
[m4_translit(b4_input_suffix, [yY], [hH])])
|
||||||
|
|
||||||
|
m4_define_default([b4_output_header_name],
|
||||||
|
[b4_output_prefix[]b4_output_infix[]b4_output_header_suffix[]])
|
||||||
|
|
||||||
|
m4_define_default([b4_header_guard],
|
||||||
|
[m4_bpatsubst(m4_toupper([BISON_]b4_output_header_name),
|
||||||
|
[[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]], [_])])
|
||||||
|
|
||||||
|
m4_define([b4_inherit],
|
||||||
|
[m4_ifdef([b4_root],
|
||||||
|
[: public b4_root
|
||||||
|
],
|
||||||
|
[])])
|
||||||
|
|
||||||
|
m4_define([b4_param],
|
||||||
|
[m4_ifdef([b4_root],
|
||||||
|
[,
|
||||||
|
const Param& param],
|
||||||
|
[])])
|
||||||
|
|
||||||
|
m4_define([b4_constructor],
|
||||||
|
[m4_ifdef([b4_root],
|
||||||
|
[b4_root (param),
|
||||||
|
],
|
||||||
|
[])])
|
||||||
|
|
||||||
|
m4_define([b4_copyright],
|
||||||
|
[/* -*- C++ -*- */
|
||||||
|
/* A Bison parser, made from b4_filename,
|
||||||
|
by GNU bison b4_version. */
|
||||||
|
|
||||||
|
/* Skeleton output parser for bison,
|
||||||
|
Copyright 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. */
|
||||||
|
|
||||||
|
/* As a special exception, when this file is copied by Bison into a
|
||||||
|
Bison output file, you may use that output file without restriction.
|
||||||
|
This special exception was added by the Free Software Foundation
|
||||||
|
in version 1.24 of Bison. */])
|
||||||
|
|
||||||
|
m4_divert(0)dnl
|
||||||
|
#output "b4_output_header_name"
|
||||||
|
b4_copyright
|
||||||
|
#ifndef b4_header_guard
|
||||||
|
# define b4_header_guard
|
||||||
|
|
||||||
|
#include "stack.hh"
|
||||||
|
#include "location.hh"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
/* Using locations. */
|
||||||
|
#define YYLSP_NEEDED b4_locations_flag
|
||||||
|
|
||||||
|
/* Copy the first part of user declarations. */
|
||||||
|
b4_pre_prologue
|
||||||
|
|
||||||
|
/* Tokens. */
|
||||||
|
b4_token_defines(b4_tokens)
|
||||||
|
|
||||||
|
/* Enabling traces. */
|
||||||
|
#ifndef YYDEBUG
|
||||||
|
# define YYDEBUG b4_debug
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Enabling verbose error message. */
|
||||||
|
#ifndef YYERROR_VERBOSE
|
||||||
|
# define YYERROR_VERBOSE b4_error_verbose
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef YYSTYPE
|
||||||
|
m4_ifdef([b4_stype_line],
|
||||||
|
[#line b4_stype_line "b4_filename"
|
||||||
|
])dnl
|
||||||
|
typedef b4_stype
|
||||||
|
yystype;
|
||||||
|
# define YYSTYPE yystype
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Copy the second part of user declarations. */
|
||||||
|
b4_post_prologue
|
||||||
|
|
||||||
|
#line __oline__ "__ofile__"
|
||||||
|
#ifndef YYLLOC_DEFAULT
|
||||||
|
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||||
|
Current.last_line = Rhs[[N]].last_line; \
|
||||||
|
Current.last_column = Rhs[[N]].last_column;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
m4_if(b4_locations_flag, [0], [],
|
||||||
|
[#ifndef YYLTYPE
|
||||||
|
typedef struct yyltype
|
||||||
|
{
|
||||||
|
int first_line;
|
||||||
|
int first_column;
|
||||||
|
int last_line;
|
||||||
|
int last_column;
|
||||||
|
} yyltype;
|
||||||
|
# define YYLTYPE yyltype
|
||||||
|
#endif])
|
||||||
|
|
||||||
|
namespace yy
|
||||||
|
{
|
||||||
|
class b4_name;
|
||||||
|
|
||||||
|
template < typename P >
|
||||||
|
struct Traits
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template < >
|
||||||
|
struct Traits< b4_name >
|
||||||
|
{
|
||||||
|
typedef b4_uint_type(b4_token_number_max) TokenNumberType;
|
||||||
|
typedef b4_sint_type(b4_rhs_number_max) RhsNumberType;
|
||||||
|
typedef int StateType;
|
||||||
|
typedef yystype SemanticType;
|
||||||
|
typedef b4_ltype LocationType;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace yy
|
||||||
|
{
|
||||||
|
class b4_name b4_inherit
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef Traits< b4_name >::TokenNumberType TokenNumberType;
|
||||||
|
typedef Traits< b4_name >::RhsNumberType RhsNumberType;
|
||||||
|
typedef Traits< b4_name >::StateType StateType;
|
||||||
|
typedef Traits< b4_name >::SemanticType SemanticType;
|
||||||
|
typedef Traits< b4_name >::LocationType LocationType;
|
||||||
|
|
||||||
|
typedef Stack< StateType > StateStack;
|
||||||
|
typedef Stack< SemanticType > SemanticStack;
|
||||||
|
typedef Stack< LocationType > LocationStack;
|
||||||
|
|
||||||
|
#if YYLSP_NEEDED
|
||||||
|
b4_name (bool debug,
|
||||||
|
LocationType initlocation[]b4_param) :
|
||||||
|
b4_constructor[]debug_ (debug),
|
||||||
|
initlocation_ (initlocation)
|
||||||
|
#else
|
||||||
|
b4_name (bool debug[]b4_param) :
|
||||||
|
b4_constructor[]debug_ (debug)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~b4_name ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int parse ();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
virtual void lex_ ();
|
||||||
|
virtual void error_ ();
|
||||||
|
virtual void print_ ();
|
||||||
|
|
||||||
|
/* Stacks. */
|
||||||
|
StateStack state_stack_;
|
||||||
|
SemanticStack semantic_stack_;
|
||||||
|
LocationStack location_stack_;
|
||||||
|
|
||||||
|
/* Tables. */
|
||||||
|
static const short pact_[[]];
|
||||||
|
static const short defact_[[]];
|
||||||
|
static const short pgoto_[[]];
|
||||||
|
static const short defgoto_[[]];
|
||||||
|
static const short table_[[]];
|
||||||
|
static const short check_[[]];
|
||||||
|
static const TokenNumberType r1_[[]];
|
||||||
|
static const short r2_[[]];
|
||||||
|
|
||||||
|
#if YYDEBUG || YYERROR_VERBOSE
|
||||||
|
static const char* const name_[[]];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* More tables, for debugging. */
|
||||||
|
#if YYDEBUG
|
||||||
|
static const RhsNumberType rhs_[[]];
|
||||||
|
static const short prhs_[[]];
|
||||||
|
static const short rline_[[]];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Even more tables. */
|
||||||
|
static inline TokenNumberType translate_ (int token);
|
||||||
|
|
||||||
|
/* Constants. */
|
||||||
|
static const int eof_;
|
||||||
|
static const int last_;
|
||||||
|
static const int flag_;
|
||||||
|
static const int nnts_;
|
||||||
|
static const int nsym_;
|
||||||
|
static const int empty_;
|
||||||
|
static const int final_;
|
||||||
|
static const int terror_;
|
||||||
|
static const int errcode_;
|
||||||
|
static const int ntokens_;
|
||||||
|
static const int initdepth_;
|
||||||
|
static const unsigned user_token_number_max_;
|
||||||
|
static const TokenNumberType undef_token_;
|
||||||
|
|
||||||
|
/* State. */
|
||||||
|
int n_;
|
||||||
|
int len_;
|
||||||
|
int debug_;
|
||||||
|
int state_;
|
||||||
|
|
||||||
|
/* Lookahead and lookahead in internal form. */
|
||||||
|
int looka_;
|
||||||
|
int ilooka_;
|
||||||
|
|
||||||
|
/* Message. */
|
||||||
|
std::string message;
|
||||||
|
|
||||||
|
/* Semantic value and location of lookahead token. */
|
||||||
|
SemanticType value;
|
||||||
|
LocationType location;
|
||||||
|
|
||||||
|
/* @$ and $$. */
|
||||||
|
SemanticType yyval;
|
||||||
|
LocationType yyloc;
|
||||||
|
|
||||||
|
/* Initial location. */
|
||||||
|
LocationType initlocation_;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* not b4_header_guard */
|
||||||
|
|
||||||
|
#output "b4_output_prefix[]b4_output_infix[].cc"
|
||||||
|
b4_copyright
|
||||||
|
|
||||||
|
#include "b4_output_header_name"
|
||||||
|
|
||||||
|
/* Enable debugging if requested. */
|
||||||
|
#if YYDEBUG
|
||||||
|
# include <cstdio>
|
||||||
|
# define YYFPRINTF std::fprintf
|
||||||
|
# define YYDPRINTF(Args) \
|
||||||
|
do { \
|
||||||
|
if (debug_) \
|
||||||
|
YYFPRINTF Args; \
|
||||||
|
} while (0)
|
||||||
|
#else /* !YYDEBUG */
|
||||||
|
# define YYDPRINTF(Args)
|
||||||
|
#endif /* !YYDEBUG */
|
||||||
|
|
||||||
|
int
|
||||||
|
yy::b4_name::parse ()
|
||||||
|
{
|
||||||
|
int nerrs = 0;
|
||||||
|
int errstatus = 0;
|
||||||
|
|
||||||
|
/* Initialize stack. */
|
||||||
|
state_stack_ = StateStack (0);
|
||||||
|
semantic_stack_ = SemanticStack (1);
|
||||||
|
location_stack_ = LocationStack (1);
|
||||||
|
|
||||||
|
/* Reserve initial space. The C parser needed that, but is it really
|
||||||
|
useful here? */
|
||||||
|
state_stack_.reserve (initdepth_);
|
||||||
|
semantic_stack_.reserve (initdepth_);
|
||||||
|
location_stack_.reserve (initdepth_);
|
||||||
|
|
||||||
|
/* Start. */
|
||||||
|
state_ = 0;
|
||||||
|
looka_ = empty_;
|
||||||
|
#if YYLSP_NEEDED
|
||||||
|
location = initlocation_;
|
||||||
|
#endif
|
||||||
|
YYDPRINTF ((stderr, "Starting parse\n"));
|
||||||
|
|
||||||
|
/* New state. */
|
||||||
|
yynewstate:
|
||||||
|
state_stack_.push (state_);
|
||||||
|
YYDPRINTF ((stderr, "Entering state %d\n", state_));
|
||||||
|
goto yybackup;
|
||||||
|
|
||||||
|
/* Backup. */
|
||||||
|
yybackup:
|
||||||
|
|
||||||
|
/* Try to take a decision without lookahead. */
|
||||||
|
n_ = pact_[[state_]];
|
||||||
|
if (n_ == flag_)
|
||||||
|
goto yydefault;
|
||||||
|
|
||||||
|
/* Read a lookahead token. */
|
||||||
|
if (looka_ == empty_)
|
||||||
|
{
|
||||||
|
YYDPRINTF ((stderr, "Reading a token: "));
|
||||||
|
lex_ ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Convert token to internal form. */
|
||||||
|
if (looka_ <= 0)
|
||||||
|
{
|
||||||
|
looka_ = eof_;
|
||||||
|
ilooka_ = 0;
|
||||||
|
YYDPRINTF ((stderr, "Now at end of input.\n"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ilooka_ = translate_ (looka_);
|
||||||
|
#if YYDEBUG
|
||||||
|
if (debug_)
|
||||||
|
{
|
||||||
|
YYFPRINTF (stderr, "Next token is %d (%s", looka_, name_[[ilooka_]]);
|
||||||
|
print_ ();
|
||||||
|
YYFPRINTF (stderr, ")\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
n_ += ilooka_;
|
||||||
|
if (n_ < 0 || n_ > last_ || check_[[n_]] != ilooka_)
|
||||||
|
goto yydefault;
|
||||||
|
|
||||||
|
/* Reduce or error. */
|
||||||
|
n_ = table_[[n_]];
|
||||||
|
if (n_ < 0)
|
||||||
|
{
|
||||||
|
if (n_ == flag_)
|
||||||
|
goto yyerrlab;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
n_ = -n_;
|
||||||
|
goto yyreduce;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (n_ == 0)
|
||||||
|
goto yyerrlab;
|
||||||
|
|
||||||
|
/* Accept? */
|
||||||
|
if (n_ == final_)
|
||||||
|
goto yyacceptlab;
|
||||||
|
|
||||||
|
/* Shift the lookahead token. */
|
||||||
|
YYDPRINTF ((stderr, "Shifting token %d (%s), ", looka_, name_[[ilooka_]]));
|
||||||
|
|
||||||
|
/* Discard the token being shifted unless it is eof. */
|
||||||
|
if (looka_ != eof_)
|
||||||
|
looka_ = empty_;
|
||||||
|
|
||||||
|
semantic_stack_.push (value);
|
||||||
|
location_stack_.push (location);
|
||||||
|
|
||||||
|
/* Count tokens shifted since error; after three, turn off error
|
||||||
|
status. */
|
||||||
|
if (errstatus)
|
||||||
|
--errstatus;
|
||||||
|
|
||||||
|
state_ = n_;
|
||||||
|
goto yynewstate;
|
||||||
|
|
||||||
|
/* Default action. */
|
||||||
|
yydefault:
|
||||||
|
n_ = defact_[[state_]];
|
||||||
|
if (n_ == 0)
|
||||||
|
goto yyerrlab;
|
||||||
|
goto yyreduce;
|
||||||
|
|
||||||
|
/* Reduce. */
|
||||||
|
yyreduce:
|
||||||
|
len_ = r2_[[n_]];
|
||||||
|
if (len_)
|
||||||
|
{
|
||||||
|
yyval = semantic_stack_[[1 - len_]];
|
||||||
|
yyloc = location_stack_[[1 - len_]];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
yyval = semantic_stack_[[0]];
|
||||||
|
yyloc = location_stack_[[0]];
|
||||||
|
}
|
||||||
|
|
||||||
|
#if YYDEBUG
|
||||||
|
if (debug_)
|
||||||
|
{
|
||||||
|
YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", n_ - 1, rline_[[n_]]);
|
||||||
|
for (unsigned i = prhs_[[n_]];
|
||||||
|
rhs_[[i]] >= 0; ++i)
|
||||||
|
YYFPRINTF (stderr, "%s ", name_[[rhs_[i]]]);
|
||||||
|
YYFPRINTF (stderr, "-> %s\n", name_[[r1_[n_]]]);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (len_)
|
||||||
|
{
|
||||||
|
Slice< LocationType, LocationStack > slice (location_stack_, len_);
|
||||||
|
YYLLOC_DEFAULT (yyloc, slice, len_);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
SemanticStack& yyvsp (semantic_stack_);
|
||||||
|
LocationStack& yylsp (location_stack_);
|
||||||
|
|
||||||
|
switch (n_)
|
||||||
|
{
|
||||||
|
b4_actions
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Line __line__ of __file__. */
|
||||||
|
#line __oline__ "__ofile__"
|
||||||
|
|
||||||
|
state_stack_.pop (len_);
|
||||||
|
semantic_stack_.pop (len_);
|
||||||
|
location_stack_.pop (len_);
|
||||||
|
|
||||||
|
#if YYDEBUG
|
||||||
|
if (debug_)
|
||||||
|
{
|
||||||
|
YYFPRINTF (stderr, "state stack now");
|
||||||
|
for (StateStack::ConstIterator i = state_stack_.begin ();
|
||||||
|
i != state_stack_.end (); ++i)
|
||||||
|
YYFPRINTF (stderr, " %d", *i);
|
||||||
|
YYFPRINTF (stderr, "\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
semantic_stack_.push (yyval);
|
||||||
|
location_stack_.push (yyloc);
|
||||||
|
|
||||||
|
/* Shift the result of the reduction. */
|
||||||
|
n_ = r1_[[n_]];
|
||||||
|
state_ = pgoto_[[n_ - ntokens_]] + state_stack_[[0]];
|
||||||
|
if (state_ >= 0 && state_ <= last_ && check_[[state_]] == state_stack_[[0]])
|
||||||
|
state_ = table_[[state_]];
|
||||||
|
else
|
||||||
|
state_ = defgoto_[[n_ - ntokens_]];
|
||||||
|
goto yynewstate;
|
||||||
|
|
||||||
|
/* Report and recover from errors. This is very incomplete. */
|
||||||
|
yyerrlab:
|
||||||
|
/* If not already recovering from an error, report this error. */
|
||||||
|
if (!errstatus)
|
||||||
|
{
|
||||||
|
++nerrs;
|
||||||
|
|
||||||
|
#if YYERROR_VERBOSE
|
||||||
|
n_ = pact_[[state_]];
|
||||||
|
if (n_ > flag_ && n_ < last_)
|
||||||
|
{
|
||||||
|
message = "parse error, unexpected ";
|
||||||
|
message += name_[[ilooka_]];
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
for (int x = (n_ < 0 ? -n_ : 0); x < ntokens_ + nnts_; ++x)
|
||||||
|
if (check_[[x + n_]] == x)
|
||||||
|
++count;
|
||||||
|
if (count < 5)
|
||||||
|
{
|
||||||
|
count = 0;
|
||||||
|
for (int x = (n_ < 0 ? -n_ : 0); x < ntokens_ + nnts_; ++x)
|
||||||
|
if (check_[[x + n_]] == x)
|
||||||
|
{
|
||||||
|
message += (!count++) ? ", expecting " : " or ";
|
||||||
|
message += name_[[x]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
message = "parse error";
|
||||||
|
error_ ();
|
||||||
|
}
|
||||||
|
goto yyerrlab1;
|
||||||
|
|
||||||
|
/* Error raised explicitly by an action. */
|
||||||
|
yyerrlab1:
|
||||||
|
if (errstatus == 3)
|
||||||
|
{
|
||||||
|
/* If just tried and failed to reuse lookahead token after an
|
||||||
|
error, discard it. */
|
||||||
|
|
||||||
|
/* Return failure if at end of input. */
|
||||||
|
if (looka_ == eof_)
|
||||||
|
goto yyabortlab;
|
||||||
|
YYDPRINTF ((stderr, "Discarding token %d (%s).\n", looka_, name_[[ilooka_]]));
|
||||||
|
looka_ = empty_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Else will try to reuse lookahead token after shifting the error
|
||||||
|
token. */
|
||||||
|
|
||||||
|
errstatus = 3;
|
||||||
|
goto yyerrhandle;
|
||||||
|
|
||||||
|
/* Pop the current state because it cannot handle the error token. */
|
||||||
|
yyerrdefault:
|
||||||
|
yyerrpop:
|
||||||
|
if (!state_stack_.height ())
|
||||||
|
goto yyabortlab;
|
||||||
|
state_ = (state_stack_.pop (), state_stack_[[0]]);
|
||||||
|
semantic_stack_.pop ();
|
||||||
|
location_stack_.pop ();;
|
||||||
|
|
||||||
|
#if YYDEBUG
|
||||||
|
if (debug_)
|
||||||
|
{
|
||||||
|
YYFPRINTF (stderr, "Error: state stack now");
|
||||||
|
for (StateStack::ConstIterator i = state_stack_.begin ();
|
||||||
|
i != state_stack_.end (); ++i)
|
||||||
|
YYFPRINTF (stderr, " %d", *i);
|
||||||
|
YYFPRINTF (stderr, "\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
yyerrhandle:
|
||||||
|
n_ = pact_[[state_]];
|
||||||
|
if (n_ == flag_)
|
||||||
|
goto yyerrdefault;
|
||||||
|
|
||||||
|
n_ += terror_;
|
||||||
|
if (n_ < 0 || n_ > last_ || check_[[n_]] != terror_)
|
||||||
|
goto yyerrdefault;
|
||||||
|
|
||||||
|
n_ = table_[[n_]];
|
||||||
|
if (n_ < 0)
|
||||||
|
{
|
||||||
|
if (n_ == flag_)
|
||||||
|
goto yyerrpop;
|
||||||
|
n_ = -n_;
|
||||||
|
goto yyreduce;
|
||||||
|
}
|
||||||
|
else if (!n_)
|
||||||
|
goto yyerrpop;
|
||||||
|
|
||||||
|
if (n_ == final_)
|
||||||
|
goto yyacceptlab;
|
||||||
|
|
||||||
|
YYDPRINTF ((stderr, "Shifting error token, "));
|
||||||
|
|
||||||
|
semantic_stack_.push (value);
|
||||||
|
location_stack_.push (location);
|
||||||
|
|
||||||
|
state_ = n_;
|
||||||
|
goto yynewstate;
|
||||||
|
|
||||||
|
/* Accept. */
|
||||||
|
yyacceptlab:
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* Abort. */
|
||||||
|
yyabortlab:
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
yy::b4_name::lex_ ()
|
||||||
|
{
|
||||||
|
#if YYLSP_NEEDED
|
||||||
|
looka_ = yylex (&value, &location);
|
||||||
|
#else
|
||||||
|
looka_ = yylex (&value);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing
|
||||||
|
STATE-NUM. */
|
||||||
|
const short
|
||||||
|
yy::b4_name::pact_[[]] =
|
||||||
|
{
|
||||||
|
b4_pact
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYDEFACT[[S]] -- default rule to reduce with in state S when YYTABLE
|
||||||
|
doesn't specify something else to do. Zero means the default is an
|
||||||
|
error. */
|
||||||
|
const short
|
||||||
|
yy::b4_name::defact_[[]] =
|
||||||
|
{
|
||||||
|
b4_defact
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYPGOTO[[NTERM-NUM]]. */
|
||||||
|
const short
|
||||||
|
yy::b4_name::pgoto_[[]] =
|
||||||
|
{
|
||||||
|
b4_pgoto
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYDEFGOTO[[NTERM-NUM]]. */
|
||||||
|
const short
|
||||||
|
yy::b4_name::defgoto_[[]] =
|
||||||
|
{
|
||||||
|
b4_defgoto
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYTABLE[[YYPACT[STATE-NUM]]]. What to do in state STATE-NUM. If
|
||||||
|
positive, shift that token. If negative, reduce the rule which
|
||||||
|
number is the opposite. If zero, do what YYDEFACT says. */
|
||||||
|
const short
|
||||||
|
yy::b4_name::table_[[]] =
|
||||||
|
{
|
||||||
|
b4_table
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYCHECK. */
|
||||||
|
const short
|
||||||
|
yy::b4_name::check_[[]] =
|
||||||
|
{
|
||||||
|
b4_check
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives. */
|
||||||
|
const yy::b4_name::TokenNumberType
|
||||||
|
yy::b4_name::r1_[[]] =
|
||||||
|
{
|
||||||
|
b4_r1
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYR2[[YYN]] -- Number of symbols composing right hand side of rule YYN. */
|
||||||
|
const short
|
||||||
|
yy::b4_name::r2_[[]] =
|
||||||
|
{
|
||||||
|
b4_r2
|
||||||
|
};
|
||||||
|
|
||||||
|
#if YYDEBUG || YYERROR_VERBOSE
|
||||||
|
/* YYTNAME[[SYMBOL-NUM]] -- String name of the symbol SYMBOL-NUM.
|
||||||
|
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
|
||||||
|
const char*
|
||||||
|
const yy::b4_name::name_[[]] =
|
||||||
|
{
|
||||||
|
b4_tname
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if YYDEBUG
|
||||||
|
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
||||||
|
const yy::b4_name::RhsNumberType
|
||||||
|
yy::b4_name::rhs_[[]] =
|
||||||
|
{
|
||||||
|
b4_rhs
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYPRHS[[YYN]] -- Index of the first RHS symbol of rule number YYN in
|
||||||
|
YYRHS. */
|
||||||
|
const short
|
||||||
|
yy::b4_name::prhs_[[]] =
|
||||||
|
{
|
||||||
|
b4_prhs
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYRLINE[[YYN]] -- source line where rule number YYN was defined. */
|
||||||
|
const short
|
||||||
|
yy::b4_name::rline_[[]] =
|
||||||
|
{
|
||||||
|
b4_rline
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||||
|
yy::b4_name::TokenNumberType
|
||||||
|
yy::b4_name::translate_ (int token)
|
||||||
|
{
|
||||||
|
static
|
||||||
|
const TokenNumberType
|
||||||
|
translate_[[]] =
|
||||||
|
{
|
||||||
|
b4_translate
|
||||||
|
};
|
||||||
|
if ((unsigned) token <= user_token_number_max_)
|
||||||
|
return translate_[[token]];
|
||||||
|
else
|
||||||
|
return undef_token_;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int yy::b4_name::eof_ = 0;
|
||||||
|
const int yy::b4_name::last_ = b4_last;
|
||||||
|
const int yy::b4_name::flag_ = b4_flag;
|
||||||
|
const int yy::b4_name::nnts_ = b4_nnts;
|
||||||
|
const int yy::b4_name::nsym_ = b4_nsym;
|
||||||
|
const int yy::b4_name::empty_ = -2;
|
||||||
|
const int yy::b4_name::final_ = b4_final;
|
||||||
|
const int yy::b4_name::terror_ = 1;
|
||||||
|
const int yy::b4_name::errcode_ = 256;
|
||||||
|
const int yy::b4_name::ntokens_ = b4_ntokens;
|
||||||
|
const int yy::b4_name::initdepth_ = b4_initdepth;
|
||||||
|
|
||||||
|
const unsigned yy::b4_name::user_token_number_max_ = b4_user_token_number_max;
|
||||||
|
const yy::b4_name::TokenNumberType yy::b4_name::undef_token_ = b4_undef_token_number;
|
||||||
|
|
||||||
|
b4_epilogue
|
||||||
|
|
||||||
|
#output "stack.hh"
|
||||||
|
b4_copyright
|
||||||
|
|
||||||
|
#ifndef BISON_STACK_HH
|
||||||
|
# define BISON_STACK_HH
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace yy
|
||||||
|
{
|
||||||
|
template < class T, class S = std::vector< T > >
|
||||||
|
class Stack
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef typename S::iterator Iterator;
|
||||||
|
typedef typename S::const_iterator ConstIterator;
|
||||||
|
|
||||||
|
Stack () : seq_ ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Stack (unsigned n) : seq_ (n)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
T&
|
||||||
|
operator [[]] (int index)
|
||||||
|
{
|
||||||
|
return seq_[[height () - 1 + index]];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
const T&
|
||||||
|
operator [[]] (int index) const
|
||||||
|
{
|
||||||
|
return seq_[[height () - 1 + index]];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void
|
||||||
|
push (const T& t)
|
||||||
|
{
|
||||||
|
seq_.push_back (t);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void
|
||||||
|
pop (unsigned n = 1)
|
||||||
|
{
|
||||||
|
for (; n; --n)
|
||||||
|
seq_.pop_back ();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void
|
||||||
|
reserve (unsigned n)
|
||||||
|
{
|
||||||
|
seq_.reserve (n);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
unsigned
|
||||||
|
height () const
|
||||||
|
{
|
||||||
|
return seq_.size ();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline ConstIterator begin () const { return seq_.begin (); }
|
||||||
|
inline ConstIterator end () const { return seq_.end (); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
S seq_;
|
||||||
|
};
|
||||||
|
|
||||||
|
template < class T, class S = Stack< T > >
|
||||||
|
class Slice
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
Slice (const S& stack,
|
||||||
|
unsigned range) : stack_ (stack),
|
||||||
|
range_ (range)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
const T&
|
||||||
|
operator [[]] (unsigned index) const
|
||||||
|
{
|
||||||
|
return stack_[[index - range_]];
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
const S& stack_;
|
||||||
|
unsigned range_;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // not BISON_STACK_HH
|
||||||
|
|
||||||
|
#output "location.hh"
|
||||||
|
b4_copyright
|
||||||
|
|
||||||
|
#ifndef BISON_LOCATION_HH
|
||||||
|
# define BISON_LOCATION_HH
|
||||||
|
|
||||||
|
namespace yy
|
||||||
|
{
|
||||||
|
struct Position
|
||||||
|
{
|
||||||
|
int line;
|
||||||
|
int column;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Location
|
||||||
|
{
|
||||||
|
Position first;
|
||||||
|
Position last;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // not BISON_LOCATION_HH
|
||||||
@@ -0,0 +1,336 @@
|
|||||||
|
%%{section} %%{output-prefix} %%{output-infix} %%".c"
|
||||||
|
/* -*- C -*- */
|
||||||
|
|
||||||
|
/* YYERROR and YYCOST are set by guards. If yyerror is set to a
|
||||||
|
nonzero value by a guard, the reduction with which the guard is
|
||||||
|
associated is not performed, and the error recovery mechanism is
|
||||||
|
invoked. Yycost indicates the cost of performing the reduction
|
||||||
|
given the attributes of the symbols. */
|
||||||
|
static int yyerror;
|
||||||
|
static int yycost;
|
||||||
|
|
||||||
|
/* YYMAXDEPTH indicates the size of the parser's state and value
|
||||||
|
stacks. */
|
||||||
|
|
||||||
|
#ifndef YYMAXDEPTH
|
||||||
|
# define YYMAXDEPTH 500
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* YYMAXRULES must be at least as large as the number of rules that
|
||||||
|
could be placed in the rule queue. That number could be determined
|
||||||
|
from the grammar and the size of the stack, but, as yet, it is not.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef YYMAXRULES
|
||||||
|
# define YYMAXRULES 100
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef YYMAXBACKUP
|
||||||
|
# define YYMAXBACKUP 100
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* The state stack. */
|
||||||
|
static short yyss[YYMAXDEPTH];
|
||||||
|
/* The semantic value stack. */
|
||||||
|
static YYSTYPE yyvs[YYMAXDEPTH];
|
||||||
|
/* The location stack. */
|
||||||
|
static YYLTYPE yyls[YYMAXDEPTH];
|
||||||
|
/* The rule queue. */
|
||||||
|
static short yyrq[YYMAXRULES];
|
||||||
|
/* The lookahead symbol. */
|
||||||
|
static int yychar;
|
||||||
|
|
||||||
|
/* the semantic value of the lookahead symbol. */
|
||||||
|
static YYSTYPE yylval;
|
||||||
|
|
||||||
|
/* the semantic value for the state at the top of the state stack. */
|
||||||
|
static YYSTYPE yytval;
|
||||||
|
|
||||||
|
/* the variable used to return semantic values from the action
|
||||||
|
routines. */
|
||||||
|
static YYSTYPE yyval;
|
||||||
|
|
||||||
|
/* location data for the lookahead symbol. */
|
||||||
|
static YYLTYPE yylloc;
|
||||||
|
|
||||||
|
/* location data for the state at the top of the state stack. */
|
||||||
|
static YYLTYPE yytloc;
|
||||||
|
|
||||||
|
|
||||||
|
static int yynunlexed;
|
||||||
|
static short yyunchar[YYMAXBACKUP];
|
||||||
|
static YYSTYPE yyunval[YYMAXBACKUP];
|
||||||
|
static YYLTYPE yyunloc[YYMAXBACKUP];
|
||||||
|
|
||||||
|
/* a pointer to the top of the state stack; only set during error
|
||||||
|
recovery. */
|
||||||
|
static short *yygssp;
|
||||||
|
|
||||||
|
/* a pointer to the top of the value stack; only set during error
|
||||||
|
recovery. */
|
||||||
|
static YYSTYPE *yygvsp;
|
||||||
|
|
||||||
|
/* a pointer to the top of the location stack; only set during error
|
||||||
|
recovery. */
|
||||||
|
static YYLTYPE *yyglsp;
|
||||||
|
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------.
|
||||||
|
| Yyget is an interface between the parser and the lexical analyzer. |
|
||||||
|
| It is costly to provide such an interface, but it avoids requiring |
|
||||||
|
| the lexical analyzer to be able to back up the scan. |
|
||||||
|
`--------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
yyget (void)
|
||||||
|
{
|
||||||
|
if (yynunlexed > 0)
|
||||||
|
{
|
||||||
|
yynunlexed--;
|
||||||
|
yychar = yyunchar[yynunlexed];
|
||||||
|
yylval = yyunval[yynunlexed];
|
||||||
|
yylloc = yyunloc[yynunlexed];
|
||||||
|
}
|
||||||
|
else if (yychar <= 0)
|
||||||
|
yychar = 0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
yychar = yylex ();
|
||||||
|
if (yychar < 0)
|
||||||
|
yychar = 0;
|
||||||
|
else
|
||||||
|
yychar = YYTRANSLATE (yychar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
yyunlex (int chr, YYSTYPE val, YYLTYPE loc)
|
||||||
|
{
|
||||||
|
yyunchar[yynunlexed] = chr;
|
||||||
|
yyunval[yynunlexed] = val;
|
||||||
|
yyunloc[yynunlexed] = loc;
|
||||||
|
yynunlexed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
yyrestore (short *first, short *last)
|
||||||
|
{
|
||||||
|
short *ssp;
|
||||||
|
short *rp;
|
||||||
|
int symbol;
|
||||||
|
int state;
|
||||||
|
int tvalsaved;
|
||||||
|
|
||||||
|
ssp = yygssp;
|
||||||
|
yyunlex (yychar, yylval, yylloc);
|
||||||
|
|
||||||
|
tvalsaved = 0;
|
||||||
|
while (first != last)
|
||||||
|
{
|
||||||
|
symbol = yystos[*ssp];
|
||||||
|
if (symbol < YYNTBASE)
|
||||||
|
{
|
||||||
|
yyunlex (symbol, yytval, yytloc);
|
||||||
|
tvalsaved = 1;
|
||||||
|
ssp--;
|
||||||
|
}
|
||||||
|
|
||||||
|
ssp--;
|
||||||
|
|
||||||
|
if (first == yyrq)
|
||||||
|
first = yyrq + YYMAXRULES;
|
||||||
|
|
||||||
|
first--;
|
||||||
|
|
||||||
|
for (rp = yyrhs + yyprhs[*first]; symbol = *rp; rp++)
|
||||||
|
{
|
||||||
|
if (symbol < YYNTBASE)
|
||||||
|
state = yytable[yypact[*ssp] + symbol];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
state = yypgoto[symbol - YYNTBASE] + *ssp;
|
||||||
|
|
||||||
|
if (state >= 0 && state <= YYLAST && yycheck[state] == *ssp)
|
||||||
|
state = yytable[state];
|
||||||
|
else
|
||||||
|
state = yydefgoto[symbol - YYNTBASE];
|
||||||
|
}
|
||||||
|
|
||||||
|
*++ssp = state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!tvalsaved && ssp > yyss)
|
||||||
|
{
|
||||||
|
yyunlex (yystos[*ssp], yytval, yytloc);
|
||||||
|
ssp--;
|
||||||
|
}
|
||||||
|
|
||||||
|
yygssp = ssp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
yyparse (void)
|
||||||
|
{
|
||||||
|
int yystate;
|
||||||
|
int yyn;
|
||||||
|
short *yyssp;
|
||||||
|
short *yyrq0;
|
||||||
|
short *yyptr;
|
||||||
|
YYSTYPE *yyvsp;
|
||||||
|
|
||||||
|
int yylen;
|
||||||
|
YYLTYPE *yylsp;
|
||||||
|
short *yyrq1;
|
||||||
|
short *yyrq2;
|
||||||
|
|
||||||
|
yystate = 0;
|
||||||
|
yyssp = yyss - 1;
|
||||||
|
yyvsp = yyvs - 1;
|
||||||
|
yylsp = yyls - 1;
|
||||||
|
yyrq0 = yyrq;
|
||||||
|
yyrq1 = yyrq0;
|
||||||
|
yyrq2 = yyrq0;
|
||||||
|
|
||||||
|
yychar = yylex ();
|
||||||
|
if (yychar < 0)
|
||||||
|
yychar = 0;
|
||||||
|
else
|
||||||
|
yychar = YYTRANSLATE (yychar);
|
||||||
|
|
||||||
|
yynewstate:
|
||||||
|
|
||||||
|
if (yyssp >= yyss + YYMAXDEPTH - 1)
|
||||||
|
{
|
||||||
|
yyabort ("Parser Stack Overflow");
|
||||||
|
YYABORT;
|
||||||
|
}
|
||||||
|
|
||||||
|
*++yyssp = yystate;
|
||||||
|
|
||||||
|
yyresume:
|
||||||
|
|
||||||
|
yyn = yypact[yystate];
|
||||||
|
if (yyn == YYFLAG)
|
||||||
|
goto yydefault;
|
||||||
|
|
||||||
|
yyn += yychar;
|
||||||
|
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar)
|
||||||
|
goto yydefault;
|
||||||
|
|
||||||
|
yyn = yytable[yyn];
|
||||||
|
if (yyn < 0)
|
||||||
|
{
|
||||||
|
yyn = -yyn;
|
||||||
|
goto yyreduce;
|
||||||
|
}
|
||||||
|
else if (yyn == 0)
|
||||||
|
goto yyerrlab;
|
||||||
|
|
||||||
|
yystate = yyn;
|
||||||
|
|
||||||
|
yyptr = yyrq2;
|
||||||
|
while (yyptr != yyrq1)
|
||||||
|
{
|
||||||
|
yyn = *yyptr++;
|
||||||
|
yylen = yyr2[yyn];
|
||||||
|
yyvsp -= yylen;
|
||||||
|
yylsp -= yylen;
|
||||||
|
|
||||||
|
yyguard (yyn, yyvsp, yylsp);
|
||||||
|
if (yyerror)
|
||||||
|
goto yysemerr;
|
||||||
|
|
||||||
|
yyaction (yyn, yyvsp, yylsp);
|
||||||
|
*++yyvsp = yyval;
|
||||||
|
|
||||||
|
yylsp++;
|
||||||
|
if (yylen == 0)
|
||||||
|
{
|
||||||
|
yylsp->first_line = yytloc.first_line;
|
||||||
|
yylsp->first_column = yytloc.first_column;
|
||||||
|
yylsp->last_line = (yylsp - 1)->last_line;
|
||||||
|
yylsp->last_column = (yylsp - 1)->last_column;
|
||||||
|
yylsp->text = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
yylsp->last_line = (yylsp + yylen - 1)->last_line;
|
||||||
|
yylsp->last_column = (yylsp + yylen - 1)->last_column;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (yyptr == yyrq + YYMAXRULES)
|
||||||
|
yyptr = yyrq;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (yystate == YYFINAL)
|
||||||
|
YYACCEPT;
|
||||||
|
|
||||||
|
yyrq2 = yyptr;
|
||||||
|
yyrq1 = yyrq0;
|
||||||
|
|
||||||
|
*++yyvsp = yytval;
|
||||||
|
*++yylsp = yytloc;
|
||||||
|
yytval = yylval;
|
||||||
|
yytloc = yylloc;
|
||||||
|
yyget ();
|
||||||
|
|
||||||
|
goto yynewstate;
|
||||||
|
|
||||||
|
yydefault:
|
||||||
|
|
||||||
|
yyn = yydefact[yystate];
|
||||||
|
if (yyn == 0)
|
||||||
|
goto yyerrlab;
|
||||||
|
|
||||||
|
yyreduce:
|
||||||
|
|
||||||
|
*yyrq0++ = yyn;
|
||||||
|
|
||||||
|
if (yyrq0 == yyrq + YYMAXRULES)
|
||||||
|
yyrq0 = yyrq;
|
||||||
|
|
||||||
|
if (yyrq0 == yyrq2)
|
||||||
|
{
|
||||||
|
yyabort ("Parser Rule Queue Overflow");
|
||||||
|
YYABORT;
|
||||||
|
}
|
||||||
|
|
||||||
|
yyssp -= yyr2[yyn];
|
||||||
|
yyn = yyr1[yyn];
|
||||||
|
|
||||||
|
yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
|
||||||
|
if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
|
||||||
|
yystate = yytable[yystate];
|
||||||
|
else
|
||||||
|
yystate = yydefgoto[yyn - YYNTBASE];
|
||||||
|
|
||||||
|
goto yynewstate;
|
||||||
|
|
||||||
|
yysemerr:
|
||||||
|
*--yyptr = yyn;
|
||||||
|
yyrq2 = yyptr;
|
||||||
|
yyvsp += yyr2[yyn];
|
||||||
|
|
||||||
|
yyerrlab:
|
||||||
|
|
||||||
|
yygssp = yyssp;
|
||||||
|
yygvsp = yyvsp;
|
||||||
|
yyglsp = yylsp;
|
||||||
|
yyrestore (yyrq0, yyrq2);
|
||||||
|
yyrecover ();
|
||||||
|
yystate = *yygssp;
|
||||||
|
yyssp = yygssp;
|
||||||
|
yyvsp = yygvsp;
|
||||||
|
yyrq0 = yyrq;
|
||||||
|
yyrq1 = yyrq0;
|
||||||
|
yyrq2 = yyrq0;
|
||||||
|
goto yyresume;
|
||||||
|
}
|
||||||
|
|
||||||
|
%%{actions}
|
||||||
+1224
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
|||||||
|
# This file is part of -*- Autoconf -*-.
|
||||||
|
# Version of Autoconf.
|
||||||
|
# Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
m4_define([m4_PACKAGE_NAME], [GNU Autoconf])
|
||||||
|
m4_define([m4_PACKAGE_TARNAME], [autoconf])
|
||||||
|
m4_define([m4_PACKAGE_VERSION], [2.52h])
|
||||||
|
m4_define([m4_PACKAGE_STRING], [GNU Autoconf 2.52h])
|
||||||
|
m4_define([m4_PACKAGE_BUGREPORT], [[email protected]])
|
||||||
@@ -6,6 +6,7 @@ bison.dvi
|
|||||||
bison.fn
|
bison.fn
|
||||||
bison.ky
|
bison.ky
|
||||||
bison.log
|
bison.log
|
||||||
|
bison.pdf
|
||||||
bison.pg
|
bison.pg
|
||||||
bison.ps
|
bison.ps
|
||||||
bison.toc
|
bison.toc
|
||||||
@@ -14,3 +15,7 @@ bison.vr
|
|||||||
refcard.dvi
|
refcard.dvi
|
||||||
refcard.log
|
refcard.log
|
||||||
refcard.ps
|
refcard.ps
|
||||||
|
Makefile.in
|
||||||
|
*.info*
|
||||||
|
stamp-vti
|
||||||
|
version.texi
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
AUTOMAKE_OPTIONS = 1.4
|
|
||||||
|
|
||||||
info_TEXINFOS = bison.texinfo
|
info_TEXINFOS = bison.texinfo
|
||||||
man_MANS = bison.1
|
man_MANS = bison.1
|
||||||
|
|||||||
+2
-2
@@ -262,9 +262,9 @@ and so on.
|
|||||||
.ns
|
.ns
|
||||||
.TP
|
.TP
|
||||||
.B \-\-debug
|
.B \-\-debug
|
||||||
Output a definition of the macro
|
In the parser file, define the macro
|
||||||
.B YYDEBUG
|
.B YYDEBUG
|
||||||
into the parser file,
|
to 1 if it is not already defined,
|
||||||
so that the debugging facilities are compiled.
|
so that the debugging facilities are compiled.
|
||||||
.TP
|
.TP
|
||||||
.B \-v
|
.B \-v
|
||||||
|
|||||||
+2
-1
@@ -56,7 +56,8 @@ foo_tab.c.
|
|||||||
.indent -1
|
.indent -1
|
||||||
2 /DEBUG
|
2 /DEBUG
|
||||||
.skip
|
.skip
|
||||||
Output a definition of the macro YYDEBUG into the parser file,
|
In the parser file,
|
||||||
|
define the macro YYDEBUG to 1 if it is not already defined,
|
||||||
so that the debugging facilities are compiled.
|
so that the debugging facilities are compiled.
|
||||||
.skip
|
.skip
|
||||||
.indent -1
|
.indent -1
|
||||||
|
|||||||
+455
-313
File diff suppressed because it is too large
Load Diff
+19
-13
@@ -19,7 +19,7 @@
|
|||||||
\def\finalout{\overfullrule=0pt}
|
\def\finalout{\overfullrule=0pt}
|
||||||
%\finalout
|
%\finalout
|
||||||
|
|
||||||
% Copyright (c) 1998 Free Software Foundation, Inc.
|
% Copyright (c) 1998, 2001 Free Software Foundation, Inc.
|
||||||
%
|
%
|
||||||
% This file is part of Bison.
|
% This file is part of Bison.
|
||||||
%
|
%
|
||||||
@@ -66,11 +66,11 @@
|
|||||||
% We only change the following to change the version numbers and
|
% We only change the following to change the version numbers and
|
||||||
% such.
|
% such.
|
||||||
|
|
||||||
\def\bisonversion{1.20} % the bison version
|
\def\bisonversion{1.31} % the bison version
|
||||||
|
|
||||||
\def\refcardversion{0.4a} % reference card version
|
\def\refcardversion{0.5} % reference card version
|
||||||
\def\month{August} % month
|
\def\month{November} % month
|
||||||
\def\year{1998} % year
|
\def\year{2001} % year
|
||||||
\def\version{\month\ \year, Bison Refcard Version \refcardversion}
|
\def\version{\month\ \year, Bison Refcard Version \refcardversion}
|
||||||
|
|
||||||
% for copyright notices
|
% for copyright notices
|
||||||
@@ -316,10 +316,13 @@ Options can be used as: \kbd{bison {\it options} {\it filename}}
|
|||||||
\section{Command Line Options}
|
\section{Command Line Options}
|
||||||
%*****************************
|
%*****************************
|
||||||
|
|
||||||
|
\key{Display usage information.} {-h}
|
||||||
|
\key{Display version information.} {-V}
|
||||||
\key{Generate token and {\tt YYSTYPE} definitions.} {-d}
|
\key{Generate token and {\tt YYSTYPE} definitions.} {-d}
|
||||||
|
\key{Prepend a prefix to external symbols.} {-p {\it prefix}}
|
||||||
\key{Don't put {\tt \#line} directives in the parser.} {-l}
|
\key{Don't put {\tt \#line} directives in the parser.} {-l}
|
||||||
\key{Specify the output file.} {-o {\it filename}}
|
\key{Specify the output file.} {-o {\it filename}}
|
||||||
\key{Debug or {\it trace} mode.} {-t}
|
\key{Debug or {\it trace} mode.} {-t}
|
||||||
\key{Verbose description of the parser.} {-v}
|
\key{Verbose description of the parser.} {-v}
|
||||||
\key{Emulate {\tt yacc} (generate {\tt y.tab.*} files).} {-y}
|
\key{Emulate {\tt yacc} (generate {\tt y.tab.*} files).} {-y}
|
||||||
|
|
||||||
@@ -362,8 +365,8 @@ definition, {\it n} is a {\it terminal} symbol name, {\it m} is a
|
|||||||
\vskip .10truein
|
\vskip .10truein
|
||||||
|
|
||||||
The {\tt <{\it t\/}>} after {\tt \%token, \%left, \%right} and {\tt
|
The {\tt <{\it t\/}>} after {\tt \%token, \%left, \%right} and {\tt
|
||||||
\%nonassoc} is optional. Additionally, precedence may be overridden with
|
\%nonassoc} is optional. Additionally, precedence may be overridden
|
||||||
embedded {\tt \%prec} commands.
|
in the rules with {\tt \%prec} commands.
|
||||||
|
|
||||||
\section{Parser Definition Files}
|
\section{Parser Definition Files}
|
||||||
%*********************************
|
%*********************************
|
||||||
@@ -397,6 +400,7 @@ The general form for a parser definition is:
|
|||||||
|
|
||||||
Rules take the form:
|
Rules take the form:
|
||||||
|
|
||||||
|
\vskip -\baselineskip
|
||||||
\beginexample
|
\beginexample
|
||||||
non-terminal : {\it statement} 1
|
non-terminal : {\it statement} 1
|
||||||
| {\it statement} 2
|
| {\it statement} 2
|
||||||
@@ -439,15 +443,17 @@ For example:
|
|||||||
\key{Access data associated with a symbol.} {\$\$, \$0\dots\${\it n}}
|
\key{Access data associated with a symbol.} {\$\$, \$0\dots\${\it n}}
|
||||||
\key{Access a field of the data union.} {\$\$.{\it t},
|
\key{Access a field of the data union.} {\$\$.{\it t},
|
||||||
\$0.{\it t}\dots\${\it n}.{\it t}}
|
\$0.{\it t}\dots\${\it n}.{\it t}}
|
||||||
\key{Access data's line position.} {@{\it n}.{\it line\_spec}}
|
\key{Access symbol's location.} {@\$, @0\dots@{\it n}}
|
||||||
\key{Access data's column position.} {@{\it n}.{\it column\_spec}}
|
\key{Access data's line location.} {@{\it x}.{\it line\_spec}}
|
||||||
|
\key{Access data's column location.} {@{\it x}.{\it column\_spec}}
|
||||||
|
|
||||||
|
|
||||||
\vskip .10truein
|
\vskip .10truein
|
||||||
|
%
|
||||||
Where {\it t} is a type defined in the {\tt \%union}, {\it n} is a
|
Where {\it t} is a type defined in the {\tt \%union}, {\it n} is a
|
||||||
number, {\it line\_spec} one of {\tt first_line} and {\tt last_line},
|
number, {\it x} is a number or \$, {\it line\_spec} one of {\tt
|
||||||
and {\it column\_spec} is specified as either {\tt first_column} or {\tt
|
first_line} and {\tt last_line}, and {\it column\_spec} is specified
|
||||||
last_column}.
|
as either {\tt first_column} or {\tt last_column}.
|
||||||
|
|
||||||
\section {Variables and Types}
|
\section {Variables and Types}
|
||||||
%*****************************
|
%*****************************
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
Makefile
|
|
||||||
+2
-1
@@ -1,4 +1,5 @@
|
|||||||
*_.c
|
*_.c
|
||||||
.deps
|
.deps
|
||||||
Makefile
|
Makefile
|
||||||
ansi2knr
|
ansi2knr ansi2knr.*
|
||||||
|
Makefile.in
|
||||||
|
|||||||
+39
-9
@@ -1,23 +1,53 @@
|
|||||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
## Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
## This program is free software; you can redistribute it and/or modify
|
||||||
|
## it under the terms of the GNU General Public License as published by
|
||||||
|
## the Free Software Foundation; either version 2 of the License, or
|
||||||
|
## (at your option) any later version.
|
||||||
|
|
||||||
|
## This program is distributed in the hope that it will be useful,
|
||||||
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
## GNU General Public License for more details.
|
||||||
|
|
||||||
|
## You should have received a copy of the GNU General Public License
|
||||||
|
## along with this program; if not, write to the Free Software
|
||||||
|
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||||
|
## 02111-1307 USA
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = ansi2knr
|
AUTOMAKE_OPTIONS = ansi2knr
|
||||||
|
|
||||||
|
CFLAGS = @CFLAGS@ $(WARNING_CFLAGS)
|
||||||
|
|
||||||
noinst_LIBRARIES = libbison.a
|
noinst_LIBRARIES = libbison.a
|
||||||
|
|
||||||
INCLUDES = -I.. -I$(srcdir) -I$(top_srcdir)/src -I../intl
|
# libintl.h in is build/intl, libgettext.h in src/intl/,
|
||||||
|
# config.h in build/., and system.h is in src/src/.
|
||||||
|
INCLUDES = -I$(top_builddir)/intl \
|
||||||
|
-I$(top_builddir) \
|
||||||
|
-I$(top_srcdir)/src \
|
||||||
|
-I$(top_srcdir)/intl \
|
||||||
|
-I$(top_srcdir)/lib
|
||||||
|
|
||||||
# Heck, we are still using an old version of Automake which does not
|
# Heck, we are still using an old version of Automake which does not
|
||||||
# understand LIBOBJ additions using $objext...
|
# understand inner AC_LIBOBJ (i.e., from Autoconf itself, not from
|
||||||
|
# configure.in).
|
||||||
EXTRA_DIST = malloc.c realloc.c
|
EXTRA_DIST = malloc.c realloc.c strnlen.c
|
||||||
|
|
||||||
libbison_a_SOURCES = \
|
libbison_a_SOURCES = \
|
||||||
error.c error.h \
|
gettext.h \
|
||||||
|
basename.c dirname.h dirname.c \
|
||||||
getopt.h getopt.c getopt1.c \
|
getopt.h getopt.c getopt1.c \
|
||||||
hash.h hash.c \
|
hash.h hash.c \
|
||||||
obstack.h obstack.c \
|
|
||||||
quote.h quote.c quotearg.h quotearg.c \
|
quote.h quote.c quotearg.h quotearg.c \
|
||||||
xalloc.h xmalloc.c xstrdup.c
|
xalloc.h xmalloc.c xstrdup.c xstrndup.c \
|
||||||
|
readpipe.c
|
||||||
|
|
||||||
libbison_a_LIBADD = @LIBOBJS@
|
# Implementation of bitsets
|
||||||
|
libbison_a_SOURCES += \
|
||||||
|
bbitset.h \
|
||||||
|
bitset-int.h bitset.h bitsetv.h ebitset.h lbitset.h sbitset.h \
|
||||||
|
bitset.c bitsetv.c ebitset.c lbitset.c sbitset.c
|
||||||
|
|
||||||
|
libbison_a_LIBADD = @LIBOBJS@ @ALLOCA@
|
||||||
libbison_a_DEPENDENCIES = $(libbison_a_LIBADD)
|
libbison_a_DEPENDENCIES = $(libbison_a_LIBADD)
|
||||||
|
|||||||
+66
-66
@@ -22,18 +22,18 @@
|
|||||||
your main control loop, etc. to force garbage collection. */
|
your main control loop, etc. to force garbage collection. */
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_STRING_H
|
#if HAVE_STRING_H
|
||||||
#include <string.h>
|
# include <string.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_STDLIB_H
|
#if HAVE_STDLIB_H
|
||||||
#include <stdlib.h>
|
# include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef emacs
|
#ifdef emacs
|
||||||
#include "blockinput.h"
|
# include "blockinput.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If compiling with GCC 2, this file's not needed. */
|
/* If compiling with GCC 2, this file's not needed. */
|
||||||
@@ -41,41 +41,41 @@
|
|||||||
|
|
||||||
/* If someone has defined alloca as a macro,
|
/* If someone has defined alloca as a macro,
|
||||||
there must be some other way alloca is supposed to work. */
|
there must be some other way alloca is supposed to work. */
|
||||||
#ifndef alloca
|
# ifndef alloca
|
||||||
|
|
||||||
#ifdef emacs
|
# ifdef emacs
|
||||||
#ifdef static
|
# ifdef static
|
||||||
/* actually, only want this if static is defined as ""
|
/* actually, only want this if static is defined as ""
|
||||||
-- this is for usg, in which emacs must undefine static
|
-- this is for usg, in which emacs must undefine static
|
||||||
in order to make unexec workable
|
in order to make unexec workable
|
||||||
*/
|
*/
|
||||||
#ifndef STACK_DIRECTION
|
# ifndef STACK_DIRECTION
|
||||||
you
|
you
|
||||||
lose
|
lose
|
||||||
-- must know STACK_DIRECTION at compile-time
|
-- must know STACK_DIRECTION at compile-time
|
||||||
#endif /* STACK_DIRECTION undefined */
|
# endif /* STACK_DIRECTION undefined */
|
||||||
#endif /* static */
|
# endif /* static */
|
||||||
#endif /* emacs */
|
# endif /* emacs */
|
||||||
|
|
||||||
/* If your stack is a linked list of frames, you have to
|
/* If your stack is a linked list of frames, you have to
|
||||||
provide an "address metric" ADDRESS_FUNCTION macro. */
|
provide an "address metric" ADDRESS_FUNCTION macro. */
|
||||||
|
|
||||||
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
# if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||||
long i00afunc ();
|
long i00afunc ();
|
||||||
#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
|
# define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
|
||||||
#else
|
# else
|
||||||
#define ADDRESS_FUNCTION(arg) &(arg)
|
# define ADDRESS_FUNCTION(arg) &(arg)
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#if __STDC__
|
# if __STDC__
|
||||||
typedef void *pointer;
|
typedef void *pointer;
|
||||||
#else
|
# else
|
||||||
typedef char *pointer;
|
typedef char *pointer;
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#ifndef NULL
|
# ifndef NULL
|
||||||
#define NULL 0
|
# define NULL 0
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
/* Different portions of Emacs need to call different versions of
|
/* Different portions of Emacs need to call different versions of
|
||||||
malloc. The Emacs executable needs alloca to call xmalloc, because
|
malloc. The Emacs executable needs alloca to call xmalloc, because
|
||||||
@@ -83,13 +83,14 @@ typedef char *pointer;
|
|||||||
hand, the utilities in lib-src need alloca to call malloc; some of
|
hand, the utilities in lib-src need alloca to call malloc; some of
|
||||||
them are very simple, and don't have an xmalloc routine.
|
them are very simple, and don't have an xmalloc routine.
|
||||||
|
|
||||||
Non-Emacs programs expect this to call use xmalloc.
|
Non-Emacs programs expect this to call xmalloc.
|
||||||
|
|
||||||
Callers below should use malloc. */
|
Callers below should use malloc. */
|
||||||
|
|
||||||
#ifndef emacs
|
# ifndef emacs
|
||||||
#define malloc xmalloc
|
# undef malloc
|
||||||
#endif
|
# define malloc xmalloc
|
||||||
|
# endif
|
||||||
extern pointer malloc ();
|
extern pointer malloc ();
|
||||||
|
|
||||||
/* Define STACK_DIRECTION if you know the direction of stack
|
/* Define STACK_DIRECTION if you know the direction of stack
|
||||||
@@ -100,18 +101,18 @@ extern pointer malloc ();
|
|||||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||||
|
|
||||||
#ifndef STACK_DIRECTION
|
# ifndef STACK_DIRECTION
|
||||||
#define STACK_DIRECTION 0 /* Direction unknown. */
|
# define STACK_DIRECTION 0 /* Direction unknown. */
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#if STACK_DIRECTION != 0
|
# if STACK_DIRECTION != 0
|
||||||
|
|
||||||
#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
|
# define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
|
||||||
|
|
||||||
#else /* STACK_DIRECTION == 0; need run-time code. */
|
# else /* STACK_DIRECTION == 0; need run-time code. */
|
||||||
|
|
||||||
static int stack_dir; /* 1 or -1 once known. */
|
static int stack_dir; /* 1 or -1 once known. */
|
||||||
#define STACK_DIR stack_dir
|
# define STACK_DIR stack_dir
|
||||||
|
|
||||||
static void
|
static void
|
||||||
find_stack_direction ()
|
find_stack_direction ()
|
||||||
@@ -135,7 +136,7 @@ find_stack_direction ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* STACK_DIRECTION == 0 */
|
# endif /* STACK_DIRECTION == 0 */
|
||||||
|
|
||||||
/* An "alloca header" is used to:
|
/* An "alloca header" is used to:
|
||||||
(a) chain together all alloca'ed blocks;
|
(a) chain together all alloca'ed blocks;
|
||||||
@@ -144,9 +145,9 @@ find_stack_direction ()
|
|||||||
It is very important that sizeof(header) agree with malloc
|
It is very important that sizeof(header) agree with malloc
|
||||||
alignment chunk size. The following default should work okay. */
|
alignment chunk size. The following default should work okay. */
|
||||||
|
|
||||||
#ifndef ALIGN_SIZE
|
# ifndef ALIGN_SIZE
|
||||||
#define ALIGN_SIZE sizeof(double)
|
# define ALIGN_SIZE sizeof(double)
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
typedef union hdr
|
typedef union hdr
|
||||||
{
|
{
|
||||||
@@ -168,16 +169,15 @@ static header *last_alloca_header = NULL; /* -> last alloca header. */
|
|||||||
implementations of C, for example under Gould's UTX/32. */
|
implementations of C, for example under Gould's UTX/32. */
|
||||||
|
|
||||||
pointer
|
pointer
|
||||||
alloca (size)
|
alloca (size_t size)
|
||||||
unsigned size;
|
|
||||||
{
|
{
|
||||||
auto char probe; /* Probes stack depth: */
|
auto char probe; /* Probes stack depth: */
|
||||||
register char *depth = ADDRESS_FUNCTION (probe);
|
register char *depth = ADDRESS_FUNCTION (probe);
|
||||||
|
|
||||||
#if STACK_DIRECTION == 0
|
# if STACK_DIRECTION == 0
|
||||||
if (STACK_DIR == 0) /* Unknown growth direction. */
|
if (STACK_DIR == 0) /* Unknown growth direction. */
|
||||||
find_stack_direction ();
|
find_stack_direction ();
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
/* Reclaim garbage, defined as all alloca'd storage that
|
/* Reclaim garbage, defined as all alloca'd storage that
|
||||||
was allocated from deeper in the stack than currently. */
|
was allocated from deeper in the stack than currently. */
|
||||||
@@ -185,9 +185,9 @@ alloca (size)
|
|||||||
{
|
{
|
||||||
register header *hp; /* Traverses linked list. */
|
register header *hp; /* Traverses linked list. */
|
||||||
|
|
||||||
#ifdef emacs
|
# ifdef emacs
|
||||||
BLOCK_INPUT;
|
BLOCK_INPUT;
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
for (hp = last_alloca_header; hp != NULL;)
|
for (hp = last_alloca_header; hp != NULL;)
|
||||||
if ((STACK_DIR > 0 && hp->h.deep > depth)
|
if ((STACK_DIR > 0 && hp->h.deep > depth)
|
||||||
@@ -204,9 +204,9 @@ alloca (size)
|
|||||||
|
|
||||||
last_alloca_header = hp; /* -> last valid storage. */
|
last_alloca_header = hp; /* -> last valid storage. */
|
||||||
|
|
||||||
#ifdef emacs
|
# ifdef emacs
|
||||||
UNBLOCK_INPUT;
|
UNBLOCK_INPUT;
|
||||||
#endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
@@ -232,15 +232,15 @@ alloca (size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
# if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||||
|
|
||||||
#ifdef DEBUG_I00AFUNC
|
# ifdef DEBUG_I00AFUNC
|
||||||
#include <stdio.h>
|
# include <stdio.h>
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#ifndef CRAY_STACK
|
# ifndef CRAY_STACK
|
||||||
#define CRAY_STACK
|
# define CRAY_STACK
|
||||||
#ifndef CRAY2
|
# ifndef CRAY2
|
||||||
/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
|
/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
|
||||||
struct stack_control_header
|
struct stack_control_header
|
||||||
{
|
{
|
||||||
@@ -292,7 +292,7 @@ struct stack_segment_linkage
|
|||||||
long sss7;
|
long sss7;
|
||||||
};
|
};
|
||||||
|
|
||||||
#else /* CRAY2 */
|
# else /* CRAY2 */
|
||||||
/* The following structure defines the vector of words
|
/* The following structure defines the vector of words
|
||||||
returned by the STKSTAT library routine. */
|
returned by the STKSTAT library routine. */
|
||||||
struct stk_stat
|
struct stk_stat
|
||||||
@@ -345,10 +345,10 @@ struct stk_trailer
|
|||||||
long unknown14;
|
long unknown14;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* CRAY2 */
|
# endif /* CRAY2 */
|
||||||
#endif /* not CRAY_STACK */
|
# endif /* not CRAY_STACK */
|
||||||
|
|
||||||
#ifdef CRAY2
|
# ifdef CRAY2
|
||||||
/* Determine a "stack measure" for an arbitrary ADDRESS.
|
/* Determine a "stack measure" for an arbitrary ADDRESS.
|
||||||
I doubt that "lint" will like this much. */
|
I doubt that "lint" will like this much. */
|
||||||
|
|
||||||
@@ -419,7 +419,7 @@ i00afunc (long *address)
|
|||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* not CRAY2 */
|
# else /* not CRAY2 */
|
||||||
/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
|
/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
|
||||||
Determine the number of the cell within the stack,
|
Determine the number of the cell within the stack,
|
||||||
given the address of the cell. The purpose of this
|
given the address of the cell. The purpose of this
|
||||||
@@ -464,9 +464,9 @@ i00afunc (long address)
|
|||||||
|
|
||||||
while (!(this_segment <= address && address <= stkl))
|
while (!(this_segment <= address && address <= stkl))
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_I00AFUNC
|
# ifdef DEBUG_I00AFUNC
|
||||||
fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
|
fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
|
||||||
#endif
|
# endif
|
||||||
if (pseg == 0)
|
if (pseg == 0)
|
||||||
break;
|
break;
|
||||||
stkl = stkl - pseg;
|
stkl = stkl - pseg;
|
||||||
@@ -485,9 +485,9 @@ i00afunc (long address)
|
|||||||
|
|
||||||
while (pseg != 0)
|
while (pseg != 0)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_I00AFUNC
|
# ifdef DEBUG_I00AFUNC
|
||||||
fprintf (stderr, "%011o %011o\n", pseg, size);
|
fprintf (stderr, "%011o %011o\n", pseg, size);
|
||||||
#endif
|
# endif
|
||||||
stkl = stkl - pseg;
|
stkl = stkl - pseg;
|
||||||
ssptr = (struct stack_segment_linkage *) stkl;
|
ssptr = (struct stack_segment_linkage *) stkl;
|
||||||
size = ssptr->sssize;
|
size = ssptr->sssize;
|
||||||
@@ -497,8 +497,8 @@ i00afunc (long address)
|
|||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* not CRAY2 */
|
# endif /* not CRAY2 */
|
||||||
#endif /* CRAY */
|
# endif /* CRAY */
|
||||||
|
|
||||||
#endif /* no alloca */
|
# endif /* no alloca */
|
||||||
#endif /* not GCC version 2 */
|
#endif /* not GCC version 2 */
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
.TH ANSI2KNR 1 "19 Jan 1996"
|
|
||||||
.SH NAME
|
|
||||||
ansi2knr \- convert ANSI C to Kernighan & Ritchie C
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.I ansi2knr
|
|
||||||
[--varargs] input_file [output_file]
|
|
||||||
.SH DESCRIPTION
|
|
||||||
If no output_file is supplied, output goes to stdout.
|
|
||||||
.br
|
|
||||||
There are no error messages.
|
|
||||||
.sp
|
|
||||||
.I ansi2knr
|
|
||||||
recognizes function definitions by seeing a non-keyword identifier at the left
|
|
||||||
margin, followed by a left parenthesis, with a right parenthesis as the last
|
|
||||||
character on the line, and with a left brace as the first token on the
|
|
||||||
following line (ignoring possible intervening comments). It will recognize a
|
|
||||||
multi-line header provided that no intervening line ends with a left or right
|
|
||||||
brace or a semicolon. These algorithms ignore whitespace and comments, except
|
|
||||||
that the function name must be the first thing on the line.
|
|
||||||
.sp
|
|
||||||
The following constructs will confuse it:
|
|
||||||
.br
|
|
||||||
- Any other construct that starts at the left margin and follows the
|
|
||||||
above syntax (such as a macro or function call).
|
|
||||||
.br
|
|
||||||
- Some macros that tinker with the syntax of the function header.
|
|
||||||
.sp
|
|
||||||
The --varargs switch is obsolete, and is recognized only for
|
|
||||||
backwards compatibility. The present version of
|
|
||||||
.I ansi2knr
|
|
||||||
will always attempt to convert a ... argument to va_alist and va_dcl.
|
|
||||||
.SH AUTHOR
|
|
||||||
L. Peter Deutsch <[email protected]> wrote the original ansi2knr and
|
|
||||||
continues to maintain the current version; most of the code in the current
|
|
||||||
version is his work. ansi2knr also includes contributions by Francois
|
|
||||||
Pinard <[email protected]> and Jim Avera <[email protected]>.
|
|
||||||
-609
@@ -1,609 +0,0 @@
|
|||||||
/* Copyright (C) 1989, 1997, 1998 Aladdin Enterprises. All rights reserved. */
|
|
||||||
|
|
||||||
/*$Id$*/
|
|
||||||
/* Convert ANSI C function definitions to K&R ("traditional C") syntax */
|
|
||||||
|
|
||||||
/*
|
|
||||||
ansi2knr is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
||||||
WARRANTY. No author or distributor accepts responsibility to anyone for the
|
|
||||||
consequences of using it or for whether it serves any particular purpose or
|
|
||||||
works at all, unless he says so in writing. Refer to the GNU General Public
|
|
||||||
License (the "GPL") for full details.
|
|
||||||
|
|
||||||
Everyone is granted permission to copy, modify and redistribute ansi2knr,
|
|
||||||
but only under the conditions described in the GPL. A copy of this license
|
|
||||||
is supposed to have been given to you along with ansi2knr so you can know
|
|
||||||
your rights and responsibilities. It should be in a file named COPYLEFT,
|
|
||||||
or, if there is no file named COPYLEFT, a file named COPYING. Among other
|
|
||||||
things, the copyright notice and this notice must be preserved on all
|
|
||||||
copies.
|
|
||||||
|
|
||||||
We explicitly state here what we believe is already implied by the GPL: if
|
|
||||||
the ansi2knr program is distributed as a separate set of sources and a
|
|
||||||
separate executable file which are aggregated on a storage medium together
|
|
||||||
with another program, this in itself does not bring the other program under
|
|
||||||
the GPL, nor does the mere fact that such a program or the procedures for
|
|
||||||
constructing it invoke the ansi2knr executable bring any other part of the
|
|
||||||
program under the GPL.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Usage:
|
|
||||||
ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]
|
|
||||||
* --filename provides the file name for the #line directive in the output,
|
|
||||||
* overriding input_file (if present).
|
|
||||||
* If no input_file is supplied, input is read from stdin.
|
|
||||||
* If no output_file is supplied, output goes to stdout.
|
|
||||||
* There are no error messages.
|
|
||||||
*
|
|
||||||
* ansi2knr recognizes function definitions by seeing a non-keyword
|
|
||||||
* identifier at the left margin, followed by a left parenthesis,
|
|
||||||
* with a right parenthesis as the last character on the line,
|
|
||||||
* and with a left brace as the first token on the following line
|
|
||||||
* (ignoring possible intervening comments), except that a line
|
|
||||||
* consisting of only
|
|
||||||
* identifier1(identifier2)
|
|
||||||
* will not be considered a function definition unless identifier2 is
|
|
||||||
* the word "void". ansi2knr will recognize a multi-line header provided
|
|
||||||
* that no intervening line ends with a left or right brace or a semicolon.
|
|
||||||
* These algorithms ignore whitespace and comments, except that
|
|
||||||
* the function name must be the first thing on the line.
|
|
||||||
* The following constructs will confuse it:
|
|
||||||
* - Any other construct that starts at the left margin and
|
|
||||||
* follows the above syntax (such as a macro or function call).
|
|
||||||
* - Some macros that tinker with the syntax of the function header.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The original and principal author of ansi2knr is L. Peter Deutsch
|
|
||||||
* <[email protected]>. Other authors are noted in the change history
|
|
||||||
* that follows (in reverse chronological order):
|
|
||||||
lpd 1998-11-09 added further hack to recognize identifier(void)
|
|
||||||
as being a procedure
|
|
||||||
lpd 1998-10-23 added hack to recognize lines consisting of
|
|
||||||
identifier1(identifier2) as *not* being procedures
|
|
||||||
lpd 1997-12-08 made input_file optional; only closes input and/or
|
|
||||||
output file if not stdin or stdout respectively; prints
|
|
||||||
usage message on stderr rather than stdout; adds
|
|
||||||
--filename switch (changes suggested by
|
|
||||||
<[email protected]>)
|
|
||||||
lpd 1996-01-21 added code to cope with not HAVE_CONFIG_H and with
|
|
||||||
compilers that don't understand void, as suggested by
|
|
||||||
Tom Lane
|
|
||||||
lpd 1996-01-15 changed to require that the first non-comment token
|
|
||||||
on the line following a function header be a left brace,
|
|
||||||
to reduce sensitivity to macros, as suggested by Tom Lane
|
|
||||||
<[email protected]>
|
|
||||||
lpd 1995-06-22 removed #ifndefs whose sole purpose was to define
|
|
||||||
undefined preprocessor symbols as 0; changed all #ifdefs
|
|
||||||
for configuration symbols to #ifs
|
|
||||||
lpd 1995-04-05 changed copyright notice to make it clear that
|
|
||||||
including ansi2knr in a program does not bring the entire
|
|
||||||
program under the GPL
|
|
||||||
lpd 1994-12-18 added conditionals for systems where ctype macros
|
|
||||||
don't handle 8-bit characters properly, suggested by
|
|
||||||
Francois Pinard <[email protected]>;
|
|
||||||
removed --varargs switch (this is now the default)
|
|
||||||
lpd 1994-10-10 removed CONFIG_BROKETS conditional
|
|
||||||
lpd 1994-07-16 added some conditionals to help GNU `configure',
|
|
||||||
suggested by Francois Pinard <[email protected]>;
|
|
||||||
properly erase prototype args in function parameters,
|
|
||||||
contributed by Jim Avera <[email protected]>;
|
|
||||||
correct error in writeblanks (it shouldn't erase EOLs)
|
|
||||||
lpd 1989-xx-xx original version
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Most of the conditionals here are to make ansi2knr work with */
|
|
||||||
/* or without the GNU configure machinery. */
|
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
|
||||||
# include <config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
|
||||||
|
|
||||||
/*
|
|
||||||
For properly autoconfiguring ansi2knr, use AC_CONFIG_HEADER(config.h).
|
|
||||||
This will define HAVE_CONFIG_H and so, activate the following lines.
|
|
||||||
*/
|
|
||||||
|
|
||||||
# if STDC_HEADERS || HAVE_STRING_H
|
|
||||||
# include <string.h>
|
|
||||||
# else
|
|
||||||
# include <strings.h>
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#else /* not HAVE_CONFIG_H */
|
|
||||||
|
|
||||||
/* Otherwise do it the hard way */
|
|
||||||
|
|
||||||
# ifdef BSD
|
|
||||||
# include <strings.h>
|
|
||||||
# else
|
|
||||||
# ifdef VMS
|
|
||||||
extern int strlen(), strncmp();
|
|
||||||
# else
|
|
||||||
# include <string.h>
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#endif /* not HAVE_CONFIG_H */
|
|
||||||
|
|
||||||
#if STDC_HEADERS
|
|
||||||
# include <stdlib.h>
|
|
||||||
#else
|
|
||||||
/*
|
|
||||||
malloc and free should be declared in stdlib.h,
|
|
||||||
but if you've got a K&R compiler, they probably aren't.
|
|
||||||
*/
|
|
||||||
# ifdef MSDOS
|
|
||||||
# include <malloc.h>
|
|
||||||
# else
|
|
||||||
# ifdef VMS
|
|
||||||
extern char *malloc();
|
|
||||||
extern void free();
|
|
||||||
# else
|
|
||||||
extern char *malloc();
|
|
||||||
extern int free();
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The ctype macros don't always handle 8-bit characters correctly.
|
|
||||||
* Compensate for this here.
|
|
||||||
*/
|
|
||||||
#ifdef isascii
|
|
||||||
# undef HAVE_ISASCII /* just in case */
|
|
||||||
# define HAVE_ISASCII 1
|
|
||||||
#else
|
|
||||||
#endif
|
|
||||||
#if STDC_HEADERS || !HAVE_ISASCII
|
|
||||||
# define is_ascii(c) 1
|
|
||||||
#else
|
|
||||||
# define is_ascii(c) isascii(c)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define is_space(c) (is_ascii(c) && isspace(c))
|
|
||||||
#define is_alpha(c) (is_ascii(c) && isalpha(c))
|
|
||||||
#define is_alnum(c) (is_ascii(c) && isalnum(c))
|
|
||||||
|
|
||||||
/* Scanning macros */
|
|
||||||
#define isidchar(ch) (is_alnum(ch) || (ch) == '_')
|
|
||||||
#define isidfirstchar(ch) (is_alpha(ch) || (ch) == '_')
|
|
||||||
|
|
||||||
/* Forward references */
|
|
||||||
char *skipspace();
|
|
||||||
int writeblanks();
|
|
||||||
int test1();
|
|
||||||
int convert1();
|
|
||||||
|
|
||||||
/* The main program */
|
|
||||||
int
|
|
||||||
main(argc, argv)
|
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{ FILE *in = stdin;
|
|
||||||
FILE *out = stdout;
|
|
||||||
char *filename = 0;
|
|
||||||
#define bufsize 5000 /* arbitrary size */
|
|
||||||
char *buf;
|
|
||||||
char *line;
|
|
||||||
char *more;
|
|
||||||
char *usage =
|
|
||||||
"Usage: ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]\n";
|
|
||||||
/*
|
|
||||||
* In previous versions, ansi2knr recognized a --varargs switch.
|
|
||||||
* If this switch was supplied, ansi2knr would attempt to convert
|
|
||||||
* a ... argument to va_alist and va_dcl; if this switch was not
|
|
||||||
* supplied, ansi2knr would simply drop any such arguments.
|
|
||||||
* Now, ansi2knr always does this conversion, and we only
|
|
||||||
* check for this switch for backward compatibility.
|
|
||||||
*/
|
|
||||||
int convert_varargs = 1;
|
|
||||||
|
|
||||||
while ( argc > 1 && argv[1][0] == '-' ) {
|
|
||||||
if ( !strcmp(argv[1], "--varargs") ) {
|
|
||||||
convert_varargs = 1;
|
|
||||||
argc--;
|
|
||||||
argv++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ( !strcmp(argv[1], "--filename") && argc > 2 ) {
|
|
||||||
filename = argv[2];
|
|
||||||
argc -= 2;
|
|
||||||
argv += 2;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
fprintf(stderr, "Unrecognized switch: %s\n", argv[1]);
|
|
||||||
fprintf(stderr, usage);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
switch ( argc )
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
fprintf(stderr, usage);
|
|
||||||
exit(0);
|
|
||||||
case 3:
|
|
||||||
out = fopen(argv[2], "w");
|
|
||||||
if ( out == NULL ) {
|
|
||||||
fprintf(stderr, "Cannot open output file %s\n", argv[2]);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
/* falls through */
|
|
||||||
case 2:
|
|
||||||
in = fopen(argv[1], "r");
|
|
||||||
if ( in == NULL ) {
|
|
||||||
fprintf(stderr, "Cannot open input file %s\n", argv[1]);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if ( filename == 0 )
|
|
||||||
filename = argv[1];
|
|
||||||
/* falls through */
|
|
||||||
case 1:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if ( filename )
|
|
||||||
fprintf(out, "#line 1 \"%s\"\n", filename);
|
|
||||||
buf = malloc(bufsize);
|
|
||||||
line = buf;
|
|
||||||
while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL )
|
|
||||||
{
|
|
||||||
test: line += strlen(line);
|
|
||||||
switch ( test1(buf) )
|
|
||||||
{
|
|
||||||
case 2: /* a function header */
|
|
||||||
convert1(buf, out, 1, convert_varargs);
|
|
||||||
break;
|
|
||||||
case 1: /* a function */
|
|
||||||
/* Check for a { at the start of the next line. */
|
|
||||||
more = ++line;
|
|
||||||
f: if ( line >= buf + (bufsize - 1) ) /* overflow check */
|
|
||||||
goto wl;
|
|
||||||
if ( fgets(line, (unsigned)(buf + bufsize - line), in) == NULL )
|
|
||||||
goto wl;
|
|
||||||
switch ( *skipspace(more, 1) )
|
|
||||||
{
|
|
||||||
case '{':
|
|
||||||
/* Definitely a function header. */
|
|
||||||
convert1(buf, out, 0, convert_varargs);
|
|
||||||
fputs(more, out);
|
|
||||||
break;
|
|
||||||
case 0:
|
|
||||||
/* The next line was blank or a comment: */
|
|
||||||
/* keep scanning for a non-comment. */
|
|
||||||
line += strlen(line);
|
|
||||||
goto f;
|
|
||||||
default:
|
|
||||||
/* buf isn't a function header, but */
|
|
||||||
/* more might be. */
|
|
||||||
fputs(buf, out);
|
|
||||||
strcpy(buf, more);
|
|
||||||
line = buf;
|
|
||||||
goto test;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case -1: /* maybe the start of a function */
|
|
||||||
if ( line != buf + (bufsize - 1) ) /* overflow check */
|
|
||||||
continue;
|
|
||||||
/* falls through */
|
|
||||||
default: /* not a function */
|
|
||||||
wl: fputs(buf, out);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
line = buf;
|
|
||||||
}
|
|
||||||
if ( line != buf )
|
|
||||||
fputs(buf, out);
|
|
||||||
free(buf);
|
|
||||||
if ( out != stdout )
|
|
||||||
fclose(out);
|
|
||||||
if ( in != stdin )
|
|
||||||
fclose(in);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Skip over space and comments, in either direction. */
|
|
||||||
char *
|
|
||||||
skipspace(p, dir)
|
|
||||||
register char *p;
|
|
||||||
register int dir; /* 1 for forward, -1 for backward */
|
|
||||||
{ for ( ; ; )
|
|
||||||
{ while ( is_space(*p) )
|
|
||||||
p += dir;
|
|
||||||
if ( !(*p == '/' && p[dir] == '*') )
|
|
||||||
break;
|
|
||||||
p += dir; p += dir;
|
|
||||||
while ( !(*p == '*' && p[dir] == '/') )
|
|
||||||
{ if ( *p == 0 )
|
|
||||||
return p; /* multi-line comment?? */
|
|
||||||
p += dir;
|
|
||||||
}
|
|
||||||
p += dir; p += dir;
|
|
||||||
}
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Write blanks over part of a string.
|
|
||||||
* Don't overwrite end-of-line characters.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
writeblanks(start, end)
|
|
||||||
char *start;
|
|
||||||
char *end;
|
|
||||||
{ char *p;
|
|
||||||
for ( p = start; p < end; p++ )
|
|
||||||
if ( *p != '\r' && *p != '\n' )
|
|
||||||
*p = ' ';
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Test whether the string in buf is a function definition.
|
|
||||||
* The string may contain and/or end with a newline.
|
|
||||||
* Return as follows:
|
|
||||||
* 0 - definitely not a function definition;
|
|
||||||
* 1 - definitely a function definition;
|
|
||||||
* 2 - definitely a function prototype (NOT USED);
|
|
||||||
* -1 - may be the beginning of a function definition,
|
|
||||||
* append another line and look again.
|
|
||||||
* The reason we don't attempt to convert function prototypes is that
|
|
||||||
* Ghostscript's declaration-generating macros look too much like
|
|
||||||
* prototypes, and confuse the algorithms.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
test1(buf)
|
|
||||||
char *buf;
|
|
||||||
{ register char *p = buf;
|
|
||||||
char *bend;
|
|
||||||
char *endfn;
|
|
||||||
int contin;
|
|
||||||
|
|
||||||
if ( !isidfirstchar(*p) )
|
|
||||||
return 0; /* no name at left margin */
|
|
||||||
bend = skipspace(buf + strlen(buf) - 1, -1);
|
|
||||||
switch ( *bend )
|
|
||||||
{
|
|
||||||
case ';': contin = 0 /*2*/; break;
|
|
||||||
case ')': contin = 1; break;
|
|
||||||
case '{': return 0; /* not a function */
|
|
||||||
case '}': return 0; /* not a function */
|
|
||||||
default: contin = -1;
|
|
||||||
}
|
|
||||||
while ( isidchar(*p) )
|
|
||||||
p++;
|
|
||||||
endfn = p;
|
|
||||||
p = skipspace(p, 1);
|
|
||||||
if ( *p++ != '(' )
|
|
||||||
return 0; /* not a function */
|
|
||||||
p = skipspace(p, 1);
|
|
||||||
if ( *p == ')' )
|
|
||||||
return 0; /* no parameters */
|
|
||||||
/* Check that the apparent function name isn't a keyword. */
|
|
||||||
/* We only need to check for keywords that could be followed */
|
|
||||||
/* by a left parenthesis (which, unfortunately, is most of them). */
|
|
||||||
{ static char *words[] =
|
|
||||||
{ "asm", "auto", "case", "char", "const", "double",
|
|
||||||
"extern", "float", "for", "if", "int", "long",
|
|
||||||
"register", "return", "short", "signed", "sizeof",
|
|
||||||
"static", "switch", "typedef", "unsigned",
|
|
||||||
"void", "volatile", "while", 0
|
|
||||||
};
|
|
||||||
char **key = words;
|
|
||||||
char *kp;
|
|
||||||
int len = endfn - buf;
|
|
||||||
|
|
||||||
while ( (kp = *key) != 0 )
|
|
||||||
{ if ( strlen(kp) == len && !strncmp(kp, buf, len) )
|
|
||||||
return 0; /* name is a keyword */
|
|
||||||
key++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
char *id = p;
|
|
||||||
int len;
|
|
||||||
/*
|
|
||||||
* Check for identifier1(identifier2) and not
|
|
||||||
* identifier1(void).
|
|
||||||
*/
|
|
||||||
|
|
||||||
while ( isidchar(*p) )
|
|
||||||
p++;
|
|
||||||
len = p - id;
|
|
||||||
p = skipspace(p, 1);
|
|
||||||
if ( *p == ')' && (len != 4 || strncmp(id, "void", 4)) )
|
|
||||||
return 0; /* not a function */
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* If the last significant character was a ), we need to count
|
|
||||||
* parentheses, because it might be part of a formal parameter
|
|
||||||
* that is a procedure.
|
|
||||||
*/
|
|
||||||
if (contin > 0) {
|
|
||||||
int level = 0;
|
|
||||||
|
|
||||||
for (p = skipspace(buf, 1); *p; p = skipspace(p + 1, 1))
|
|
||||||
level += (*p == '(' ? 1 : *p == ')' ? -1 : 0);
|
|
||||||
if (level > 0)
|
|
||||||
contin = -1;
|
|
||||||
}
|
|
||||||
return contin;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Convert a recognized function definition or header to K&R syntax. */
|
|
||||||
int
|
|
||||||
convert1(buf, out, header, convert_varargs)
|
|
||||||
char *buf;
|
|
||||||
FILE *out;
|
|
||||||
int header; /* Boolean */
|
|
||||||
int convert_varargs; /* Boolean */
|
|
||||||
{ char *endfn;
|
|
||||||
register char *p;
|
|
||||||
/*
|
|
||||||
* The breaks table contains pointers to the beginning and end
|
|
||||||
* of each argument.
|
|
||||||
*/
|
|
||||||
char **breaks;
|
|
||||||
unsigned num_breaks = 2; /* for testing */
|
|
||||||
char **btop;
|
|
||||||
char **bp;
|
|
||||||
char **ap;
|
|
||||||
char *vararg = 0;
|
|
||||||
|
|
||||||
/* Pre-ANSI implementations don't agree on whether strchr */
|
|
||||||
/* is called strchr or index, so we open-code it here. */
|
|
||||||
for ( endfn = buf; *(endfn++) != '('; )
|
|
||||||
;
|
|
||||||
top: p = endfn;
|
|
||||||
breaks = (char **)malloc(sizeof(char *) * num_breaks * 2);
|
|
||||||
if ( breaks == 0 )
|
|
||||||
{ /* Couldn't allocate break table, give up */
|
|
||||||
fprintf(stderr, "Unable to allocate break table!\n");
|
|
||||||
fputs(buf, out);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
btop = breaks + num_breaks * 2 - 2;
|
|
||||||
bp = breaks;
|
|
||||||
/* Parse the argument list */
|
|
||||||
do
|
|
||||||
{ int level = 0;
|
|
||||||
char *lp = NULL;
|
|
||||||
char *rp;
|
|
||||||
char *end = NULL;
|
|
||||||
|
|
||||||
if ( bp >= btop )
|
|
||||||
{ /* Filled up break table. */
|
|
||||||
/* Allocate a bigger one and start over. */
|
|
||||||
free((char *)breaks);
|
|
||||||
num_breaks <<= 1;
|
|
||||||
goto top;
|
|
||||||
}
|
|
||||||
*bp++ = p;
|
|
||||||
/* Find the end of the argument */
|
|
||||||
for ( ; end == NULL; p++ )
|
|
||||||
{ switch(*p)
|
|
||||||
{
|
|
||||||
case ',':
|
|
||||||
if ( !level ) end = p;
|
|
||||||
break;
|
|
||||||
case '(':
|
|
||||||
if ( !level ) lp = p;
|
|
||||||
level++;
|
|
||||||
break;
|
|
||||||
case ')':
|
|
||||||
if ( --level < 0 ) end = p;
|
|
||||||
else rp = p;
|
|
||||||
break;
|
|
||||||
case '/':
|
|
||||||
p = skipspace(p, 1) - 1;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Erase any embedded prototype parameters. */
|
|
||||||
if ( lp )
|
|
||||||
writeblanks(lp + 1, rp);
|
|
||||||
p--; /* back up over terminator */
|
|
||||||
/* Find the name being declared. */
|
|
||||||
/* This is complicated because of procedure and */
|
|
||||||
/* array modifiers. */
|
|
||||||
for ( ; ; )
|
|
||||||
{ p = skipspace(p - 1, -1);
|
|
||||||
switch ( *p )
|
|
||||||
{
|
|
||||||
case ']': /* skip array dimension(s) */
|
|
||||||
case ')': /* skip procedure args OR name */
|
|
||||||
{ int level = 1;
|
|
||||||
while ( level )
|
|
||||||
switch ( *--p )
|
|
||||||
{
|
|
||||||
case ']': case ')': level++; break;
|
|
||||||
case '[': case '(': level--; break;
|
|
||||||
case '/': p = skipspace(p, -1) + 1; break;
|
|
||||||
default: ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( *p == '(' && *skipspace(p + 1, 1) == '*' )
|
|
||||||
{ /* We found the name being declared */
|
|
||||||
while ( !isidfirstchar(*p) )
|
|
||||||
p = skipspace(p, 1) + 1;
|
|
||||||
goto found;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
goto found;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
found: if ( *p == '.' && p[-1] == '.' && p[-2] == '.' )
|
|
||||||
{ if ( convert_varargs )
|
|
||||||
{ *bp++ = "va_alist";
|
|
||||||
vararg = p-2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ p++;
|
|
||||||
if ( bp == breaks + 1 ) /* sole argument */
|
|
||||||
writeblanks(breaks[0], p);
|
|
||||||
else
|
|
||||||
writeblanks(bp[-1] - 1, p);
|
|
||||||
bp--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ while ( isidchar(*p) ) p--;
|
|
||||||
*bp++ = p+1;
|
|
||||||
}
|
|
||||||
p = end;
|
|
||||||
}
|
|
||||||
while ( *p++ == ',' );
|
|
||||||
*bp = p;
|
|
||||||
/* Make a special check for 'void' arglist */
|
|
||||||
if ( bp == breaks+2 )
|
|
||||||
{ p = skipspace(breaks[0], 1);
|
|
||||||
if ( !strncmp(p, "void", 4) )
|
|
||||||
{ p = skipspace(p+4, 1);
|
|
||||||
if ( p == breaks[2] - 1 )
|
|
||||||
{ bp = breaks; /* yup, pretend arglist is empty */
|
|
||||||
writeblanks(breaks[0], p + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Put out the function name and left parenthesis. */
|
|
||||||
p = buf;
|
|
||||||
while ( p != endfn ) putc(*p, out), p++;
|
|
||||||
/* Put out the declaration. */
|
|
||||||
if ( header )
|
|
||||||
{ fputs(");", out);
|
|
||||||
for ( p = breaks[0]; *p; p++ )
|
|
||||||
if ( *p == '\r' || *p == '\n' )
|
|
||||||
putc(*p, out);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ for ( ap = breaks+1; ap < bp; ap += 2 )
|
|
||||||
{ p = *ap;
|
|
||||||
while ( isidchar(*p) )
|
|
||||||
putc(*p, out), p++;
|
|
||||||
if ( ap < bp - 1 )
|
|
||||||
fputs(", ", out);
|
|
||||||
}
|
|
||||||
fputs(") ", out);
|
|
||||||
/* Put out the argument declarations */
|
|
||||||
for ( ap = breaks+2; ap <= bp; ap += 2 )
|
|
||||||
(*ap)[-1] = ';';
|
|
||||||
if ( vararg != 0 )
|
|
||||||
{ *vararg = 0;
|
|
||||||
fputs(breaks[0], out); /* any prior args */
|
|
||||||
fputs("va_dcl", out); /* the final arg */
|
|
||||||
fputs(bp[0], out);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
fputs(breaks[0], out);
|
|
||||||
}
|
|
||||||
free((char *)breaks);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
/* 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
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#ifndef FILESYSTEM_PREFIX_LEN
|
||||||
|
# define FILESYSTEM_PREFIX_LEN(Filename) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PARAMS
|
||||||
|
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||||
|
# define PARAMS(Args) Args
|
||||||
|
# else
|
||||||
|
# define PARAMS(Args) ()
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ISSLASH
|
||||||
|
# define ISSLASH(C) ((C) == '/')
|
||||||
|
#endif
|
||||||
|
|
||||||
|
char *base_name PARAMS ((char const *name));
|
||||||
|
|
||||||
|
/* 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.
|
||||||
|
If NAME is all slashes, be sure to return `/'. */
|
||||||
|
|
||||||
|
char *
|
||||||
|
base_name (char const *name)
|
||||||
|
{
|
||||||
|
char const *base = name += FILESYSTEM_PREFIX_LEN (name);
|
||||||
|
int all_slashes = 1;
|
||||||
|
char const *p;
|
||||||
|
|
||||||
|
for (p = name; *p; p++)
|
||||||
|
{
|
||||||
|
if (ISSLASH (*p))
|
||||||
|
base = p + 1;
|
||||||
|
else
|
||||||
|
all_slashes = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If NAME is all slashes, arrange to return `/'. */
|
||||||
|
if (*base == '\0' && ISSLASH (*name) && all_slashes)
|
||||||
|
--base;
|
||||||
|
|
||||||
|
/* Make sure the last byte is not a slash. */
|
||||||
|
assert (all_slashes || !ISSLASH (*(p - 1)));
|
||||||
|
|
||||||
|
return (char *) base;
|
||||||
|
}
|
||||||
+275
@@ -0,0 +1,275 @@
|
|||||||
|
/* Base bitset stuff.
|
||||||
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
|
Contributed by Michael Hayes ([email protected]).
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifndef _BBITSET_H
|
||||||
|
#define _BBITSET_H
|
||||||
|
|
||||||
|
/* Bison modifications: BEGIN. */
|
||||||
|
#define IN_BISON 1
|
||||||
|
#if IN_BISON
|
||||||
|
# if HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
# endif
|
||||||
|
# include <stdlib.h>
|
||||||
|
|
||||||
|
# define BITSET_STATS 1
|
||||||
|
/* This file is the public interface to the bitset abstract data type.
|
||||||
|
Only use the functions and macros defined in this file. */
|
||||||
|
|
||||||
|
# ifndef PARAMS
|
||||||
|
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||||
|
# define PARAMS(Args) Args
|
||||||
|
# else
|
||||||
|
# define PARAMS(Args) ()
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifndef __attribute__
|
||||||
|
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
|
||||||
|
# define __attribute__(x)
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifndef ATTRIBUTE_NORETURN
|
||||||
|
# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifndef ATTRIBUTE_UNUSED
|
||||||
|
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
||||||
|
# endif
|
||||||
|
# include "xalloc.h"
|
||||||
|
#else /* ! IN_BISON */
|
||||||
|
# include "libiberty.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LIMITS_H
|
||||||
|
#include <limits.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Currently we support three flavours of bitsets:
|
||||||
|
BITSET_ARRAY: Array of bits (fixed size, faster).
|
||||||
|
BITSET_LIST: Linked list of array of bits (variable size, least storage
|
||||||
|
for large very sparse sets).
|
||||||
|
BITSET_TABLE: Expandable table of pointers to array of bits
|
||||||
|
(variable size, less storage for large sparse sets).
|
||||||
|
*/
|
||||||
|
enum bitset_type {BITSET_ARRAY, BITSET_LIST, BITSET_TABLE, BITSET_TYPE_NUM};
|
||||||
|
#define BITSET_TYPE_NAMES {"sbitset", "lbitset", "ebitset"}
|
||||||
|
|
||||||
|
/* Non-zero to enable bitset caching. */
|
||||||
|
#define BITSET_CACHE 1
|
||||||
|
|
||||||
|
/* Non-zero to use inline functions instead of macros. */
|
||||||
|
#define BITSET_INLINE 0
|
||||||
|
|
||||||
|
/* Non-zero to enable bitset statistics gathering. */
|
||||||
|
#define BITSET_STATS 1
|
||||||
|
|
||||||
|
/* Non-zero to enable bitset type checking. */
|
||||||
|
#define BITSET_CHECK 1
|
||||||
|
|
||||||
|
/* Data type used to store a word of bits. */
|
||||||
|
typedef unsigned long bitset_word;
|
||||||
|
#define BITSET_WORD_BITS ((unsigned) CHAR_BIT * sizeof (bitset_word))
|
||||||
|
|
||||||
|
/* Bit index. */
|
||||||
|
typedef unsigned long bitset_bindex;
|
||||||
|
|
||||||
|
/* Word index. */
|
||||||
|
typedef unsigned long bitset_windex;
|
||||||
|
|
||||||
|
#define BITSET_INDEX_MAX ((1U << (BITSET_WORD_BITS - 1)))
|
||||||
|
|
||||||
|
#define BITSET_MSB (1U << (BITSET_WORD_BITS - 1))
|
||||||
|
|
||||||
|
#define BITSET_LIST_SIZE 1024
|
||||||
|
|
||||||
|
enum bitset_ops {BITSET_OP_ZERO, BITSET_OP_ONES,
|
||||||
|
BITSET_OP_COPY, BITSET_OP_NOT,
|
||||||
|
BITSET_OP_EMPTY_P, BITSET_OP_EQUAL_P,
|
||||||
|
BITSET_OP_SUBSET_P, BITSET_OP_DISJOINT_P,
|
||||||
|
BITSET_OP_AND, BITSET_OP_OR, BITSET_OP_XOR, BITSET_OP_ANDN,
|
||||||
|
BITSET_OP_OR_AND, BITSET_OP_AND_OR, BITSET_OP_ANDN_OR};
|
||||||
|
|
||||||
|
/* Return size in bits of bitset SRC. */
|
||||||
|
#define BITSET_SIZE_(SRC) (SRC)->b.ops->size (SRC)
|
||||||
|
|
||||||
|
/* Return type of bitset SRC. */
|
||||||
|
#define BITSET_TYPE_(DST) (DST)->b.ops->type
|
||||||
|
|
||||||
|
/* Set bit BITNO in bitset DST. */
|
||||||
|
#define BITSET_SET_(DST, BITNO) (DST)->b.ops->set (DST, BITNO)
|
||||||
|
|
||||||
|
/* Reset bit BITNO in bitset DST. */
|
||||||
|
#define BITSET_RESET_(DST, BITNO) (DST)->b.ops->reset (DST, BITNO)
|
||||||
|
|
||||||
|
/* Return non-zero if bit BITNO in bitset SRC is set. */
|
||||||
|
#define BITSET_TEST_(SRC, BITNO) (SRC)->b.ops->test (SRC, BITNO)
|
||||||
|
|
||||||
|
/* Free bitset SRC. */
|
||||||
|
#define BITSET_FREE_(SRC)\
|
||||||
|
((SRC)->b.ops->free ? (SRC)->b.ops->free (SRC) :(void)0)
|
||||||
|
|
||||||
|
/* Perform operation OP on DST. */
|
||||||
|
#define BITSET_OP1_(DST, OP) (DST)->b.ops->op1 (DST, OP)
|
||||||
|
|
||||||
|
/* Perform operation OP on SRC and store in DST. */
|
||||||
|
#define BITSET_OP2_(DST, SRC, OP) (DST)->b.ops->op2 (DST, SRC, OP)
|
||||||
|
|
||||||
|
/* DST = SRC1 OP SRC2. */
|
||||||
|
#define BITSET_OP3_(DST, SRC1, SRC2, OP) \
|
||||||
|
(DST)->b.ops->op3 (DST, SRC1, SRC2, OP)
|
||||||
|
|
||||||
|
/* DST = (SRC1 OP1 SRC2) OP2 SRC3. */
|
||||||
|
#define BITSET_OP4_(DST, SRC1, SRC2, SRC3, OP) \
|
||||||
|
(DST)->b.ops->op4 (DST, SRC1, SRC2, SRC3, OP)
|
||||||
|
|
||||||
|
/* DST = 0. */
|
||||||
|
#define BITSET_ZERO_(DST) BITSET_OP1_ (DST, BITSET_OP_ZERO);
|
||||||
|
|
||||||
|
/* DST = ~0. */
|
||||||
|
#define BITSET_ONES_(DST) BITSET_OP1_ (DST, BITSET_OP_ONES);
|
||||||
|
|
||||||
|
/* Return SRC == 0. */
|
||||||
|
#define BITSET_EMPTY_P_(SRC) BITSET_OP1_ (SRC, BITSET_OP_EMPTY_P);
|
||||||
|
|
||||||
|
/* Return DST == SRC. */
|
||||||
|
#define BITSET_EQUAL_P_(DST, SRC) BITSET_OP2_ (DST, SRC, BITSET_OP_EQUAL_P)
|
||||||
|
|
||||||
|
/* Return DST == DST | SRC. */
|
||||||
|
#define BITSET_SUBSET_P_(DST, SRC) BITSET_OP2_ (DST, SRC, BITSET_OP_SUBSET_P)
|
||||||
|
|
||||||
|
/* Return DST & SRC == 0. */
|
||||||
|
#define BITSET_DISJOINT_P_(DST, SRC)\
|
||||||
|
BITSET_OP2_ (DST, SRC, BITSET_OP_DISJOINT_P)
|
||||||
|
|
||||||
|
/* DST = SRC. */
|
||||||
|
#define BITSET_COPY_(DST, SRC) BITSET_OP2_ (DST, SRC, BITSET_OP_COPY)
|
||||||
|
|
||||||
|
/* DST = ~SRC. */
|
||||||
|
#define BITSET_NOT_(DST, SRC) BITSET_OP2_ (DST, SRC, BITSET_OP_NOT)
|
||||||
|
|
||||||
|
/* DST = SRC1 | SRC2. */
|
||||||
|
#define BITSET_OR_(DST, SRC1, SRC2) BITSET_OP3_ (DST, SRC1, SRC2,\
|
||||||
|
BITSET_OP_OR)
|
||||||
|
|
||||||
|
/* DST = SRC1 ^ SRC2. */
|
||||||
|
#define BITSET_XOR_(DST, SRC1, SRC2) BITSET_OP3_ (DST, SRC1, SRC2,\
|
||||||
|
BITSET_OP_XOR)
|
||||||
|
|
||||||
|
/* DST = SRC1 & SRC2. */
|
||||||
|
#define BITSET_AND_(DST, SRC1, SRC2) BITSET_OP3_ (DST, SRC1, SRC2, \
|
||||||
|
BITSET_OP_AND)
|
||||||
|
|
||||||
|
/* DST = SRC1 & ~SRC2. */
|
||||||
|
#define BITSET_ANDN_(DST, SRC1, SRC2) BITSET_OP3_ (DST, SRC1, SRC2, \
|
||||||
|
BITSET_OP_ANDN)
|
||||||
|
|
||||||
|
/* DST = (SRC1 & SRC2) | SRC3. Return non-zero if
|
||||||
|
DST != (SRC1 & SRC2) | SRC3. */
|
||||||
|
#define BITSET_AND_OR_(DST, SRC1, SRC2, SRC3)\
|
||||||
|
BITSET_OP4_ (DST, SRC1, SRC2, SRC3, BITSET_OP_AND_OR)
|
||||||
|
|
||||||
|
/* DST = (SRC1 | SRC2) & SRC3. Return non-zero if
|
||||||
|
DST != (SRC1 | SRC2) & SRC3. */
|
||||||
|
#define BITSET_OR_AND_(DST, SRC1, SRC2, SRC3)\
|
||||||
|
BITSET_OP4_ (DST, SRC1, SRC2, SRC3, BITSET_OP_OR_AND)
|
||||||
|
|
||||||
|
/* DST = (SRC1 & ~SRC2) | SRC3. Return non-zero if
|
||||||
|
DST != (SRC1 & ~SRC2) | SRC3. */
|
||||||
|
#define BITSET_ANDN_OR_(DST, SRC1, SRC2, SRC3)\
|
||||||
|
BITSET_OP4_ (DST, SRC1, SRC2, SRC3, BITSET_OP_ANDN_OR)
|
||||||
|
|
||||||
|
/* Find list of up to NUM bits set in BSET starting from and including
|
||||||
|
*NEXT. Return with actual number of bits found and with *NEXT
|
||||||
|
indicating where search stopped. */
|
||||||
|
#define BITSET_LIST_(BSET, LIST, NUM, NEXT) \
|
||||||
|
(BSET)->b.ops->list (BSET, LIST, NUM, NEXT)
|
||||||
|
|
||||||
|
/* Find reverse list of up to NUM bits set in BSET starting from and
|
||||||
|
including NEXT. Return with actual number of bits found and with
|
||||||
|
*NEXT indicating where search stopped. */
|
||||||
|
#define BITSET_REVERSE_LIST_(BSET, LIST, NUM, NEXT) \
|
||||||
|
(BSET)->b.ops->reverse_list (BSET, LIST, NUM, NEXT)
|
||||||
|
|
||||||
|
|
||||||
|
struct bbitset_struct
|
||||||
|
{
|
||||||
|
struct bitset_ops_struct *ops;
|
||||||
|
bitset_windex cindex; /* Cache word index. */
|
||||||
|
bitset_windex csize; /* Cache size in words. */
|
||||||
|
bitset_word *cdata; /* Cache data pointer. */
|
||||||
|
/* Perhaps we could sacrifice another word to indicate
|
||||||
|
that the bitset is known to be zero, that a bit has been set
|
||||||
|
in the cache, and that a bit has been cleared in the cache.
|
||||||
|
This would speed up some of the searches but slightly slow down
|
||||||
|
bit set/reset operations of cached bits. */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct bitset_struct *bitset;
|
||||||
|
|
||||||
|
|
||||||
|
/* The contents of this structure should be considered private. */
|
||||||
|
struct bitset_ops_struct
|
||||||
|
{
|
||||||
|
void (*set) PARAMS ((struct bitset_struct *, bitset_bindex));
|
||||||
|
void (*reset) PARAMS ((struct bitset_struct *, bitset_bindex));
|
||||||
|
int (*test) PARAMS ((struct bitset_struct *, bitset_bindex));
|
||||||
|
int (*size) PARAMS ((struct bitset_struct *));
|
||||||
|
int (*op1) PARAMS ((struct bitset_struct *, enum bitset_ops));
|
||||||
|
int (*op2) PARAMS ((struct bitset_struct *, struct bitset_struct *,
|
||||||
|
enum bitset_ops));
|
||||||
|
int (*op3) PARAMS ((struct bitset_struct *, struct bitset_struct *,
|
||||||
|
struct bitset_struct *, enum bitset_ops));
|
||||||
|
int (*op4) PARAMS ((struct bitset_struct *, struct bitset_struct *,
|
||||||
|
struct bitset_struct *, struct bitset_struct *,
|
||||||
|
enum bitset_ops));
|
||||||
|
int (*list) PARAMS ((struct bitset_struct *, bitset_bindex *,
|
||||||
|
bitset_bindex, bitset_bindex *));
|
||||||
|
int (*reverse_list) PARAMS ((struct bitset_struct *, bitset_bindex *,
|
||||||
|
bitset_bindex, bitset_bindex *));
|
||||||
|
void (*free) PARAMS ((struct bitset_struct *));
|
||||||
|
enum bitset_type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define BITSET_COMPATIBLE_(BSET1, BSET2) ((BSET1)->b.ops == (BSET2)->b.ops)
|
||||||
|
|
||||||
|
#if BITSET_CHECK
|
||||||
|
#define BITSET_CHECK2_(DST, SRC) \
|
||||||
|
if (!BITSET_COMPATIBLE_ (DST, SRC)) abort ();
|
||||||
|
|
||||||
|
#define BITSET_CHECK3_(DST, SRC1, SRC2) \
|
||||||
|
if (!BITSET_COMPATIBLE_ (DST, SRC1) \
|
||||||
|
|| !BITSET_COMPATIBLE_ (DST, SRC2)) abort ();
|
||||||
|
|
||||||
|
#define BITSET_CHECK4_(DST, SRC1, SRC2, SRC3) \
|
||||||
|
if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
|
||||||
|
|| !BITSET_COMPATIBLE_ (DST, SRC3)) abort ();
|
||||||
|
#else
|
||||||
|
#define BITSET_CHECK2_(DST, SRC)
|
||||||
|
|
||||||
|
#define BITSET_CHECK3_(DST, SRC1, SRC2)
|
||||||
|
|
||||||
|
#define BITSET_CHECK4_(DST, SRC1, SRC2, SRC3)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern int bitset_op4 PARAMS ((bitset, bitset, bitset, bitset,
|
||||||
|
enum bitset_ops op));
|
||||||
|
|
||||||
|
#endif /* _BBITSET_H */
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
/* Internal bitset definitions.
|
||||||
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
|
Contributed by Michael Hayes ([email protected]).
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifndef _BITSET_INT_H
|
||||||
|
#define _BITSET_INT_H
|
||||||
|
|
||||||
|
#ifdef HAVE_LIMITS_H
|
||||||
|
#include <limits.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Currently we support three flavours of bitsets:
|
||||||
|
BITSET_ARRAY: Array of bits (fixed size, faster).
|
||||||
|
BITSET_LIST: Linked list of array of bits (variable size, least storage
|
||||||
|
for large very sparse sets).
|
||||||
|
BITSET_TABLE: Expandable table of pointers to array of bits
|
||||||
|
(variable size, less storage for large sparse sets).
|
||||||
|
*/
|
||||||
|
enum bitset_type {BITSET_ARRAY, BITSET_LIST, BITSET_TABLE, BITSET_TYPE_NUM};
|
||||||
|
#define BITSET__TYPE_NAMES {"sbitset", "lbitset", "ebitset"}
|
||||||
|
|
||||||
|
/* Non-zero to enable bitset caching. */
|
||||||
|
#define BITSET_CACHE 1
|
||||||
|
|
||||||
|
/* Non-zero to use inline functions instead of macros. */
|
||||||
|
#define BITSET_INLINE 0
|
||||||
|
|
||||||
|
/* Non-zero to enable bitset statistics gathering. */
|
||||||
|
#define BITSET_STATS 1
|
||||||
|
|
||||||
|
/* Non-zero to enable bitset type checking. */
|
||||||
|
#define BITSET_CHECK 0
|
||||||
|
|
||||||
|
typedef unsigned long bitset_word;
|
||||||
|
#define BITSET_WORD_BITS ((unsigned) CHAR_BIT * sizeof (bitset_word))
|
||||||
|
|
||||||
|
/* Bit index. */
|
||||||
|
typedef unsigned long bitset_bindex;
|
||||||
|
|
||||||
|
/* Word index. */
|
||||||
|
typedef unsigned long bitset_windex;
|
||||||
|
|
||||||
|
#define BITSET_INDEX_MAX ((1U << (BITSET_WORD_BITS - 1)))
|
||||||
|
|
||||||
|
#define BITSET_MSB (1U << (BITSET_WORD_BITS - 1))
|
||||||
|
|
||||||
|
#define BITSET_LIST_SIZE 1024
|
||||||
|
|
||||||
|
enum bitset_ops {BITSET_ZERO, BITSET_ONES, BITSET_EMPTY_P,
|
||||||
|
BITSET_COPY, BITSET_EQUAL_P, BITSET_SUBSET_P, BITSET_NOT,
|
||||||
|
BITSET_AND, BITSET_OR, BITSET_XOR, BITSET_ANDN, BITSET_ORN,
|
||||||
|
BITSET_OR_AND, BITSET_AND_OR, BITSET_ANDN_OR};
|
||||||
|
|
||||||
|
/* Return size in bits of bitset SRC. */
|
||||||
|
#define BITSET__SIZE(SRC) (SRC)->ops->size (SRC)
|
||||||
|
|
||||||
|
/* Set bit BITNO in bitset DST. */
|
||||||
|
#define BITSET__SET(DST, BITNO) (DST)->ops->set (DST, BITNO)
|
||||||
|
|
||||||
|
/* Reset bit BITNO in bitset DST. */
|
||||||
|
#define BITSET__RESET(DST, BITNO) (DST)->ops->reset (DST, BITNO)
|
||||||
|
|
||||||
|
/* Return non-zero if bit BITNO in bitset SRC is set. */
|
||||||
|
#define BITSET__TEST(SRC, BITNO) (SRC)->ops->test (SRC, BITNO)
|
||||||
|
|
||||||
|
/* Free bitset SRC. */
|
||||||
|
#define BITSET__FREE(SRC) ((SRC)->ops->free) (SRC)
|
||||||
|
|
||||||
|
/* Perform operation OP on DST. */
|
||||||
|
#define BITSET__OP1(DST, OP) (DST)->ops->op1 (DST, OP)
|
||||||
|
|
||||||
|
/* Perform operation OP on SRC and store in DST. */
|
||||||
|
#define BITSET__OP2(DST, SRC, OP) (DST)->ops->op2 (DST, SRC, OP)
|
||||||
|
|
||||||
|
/* DST = SRC1 OP SRC2. */
|
||||||
|
#define BITSET__OP3(DST, SRC1, SRC2, OP) \
|
||||||
|
(DST)->ops->op3 (DST, SRC1, SRC2, OP)
|
||||||
|
|
||||||
|
/* DST = (SRC1 OP1 SRC2) OP2 SRC3. */
|
||||||
|
#define BITSET__OP4(DST, SRC1, SRC2, SRC3, OP) \
|
||||||
|
(DST)->ops->op4 (DST, SRC1, SRC2, SRC3, OP)
|
||||||
|
|
||||||
|
/* DST = SRC. */
|
||||||
|
#define BITSET__COPY(DST, SRC) BITSET__OP2 (DST, SRC, BITSET_COPY)
|
||||||
|
|
||||||
|
/* 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)->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)->ops->reverse_list (BSET, LIST, NUM, NEXT)
|
||||||
|
|
||||||
|
#endif /* _BITSET_INT_H */
|
||||||
+936
@@ -0,0 +1,936 @@
|
|||||||
|
/* General bitsets.
|
||||||
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
|
Contributed by Michael Hayes ([email protected]).
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "bitset.h"
|
||||||
|
#include "sbitset.h"
|
||||||
|
#include "lbitset.h"
|
||||||
|
#include "ebitset.h"
|
||||||
|
#include "obstack.h"
|
||||||
|
|
||||||
|
static void bitset_print PARAMS ((FILE *, bitset, int));
|
||||||
|
|
||||||
|
#if BITSET_STATS
|
||||||
|
#define BITSET_STATS_FILE "bitset.dat"
|
||||||
|
|
||||||
|
#define BITSET_LOG_COUNT_BINS 10
|
||||||
|
#define BITSET_LOG_SIZE_BINS 16
|
||||||
|
#define BITSET_DENSITY_BINS 20
|
||||||
|
|
||||||
|
struct bitset_type_stats_struct
|
||||||
|
{
|
||||||
|
unsigned int xmallocs;
|
||||||
|
unsigned int xfrees;
|
||||||
|
unsigned int oballocs;
|
||||||
|
unsigned int obfrees;
|
||||||
|
unsigned int lists;
|
||||||
|
unsigned int list_counts[BITSET_LOG_COUNT_BINS];
|
||||||
|
unsigned int list_sizes[BITSET_LOG_SIZE_BINS];
|
||||||
|
unsigned int list_density[BITSET_DENSITY_BINS];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct bitset_stats_struct
|
||||||
|
{
|
||||||
|
unsigned int runs;
|
||||||
|
struct bitset_type_stats_struct types[BITSET_TYPE_NUM];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct bitset_stats_struct bitset_stats_data;
|
||||||
|
struct bitset_stats_struct *bitset_stats;
|
||||||
|
|
||||||
|
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_stats_struct *));
|
||||||
|
static void bitset_stats_print PARAMS ((FILE *, int));
|
||||||
|
static void bitset_stats_read PARAMS ((void));
|
||||||
|
static void bitset_stats_write PARAMS ((void));
|
||||||
|
|
||||||
|
#define BITSET_STATS_XMALLOCS_INC(TYPE) \
|
||||||
|
if (bitset_stats) \
|
||||||
|
bitset_stats->types[(TYPE)].xmallocs++
|
||||||
|
|
||||||
|
#define BITSET_STATS_XFREES_INC(BSET) \
|
||||||
|
if (bitset_stats) \
|
||||||
|
bitset_stats->types[BITSET_TYPE_ (BSET)].xfrees++
|
||||||
|
|
||||||
|
#define BITSET_STATS_OBALLOCS_INC(TYPE) \
|
||||||
|
if (bitset_stats) \
|
||||||
|
bitset_stats->types[(TYPE)].oballocs++
|
||||||
|
|
||||||
|
#define BITSET_STATS_OBFREES_INC(BSET) \
|
||||||
|
if (bitset_stats) \
|
||||||
|
bitset_stats->types[BITSET_TYPE_ (BSET)].obfrees++
|
||||||
|
|
||||||
|
#define BITSET_STATS_LISTS_INC(BSET) \
|
||||||
|
if (bitset_stats) \
|
||||||
|
bitset_stats->types[BITSET_TYPE_ (BSET)].lists++
|
||||||
|
|
||||||
|
#define BITSET_STATS_LIST_COUNTS_INC(BSET, I) \
|
||||||
|
if (bitset_stats) \
|
||||||
|
bitset_stats->types[BITSET_TYPE_ (BSET)].list_counts[(I)]++
|
||||||
|
|
||||||
|
#define BITSET_STATS_LIST_SIZES_INC(BSET, I) \
|
||||||
|
if (bitset_stats) \
|
||||||
|
bitset_stats->types[BITSET_TYPE_ (BSET)].list_sizes[(I)]++
|
||||||
|
|
||||||
|
#define BITSET_STATS_LIST_DENSITY_INC(BSET, I) \
|
||||||
|
if (bitset_stats) \
|
||||||
|
bitset_stats->types[BITSET_TYPE_ (BSET)].list_density[(I)]++
|
||||||
|
|
||||||
|
#else
|
||||||
|
#define BITSET_STATS_XMALLOCS_INC(TYPE)
|
||||||
|
|
||||||
|
#define BITSET_STATS_XFREES_INC(BSET)
|
||||||
|
|
||||||
|
#define BITSET_STATS_OBALLOCS_INC(TYPE)
|
||||||
|
|
||||||
|
#define BITSET_STATS_OBFREES_INC(BSET)
|
||||||
|
|
||||||
|
#define BITSET_STATS_LISTS_INC(BSET)
|
||||||
|
|
||||||
|
#define BITSET_STATS_LIST_COUNTS_INC(BSET, I)
|
||||||
|
|
||||||
|
#define BITSET_STATS_LIST_SIZES_INC(BSET, I)
|
||||||
|
|
||||||
|
#define BITSET_STATS_LIST_DENSITY_INC(BSET, I)
|
||||||
|
#endif /* BITSET_STATS */
|
||||||
|
|
||||||
|
|
||||||
|
/* Return number of bytes required to create a N_BIT bitset
|
||||||
|
of TYPE. The bitset may grow to require more bytes than this. */
|
||||||
|
int
|
||||||
|
bitset_bytes (type, n_bits)
|
||||||
|
enum bitset_type type;
|
||||||
|
bitset_bindex n_bits;
|
||||||
|
{
|
||||||
|
unsigned int bytes;
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case BITSET_ARRAY:
|
||||||
|
bytes = sbitset_bytes (n_bits);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BITSET_LIST:
|
||||||
|
bytes = lbitset_bytes (n_bits);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BITSET_TABLE:
|
||||||
|
bytes = ebitset_bytes (n_bits);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Initialise bitset BSET of TYPE for N_BITS. */
|
||||||
|
bitset
|
||||||
|
bitset_init (bset, n_bits, type)
|
||||||
|
bitset bset;
|
||||||
|
bitset_bindex n_bits;
|
||||||
|
enum bitset_type type;
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case BITSET_ARRAY:
|
||||||
|
return sbitset_init (bset, n_bits);
|
||||||
|
|
||||||
|
case BITSET_LIST:
|
||||||
|
return lbitset_init (bset, n_bits);
|
||||||
|
|
||||||
|
case BITSET_TABLE:
|
||||||
|
return ebitset_init (bset, n_bits);
|
||||||
|
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Select a bitset type for a set of N_BITS and with attribute hints
|
||||||
|
specified by ATTR. For variable size bitsets, N_BITS is only a
|
||||||
|
hint and may be zero. */
|
||||||
|
enum bitset_type
|
||||||
|
bitset_type_choose (n_bits, attr)
|
||||||
|
bitset_bindex n_bits ATTRIBUTE_UNUSED;
|
||||||
|
unsigned int attr;
|
||||||
|
{
|
||||||
|
enum bitset_type type;
|
||||||
|
|
||||||
|
#if BITSET_CHECK
|
||||||
|
/* Check attributes. */
|
||||||
|
if (attr & BITSET_FIXED && attr & BITSET_VARIABLE)
|
||||||
|
abort ();
|
||||||
|
if (attr & BITSET_SPARSE && attr & BITSET_DENSE)
|
||||||
|
abort ();
|
||||||
|
|
||||||
|
/* Note that sometimes we will be asked for a zero length
|
||||||
|
fixed size bitset. */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Choose the type of bitset. */
|
||||||
|
|
||||||
|
type = BITSET_ARRAY;
|
||||||
|
/* Currently, the simple bitsets do not support a variable size. */
|
||||||
|
if (attr & BITSET_VARIABLE || attr & BITSET_SPARSE)
|
||||||
|
{
|
||||||
|
type = BITSET_LIST;
|
||||||
|
if (attr & BITSET_DENSE || attr & BITSET_GREEDY)
|
||||||
|
type = BITSET_TABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Create a bitset of N_BITS of type TYPE. */
|
||||||
|
bitset
|
||||||
|
bitset_alloc (n_bits, type)
|
||||||
|
bitset_bindex n_bits;
|
||||||
|
enum bitset_type type;
|
||||||
|
{
|
||||||
|
unsigned int bytes;
|
||||||
|
bitset bset;
|
||||||
|
|
||||||
|
BITSET_STATS_XMALLOCS_INC (type);
|
||||||
|
|
||||||
|
bytes = bitset_bytes (type, n_bits);
|
||||||
|
|
||||||
|
bset = (bitset) xcalloc (1, bytes);
|
||||||
|
|
||||||
|
/* The cache is disabled until some elements are allocated. If we
|
||||||
|
have variable length arrays, then we may need to allocate dummy
|
||||||
|
element. */
|
||||||
|
|
||||||
|
return bitset_init (bset, n_bits, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Create a bitset of N_BITS of type TYPE. */
|
||||||
|
bitset
|
||||||
|
bitset_obstack_alloc (bobstack, n_bits, type)
|
||||||
|
struct obstack *bobstack;
|
||||||
|
bitset_bindex n_bits;
|
||||||
|
enum bitset_type type;
|
||||||
|
{
|
||||||
|
unsigned int bytes;
|
||||||
|
bitset bset;
|
||||||
|
|
||||||
|
BITSET_STATS_OBALLOCS_INC (type);
|
||||||
|
|
||||||
|
bytes = bitset_bytes (type, n_bits);
|
||||||
|
|
||||||
|
bset = obstack_alloc (bobstack, bytes);
|
||||||
|
memset (bset, 0, bytes);
|
||||||
|
|
||||||
|
return bitset_init (bset, n_bits, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Create a bitset of N_BITS and with attribute hints specified by
|
||||||
|
ATTR. */
|
||||||
|
bitset
|
||||||
|
bitset_create (n_bits, attr)
|
||||||
|
bitset_bindex n_bits;
|
||||||
|
unsigned int attr;
|
||||||
|
{
|
||||||
|
enum bitset_type type;
|
||||||
|
|
||||||
|
type = bitset_type_choose (n_bits, attr);
|
||||||
|
|
||||||
|
return bitset_alloc (n_bits, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Free bitset BSET. */
|
||||||
|
void
|
||||||
|
bitset_free (bset)
|
||||||
|
bitset bset;
|
||||||
|
{
|
||||||
|
BITSET_STATS_XFREES_INC (bset);
|
||||||
|
|
||||||
|
BITSET_FREE_ (bset);
|
||||||
|
free (bset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Free bitset BSET allocated on obstack. */
|
||||||
|
void
|
||||||
|
bitset_obstack_free (bset)
|
||||||
|
bitset bset;
|
||||||
|
{
|
||||||
|
BITSET_STATS_OBFREES_INC (bset);
|
||||||
|
|
||||||
|
BITSET_FREE_ (bset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Find next bit set in SRC starting from and including BITNO.
|
||||||
|
Return -1 if SRC empty. */
|
||||||
|
int
|
||||||
|
bitset_next (src, bitno)
|
||||||
|
bitset src;
|
||||||
|
bitset_bindex bitno;
|
||||||
|
{
|
||||||
|
bitset_bindex val;
|
||||||
|
bitset_bindex next = bitno;
|
||||||
|
|
||||||
|
if (!bitset_list (src, &val, 1, &next))
|
||||||
|
return -1;
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Find previous bit set in SRC starting from and including BITNO.
|
||||||
|
Return -1 if SRC empty. */
|
||||||
|
int
|
||||||
|
bitset_prev (src, bitno)
|
||||||
|
bitset src;
|
||||||
|
bitset_bindex bitno;
|
||||||
|
{
|
||||||
|
bitset_bindex val;
|
||||||
|
bitset_bindex next = bitno;
|
||||||
|
|
||||||
|
if (!bitset_reverse_list (src, &val, 1, &next))
|
||||||
|
return -1;
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Find first set bit. */
|
||||||
|
int
|
||||||
|
bitset_first (src)
|
||||||
|
bitset src;
|
||||||
|
{
|
||||||
|
return bitset_next (src, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Find last set bit. */
|
||||||
|
int
|
||||||
|
bitset_last (src)
|
||||||
|
bitset src;
|
||||||
|
{
|
||||||
|
return bitset_prev (src, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Return non-zero if BITNO in SRC is the only set bit. */
|
||||||
|
int
|
||||||
|
bitset_only_set_p (src, bitno)
|
||||||
|
bitset src;
|
||||||
|
bitset_bindex bitno;
|
||||||
|
{
|
||||||
|
bitset_bindex val[2];
|
||||||
|
bitset_bindex next = 0;
|
||||||
|
|
||||||
|
if (bitset_list (src, val, 2, &next) != 1)
|
||||||
|
return 0;
|
||||||
|
return val[0] == bitno;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Toggle bit BITNO in bitset BSET and return non-zero if now set. */
|
||||||
|
int
|
||||||
|
bitset_toggle (bset, bitno)
|
||||||
|
bitset bset;
|
||||||
|
bitset_bindex bitno;
|
||||||
|
{
|
||||||
|
/* This routine is for completeness. It could be optimized if
|
||||||
|
required. */
|
||||||
|
if (bitset_test (bset, bitno))
|
||||||
|
{
|
||||||
|
bitset_reset (bset, bitno);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bitset_set (bset, bitno);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Print contents of bitset BSET to FILE. */
|
||||||
|
static void
|
||||||
|
bitset_print (file, bset, verbose)
|
||||||
|
FILE *file;
|
||||||
|
bitset bset;
|
||||||
|
int verbose;
|
||||||
|
{
|
||||||
|
unsigned int i, pos;
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
fprintf (file, "n_bits = %d, set = {", bitset_size (bset));
|
||||||
|
|
||||||
|
pos = 30;
|
||||||
|
BITSET_EXECUTE (bset, 0, i,
|
||||||
|
{
|
||||||
|
if (pos > 70)
|
||||||
|
{
|
||||||
|
fprintf (file, "\n");
|
||||||
|
pos = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf (file, "%d ", i);
|
||||||
|
pos += 1 + (i >= 10) + (i >= 100);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
fprintf (file, "}\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* DST = SRC. Return non-zero if DST != SRC. */
|
||||||
|
int
|
||||||
|
bitset_copy (dst, src)
|
||||||
|
bitset dst;
|
||||||
|
bitset src;
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
if (BITSET_COMPATIBLE_ (dst, src))
|
||||||
|
return BITSET_COPY_ (dst, src);
|
||||||
|
|
||||||
|
/* Convert bitset types. We assume that the DST bitset
|
||||||
|
is large enough to hold the SRC bitset. */
|
||||||
|
bitset_zero (dst);
|
||||||
|
BITSET_EXECUTE (src, 0, i,
|
||||||
|
{
|
||||||
|
bitset_set (dst, i);
|
||||||
|
});
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Return size in bits of bitset SRC. */
|
||||||
|
int
|
||||||
|
bitset_size (src)
|
||||||
|
bitset src;
|
||||||
|
{
|
||||||
|
return BITSET_SIZE_ (src);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Return number of bits set in bitset SRC. */
|
||||||
|
int
|
||||||
|
bitset_count (src)
|
||||||
|
bitset src;
|
||||||
|
{
|
||||||
|
bitset_bindex list[BITSET_LIST_SIZE];
|
||||||
|
bitset_bindex next;
|
||||||
|
int num;
|
||||||
|
int count;
|
||||||
|
|
||||||
|
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;
|
||||||
|
{
|
||||||
|
BITSET_CHECK2_ (dst, src);
|
||||||
|
return BITSET_SUBSET_P_ (dst, src);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Return DST == SRC. */
|
||||||
|
int
|
||||||
|
bitset_equal_p (dst, src)
|
||||||
|
bitset dst;
|
||||||
|
bitset src;
|
||||||
|
{
|
||||||
|
BITSET_CHECK2_ (dst, src);
|
||||||
|
return BITSET_EQUAL_P_ (dst, src);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Return DST & SRC == 0. */
|
||||||
|
int
|
||||||
|
bitset_disjoint_p (dst, src)
|
||||||
|
bitset dst;
|
||||||
|
bitset src;
|
||||||
|
{
|
||||||
|
BITSET_CHECK2_ (dst, src);
|
||||||
|
return BITSET_DISJOINT_P_ (dst, src);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* DST = ~SRC. */
|
||||||
|
int
|
||||||
|
bitset_not (dst, src)
|
||||||
|
bitset dst;
|
||||||
|
bitset src;
|
||||||
|
{
|
||||||
|
BITSET_CHECK2_ (dst, 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;
|
||||||
|
{
|
||||||
|
BITSET_CHECK3_ (dst, src1, 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;
|
||||||
|
{
|
||||||
|
BITSET_CHECK3_ (dst, src1, 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;
|
||||||
|
{
|
||||||
|
BITSET_CHECK3_ (dst, src1, 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;
|
||||||
|
{
|
||||||
|
BITSET_CHECK3_ (dst, src1, src2);
|
||||||
|
return BITSET_ANDN_ (dst, src1, src2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
bitset_op4 (dst, src1, src2, src3, op)
|
||||||
|
bitset dst;
|
||||||
|
bitset src1;
|
||||||
|
bitset src2;
|
||||||
|
bitset src3;
|
||||||
|
enum bitset_ops op;
|
||||||
|
{
|
||||||
|
int changed = 0;
|
||||||
|
bitset tmp;
|
||||||
|
|
||||||
|
/* Create temporary bitset. */
|
||||||
|
tmp = bitset_alloc (0, BITSET_TYPE_ (dst));
|
||||||
|
|
||||||
|
switch (op)
|
||||||
|
{
|
||||||
|
case BITSET_OP_OR_AND:
|
||||||
|
BITSET_OR_ (tmp, src1, src2);
|
||||||
|
changed = BITSET_AND_ (dst, src3, tmp);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BITSET_OP_AND_OR:
|
||||||
|
BITSET_AND_ (tmp, src1, src2);
|
||||||
|
changed = BITSET_OR_ (dst, src3, tmp);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BITSET_OP_ANDN_OR:
|
||||||
|
BITSET_ANDN_ (tmp, src1, src2);
|
||||||
|
changed = BITSET_OR_ (dst, src3, tmp);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
|
||||||
|
bitset_free (tmp);
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* DST = (SRC1 | SRC2) & SRC3. Return non-zero if
|
||||||
|
DST != (SRC1 | SRC2) & SRC3. */
|
||||||
|
int
|
||||||
|
bitset_or_and (dst, src1, src2, src3)
|
||||||
|
bitset dst;
|
||||||
|
bitset src1;
|
||||||
|
bitset src2;
|
||||||
|
bitset src3;
|
||||||
|
{
|
||||||
|
BITSET_CHECK4_ (dst, src1, src2, src3);
|
||||||
|
return BITSET_OR_AND_ (dst, src1, src2, src3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* DST = (SRC1 & SRC2) | SRC3. Return non-zero if
|
||||||
|
DST != (SRC1 & SRC2) | SRC3. */
|
||||||
|
int
|
||||||
|
bitset_and_or (dst, src1, src2, src3)
|
||||||
|
bitset dst;
|
||||||
|
bitset src1;
|
||||||
|
bitset src2;
|
||||||
|
bitset src3;
|
||||||
|
{
|
||||||
|
BITSET_CHECK4_ (dst, src1, src2, src3);
|
||||||
|
return BITSET_AND_OR_ (dst, src1, src2, src3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* DST = (SRC1 & ~SRC2) | SRC3. Return non-zero if
|
||||||
|
DST != (SRC1 & ~SRC2) | SRC3. */
|
||||||
|
int
|
||||||
|
bitset_andn_or (dst, src1, src2, src3)
|
||||||
|
bitset dst;
|
||||||
|
bitset src1;
|
||||||
|
bitset src2;
|
||||||
|
bitset src3;
|
||||||
|
{
|
||||||
|
BITSET_CHECK4_ (dst, src1, src2, src3);
|
||||||
|
return BITSET_ANDN_OR_ (dst, src1, src2, src3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Dump bitset BSET to FILE. */
|
||||||
|
void
|
||||||
|
bitset_dump (file, bset)
|
||||||
|
FILE *file;
|
||||||
|
bitset bset;
|
||||||
|
{
|
||||||
|
bitset_print (file, bset, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Function to be called from debugger to print bitset. */
|
||||||
|
void
|
||||||
|
debug_bitset (bset)
|
||||||
|
bitset bset;
|
||||||
|
{
|
||||||
|
if (bset)
|
||||||
|
bitset_print (stderr, bset, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Release memory associated with bitsets. */
|
||||||
|
void
|
||||||
|
bitset_release_memory ()
|
||||||
|
{
|
||||||
|
lbitset_release_memory ();
|
||||||
|
ebitset_release_memory ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if BITSET_STATS
|
||||||
|
int
|
||||||
|
bitset_list (bset, list, num, next)
|
||||||
|
bitset bset;
|
||||||
|
bitset_bindex *list;
|
||||||
|
bitset_bindex num;
|
||||||
|
bitset_bindex *next;
|
||||||
|
{
|
||||||
|
bitset_bindex count;
|
||||||
|
|
||||||
|
count = BITSET_LIST_ (bset, list, num, next);
|
||||||
|
|
||||||
|
if (bitset_stats)
|
||||||
|
{
|
||||||
|
bitset_bindex tmp;
|
||||||
|
bitset_bindex size;
|
||||||
|
bitset_bindex i;
|
||||||
|
enum bitset_type type;
|
||||||
|
|
||||||
|
type = BITSET_TYPE_ (bset);
|
||||||
|
BITSET_STATS_LISTS_INC (bset);
|
||||||
|
|
||||||
|
/* Log histogram of number of set bits. */
|
||||||
|
for (i = 0, tmp = count; tmp; tmp >>= 1, i++)
|
||||||
|
continue;
|
||||||
|
if (i >= BITSET_LOG_COUNT_BINS)
|
||||||
|
i = BITSET_LOG_COUNT_BINS - 1;
|
||||||
|
BITSET_STATS_LIST_COUNTS_INC (bset, i);
|
||||||
|
|
||||||
|
/* Log histogram of number of bits in set. */
|
||||||
|
size = bitset_size (bset);
|
||||||
|
for (i = 0, tmp = size; tmp; tmp >>= 1, i++)
|
||||||
|
continue;
|
||||||
|
if (i >= BITSET_LOG_SIZE_BINS)
|
||||||
|
i = BITSET_LOG_SIZE_BINS - 1;
|
||||||
|
BITSET_STATS_LIST_SIZES_INC (bset, i);
|
||||||
|
|
||||||
|
/* Histogram of fraction of bits set. */
|
||||||
|
i = size ? (count * BITSET_DENSITY_BINS) / size : 0;
|
||||||
|
if (i >= BITSET_DENSITY_BINS)
|
||||||
|
i = BITSET_DENSITY_BINS - 1;
|
||||||
|
BITSET_STATS_LIST_DENSITY_INC (bset, i);
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Print a percentage histogram with message MSG to FILE. */
|
||||||
|
static void
|
||||||
|
bitset_percent_histogram_print (file, name, msg, n_bins, bins)
|
||||||
|
FILE *file;
|
||||||
|
const char *name;
|
||||||
|
const char *msg;
|
||||||
|
unsigned int n_bins;
|
||||||
|
unsigned int *bins;
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
unsigned int total;
|
||||||
|
|
||||||
|
total = 0;
|
||||||
|
for (i = 0; i < n_bins; i++)
|
||||||
|
total += bins[i];
|
||||||
|
|
||||||
|
if (!total)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fprintf (file, "%s %s", name, msg);
|
||||||
|
for (i = 0; i < n_bins; i++)
|
||||||
|
fprintf (file, "%.0f-%.0f%%\t%8d (%5.1f%%)\n",
|
||||||
|
i * 100.0 / n_bins,
|
||||||
|
(i + 1) * 100.0 / n_bins, bins[i],
|
||||||
|
(100.0 * bins[i]) / total);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Print a log histogram with message MSG to FILE. */
|
||||||
|
static void
|
||||||
|
bitset_log_histogram_print (file, name, msg, n_bins, bins)
|
||||||
|
FILE *file;
|
||||||
|
const char *name;
|
||||||
|
const char *msg;
|
||||||
|
unsigned int n_bins;
|
||||||
|
unsigned int *bins;
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
unsigned int total;
|
||||||
|
unsigned int max_width;
|
||||||
|
|
||||||
|
total = 0;
|
||||||
|
for (i = 0; i < n_bins; i++)
|
||||||
|
total += bins[i];
|
||||||
|
|
||||||
|
if (!total)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* 2 * ceil (log10(2) * (N - 1)) + 1 */
|
||||||
|
max_width = 2 * (unsigned int) (0.30103 * (n_bins - 1) + 0.9999) + 1;
|
||||||
|
|
||||||
|
fprintf (file, "%s %s", name, msg);
|
||||||
|
for (i = 0; i < 2; i++)
|
||||||
|
fprintf (file, "%*d\t%8d (%5.1f%%)\n",
|
||||||
|
max_width, i, bins[i], 100.0 * bins[i] / total);
|
||||||
|
|
||||||
|
/* Perhaps we should bail out once the histogram goes to zero. */
|
||||||
|
for (; i < n_bins; i++)
|
||||||
|
fprintf (file, "%*d-%d\t%8d (%5.1f%%)\n",
|
||||||
|
max_width - ((unsigned int) (0.30103 * (i) + 0.9999) + 1),
|
||||||
|
1 << (i - 1), (1 << i) - 1, bins[i],
|
||||||
|
(100.0 * bins[i]) / total);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Print bitset statistics to FILE. */
|
||||||
|
static void
|
||||||
|
bitset_stats_print_1 (file, name, stats)
|
||||||
|
FILE *file;
|
||||||
|
const char *name;
|
||||||
|
struct bitset_type_stats_struct *stats;
|
||||||
|
{
|
||||||
|
if (!stats)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fprintf (file, "%d %ss xmalloced, %d freed.\n",
|
||||||
|
stats->xmallocs, name, stats->xfrees);
|
||||||
|
fprintf (file, "%d %ss oballoced, %d freed.\n",
|
||||||
|
stats->oballocs, name, stats->obfrees);
|
||||||
|
|
||||||
|
fprintf (file, "%d bitset_lists\n", stats->lists);
|
||||||
|
|
||||||
|
bitset_log_histogram_print (file, name, "count log histogram\n",
|
||||||
|
BITSET_LOG_COUNT_BINS, stats->list_counts);
|
||||||
|
|
||||||
|
bitset_log_histogram_print (file, name, "size log histogram\n",
|
||||||
|
BITSET_LOG_SIZE_BINS, stats->list_sizes);
|
||||||
|
|
||||||
|
bitset_percent_histogram_print (file, name, "density histogram\n",
|
||||||
|
BITSET_DENSITY_BINS, stats->list_density);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Print all bitset statistics to FILE. */
|
||||||
|
static void
|
||||||
|
bitset_stats_print (file, verbose)
|
||||||
|
FILE *file;
|
||||||
|
int verbose ATTRIBUTE_UNUSED;
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
static const char *names[] = BITSET_TYPE_NAMES;
|
||||||
|
|
||||||
|
if (!bitset_stats)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fprintf (file, "Bitset statistics:\n\n");
|
||||||
|
|
||||||
|
if (bitset_stats->runs > 1)
|
||||||
|
fprintf (file, "Accumulated runs = %d\n", bitset_stats->runs);
|
||||||
|
|
||||||
|
for (i = 0; i < BITSET_TYPE_NUM; i++)
|
||||||
|
bitset_stats_print_1 (file, names[i], &bitset_stats->types[i]);
|
||||||
|
}
|
||||||
|
#endif /* BITSET_STATS */
|
||||||
|
|
||||||
|
|
||||||
|
/* Initialise bitset statistics logging. */
|
||||||
|
void
|
||||||
|
bitset_stats_init ()
|
||||||
|
{
|
||||||
|
#if BITSET_STATS
|
||||||
|
bitset_stats = &bitset_stats_data;
|
||||||
|
bitset_stats_read ();
|
||||||
|
#endif /* BITSET_STATS */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Read bitset statistics file. */
|
||||||
|
static void
|
||||||
|
bitset_stats_read ()
|
||||||
|
{
|
||||||
|
FILE *file;
|
||||||
|
|
||||||
|
if (!bitset_stats)
|
||||||
|
return;
|
||||||
|
|
||||||
|
file = fopen (BITSET_STATS_FILE, "r");
|
||||||
|
if (file)
|
||||||
|
{
|
||||||
|
if (fread (&bitset_stats_data, sizeof (bitset_stats_data),
|
||||||
|
1, file) != 1)
|
||||||
|
{
|
||||||
|
if (ferror (file))
|
||||||
|
perror ("Could not read stats file.");
|
||||||
|
else
|
||||||
|
fprintf (stderr, "Bad stats file size.\n");
|
||||||
|
}
|
||||||
|
fclose (file);
|
||||||
|
}
|
||||||
|
bitset_stats_data.runs++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Write bitset statistics file. */
|
||||||
|
static void
|
||||||
|
bitset_stats_write ()
|
||||||
|
{
|
||||||
|
FILE *file;
|
||||||
|
|
||||||
|
if (!bitset_stats)
|
||||||
|
return;
|
||||||
|
|
||||||
|
file = fopen (BITSET_STATS_FILE, "w");
|
||||||
|
if (file)
|
||||||
|
{
|
||||||
|
if (fwrite (&bitset_stats_data, sizeof (bitset_stats_data),
|
||||||
|
1, file) != 1)
|
||||||
|
perror ("Could not write stats file.");
|
||||||
|
fclose (file);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
perror ("Could not open stats file for writing.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Dump bitset statistics to FILE. */
|
||||||
|
void
|
||||||
|
bitset_stats_dump (file)
|
||||||
|
FILE *file;
|
||||||
|
{
|
||||||
|
#if BITSET_STATS
|
||||||
|
bitset_stats_print (file, 0);
|
||||||
|
bitset_stats_write ();
|
||||||
|
#endif /* BITSET_STATS */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Function to be called from debugger to print bitset stats. */
|
||||||
|
void
|
||||||
|
debug_bitset_stats (void)
|
||||||
|
{
|
||||||
|
#if BITSET_STATS
|
||||||
|
bitset_stats_print (stderr, 1);
|
||||||
|
#endif /* BITSET_STATS */
|
||||||
|
}
|
||||||
+341
@@ -0,0 +1,341 @@
|
|||||||
|
/* Generic bitsets.
|
||||||
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
|
Contributed by Michael Hayes ([email protected]).
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifndef _BITSET_H
|
||||||
|
#define _BITSET_H
|
||||||
|
|
||||||
|
/* This file is the public interface to the bitset abstract data type.
|
||||||
|
Only use the functions and macros defined in this file. */
|
||||||
|
|
||||||
|
#include "bbitset.h"
|
||||||
|
#include "obstack.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/* Attributes used to select a bitset implementation. */
|
||||||
|
enum bitset_attr {BITSET_FIXED = 1, /* Bitset size fixed. */
|
||||||
|
BITSET_VARIABLE = 2, /* Bitset size variable. */
|
||||||
|
BITSET_DENSE = 4, /* Bitset dense. */
|
||||||
|
BITSET_SPARSE = 8, /* Bitset sparse. */
|
||||||
|
BITSET_FRUGAL = 16, /* Prefer most compact. */
|
||||||
|
BITSET_GREEDY = 32}; /* Prefer fastest. */
|
||||||
|
|
||||||
|
typedef unsigned int bitset_attrs;
|
||||||
|
|
||||||
|
/* The contents of the structure should be considered to be private.
|
||||||
|
While I would like to make this structure opaque, it needs to be
|
||||||
|
visible for the inline bit set/test functions. */
|
||||||
|
struct bitset_struct
|
||||||
|
{
|
||||||
|
struct bbitset_struct b;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Return bytes required for bitset of desired type and size. */
|
||||||
|
extern int bitset_bytes PARAMS ((enum bitset_type, bitset_bindex));
|
||||||
|
|
||||||
|
/* Initialise a bitset with desired type and size. */
|
||||||
|
extern bitset bitset_init PARAMS ((bitset, bitset_bindex, enum bitset_type));
|
||||||
|
|
||||||
|
/* Select an implementation type based on the desired bitset size
|
||||||
|
and attributes. */
|
||||||
|
extern enum bitset_type bitset_type_choose PARAMS ((bitset_bindex,
|
||||||
|
bitset_attrs));
|
||||||
|
|
||||||
|
/* Create a bitset of desired type and size. The bitset is zeroed. */
|
||||||
|
extern bitset bitset_alloc PARAMS ((bitset_bindex, enum bitset_type));
|
||||||
|
|
||||||
|
/* Free bitset. */
|
||||||
|
extern void bitset_free PARAMS ((bitset));
|
||||||
|
|
||||||
|
/* Create a bitset of desired type and size using an obstack. The
|
||||||
|
bitset is zeroed. */
|
||||||
|
extern bitset bitset_obstack_alloc PARAMS ((struct obstack *bobstack,
|
||||||
|
bitset_bindex, enum bitset_type));
|
||||||
|
|
||||||
|
/* Free bitset allocated on obstack. */
|
||||||
|
extern void bitset_obstack_free PARAMS ((bitset));
|
||||||
|
|
||||||
|
/* Create a bitset of desired size and attributes. The bitset is zeroed. */
|
||||||
|
extern bitset bitset_create PARAMS ((bitset_bindex, bitset_attrs));
|
||||||
|
|
||||||
|
/* Return size in bits of bitset SRC. */
|
||||||
|
extern int bitset_size PARAMS ((bitset));
|
||||||
|
|
||||||
|
/* Return number of bits set in bitset SRC. */
|
||||||
|
extern int bitset_count PARAMS ((bitset));
|
||||||
|
|
||||||
|
#if BITSET_CACHE && BITSET_INLINE
|
||||||
|
static inline void bitset_set PARAMS ((bitset, bitset_bindex));
|
||||||
|
static inline void bitset_reset PARAMS ((bitset, bitset_bindex));
|
||||||
|
static inline int bitset_test PARAMS ((bitset, bitset_bindex));
|
||||||
|
|
||||||
|
/* Set bit BITNO in bitset BSET. */
|
||||||
|
static inline void bitset_set (bset, bitno)
|
||||||
|
bitset bset;
|
||||||
|
bitset_bindex bitno;
|
||||||
|
{
|
||||||
|
bitset_windex index = bitno / BITSET_WORD_BITS;
|
||||||
|
bitset_windex offset = index - bset->b.cindex;
|
||||||
|
|
||||||
|
if (offset < bset->b.csize)
|
||||||
|
bset->b.cdata[offset] |= (1 << (bitno % BITSET_WORD_BITS));
|
||||||
|
else
|
||||||
|
BITSET_SET_ (bset, bitno);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Reset bit BITNO in bitset BSET. */
|
||||||
|
static inline void bitset_reset (bset, bitno)
|
||||||
|
bitset bset;
|
||||||
|
bitset_bindex bitno;
|
||||||
|
{
|
||||||
|
bitset_windex index = bitno / BITSET_WORD_BITS;
|
||||||
|
bitset_windex offset = index - bset->b.cindex;
|
||||||
|
|
||||||
|
if (offset < bset->b.csize)
|
||||||
|
bset->b.cdata[offset] &= ~(1 << (bitno % BITSET_WORD_BITS));
|
||||||
|
else
|
||||||
|
BITSET_RESET_ (bset, bitno);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Test bit BITNO in bitset BSET. */
|
||||||
|
static inline int bitset_test (bset, bitno)
|
||||||
|
bitset bset;
|
||||||
|
bitset_bindex bitno;
|
||||||
|
{
|
||||||
|
bitset_windex index = bitno / BITSET_WORD_BITS;
|
||||||
|
bitset_windex offset = index - bset->b.cindex;
|
||||||
|
|
||||||
|
if (offset < bset->b.csize)
|
||||||
|
return (bset->b.cdata[offset] >> (bitno % BITSET_WORD_BITS)) & 1;
|
||||||
|
else
|
||||||
|
return BITSET_TEST_ (bset, bitno);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BITSET_CACHE && ! 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] |= (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] &= ~(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) \
|
||||||
|
? ((bset)->b.cdata[(((bitno) / BITSET_WORD_BITS) - (bset)->b.cindex)] \
|
||||||
|
>> ((bitno) % BITSET_WORD_BITS)) & 1 \
|
||||||
|
: (unsigned int) BITSET_TEST_ ((bset), (bitno)))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ! BITSET_CACHE
|
||||||
|
/* Set bit BITNO in bitset SRC. */
|
||||||
|
#define bitset_set(SRC, BITNO) BITSET_SET_ (SRC, BITNO)
|
||||||
|
|
||||||
|
/* Reset bit BITNO in bitset SRC. */
|
||||||
|
#define bitset_reset(SRC, BITNO) BITSET_RESET_ (SRC, BITNO)
|
||||||
|
|
||||||
|
/* Return non-zero if bit BITNO in bitset SRC is set. */
|
||||||
|
#define bitset_test(SRC, BITNO) BITSET_TEST_ (SRC, BITNO)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Toggle bit BITNO in bitset BSET and return non-zero if now set. */
|
||||||
|
extern int bitset_toggle PARAMS ((bitset, bitset_bindex));
|
||||||
|
|
||||||
|
/* DST = 0. */
|
||||||
|
extern int bitset_zero PARAMS ((bitset));
|
||||||
|
|
||||||
|
/* DST = ~0. */
|
||||||
|
extern int bitset_ones PARAMS ((bitset));
|
||||||
|
|
||||||
|
/* Return non-zero if all bits in bitset SRC are reset. */
|
||||||
|
extern int bitset_empty_p PARAMS ((bitset));
|
||||||
|
|
||||||
|
/* Return DST == DST | SRC. */
|
||||||
|
extern int bitset_subset_p PARAMS ((bitset, bitset));
|
||||||
|
|
||||||
|
/* Return DST == SRC. */
|
||||||
|
extern int bitset_equal_p PARAMS ((bitset, bitset));
|
||||||
|
|
||||||
|
/* Return DST & SRC == 0. */
|
||||||
|
extern int bitset_disjoint_p PARAMS ((bitset, bitset));
|
||||||
|
|
||||||
|
/* DST == SRC. */
|
||||||
|
extern int bitset_copy PARAMS ((bitset, bitset));
|
||||||
|
|
||||||
|
/* DST = ~SRC. */
|
||||||
|
extern int bitset_not PARAMS ((bitset, bitset));
|
||||||
|
|
||||||
|
/* DST = SRC1 | SRC2. Return non-zero if DST != SRC1 | SRC2. */
|
||||||
|
extern int bitset_or PARAMS ((bitset, bitset, bitset));
|
||||||
|
|
||||||
|
/* DST = SRC1 & SRC2. Return non-zero if DST != SRC1 & SRC2. */
|
||||||
|
extern int bitset_and PARAMS ((bitset, bitset, bitset));
|
||||||
|
|
||||||
|
/* DST = SRC1 ^ SRC2. Return non-zero if DST != SRC1 ^ SRC2. */
|
||||||
|
extern int bitset_xor PARAMS ((bitset, bitset, bitset));
|
||||||
|
|
||||||
|
/* DST = SRC1 & ~SRC2. Return non-zero if DST != SRC1 & ~SRC2. */
|
||||||
|
extern int bitset_andn PARAMS ((bitset, bitset, bitset));
|
||||||
|
|
||||||
|
/* DST = (SRC1 | SRC2) & SRC3. Return non-zero if
|
||||||
|
DST != (SRC1 | SRC2) & SRC3. */
|
||||||
|
extern int bitset_or_and PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
|
|
||||||
|
/* DST = (SRC1 & SRC2) | SRC3. Return non-zero if
|
||||||
|
DST != (SRC1 & SRC2) | SRC3. */
|
||||||
|
extern int bitset_and_or PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
|
|
||||||
|
/* DST = (SRC1 & ~SRC2) | SRC3. Return non-zero if
|
||||||
|
DST != (SRC1 & ~SRC2) | SRC3. */
|
||||||
|
extern int bitset_andn_or PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
|
|
||||||
|
/* Find next bit set in BSET starting from and including BITNO. */
|
||||||
|
extern int bitset_next PARAMS ((bitset, bitset_bindex));
|
||||||
|
|
||||||
|
/* Find previous bit set in BSET starting from and including BITNO. */
|
||||||
|
extern int bitset_prev PARAMS ((bitset, bitset_bindex));
|
||||||
|
|
||||||
|
/* Return non-zero if BITNO in SRC is the only set bit. */
|
||||||
|
extern int bitset_only_set_p PARAMS ((bitset, bitset_bindex));
|
||||||
|
|
||||||
|
/* Find list of up to NUM bits set in BSET starting from and including
|
||||||
|
*NEXT. Return with actual number of bits found and with *NEXT
|
||||||
|
indicating where search stopped. */
|
||||||
|
#if BITSET_STATS
|
||||||
|
extern int bitset_list PARAMS ((bitset, bitset_bindex *, bitset_bindex,
|
||||||
|
bitset_bindex *));
|
||||||
|
#else
|
||||||
|
#define bitset_list(BSET, LIST, NUM, NEXT) \
|
||||||
|
BITSET_LIST_ (BSET, LIST, NUM, NEXT)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Find reverse list of up to NUM bits set in BSET starting from and
|
||||||
|
including NEXT. Return with actual number of bits found and with
|
||||||
|
*NEXT indicating where search stopped. */
|
||||||
|
#define bitset_reverse_list(BSET, LIST, NUM, NEXT) \
|
||||||
|
BITSET_REVERSE_LIST_ (BSET, LIST, NUM, NEXT)
|
||||||
|
|
||||||
|
/* Find first set bit. */
|
||||||
|
extern int bitset_first PARAMS ((bitset));
|
||||||
|
|
||||||
|
/* Find last set bit. */
|
||||||
|
extern int bitset_last PARAMS ((bitset));
|
||||||
|
|
||||||
|
/* Dump bitset. */
|
||||||
|
extern void bitset_dump PARAMS ((FILE *, bitset));
|
||||||
|
|
||||||
|
/* Loop over all elements of BSET, starting with MIN, executing CODE. */
|
||||||
|
#define BITSET_EXECUTE(BSET, MIN, N, CODE) \
|
||||||
|
do { \
|
||||||
|
bitset_bindex _list[BITSET_LIST_SIZE]; \
|
||||||
|
bitset_bindex _next = (MIN); \
|
||||||
|
int _num; \
|
||||||
|
\
|
||||||
|
while ((_num = bitset_list ((BSET), _list, BITSET_LIST_SIZE, &_next)))\
|
||||||
|
{ \
|
||||||
|
int _i; \
|
||||||
|
\
|
||||||
|
for (_i = 0; _i < _num; _i++) \
|
||||||
|
{ \
|
||||||
|
(N) = _list[_i]; \
|
||||||
|
CODE; \
|
||||||
|
} \
|
||||||
|
if (_num < BITSET_LIST_SIZE) \
|
||||||
|
break; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
/* Loop over all elements of BSET, in reverse order starting with
|
||||||
|
MIN, executing CODE. */
|
||||||
|
#define BITSET_REVERSE_EXECUTE(BSET, MIN, N, CODE) \
|
||||||
|
do { \
|
||||||
|
bitset_bindex _list[BITSET_LIST_SIZE]; \
|
||||||
|
bitset_bindex _next = (MIN); \
|
||||||
|
int _num; \
|
||||||
|
\
|
||||||
|
while ((_num = bitset_reverse_list ((BSET), _list, \
|
||||||
|
BITSET_LIST_SIZE, &_next))) \
|
||||||
|
{ \
|
||||||
|
int _i; \
|
||||||
|
\
|
||||||
|
for (_i = 0; _i < _num; _i++) \
|
||||||
|
{ \
|
||||||
|
(N) = _list[_i]; \
|
||||||
|
CODE; \
|
||||||
|
} \
|
||||||
|
if (_num < BITSET_LIST_SIZE) \
|
||||||
|
break; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
/* Define set operations in terms of logical operations. */
|
||||||
|
|
||||||
|
#define bitset_diff(DST, SRC1, SRC2) bitset_andn (DST, SRC1, SRC2)
|
||||||
|
|
||||||
|
#define bitset_intersection(DST, SRC1, SRC2) bitset_and (DST, SRC1, SRC2)
|
||||||
|
|
||||||
|
#define bitset_union(DST, SRC1, SRC2) bitset_or (DST, SRC1, SRC2)
|
||||||
|
|
||||||
|
#define bitset_diff_union(DST, SRC1, SRC2, SRC3) \
|
||||||
|
bitset_andn_or (DST, SRC1, SRC2, SRC3)
|
||||||
|
|
||||||
|
|
||||||
|
/* Release any memory tied up with bitsets. */
|
||||||
|
extern void bitset_release_memory PARAMS ((void));
|
||||||
|
|
||||||
|
/* Initialise bitset stats. */
|
||||||
|
extern void bitset_stats_init PARAMS ((void));
|
||||||
|
|
||||||
|
/* Dump bitset stats. */
|
||||||
|
extern void bitset_stats_dump PARAMS ((FILE *));
|
||||||
|
|
||||||
|
/* Function to debug bitset from debugger. */
|
||||||
|
extern void debug_bitset PARAMS ((bitset));
|
||||||
|
|
||||||
|
/* Function to debug bitset stats from debugger. */
|
||||||
|
extern void debug_bitset_stats PARAMS ((void));
|
||||||
|
|
||||||
|
#endif /* _BITSET_H */
|
||||||
+179
@@ -0,0 +1,179 @@
|
|||||||
|
/* Bitset vectors.
|
||||||
|
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of GCC.
|
||||||
|
|
||||||
|
GCC 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.
|
||||||
|
|
||||||
|
GCC 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 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
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "bitsetv.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* Create a vector of N_VECS bitsets, each of N_BITS, and of
|
||||||
|
type TYPE. */
|
||||||
|
bitset *
|
||||||
|
bitsetv_alloc (n_vecs, n_bits, type)
|
||||||
|
unsigned int n_vecs;
|
||||||
|
unsigned int n_bits;
|
||||||
|
enum bitset_type type;
|
||||||
|
{
|
||||||
|
unsigned int vector_bytes;
|
||||||
|
unsigned int bytes;
|
||||||
|
bitset *bsetv;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
/* Determine number of bytes for each set. */
|
||||||
|
bytes = bitset_bytes (type, n_bits);
|
||||||
|
|
||||||
|
/* Allocate vector table at head of bitset array. */
|
||||||
|
vector_bytes = (n_vecs + 1) * sizeof (bitset);
|
||||||
|
bsetv = (bitset *) xcalloc (1, vector_bytes + bytes * n_vecs);
|
||||||
|
|
||||||
|
for (i = 0; i < n_vecs; i++)
|
||||||
|
{
|
||||||
|
bsetv[i] = (bitset) ((char *) bsetv + vector_bytes + i * bytes);
|
||||||
|
|
||||||
|
bitset_init (bsetv[i], n_bits, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Null terminate table. */
|
||||||
|
bsetv[i] = 0;
|
||||||
|
return bsetv;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Create a vector of N_VECS bitsets, each of N_BITS, and with
|
||||||
|
attribute hints specified by ATTR. */
|
||||||
|
bitset *
|
||||||
|
bitsetv_create (n_vecs, n_bits, attr)
|
||||||
|
unsigned int n_vecs;
|
||||||
|
unsigned int n_bits;
|
||||||
|
unsigned int attr;
|
||||||
|
{
|
||||||
|
enum bitset_type type;
|
||||||
|
|
||||||
|
type = bitset_type_choose (n_bits, attr);
|
||||||
|
return bitsetv_alloc (n_vecs, n_bits, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Free bitset vector BSETV. */
|
||||||
|
void
|
||||||
|
bitsetv_free (bsetv)
|
||||||
|
bitset *bsetv;
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; bsetv[i]; i++)
|
||||||
|
BITSET_FREE_ (bsetv[i]);
|
||||||
|
free (bsetv);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Zero a vector of bitsets. */
|
||||||
|
void
|
||||||
|
bitsetv_zero (bsetv)
|
||||||
|
struct bitset_struct **bsetv;
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; bsetv[i]; i++)
|
||||||
|
bitset_zero (bsetv[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Set a vector of bitsets to ones. */
|
||||||
|
void
|
||||||
|
bitsetv_ones (bsetv)
|
||||||
|
bitset *bsetv;
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; bsetv[i]; i++)
|
||||||
|
bitset_ones (bsetv[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Given a vector BSETV of N bitsets of size N, modify its contents to
|
||||||
|
be the transitive closure of what was given. */
|
||||||
|
void
|
||||||
|
bitsetv_transitive_closure (bsetv)
|
||||||
|
bitset *bsetv;
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
unsigned int j;
|
||||||
|
|
||||||
|
for (i = 0; bsetv[i]; i++)
|
||||||
|
for (j = 0; bsetv[j]; j++)
|
||||||
|
if (bitset_test (bsetv[j], i))
|
||||||
|
bitset_or (bsetv[j], bsetv[j], bsetv[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* 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
|
||||||
|
the same as transitive closure but with all bits on the diagonal
|
||||||
|
of the bit matrix set. */
|
||||||
|
void
|
||||||
|
bitsetv_reflexive_transitive_closure (bitsetv bsetv)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
bitsetv_transitive_closure (bsetv);
|
||||||
|
for (i = 0; bsetv[i]; i++)
|
||||||
|
bitset_set (bsetv[i], i);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Dump the contents of a bitset vector BSETV with N_VECS elements to
|
||||||
|
FILE. */
|
||||||
|
void
|
||||||
|
bitsetv_dump (file, title, subtitle, bsetv)
|
||||||
|
FILE *file;
|
||||||
|
const char *title, *subtitle;
|
||||||
|
bitset *bsetv;
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
fprintf (file, "%s\n", title);
|
||||||
|
for (i = 0; bsetv[i]; i++)
|
||||||
|
{
|
||||||
|
fprintf (file, "%s %d\n", subtitle, i);
|
||||||
|
bitset_dump (file, bsetv[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf (file, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
debug_bitsetv (bsetv)
|
||||||
|
bitset *bsetv;
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; bsetv[i]; i++)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%d: ", i);
|
||||||
|
debug_bitset (bsetv[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf (stderr, "\n");
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
/* Bitset vectors.
|
||||||
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
|
Contributed by Michael Hayes ([email protected]).
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifndef _BITSETV_H
|
||||||
|
#define _BITSETV_H
|
||||||
|
|
||||||
|
#include "bitset.h"
|
||||||
|
|
||||||
|
typedef bitset * bitsetv;
|
||||||
|
|
||||||
|
/* Create a vector of N_VECS bitsets, each of N_BITS, and of
|
||||||
|
type TYPE. */
|
||||||
|
extern bitsetv bitsetv_alloc PARAMS ((unsigned int, unsigned int,
|
||||||
|
enum bitset_type));
|
||||||
|
|
||||||
|
/* Create a vector of N_VECS bitsets, each of N_BITS, and with
|
||||||
|
attribute hints specified by ATTR. */
|
||||||
|
extern bitsetv bitsetv_create PARAMS ((unsigned int, unsigned int,
|
||||||
|
unsigned int));
|
||||||
|
|
||||||
|
/* Free vector of bitsets. */
|
||||||
|
extern void bitsetv_free PARAMS ((bitsetv));
|
||||||
|
|
||||||
|
/* Zero vector of bitsets. */
|
||||||
|
extern void bitsetv_zero PARAMS ((bitsetv));
|
||||||
|
|
||||||
|
/* Set vector of bitsets. */
|
||||||
|
extern void bitsetv_ones PARAMS ((bitsetv));
|
||||||
|
|
||||||
|
/* Given a vector BSETV of N bitsets of size N, modify its contents to
|
||||||
|
be the transitive closure of what was given. */
|
||||||
|
extern void bitsetv_transitive_closure PARAMS ((bitsetv));
|
||||||
|
|
||||||
|
/* 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
|
||||||
|
the same as transitive closure but with all bits on the diagonal
|
||||||
|
of the bit matrix set. */
|
||||||
|
extern void bitsetv_reflexive_transitive_closure PARAMS ((bitsetv));
|
||||||
|
|
||||||
|
/* Dump vector of bitsets. */
|
||||||
|
extern void bitsetv_dump PARAMS ((FILE *, const char *,
|
||||||
|
const char *, bitsetv));
|
||||||
|
|
||||||
|
/* Function to debug vector of bitsets from debugger. */
|
||||||
|
extern void debug_bitsetv PARAMS ((bitsetv));
|
||||||
|
|
||||||
|
#endif /* _BITSETV_H */
|
||||||
+189
@@ -0,0 +1,189 @@
|
|||||||
|
/* dirname.c -- return all but the last element in a path
|
||||||
|
Copyright (C) 1990, 1998, 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. */
|
||||||
|
|
||||||
|
#if HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef STDC_HEADERS
|
||||||
|
# include <stdlib.h>
|
||||||
|
#else
|
||||||
|
char *malloc ();
|
||||||
|
#endif
|
||||||
|
#if defined STDC_HEADERS || defined HAVE_STRING_H
|
||||||
|
# include <string.h>
|
||||||
|
#else
|
||||||
|
# include <strings.h>
|
||||||
|
# ifndef strrchr
|
||||||
|
# define strrchr rindex
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#ifndef HAVE_DECL_MEMRCHR
|
||||||
|
"this configure-time declaration test was not run"
|
||||||
|
#endif
|
||||||
|
#if !HAVE_DECL_MEMRCHR
|
||||||
|
void *memrchr ();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "dirname.h"
|
||||||
|
|
||||||
|
#ifndef FILESYSTEM_PREFIX_LEN
|
||||||
|
# define FILESYSTEM_PREFIX_LEN(Filename) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ISSLASH
|
||||||
|
# define ISSLASH(C) ((C) == '/')
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define BACKSLASH_IS_PATH_SEPARATOR ISSLASH ('\\')
|
||||||
|
|
||||||
|
/* Return the length of `dirname (PATH)' and set *RESULT to point
|
||||||
|
to PATH or to `"."', as appropriate. Works properly even if
|
||||||
|
there are trailing slashes (by effectively ignoring them).
|
||||||
|
WARNING: This function doesn't work for cwd-relative names like
|
||||||
|
`a:foo' that are specified with a drive-letter prefix. That case
|
||||||
|
is handled in the caller. */
|
||||||
|
static size_t
|
||||||
|
dir_name_r (char const *path, char const **result)
|
||||||
|
{
|
||||||
|
char const *slash;
|
||||||
|
size_t length; /* Length of result, not including NUL. */
|
||||||
|
|
||||||
|
slash = strrchr (path, '/');
|
||||||
|
if (BACKSLASH_IS_PATH_SEPARATOR)
|
||||||
|
{
|
||||||
|
char const *b = strrchr (path, '\\');
|
||||||
|
if (b && slash < b)
|
||||||
|
slash = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If the last byte of PATH is a slash, decrement SLASH until it's
|
||||||
|
pointing at the leftmost in a sequence of trailing slashes. */
|
||||||
|
if (slash && slash[1] == 0)
|
||||||
|
{
|
||||||
|
while (path < slash && ISSLASH (slash[-1]))
|
||||||
|
{
|
||||||
|
--slash;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (path < slash)
|
||||||
|
{
|
||||||
|
size_t len = slash - path;
|
||||||
|
slash = memrchr (path, '/', len);
|
||||||
|
if (BACKSLASH_IS_PATH_SEPARATOR)
|
||||||
|
{
|
||||||
|
char const *b = memrchr (path, '\\', len);
|
||||||
|
if (b && slash < b)
|
||||||
|
slash = b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (slash == 0)
|
||||||
|
{
|
||||||
|
/* File is in the current directory. */
|
||||||
|
|
||||||
|
length = FILESYSTEM_PREFIX_LEN (path);
|
||||||
|
|
||||||
|
if (length == 0)
|
||||||
|
{
|
||||||
|
path = ".";
|
||||||
|
length = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Remove any trailing slashes from the result. If we have a
|
||||||
|
canonicalized "d:/path", leave alone the root case "d:/". */
|
||||||
|
char const *lim = path + FILESYSTEM_PREFIX_LEN (path);
|
||||||
|
|
||||||
|
while (lim < slash && ISSLASH (*slash))
|
||||||
|
--slash;
|
||||||
|
|
||||||
|
length = slash - path + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
*result = path;
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return the leading directories part of PATH,
|
||||||
|
allocated with malloc. If out of memory, return 0.
|
||||||
|
Works properly even if there are trailing slashes
|
||||||
|
(by effectively ignoring them). */
|
||||||
|
|
||||||
|
char *
|
||||||
|
dir_name (char const *path)
|
||||||
|
{
|
||||||
|
char const *result;
|
||||||
|
size_t length = dir_name_r (path, &result);
|
||||||
|
int append_dot = (length && length == FILESYSTEM_PREFIX_LEN (newpath));
|
||||||
|
char *newpath = (char *) malloc (length + append_dot + 1);
|
||||||
|
if (newpath == 0)
|
||||||
|
return 0;
|
||||||
|
strncpy (newpath, result, length);
|
||||||
|
/* If PATH is "d:foo", return "d:.", the CWD on drive d: */
|
||||||
|
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 memrchr.c dirname.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>
|
||||||
|
# include <stdlib.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);
|
||||||
|
}
|
||||||
|
exit (0);
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/* Copyright (C) 1998 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
|
||||||
|
|
||||||
|
char *
|
||||||
|
dir_name PARAMS ((const char *path));
|
||||||
|
|
||||||
|
#endif /* not DIRNAME_H_ */
|
||||||
+1259
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
|||||||
|
/* Functions to support ebitsets.
|
||||||
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
|
Contributed by Michael Hayes ([email protected]).
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifndef _EBITSET_H
|
||||||
|
#define _EBITSET_H
|
||||||
|
|
||||||
|
#include "bbitset.h"
|
||||||
|
|
||||||
|
extern int ebitset_bytes PARAMS ((bitset_bindex));
|
||||||
|
|
||||||
|
extern bitset ebitset_init PARAMS ((bitset, bitset_bindex));
|
||||||
|
|
||||||
|
extern void ebitset_release_memory PARAMS ((void));
|
||||||
|
|
||||||
|
#endif
|
||||||
+198
-74
@@ -1,23 +1,22 @@
|
|||||||
/* Error handler for noninteractive utilities
|
/* Error handler for noninteractive utilities
|
||||||
Copyright (C) 1990-1998, 2000 Free Software Foundation, Inc.
|
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
|
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.
|
the C library, however. The master source lives in /gd/gnu/lib.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Lesser General Public
|
||||||
published by the Free Software Foundation; either version 2 of the
|
License as published by the Free Software Foundation; either
|
||||||
License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library 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 GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
License along with the GNU C Library; if not, write to the Free
|
||||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||||
Boston, MA 02111-1307, USA. */
|
02111-1307 USA. */
|
||||||
|
|
||||||
/* Written by David MacKenzie <[email protected]>. */
|
/* Written by David MacKenzie <[email protected]>. */
|
||||||
|
|
||||||
@@ -29,6 +28,10 @@
|
|||||||
#if HAVE_LIBINTL_H
|
#if HAVE_LIBINTL_H
|
||||||
# include <libintl.h>
|
# include <libintl.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef _LIBC
|
||||||
|
# include <wchar.h>
|
||||||
|
# define mbsrtowcs __mbsrtowcs
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC
|
#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC
|
||||||
# if __STDC__
|
# if __STDC__
|
||||||
@@ -52,13 +55,6 @@ void exit ();
|
|||||||
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
#ifndef HAVE_DECL_STRERROR_R
|
|
||||||
"this configure-time declaration test was not run"
|
|
||||||
#endif
|
|
||||||
#if !HAVE_DECL_STRERROR_R
|
|
||||||
char *strerror_r ();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _
|
#ifndef _
|
||||||
# define _(String) String
|
# define _(String) String
|
||||||
#endif
|
#endif
|
||||||
@@ -83,6 +79,12 @@ unsigned int error_message_count;
|
|||||||
|
|
||||||
/* In GNU libc we want do not want to use the common name `error' directly.
|
/* In GNU libc we want do not want to use the common name `error' directly.
|
||||||
Instead make it a weak alias. */
|
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 __error
|
||||||
# define error_at_line __error_at_line
|
# define error_at_line __error_at_line
|
||||||
|
|
||||||
@@ -93,21 +95,30 @@ unsigned int error_message_count;
|
|||||||
|
|
||||||
#else /* not _LIBC */
|
#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
|
/* The calling program should define program_name and set it to the
|
||||||
name of the executing program. */
|
name of the executing program. */
|
||||||
extern char *program_name;
|
extern char *program_name;
|
||||||
|
|
||||||
# ifdef HAVE_STRERROR_R
|
# if HAVE_STRERROR_R || defined strerror_r
|
||||||
# define __strerror_r strerror_r
|
# define __strerror_r strerror_r
|
||||||
# else
|
# else
|
||||||
# if HAVE_STRERROR
|
# if HAVE_STRERROR
|
||||||
# ifndef strerror /* On some systems, strerror is a macro */
|
# ifndef HAVE_DECL_STRERROR
|
||||||
|
"this configure-time declaration test was not run"
|
||||||
|
# endif
|
||||||
|
# if !HAVE_DECL_STRERROR
|
||||||
char *strerror ();
|
char *strerror ();
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
static char *
|
static char *
|
||||||
private_strerror (errnum)
|
private_strerror (int errnum)
|
||||||
int errnum;
|
|
||||||
{
|
{
|
||||||
extern char *sys_errlist[];
|
extern char *sys_errlist[];
|
||||||
extern int sys_nerr;
|
extern int sys_nerr;
|
||||||
@@ -118,15 +129,118 @@ private_strerror (errnum)
|
|||||||
}
|
}
|
||||||
# define strerror private_strerror
|
# define strerror private_strerror
|
||||||
# endif /* HAVE_STRERROR */
|
# endif /* HAVE_STRERROR */
|
||||||
# endif /* HAVE_STRERROR_R */
|
# endif /* HAVE_STRERROR_R || defined strerror_r */
|
||||||
#endif /* not _LIBC */
|
#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
|
/* Print the program name and error message MESSAGE, which is a printf-style
|
||||||
format string with optional args.
|
format string with optional args.
|
||||||
If ERRNUM is nonzero, print its corresponding system error message.
|
If ERRNUM is nonzero, print its corresponding system error message.
|
||||||
Exit with status STATUS if it is nonzero. */
|
Exit with status STATUS if it is nonzero. */
|
||||||
/* VARARGS */
|
/* VARARGS */
|
||||||
|
|
||||||
void
|
void
|
||||||
#if defined VA_START && __STDC__
|
#if defined VA_START && __STDC__
|
||||||
error (int status, int errnum, const char *message, ...)
|
error (int status, int errnum, const char *message, ...)
|
||||||
@@ -142,47 +256,48 @@ error (status, errnum, message, va_alist)
|
|||||||
va_list args;
|
va_list args;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
fflush (stdout);
|
||||||
|
#ifdef _LIBC
|
||||||
|
# ifdef USE_IN_LIBIO
|
||||||
|
_IO_flockfile (stderr);
|
||||||
|
# else
|
||||||
|
__flockfile (stderr);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
if (error_print_progname)
|
if (error_print_progname)
|
||||||
(*error_print_progname) ();
|
(*error_print_progname) ();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fflush (stdout);
|
#if _LIBC && USE_IN_LIBIO
|
||||||
fprintf (stderr, "%s: ", program_name);
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
|
__fwprintf (stderr, L"%s: ", program_name);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
fprintf (stderr, "%s: ", program_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VA_START
|
#ifdef VA_START
|
||||||
VA_START (args, message);
|
VA_START (args, message);
|
||||||
# if HAVE_VPRINTF || _LIBC
|
error_tail (status, errnum, message, args);
|
||||||
vfprintf (stderr, message, args);
|
|
||||||
# else
|
|
||||||
_doprnt (message, args, stderr);
|
|
||||||
# endif
|
|
||||||
va_end (args);
|
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
|
fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||||
#endif
|
|
||||||
|
|
||||||
++error_message_count;
|
++error_message_count;
|
||||||
if (errnum)
|
if (errnum)
|
||||||
{
|
print_errno_message (errnum);
|
||||||
#if defined HAVE_STRERROR_R || _LIBC
|
|
||||||
char errbuf[1024];
|
|
||||||
# if HAVE_WORKING_STRERROR_R || _LIBC
|
|
||||||
fprintf (stderr, ": %s", __strerror_r (errnum, errbuf, sizeof errbuf));
|
|
||||||
# else
|
|
||||||
/* Don't use __strerror_r's return value because on some systems
|
|
||||||
(at least DEC UNIX 4.0[A-D]) strerror_r returns `int'. */
|
|
||||||
__strerror_r (errnum, errbuf, sizeof errbuf);
|
|
||||||
fprintf (stderr, ": %s", errbuf);
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
fprintf (stderr, ": %s", strerror (errnum));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
putc ('\n', stderr);
|
putc ('\n', stderr);
|
||||||
fflush (stderr);
|
fflush (stderr);
|
||||||
if (status)
|
if (status)
|
||||||
exit (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
|
/* Sometimes we want to have at most one error per line. This
|
||||||
@@ -212,8 +327,9 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
|
|||||||
static const char *old_file_name;
|
static const char *old_file_name;
|
||||||
static unsigned int old_line_number;
|
static unsigned int old_line_number;
|
||||||
|
|
||||||
if (old_line_number == line_number &&
|
if (old_line_number == line_number
|
||||||
(file_name == old_file_name || !strcmp (old_file_name, file_name)))
|
&& (file_name == old_file_name
|
||||||
|
|| strcmp (old_file_name, file_name) == 0))
|
||||||
/* Simply return and print nothing. */
|
/* Simply return and print nothing. */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -221,50 +337,58 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
|
|||||||
old_line_number = line_number;
|
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)
|
if (error_print_progname)
|
||||||
(*error_print_progname) ();
|
(*error_print_progname) ();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fflush (stdout);
|
#if _LIBC && USE_IN_LIBIO
|
||||||
fprintf (stderr, "%s:", program_name);
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
|
__fwprintf (stderr, L"%s: ", program_name);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
fprintf (stderr, "%s:", program_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_name != NULL)
|
if (file_name != NULL)
|
||||||
fprintf (stderr, "%s:%d: ", file_name, line_number);
|
{
|
||||||
|
#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
|
#ifdef VA_START
|
||||||
VA_START (args, message);
|
VA_START (args, message);
|
||||||
# if HAVE_VPRINTF || _LIBC
|
error_tail (status, errnum, message, args);
|
||||||
vfprintf (stderr, message, args);
|
|
||||||
# else
|
|
||||||
_doprnt (message, args, stderr);
|
|
||||||
# endif
|
|
||||||
va_end (args);
|
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
|
fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||||
#endif
|
|
||||||
|
|
||||||
++error_message_count;
|
++error_message_count;
|
||||||
if (errnum)
|
if (errnum)
|
||||||
{
|
print_errno_message (errnum);
|
||||||
#if defined HAVE_STRERROR_R || _LIBC
|
|
||||||
char errbuf[1024];
|
|
||||||
# if HAVE_WORKING_STRERROR_R || _LIBC
|
|
||||||
fprintf (stderr, ": %s", __strerror_r (errnum, errbuf, sizeof errbuf));
|
|
||||||
# else
|
|
||||||
/* Don't use __strerror_r's return value because on some systems
|
|
||||||
(at least DEC UNIX 4.0[A-D]) strerror_r returns `int'. */
|
|
||||||
__strerror_r (errnum, errbuf, sizeof errbuf);
|
|
||||||
fprintf (stderr, ": %s", errbuf);
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
fprintf (stderr, ": %s", strerror (errnum));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
putc ('\n', stderr);
|
putc ('\n', stderr);
|
||||||
fflush (stderr);
|
fflush (stderr);
|
||||||
if (status)
|
if (status)
|
||||||
exit (status);
|
exit (status);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
# ifdef USE_IN_LIBIO
|
||||||
|
_IO_funlockfile (stderr);
|
||||||
|
# else
|
||||||
|
__funlockfile (stderr);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#ifndef __attribute__
|
#ifndef __attribute__
|
||||||
/* This feature is available in gcc versions 2.5 and later. */
|
/* This feature is available in gcc versions 2.5 and later. */
|
||||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
|
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
|
||||||
# define __attribute__(Spec) /* empty */
|
# define __attribute__(Spec) /* empty */
|
||||||
# endif
|
# endif
|
||||||
/* The __-protected variants of `format' and `printf' attributes
|
/* The __-protected variants of `format' and `printf' attributes
|
||||||
|
|||||||
+59
-40
@@ -1,23 +1,25 @@
|
|||||||
/* Getopt for GNU.
|
/* Getopt for GNU.
|
||||||
NOTE: The canonical source of this file is maintained with the GNU
|
NOTE: getopt is now part of the C library, so if you don't know what
|
||||||
C Library. Bugs can be reported to bug-glibc@gnu.org.
|
"Keep this file name-space clean" means, talk to drepper@gnu.org
|
||||||
|
before changing it!
|
||||||
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99
|
Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001
|
||||||
Free Software Foundation, Inc.
|
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
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
under the terms of the GNU General Public License as published by the
|
modify it under the terms of the GNU Lesser General Public
|
||||||
Free Software Foundation; either version 2, or (at your option) any
|
License as published by the Free Software Foundation; either
|
||||||
later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
The GNU C Library 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
|
||||||
GNU General Public License for more details.
|
Lesser 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 Lesser General Public
|
||||||
along with this program; if not, write to the Free Software Foundation,
|
License along with the GNU C Library; if not, write to the Free
|
||||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||||
|
02111-1307 USA. */
|
||||||
|
|
||||||
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
|
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
|
||||||
Ditto for AIX 3.2 and <stdlib.h>. */
|
Ditto for AIX 3.2 and <stdlib.h>. */
|
||||||
@@ -27,13 +29,13 @@
|
|||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#else
|
#endif
|
||||||
# if !defined __STDC__ || !__STDC__
|
|
||||||
|
#if !defined __STDC__ || !__STDC__
|
||||||
/* This is a separate conditional since some stdc systems
|
/* This is a separate conditional since some stdc systems
|
||||||
reject `defined (const)'. */
|
reject `defined (const)'. */
|
||||||
# ifndef const
|
# ifndef const
|
||||||
# define const
|
# define const
|
||||||
# endif
|
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -75,11 +77,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _
|
#ifndef _
|
||||||
/* This is for other GNU distributions with internationalized messages.
|
/* This is for other GNU distributions with internationalized messages. */
|
||||||
When compiling libc, the _ macro is predefined. */
|
# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
|
||||||
# ifdef HAVE_LIBINTL_H
|
|
||||||
# include <libintl.h>
|
# include <libintl.h>
|
||||||
# define _(msgid) gettext (msgid)
|
# ifndef _
|
||||||
|
# define _(msgid) gettext (msgid)
|
||||||
|
# endif
|
||||||
# else
|
# else
|
||||||
# define _(msgid) (msgid)
|
# define _(msgid) (msgid)
|
||||||
# endif
|
# endif
|
||||||
@@ -250,11 +253,13 @@ static int last_nonopt;
|
|||||||
/* Bash 2.0 gives us an environment variable containing flags
|
/* Bash 2.0 gives us an environment variable containing flags
|
||||||
indicating ARGV elements that should not be considered arguments. */
|
indicating ARGV elements that should not be considered arguments. */
|
||||||
|
|
||||||
|
#ifdef USE_NONOPTION_FLAGS
|
||||||
/* Defined in getopt_init.c */
|
/* Defined in getopt_init.c */
|
||||||
extern char *__getopt_nonoption_flags;
|
extern char *__getopt_nonoption_flags;
|
||||||
|
|
||||||
static int nonoption_flags_max_len;
|
static int nonoption_flags_max_len;
|
||||||
static int nonoption_flags_len;
|
static int nonoption_flags_len;
|
||||||
|
#endif
|
||||||
|
|
||||||
static int original_argc;
|
static int original_argc;
|
||||||
static char *const *original_argv;
|
static char *const *original_argv;
|
||||||
@@ -275,13 +280,17 @@ store_args_and_env (int argc, char *const *argv)
|
|||||||
text_set_element (__libc_subinit, store_args_and_env);
|
text_set_element (__libc_subinit, store_args_and_env);
|
||||||
# endif /* text_set_element */
|
# endif /* text_set_element */
|
||||||
|
|
||||||
# define SWAP_FLAGS(ch1, ch2) \
|
# ifdef USE_NONOPTION_FLAGS
|
||||||
|
# define SWAP_FLAGS(ch1, ch2) \
|
||||||
if (nonoption_flags_len > 0) \
|
if (nonoption_flags_len > 0) \
|
||||||
{ \
|
{ \
|
||||||
char __tmp = __getopt_nonoption_flags[ch1]; \
|
char __tmp = __getopt_nonoption_flags[ch1]; \
|
||||||
__getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \
|
__getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \
|
||||||
__getopt_nonoption_flags[ch2] = __tmp; \
|
__getopt_nonoption_flags[ch2] = __tmp; \
|
||||||
}
|
}
|
||||||
|
# else
|
||||||
|
# define SWAP_FLAGS(ch1, ch2)
|
||||||
|
# endif
|
||||||
#else /* !_LIBC */
|
#else /* !_LIBC */
|
||||||
# define SWAP_FLAGS(ch1, ch2)
|
# define SWAP_FLAGS(ch1, ch2)
|
||||||
#endif /* _LIBC */
|
#endif /* _LIBC */
|
||||||
@@ -313,7 +322,7 @@ exchange (argv)
|
|||||||
It leaves the longer segment in the right place overall,
|
It leaves the longer segment in the right place overall,
|
||||||
but it consists of two parts that need to be swapped next. */
|
but it consists of two parts that need to be swapped next. */
|
||||||
|
|
||||||
#ifdef _LIBC
|
#if defined _LIBC && defined USE_NONOPTION_FLAGS
|
||||||
/* First make sure the handling of the `__getopt_nonoption_flags'
|
/* First make sure the handling of the `__getopt_nonoption_flags'
|
||||||
string can work normally. Our top argument must be in the range
|
string can work normally. Our top argument must be in the range
|
||||||
of the string. */
|
of the string. */
|
||||||
@@ -417,7 +426,7 @@ _getopt_initialize (argc, argv, optstring)
|
|||||||
else
|
else
|
||||||
ordering = PERMUTE;
|
ordering = PERMUTE;
|
||||||
|
|
||||||
#ifdef _LIBC
|
#if defined _LIBC && defined USE_NONOPTION_FLAGS
|
||||||
if (posixly_correct == NULL
|
if (posixly_correct == NULL
|
||||||
&& argc == original_argc && argv == original_argv)
|
&& argc == original_argc && argv == original_argv)
|
||||||
{
|
{
|
||||||
@@ -515,6 +524,13 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
|||||||
int *longind;
|
int *longind;
|
||||||
int long_only;
|
int long_only;
|
||||||
{
|
{
|
||||||
|
int print_errors = opterr;
|
||||||
|
if (optstring[0] == ':')
|
||||||
|
print_errors = 0;
|
||||||
|
|
||||||
|
if (argc < 1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
optarg = NULL;
|
optarg = NULL;
|
||||||
|
|
||||||
if (optind == 0 || !__getopt_initialized)
|
if (optind == 0 || !__getopt_initialized)
|
||||||
@@ -529,7 +545,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
|||||||
Either it does not have option syntax, or there is an environment flag
|
Either it does not have option syntax, or there is an environment flag
|
||||||
from the shell indicating it is not an option. The later information
|
from the shell indicating it is not an option. The later information
|
||||||
is only used when the used in the GNU libc. */
|
is only used when the used in the GNU libc. */
|
||||||
#ifdef _LIBC
|
#if defined _LIBC && defined USE_NONOPTION_FLAGS
|
||||||
# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
|
# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
|
||||||
|| (optind < nonoption_flags_len \
|
|| (optind < nonoption_flags_len \
|
||||||
&& __getopt_nonoption_flags[optind] == '1'))
|
&& __getopt_nonoption_flags[optind] == '1'))
|
||||||
@@ -664,14 +680,17 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
|||||||
pfound = p;
|
pfound = p;
|
||||||
indfound = option_index;
|
indfound = option_index;
|
||||||
}
|
}
|
||||||
else
|
else if (long_only
|
||||||
|
|| pfound->has_arg != p->has_arg
|
||||||
|
|| pfound->flag != p->flag
|
||||||
|
|| pfound->val != p->val)
|
||||||
/* Second or later nonexact match found. */
|
/* Second or later nonexact match found. */
|
||||||
ambig = 1;
|
ambig = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ambig && !exact)
|
if (ambig && !exact)
|
||||||
{
|
{
|
||||||
if (opterr)
|
if (print_errors)
|
||||||
fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
|
fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
|
||||||
argv[0], argv[optind]);
|
argv[0], argv[optind]);
|
||||||
nextchar += strlen (nextchar);
|
nextchar += strlen (nextchar);
|
||||||
@@ -692,7 +711,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
|||||||
optarg = nameend + 1;
|
optarg = nameend + 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (opterr)
|
if (print_errors)
|
||||||
{
|
{
|
||||||
if (argv[optind - 1][1] == '-')
|
if (argv[optind - 1][1] == '-')
|
||||||
/* --option */
|
/* --option */
|
||||||
@@ -718,7 +737,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
|||||||
optarg = argv[optind++];
|
optarg = argv[optind++];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (opterr)
|
if (print_errors)
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: option `%s' requires an argument\n"),
|
_("%s: option `%s' requires an argument\n"),
|
||||||
argv[0], argv[optind - 1]);
|
argv[0], argv[optind - 1]);
|
||||||
@@ -745,7 +764,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
|||||||
if (!long_only || argv[optind][1] == '-'
|
if (!long_only || argv[optind][1] == '-'
|
||||||
|| my_index (optstring, *nextchar) == NULL)
|
|| my_index (optstring, *nextchar) == NULL)
|
||||||
{
|
{
|
||||||
if (opterr)
|
if (print_errors)
|
||||||
{
|
{
|
||||||
if (argv[optind][1] == '-')
|
if (argv[optind][1] == '-')
|
||||||
/* --option */
|
/* --option */
|
||||||
@@ -775,7 +794,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
|||||||
|
|
||||||
if (temp == NULL || c == ':')
|
if (temp == NULL || c == ':')
|
||||||
{
|
{
|
||||||
if (opterr)
|
if (print_errors)
|
||||||
{
|
{
|
||||||
if (posixly_correct)
|
if (posixly_correct)
|
||||||
/* 1003.2 specifies the format of this message. */
|
/* 1003.2 specifies the format of this message. */
|
||||||
@@ -809,7 +828,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
|||||||
}
|
}
|
||||||
else if (optind == argc)
|
else if (optind == argc)
|
||||||
{
|
{
|
||||||
if (opterr)
|
if (print_errors)
|
||||||
{
|
{
|
||||||
/* 1003.2 specifies the format of this message. */
|
/* 1003.2 specifies the format of this message. */
|
||||||
fprintf (stderr, _("%s: option requires an argument -- %c\n"),
|
fprintf (stderr, _("%s: option requires an argument -- %c\n"),
|
||||||
@@ -858,7 +877,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
|||||||
}
|
}
|
||||||
if (ambig && !exact)
|
if (ambig && !exact)
|
||||||
{
|
{
|
||||||
if (opterr)
|
if (print_errors)
|
||||||
fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
|
fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
|
||||||
argv[0], argv[optind]);
|
argv[0], argv[optind]);
|
||||||
nextchar += strlen (nextchar);
|
nextchar += strlen (nextchar);
|
||||||
@@ -876,7 +895,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
|||||||
optarg = nameend + 1;
|
optarg = nameend + 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (opterr)
|
if (print_errors)
|
||||||
fprintf (stderr, _("\
|
fprintf (stderr, _("\
|
||||||
%s: option `-W %s' doesn't allow an argument\n"),
|
%s: option `-W %s' doesn't allow an argument\n"),
|
||||||
argv[0], pfound->name);
|
argv[0], pfound->name);
|
||||||
@@ -891,7 +910,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
|||||||
optarg = argv[optind++];
|
optarg = argv[optind++];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (opterr)
|
if (print_errors)
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: option `%s' requires an argument\n"),
|
_("%s: option `%s' requires an argument\n"),
|
||||||
argv[0], argv[optind - 1]);
|
argv[0], argv[optind - 1]);
|
||||||
@@ -938,12 +957,12 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
|||||||
}
|
}
|
||||||
else if (optind == argc)
|
else if (optind == argc)
|
||||||
{
|
{
|
||||||
if (opterr)
|
if (print_errors)
|
||||||
{
|
{
|
||||||
/* 1003.2 specifies the format of this message. */
|
/* 1003.2 specifies the format of this message. */
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: option requires an argument -- %c\n"),
|
_("%s: option requires an argument -- %c\n"),
|
||||||
argv[0], c);
|
argv[0], c);
|
||||||
}
|
}
|
||||||
optopt = c;
|
optopt = c;
|
||||||
if (optstring[0] == ':')
|
if (optstring[0] == ':')
|
||||||
|
|||||||
+27
-16
@@ -1,21 +1,21 @@
|
|||||||
/* Declarations for getopt.
|
/* Declarations for getopt.
|
||||||
Copyright (C) 1989,90,91,92,93,94,96,97,98 Free Software Foundation, Inc.
|
Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc.
|
||||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Bugs can be reported to [email protected].
|
|
||||||
This program is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by the
|
|
||||||
Free Software Foundation; either version 2, or (at your option) any
|
|
||||||
later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library 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
|
||||||
GNU General Public License for more details.
|
Lesser 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 Lesser General Public
|
||||||
along with this program; if not, write to the Free Software
|
License along with the GNU C Library; if not, write to the Free
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||||
USA. */
|
02111-1307 USA. */
|
||||||
|
|
||||||
#ifndef _GETOPT_H
|
#ifndef _GETOPT_H
|
||||||
|
|
||||||
@@ -23,6 +23,17 @@
|
|||||||
# define _GETOPT_H 1
|
# define _GETOPT_H 1
|
||||||
#endif
|
#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 <ctype.h>, which will pull in <features.h> for us
|
||||||
|
if it's from glibc. (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__
|
||||||
|
# include <ctype.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@@ -82,7 +93,7 @@ extern int optopt;
|
|||||||
|
|
||||||
struct option
|
struct option
|
||||||
{
|
{
|
||||||
# if defined __STDC__ && __STDC__
|
# if (defined __STDC__ && __STDC__) || defined __cplusplus
|
||||||
const char *name;
|
const char *name;
|
||||||
# else
|
# else
|
||||||
char *name;
|
char *name;
|
||||||
@@ -126,7 +137,7 @@ struct option
|
|||||||
arguments to the option '\0'. This behavior is specific to the GNU
|
arguments to the option '\0'. This behavior is specific to the GNU
|
||||||
`getopt'. */
|
`getopt'. */
|
||||||
|
|
||||||
#if defined __STDC__ && __STDC__
|
#if (defined __STDC__ && __STDC__) || defined __cplusplus
|
||||||
# ifdef __GNU_LIBRARY__
|
# ifdef __GNU_LIBRARY__
|
||||||
/* Many other libraries have conflicting prototypes for getopt, with
|
/* Many other libraries have conflicting prototypes for getopt, with
|
||||||
differences in the consts, in stdlib.h. To avoid compilation
|
differences in the consts, in stdlib.h. To avoid compilation
|
||||||
|
|||||||
+16
-16
@@ -1,26 +1,29 @@
|
|||||||
/* getopt_long and getopt_long_only entry points for GNU getopt.
|
/* getopt_long and getopt_long_only entry points for GNU getopt.
|
||||||
Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
|
Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Bugs can be reported to [email protected].
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
under the terms of the GNU General Public License as published by the
|
modify it under the terms of the GNU Lesser General Public
|
||||||
Free Software Foundation; either version 2, or (at your option) any
|
License as published by the Free Software Foundation; either
|
||||||
later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
The GNU C Library 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
|
||||||
GNU General Public License for more details.
|
Lesser 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 Lesser General Public
|
||||||
along with this program; if not, write to the Free Software Foundation,
|
License along with the GNU C Library; if not, write to the Free
|
||||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||||
|
02111-1307 USA. */
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#else
|
#endif
|
||||||
|
|
||||||
|
#include "getopt.h"
|
||||||
|
|
||||||
#if !defined __STDC__ || !__STDC__
|
#if !defined __STDC__ || !__STDC__
|
||||||
/* This is a separate conditional since some stdc systems
|
/* This is a separate conditional since some stdc systems
|
||||||
reject `defined (const)'. */
|
reject `defined (const)'. */
|
||||||
@@ -28,9 +31,6 @@
|
|||||||
#define const
|
#define const
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "getopt.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
/* 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 Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
#ifndef _LIBGETTEXT_H
|
||||||
|
#define _LIBGETTEXT_H 1
|
||||||
|
|
||||||
|
/* NLS can be disabled through the configure --disable-nls option. */
|
||||||
|
#if ENABLE_NLS
|
||||||
|
|
||||||
|
/* Get declarations of GNU message catalog functions. */
|
||||||
|
# include <libintl.h>
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* 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 */
|
||||||
+943
-227
File diff suppressed because it is too large
Load Diff
+94
-118
@@ -1,6 +1,6 @@
|
|||||||
/* hash.h -- decls for hash table
|
/* hash - hashing table processing.
|
||||||
Copyright (C) 1995 Free Software Foundation, Inc.
|
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||||
Written by Greg McGary <[email protected]>
|
Written by Jim Meyering <[email protected]>, 1998.
|
||||||
|
|
||||||
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,132 +13,108 @@
|
|||||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#ifndef _hash_h_
|
/* A generic hash table package. */
|
||||||
#define _hash_h_
|
|
||||||
|
|
||||||
#include <stdio.h>
|
/* 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. */
|
||||||
|
|
||||||
typedef unsigned long (*hash_func_t) __P((void const *key));
|
#ifndef PARAMS
|
||||||
typedef int (*hash_cmp_func_t) __P((void const *x, void const *y));
|
# if PROTOTYPES || __STDC__
|
||||||
typedef void (*hash_map_func_t) __P((void const *item));
|
# 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
|
struct hash_table
|
||||||
{
|
{
|
||||||
void **ht_vec;
|
/* The array of buckets starts at BUCKET and extends to BUCKET_LIMIT-1,
|
||||||
unsigned long ht_size; /* total number of slots (power of 2) */
|
for a possibility of N_BUCKETS. Among those, N_BUCKETS_USED buckets
|
||||||
unsigned long ht_capacity; /* usable slots, limited by loading-factor */
|
are not empty, there are N_ENTRIES active entries in the table. */
|
||||||
unsigned long ht_fill; /* items in table */
|
struct hash_entry *bucket;
|
||||||
unsigned long ht_collisions; /* # of failed calls to comparison function */
|
struct hash_entry *bucket_limit;
|
||||||
unsigned long ht_lookups; /* # of queries */
|
unsigned n_buckets;
|
||||||
unsigned int ht_rehashes; /* # of times we've expanded table */
|
unsigned n_buckets_used;
|
||||||
hash_func_t ht_hash_1; /* primary hash function */
|
unsigned n_entries;
|
||||||
hash_func_t ht_hash_2; /* secondary hash function */
|
|
||||||
hash_cmp_func_t ht_compare; /* comparison function */
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef int (*qsort_cmp_t) __P((void const *, void const *));
|
/* Tuning arguments, kept in a physicaly separate structure. */
|
||||||
|
const Hash_tuning *tuning;
|
||||||
|
|
||||||
void hash_init __P((struct hash_table *ht, unsigned long size,
|
/* Three functions are given to `hash_initialize', see the documentation
|
||||||
hash_func_t hash_1, hash_func_t hash_2, hash_cmp_func_t hash_cmp));
|
block for this function. In a word, HASHER randomizes a user entry
|
||||||
void hash_load __P((struct hash_table *ht, void *item_table,
|
into a number up from 0 up to some maximum minus 1; COMPARATOR returns
|
||||||
unsigned long cardinality, unsigned long size));
|
true if two user entries compare equally; and DATA_FREER is the cleanup
|
||||||
void **hash_find_slot __P((struct hash_table *ht, void const *key));
|
function for a user entry. */
|
||||||
void *hash_find_item __P((struct hash_table *ht, void const *key));
|
Hash_hasher hasher;
|
||||||
void *hash_insert __P((struct hash_table *ht, void *item));
|
Hash_comparator comparator;
|
||||||
void *hash_insert_at __P((struct hash_table *ht, void *item, void const *slot));
|
Hash_data_freer data_freer;
|
||||||
void *hash_delete __P((struct hash_table *ht, void const *item));
|
|
||||||
void *hash_delete_at __P((struct hash_table *ht, void const *slot));
|
|
||||||
void hash_delete_items __P((struct hash_table *ht));
|
|
||||||
void hash_free_items __P((struct hash_table *ht));
|
|
||||||
void hash_free __P((struct hash_table *ht, int free_items));
|
|
||||||
void hash_map __P((struct hash_table *ht, hash_map_func_t map));
|
|
||||||
void hash_print_stats __P((struct hash_table *ht, FILE *out_FILE));
|
|
||||||
void **hash_dump __P((struct hash_table *ht, void **vector_0, qsort_cmp_t compare));
|
|
||||||
|
|
||||||
extern void *hash_deleted_item;
|
/* A linked list of freed struct hash_entry structs. */
|
||||||
#define HASH_VACANT(item) ((item) == 0 || (void *) (item) == hash_deleted_item)
|
struct hash_entry *free_entry_list;
|
||||||
|
|
||||||
|
#if USE_OBSTACK
|
||||||
/* hash and comparison macros for string keys. */
|
/* Whenever obstacks are used, it is possible to allocate all overflowed
|
||||||
|
entries into a single stack, so they all can be freed in a single
|
||||||
|
operation. It is not clear if the speedup is worth the trouble. */
|
||||||
|
struct obstack entry_stack;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
#define STRING_HASH_1(_key_, _result_) { \
|
typedef struct hash_table Hash_table;
|
||||||
unsigned char const *kk = (unsigned char const *) (_key_) - 1; \
|
|
||||||
while (*++kk) \
|
|
||||||
(_result_) += (*kk << (kk[1] & 0xf)); \
|
|
||||||
} while (0)
|
|
||||||
#define return_STRING_HASH_1(_key_) do { \
|
|
||||||
unsigned long result = 0; \
|
|
||||||
STRING_HASH_1 ((_key_), result); \
|
|
||||||
return result; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define STRING_HASH_2(_key_, _result_) do { \
|
/* Information and lookup. */
|
||||||
unsigned char const *kk = (unsigned char const *) (_key_) - 1; \
|
unsigned hash_get_n_buckets PARAMS ((const Hash_table *));
|
||||||
while (*++kk) \
|
unsigned hash_get_n_buckets_used PARAMS ((const Hash_table *));
|
||||||
(_result_) += (*kk << (kk[1] & 0x7)); \
|
unsigned hash_get_n_entries PARAMS ((const Hash_table *));
|
||||||
} while (0)
|
unsigned hash_get_max_bucket_length PARAMS ((const Hash_table *));
|
||||||
#define return_STRING_HASH_2(_key_) do { \
|
bool hash_table_ok PARAMS ((const Hash_table *));
|
||||||
unsigned long result = 0; \
|
void hash_print_statistics PARAMS ((const Hash_table *, FILE *));
|
||||||
STRING_HASH_2 ((_key_), result); \
|
void *hash_lookup PARAMS ((const Hash_table *, const void *));
|
||||||
return result; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define STRING_COMPARE(_x_, _y_, _result_) do { \
|
/* Walking. */
|
||||||
unsigned char const *xx = (unsigned char const *) (_x_) - 1; \
|
void *hash_get_first PARAMS ((const Hash_table *));
|
||||||
unsigned char const *yy = (unsigned char const *) (_y_) - 1; \
|
void *hash_get_next PARAMS ((const Hash_table *, const void *));
|
||||||
do { \
|
unsigned hash_get_entries PARAMS ((const Hash_table *, void **, unsigned));
|
||||||
if (*++xx == '\0') { \
|
unsigned hash_do_for_each PARAMS ((const Hash_table *, Hash_processor, void *));
|
||||||
yy++; \
|
|
||||||
break; \
|
|
||||||
} \
|
|
||||||
} while (*xx == *++yy); \
|
|
||||||
(_result_) = *xx - *yy; \
|
|
||||||
} while (0)
|
|
||||||
#define return_STRING_COMPARE(_x_, _y_) do { \
|
|
||||||
int result; \
|
|
||||||
STRING_COMPARE (_x_, _y_, result); \
|
|
||||||
return result; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
/* hash and comparison macros for integer keys. */
|
/* 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 *));
|
||||||
|
|
||||||
#define INTEGER_HASH_1(_key_, _result_) do { \
|
/* Insertion and deletion. */
|
||||||
(_result_) += ((unsigned long)(_key_)); \
|
bool hash_rehash PARAMS ((Hash_table *, unsigned));
|
||||||
} while (0)
|
void *hash_insert PARAMS ((Hash_table *, const void *));
|
||||||
#define return_INTEGER_HASH_1(_key_) do { \
|
void *hash_delete PARAMS ((Hash_table *, const void *));
|
||||||
unsigned long result = 0; \
|
|
||||||
INTEGER_HASH_1 ((_key_), result); \
|
|
||||||
return result; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define INTEGER_HASH_2(_key_, _result_) do { \
|
|
||||||
(_result_) += ~((unsigned long)(_key_)); \
|
|
||||||
} while (0)
|
|
||||||
#define return_INTEGER_HASH_2(_key_) do { \
|
|
||||||
unsigned long result = 0; \
|
|
||||||
INTEGER_HASH_2 ((_key_), result); \
|
|
||||||
return result; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define INTEGER_COMPARE(_x_, _y_, _result_) do { \
|
|
||||||
(_result_) = _x_ - _y_; \
|
|
||||||
} while (0)
|
|
||||||
#define return_INTEGER_COMPARE(_x_, _y_) do { \
|
|
||||||
int result; \
|
|
||||||
INTEGER_COMPARE (_x_, _y_, result); \
|
|
||||||
return result; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
/* hash and comparison macros for address keys. */
|
|
||||||
|
|
||||||
#define ADDRESS_HASH_1(_key_, _result_) INTEGER_HASH_1 (((unsigned long)(_key_)) >> 3, (_result_))
|
|
||||||
#define ADDRESS_HASH_2(_key_, _result_) INTEGER_HASH_2 (((unsigned long)(_key_)) >> 3, (_result_))
|
|
||||||
#define ADDRESS_COMPARE(_x_, _y_, _result_) INTEGER_COMPARE ((_x_), (_y_), (_result_))
|
|
||||||
#define return_ADDRESS_HASH_1(_key_) return_INTEGER_HASH_1 (((unsigned long)(_key_)) >> 3)
|
|
||||||
#define return_ADDRESS_HASH_2(_key_) return_INTEGER_HASH_2 (((unsigned long)(_key_)) >> 3)
|
|
||||||
#define return_ADDRESS_COMPARE(_x_, _y_) return_INTEGER_COMPARE ((_x_), (_y_))
|
|
||||||
|
|
||||||
#endif /* not _hash_h_ */
|
|
||||||
|
|||||||
+1328
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
|||||||
|
/* Functions to support lbitsets.
|
||||||
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
|
Contributed by Michael Hayes ([email protected]).
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifndef _LBITSET_H
|
||||||
|
#define _LBITSET_H
|
||||||
|
|
||||||
|
#include "bbitset.h"
|
||||||
|
|
||||||
|
extern int lbitset_bytes PARAMS ((bitset_bindex));
|
||||||
|
|
||||||
|
extern bitset lbitset_init PARAMS ((bitset, bitset_bindex));
|
||||||
|
|
||||||
|
extern void lbitset_release_memory PARAMS ((void));
|
||||||
|
|
||||||
|
#endif
|
||||||
+209
@@ -0,0 +1,209 @@
|
|||||||
|
/* memrchr -- find the last occurrence of a byte in a memory block
|
||||||
|
Copyright (C) 1991, 93, 96, 97, 99, 2000 Free Software Foundation, Inc.
|
||||||
|
Based on strlen implementation by Torbjorn Granlund ([email protected]),
|
||||||
|
with help from Dan Sahlin ([email protected]) and
|
||||||
|
commentary by Jim Blandy ([email protected]);
|
||||||
|
adaptation to memchr suggested by Dick Karpinski ([email protected]),
|
||||||
|
and implemented by Roland McGrath ([email protected]).
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#undef __ptr_t
|
||||||
|
#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
|
||||||
|
# define __ptr_t void *
|
||||||
|
#else /* Not C++ or ANSI C. */
|
||||||
|
# define __ptr_t char *
|
||||||
|
#endif /* C++ or ANSI C. */
|
||||||
|
|
||||||
|
#if defined (_LIBC)
|
||||||
|
# include <string.h>
|
||||||
|
# include <memcopy.h>
|
||||||
|
#else
|
||||||
|
# define reg_char char
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (HAVE_LIMITS_H) || defined (_LIBC)
|
||||||
|
# include <limits.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define LONG_MAX_32_BITS 2147483647
|
||||||
|
|
||||||
|
#ifndef LONG_MAX
|
||||||
|
# define LONG_MAX LONG_MAX_32_BITS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#undef __memrchr
|
||||||
|
#undef memrchr
|
||||||
|
|
||||||
|
#ifndef weak_alias
|
||||||
|
# define __memrchr memrchr
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Search no more than N bytes of S for C. */
|
||||||
|
__ptr_t
|
||||||
|
__memrchr (s, c_in, n)
|
||||||
|
const __ptr_t s;
|
||||||
|
int c_in;
|
||||||
|
size_t n;
|
||||||
|
{
|
||||||
|
const unsigned char *char_ptr;
|
||||||
|
const unsigned long int *longword_ptr;
|
||||||
|
unsigned long int longword, magic_bits, charmask;
|
||||||
|
unsigned reg_char c;
|
||||||
|
|
||||||
|
c = (unsigned char) c_in;
|
||||||
|
|
||||||
|
/* Handle the last few characters by reading one character at a time.
|
||||||
|
Do this until CHAR_PTR is aligned on a longword boundary. */
|
||||||
|
for (char_ptr = (const unsigned char *) s + n;
|
||||||
|
n > 0 && ((unsigned long int) char_ptr
|
||||||
|
& (sizeof (longword) - 1)) != 0;
|
||||||
|
--n)
|
||||||
|
if (*--char_ptr == c)
|
||||||
|
return (__ptr_t) char_ptr;
|
||||||
|
|
||||||
|
/* All these elucidatory comments refer to 4-byte longwords,
|
||||||
|
but the theory applies equally well to 8-byte longwords. */
|
||||||
|
|
||||||
|
longword_ptr = (unsigned long int *) char_ptr;
|
||||||
|
|
||||||
|
/* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
|
||||||
|
the "holes." Note that there is a hole just to the left of
|
||||||
|
each byte, with an extra at the end:
|
||||||
|
|
||||||
|
bits: 01111110 11111110 11111110 11111111
|
||||||
|
bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
|
||||||
|
|
||||||
|
The 1-bits make sure that carries propagate to the next 0-bit.
|
||||||
|
The 0-bits provide holes for carries to fall into. */
|
||||||
|
|
||||||
|
if (sizeof (longword) != 4 && sizeof (longword) != 8)
|
||||||
|
abort ();
|
||||||
|
|
||||||
|
#if LONG_MAX <= LONG_MAX_32_BITS
|
||||||
|
magic_bits = 0x7efefeff;
|
||||||
|
#else
|
||||||
|
magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Set up a longword, each of whose bytes is C. */
|
||||||
|
charmask = c | (c << 8);
|
||||||
|
charmask |= charmask << 16;
|
||||||
|
#if LONG_MAX > LONG_MAX_32_BITS
|
||||||
|
charmask |= charmask << 32;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Instead of the traditional loop which tests each character,
|
||||||
|
we will test a longword at a time. The tricky part is testing
|
||||||
|
if *any of the four* bytes in the longword in question are zero. */
|
||||||
|
while (n >= sizeof (longword))
|
||||||
|
{
|
||||||
|
/* We tentatively exit the loop if adding MAGIC_BITS to
|
||||||
|
LONGWORD fails to change any of the hole bits of LONGWORD.
|
||||||
|
|
||||||
|
1) Is this safe? Will it catch all the zero bytes?
|
||||||
|
Suppose there is a byte with all zeros. Any carry bits
|
||||||
|
propagating from its left will fall into the hole at its
|
||||||
|
least significant bit and stop. Since there will be no
|
||||||
|
carry from its most significant bit, the LSB of the
|
||||||
|
byte to the left will be unchanged, and the zero will be
|
||||||
|
detected.
|
||||||
|
|
||||||
|
2) Is this worthwhile? Will it ignore everything except
|
||||||
|
zero bytes? Suppose every byte of LONGWORD has a bit set
|
||||||
|
somewhere. There will be a carry into bit 8. If bit 8
|
||||||
|
is set, this will carry into bit 16. If bit 8 is clear,
|
||||||
|
one of bits 9-15 must be set, so there will be a carry
|
||||||
|
into bit 16. Similarly, there will be a carry into bit
|
||||||
|
24. If one of bits 24-30 is set, there will be a carry
|
||||||
|
into bit 31, so all of the hole bits will be changed.
|
||||||
|
|
||||||
|
The one misfire occurs when bits 24-30 are clear and bit
|
||||||
|
31 is set; in this case, the hole at bit 31 is not
|
||||||
|
changed. If we had access to the processor carry flag,
|
||||||
|
we could close this loophole by putting the fourth hole
|
||||||
|
at bit 32!
|
||||||
|
|
||||||
|
So it ignores everything except 128's, when they're aligned
|
||||||
|
properly.
|
||||||
|
|
||||||
|
3) But wait! Aren't we looking for C, not zero?
|
||||||
|
Good point. So what we do is XOR LONGWORD with a longword,
|
||||||
|
each of whose bytes is C. This turns each byte that is C
|
||||||
|
into a zero. */
|
||||||
|
|
||||||
|
longword = *--longword_ptr ^ charmask;
|
||||||
|
|
||||||
|
/* Add MAGIC_BITS to LONGWORD. */
|
||||||
|
if ((((longword + magic_bits)
|
||||||
|
|
||||||
|
/* Set those bits that were unchanged by the addition. */
|
||||||
|
^ ~longword)
|
||||||
|
|
||||||
|
/* Look at only the hole bits. If any of the hole bits
|
||||||
|
are unchanged, most likely one of the bytes was a
|
||||||
|
zero. */
|
||||||
|
& ~magic_bits) != 0)
|
||||||
|
{
|
||||||
|
/* Which of the bytes was C? If none of them were, it was
|
||||||
|
a misfire; continue the search. */
|
||||||
|
|
||||||
|
const unsigned char *cp = (const unsigned char *) longword_ptr;
|
||||||
|
|
||||||
|
#if LONG_MAX > 2147483647
|
||||||
|
if (cp[7] == c)
|
||||||
|
return (__ptr_t) &cp[7];
|
||||||
|
if (cp[6] == c)
|
||||||
|
return (__ptr_t) &cp[6];
|
||||||
|
if (cp[5] == c)
|
||||||
|
return (__ptr_t) &cp[5];
|
||||||
|
if (cp[4] == c)
|
||||||
|
return (__ptr_t) &cp[4];
|
||||||
|
#endif
|
||||||
|
if (cp[3] == c)
|
||||||
|
return (__ptr_t) &cp[3];
|
||||||
|
if (cp[2] == c)
|
||||||
|
return (__ptr_t) &cp[2];
|
||||||
|
if (cp[1] == c)
|
||||||
|
return (__ptr_t) &cp[1];
|
||||||
|
if (cp[0] == c)
|
||||||
|
return (__ptr_t) cp;
|
||||||
|
}
|
||||||
|
|
||||||
|
n -= sizeof (longword);
|
||||||
|
}
|
||||||
|
|
||||||
|
char_ptr = (const unsigned char *) longword_ptr;
|
||||||
|
|
||||||
|
while (n-- > 0)
|
||||||
|
{
|
||||||
|
if (*--char_ptr == c)
|
||||||
|
return (__ptr_t) char_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#ifdef weak_alias
|
||||||
|
weak_alias (__memrchr, memrchr)
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
|
||||||
|
This file is derived from the one in the GNU C Library.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
/* Disable the definition of mkstemp to rpl_mkstemp (from config.h) in this
|
||||||
|
file. Otherwise, we'd get conflicting prototypes for rpl_mkstemp on
|
||||||
|
most systems. */
|
||||||
|
#undef mkstemp
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifndef __GT_FILE
|
||||||
|
# define __GT_FILE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int __gen_tempname ();
|
||||||
|
|
||||||
|
/* Generate a unique temporary file name from TEMPLATE.
|
||||||
|
The last six characters of TEMPLATE must be "XXXXXX";
|
||||||
|
they are replaced with a string that makes the filename unique.
|
||||||
|
Then open the file and return a fd. */
|
||||||
|
int
|
||||||
|
rpl_mkstemp (char *template)
|
||||||
|
{
|
||||||
|
return __gen_tempname (template, __GT_FILE);
|
||||||
|
}
|
||||||
+94
-75
@@ -1,26 +1,25 @@
|
|||||||
/* obstack.c - subroutines used implicitly by object stack macros
|
/* obstack.c - subroutines used implicitly by object stack macros
|
||||||
Copyright (C) 1988-1994,96,97,98,99,2000 Free Software Foundation, Inc.
|
Copyright (C) 1988-1994,96,97,98,99,2000,2001 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of the GNU C Library. Its master source is NOT part of
|
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.
|
the C library, however. The master source lives in /gd/gnu/lib.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Lesser General Public
|
||||||
published by the Free Software Foundation; either version 2 of the
|
License as published by the Free Software Foundation; either
|
||||||
License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library 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 GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
License along with the GNU C Library; if not, write to the Free
|
||||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||||
Boston, MA 02111-1307, USA. */
|
02111-1307 USA. */
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "obstack.h"
|
#include "obstack.h"
|
||||||
@@ -40,40 +39,43 @@
|
|||||||
files, it is simpler to just do this in the source for each such file. */
|
files, it is simpler to just do this in the source for each such file. */
|
||||||
|
|
||||||
#include <stdio.h> /* Random thing to get __GNU_LIBRARY__. */
|
#include <stdio.h> /* Random thing to get __GNU_LIBRARY__. */
|
||||||
#if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
|
#if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
|
||||||
#include <gnu-versions.h>
|
# include <gnu-versions.h>
|
||||||
#if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION
|
# if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION
|
||||||
#define ELIDE_CODE
|
# define ELIDE_CODE
|
||||||
#endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined _LIBC && defined USE_IN_LIBIO
|
||||||
|
# include <wchar.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef ELIDE_CODE
|
#ifndef ELIDE_CODE
|
||||||
|
|
||||||
|
|
||||||
#if defined (__STDC__) && __STDC__
|
# if defined __STDC__ && __STDC__
|
||||||
#define POINTER void *
|
# define POINTER void *
|
||||||
#else
|
# else
|
||||||
#define POINTER char *
|
# define POINTER char *
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
/* Determine default alignment. */
|
/* Determine default alignment. */
|
||||||
struct fooalign {char x; double d;};
|
struct fooalign {char x; double d;};
|
||||||
#define DEFAULT_ALIGNMENT \
|
# define DEFAULT_ALIGNMENT \
|
||||||
((PTR_INT_TYPE) ((char *) &((struct fooalign *) 0)->d - (char *) 0))
|
((PTR_INT_TYPE) ((char *) &((struct fooalign *) 0)->d - (char *) 0))
|
||||||
/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT.
|
/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT.
|
||||||
But in fact it might be less smart and round addresses to as much as
|
But in fact it might be less smart and round addresses to as much as
|
||||||
DEFAULT_ROUNDING. So we prepare for it to do that. */
|
DEFAULT_ROUNDING. So we prepare for it to do that. */
|
||||||
union fooround {long x; double d;};
|
union fooround {long x; double d;};
|
||||||
#define DEFAULT_ROUNDING (sizeof (union fooround))
|
# define DEFAULT_ROUNDING (sizeof (union fooround))
|
||||||
|
|
||||||
/* When we copy a long block of data, this is the unit to do it with.
|
/* When we copy a long block of data, this is the unit to do it with.
|
||||||
On some machines, copying successive ints does not work;
|
On some machines, copying successive ints does not work;
|
||||||
in such a case, redefine COPYING_UNIT to `long' (if that works)
|
in such a case, redefine COPYING_UNIT to `long' (if that works)
|
||||||
or `char' as a last resort. */
|
or `char' as a last resort. */
|
||||||
#ifndef COPYING_UNIT
|
# ifndef COPYING_UNIT
|
||||||
#define COPYING_UNIT int
|
# define COPYING_UNIT int
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
|
|
||||||
/* The functions allocating more room by calling `obstack_chunk_alloc'
|
/* The functions allocating more room by calling `obstack_chunk_alloc'
|
||||||
@@ -82,21 +84,21 @@ union fooround {long x; double d;};
|
|||||||
abort gracefully or use longjump - but shouldn't return. This
|
abort gracefully or use longjump - but shouldn't return. This
|
||||||
variable by default points to the internal function
|
variable by default points to the internal function
|
||||||
`print_and_abort'. */
|
`print_and_abort'. */
|
||||||
#if defined (__STDC__) && __STDC__
|
# if defined __STDC__ && __STDC__
|
||||||
static void print_and_abort (void);
|
static void print_and_abort (void);
|
||||||
void (*obstack_alloc_failed_handler) (void) = print_and_abort;
|
void (*obstack_alloc_failed_handler) (void) = print_and_abort;
|
||||||
#else
|
# else
|
||||||
static void print_and_abort ();
|
static void print_and_abort ();
|
||||||
void (*obstack_alloc_failed_handler) () = print_and_abort;
|
void (*obstack_alloc_failed_handler) () = print_and_abort;
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
/* Exit value used when `print_and_abort' is used. */
|
/* Exit value used when `print_and_abort' is used. */
|
||||||
#if defined __GNU_LIBRARY__ || defined HAVE_STDLIB_H
|
# if defined __GNU_LIBRARY__ || defined HAVE_STDLIB_H
|
||||||
#include <stdlib.h>
|
# include <stdlib.h>
|
||||||
#endif
|
# endif
|
||||||
#ifndef EXIT_FAILURE
|
# ifndef EXIT_FAILURE
|
||||||
#define EXIT_FAILURE 1
|
# define EXIT_FAILURE 1
|
||||||
#endif
|
# endif
|
||||||
int obstack_exit_failure = EXIT_FAILURE;
|
int obstack_exit_failure = EXIT_FAILURE;
|
||||||
|
|
||||||
/* The non-GNU-C macros copy the obstack into this global variable
|
/* The non-GNU-C macros copy the obstack into this global variable
|
||||||
@@ -110,33 +112,33 @@ struct obstack *_obstack;
|
|||||||
For free, do not use ?:, since some compilers, like the MIPS compilers,
|
For free, do not use ?:, since some compilers, like the MIPS compilers,
|
||||||
do not allow (expr) ? void : void. */
|
do not allow (expr) ? void : void. */
|
||||||
|
|
||||||
#if defined (__STDC__) && __STDC__
|
# if defined __STDC__ && __STDC__
|
||||||
#define CALL_CHUNKFUN(h, size) \
|
# define CALL_CHUNKFUN(h, size) \
|
||||||
(((h) -> use_extra_arg) \
|
(((h) -> use_extra_arg) \
|
||||||
? (*(h)->chunkfun) ((h)->extra_arg, (size)) \
|
? (*(h)->chunkfun) ((h)->extra_arg, (size)) \
|
||||||
: (*(struct _obstack_chunk *(*) (long)) (h)->chunkfun) ((size)))
|
: (*(struct _obstack_chunk *(*) (long)) (h)->chunkfun) ((size)))
|
||||||
|
|
||||||
#define CALL_FREEFUN(h, old_chunk) \
|
# define CALL_FREEFUN(h, old_chunk) \
|
||||||
do { \
|
do { \
|
||||||
if ((h) -> use_extra_arg) \
|
if ((h) -> use_extra_arg) \
|
||||||
(*(h)->freefun) ((h)->extra_arg, (old_chunk)); \
|
(*(h)->freefun) ((h)->extra_arg, (old_chunk)); \
|
||||||
else \
|
else \
|
||||||
(*(void (*) (void *)) (h)->freefun) ((old_chunk)); \
|
(*(void (*) (void *)) (h)->freefun) ((old_chunk)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else
|
# else
|
||||||
#define CALL_CHUNKFUN(h, size) \
|
# define CALL_CHUNKFUN(h, size) \
|
||||||
(((h) -> use_extra_arg) \
|
(((h) -> use_extra_arg) \
|
||||||
? (*(h)->chunkfun) ((h)->extra_arg, (size)) \
|
? (*(h)->chunkfun) ((h)->extra_arg, (size)) \
|
||||||
: (*(struct _obstack_chunk *(*) ()) (h)->chunkfun) ((size)))
|
: (*(struct _obstack_chunk *(*) ()) (h)->chunkfun) ((size)))
|
||||||
|
|
||||||
#define CALL_FREEFUN(h, old_chunk) \
|
# define CALL_FREEFUN(h, old_chunk) \
|
||||||
do { \
|
do { \
|
||||||
if ((h) -> use_extra_arg) \
|
if ((h) -> use_extra_arg) \
|
||||||
(*(h)->freefun) ((h)->extra_arg, (old_chunk)); \
|
(*(h)->freefun) ((h)->extra_arg, (old_chunk)); \
|
||||||
else \
|
else \
|
||||||
(*(void (*) ()) (h)->freefun) ((old_chunk)); \
|
(*(void (*) ()) (h)->freefun) ((old_chunk)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
|
|
||||||
/* Initialize an obstack H for use. Specify chunk size SIZE (0 means default).
|
/* Initialize an obstack H for use. Specify chunk size SIZE (0 means default).
|
||||||
@@ -152,13 +154,13 @@ _obstack_begin (h, size, alignment, chunkfun, freefun)
|
|||||||
struct obstack *h;
|
struct obstack *h;
|
||||||
int size;
|
int size;
|
||||||
int alignment;
|
int alignment;
|
||||||
#if defined (__STDC__) && __STDC__
|
# if defined __STDC__ && __STDC__
|
||||||
POINTER (*chunkfun) (long);
|
POINTER (*chunkfun) (long);
|
||||||
void (*freefun) (void *);
|
void (*freefun) (void *);
|
||||||
#else
|
# else
|
||||||
POINTER (*chunkfun) ();
|
POINTER (*chunkfun) ();
|
||||||
void (*freefun) ();
|
void (*freefun) ();
|
||||||
#endif
|
# endif
|
||||||
{
|
{
|
||||||
register struct _obstack_chunk *chunk; /* points to new chunk */
|
register struct _obstack_chunk *chunk; /* points to new chunk */
|
||||||
|
|
||||||
@@ -181,13 +183,13 @@ _obstack_begin (h, size, alignment, chunkfun, freefun)
|
|||||||
size = 4096 - extra;
|
size = 4096 - extra;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (__STDC__) && __STDC__
|
# if defined __STDC__ && __STDC__
|
||||||
h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun;
|
h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun;
|
||||||
h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
|
h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
|
||||||
#else
|
# else
|
||||||
h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
|
h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
|
||||||
h->freefun = freefun;
|
h->freefun = freefun;
|
||||||
#endif
|
# endif
|
||||||
h->chunk_size = size;
|
h->chunk_size = size;
|
||||||
h->alignment_mask = alignment - 1;
|
h->alignment_mask = alignment - 1;
|
||||||
h->use_extra_arg = 0;
|
h->use_extra_arg = 0;
|
||||||
@@ -210,13 +212,13 @@ _obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg)
|
|||||||
struct obstack *h;
|
struct obstack *h;
|
||||||
int size;
|
int size;
|
||||||
int alignment;
|
int alignment;
|
||||||
#if defined (__STDC__) && __STDC__
|
# if defined __STDC__ && __STDC__
|
||||||
POINTER (*chunkfun) (POINTER, long);
|
POINTER (*chunkfun) (POINTER, long);
|
||||||
void (*freefun) (POINTER, POINTER);
|
void (*freefun) (POINTER, POINTER);
|
||||||
#else
|
# else
|
||||||
POINTER (*chunkfun) ();
|
POINTER (*chunkfun) ();
|
||||||
void (*freefun) ();
|
void (*freefun) ();
|
||||||
#endif
|
# endif
|
||||||
POINTER arg;
|
POINTER arg;
|
||||||
{
|
{
|
||||||
register struct _obstack_chunk *chunk; /* points to new chunk */
|
register struct _obstack_chunk *chunk; /* points to new chunk */
|
||||||
@@ -240,13 +242,13 @@ _obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg)
|
|||||||
size = 4096 - extra;
|
size = 4096 - extra;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__STDC__) && __STDC__
|
# if defined __STDC__ && __STDC__
|
||||||
h->chunkfun = (struct _obstack_chunk * (*)(void *,long)) chunkfun;
|
h->chunkfun = (struct _obstack_chunk * (*)(void *,long)) chunkfun;
|
||||||
h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
|
h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
|
||||||
#else
|
# else
|
||||||
h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
|
h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
|
||||||
h->freefun = freefun;
|
h->freefun = freefun;
|
||||||
#endif
|
# endif
|
||||||
h->chunk_size = size;
|
h->chunk_size = size;
|
||||||
h->alignment_mask = alignment - 1;
|
h->alignment_mask = alignment - 1;
|
||||||
h->extra_arg = arg;
|
h->extra_arg = arg;
|
||||||
@@ -341,11 +343,11 @@ _obstack_newchunk (h, length)
|
|||||||
This is here for debugging.
|
This is here for debugging.
|
||||||
If you use it in a program, you are probably losing. */
|
If you use it in a program, you are probably losing. */
|
||||||
|
|
||||||
#if defined (__STDC__) && __STDC__
|
# if defined __STDC__ && __STDC__
|
||||||
/* Suppress -Wmissing-prototypes warning. We don't want to declare this in
|
/* Suppress -Wmissing-prototypes warning. We don't want to declare this in
|
||||||
obstack.h because it is just for debugging. */
|
obstack.h because it is just for debugging. */
|
||||||
int _obstack_allocated_p (struct obstack *h, POINTER obj);
|
int _obstack_allocated_p (struct obstack *h, POINTER obj);
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
int
|
int
|
||||||
_obstack_allocated_p (h, obj)
|
_obstack_allocated_p (h, obj)
|
||||||
@@ -370,7 +372,7 @@ _obstack_allocated_p (h, obj)
|
|||||||
/* Free objects in obstack H, including OBJ and everything allocate
|
/* Free objects in obstack H, including OBJ and everything allocate
|
||||||
more recently than OBJ. If OBJ is zero, free everything in H. */
|
more recently than OBJ. If OBJ is zero, free everything in H. */
|
||||||
|
|
||||||
#undef obstack_free
|
# undef obstack_free
|
||||||
|
|
||||||
/* This function has two names with identical definitions.
|
/* This function has two names with identical definitions.
|
||||||
This is the first one, called from non-ANSI code. */
|
This is the first one, called from non-ANSI code. */
|
||||||
@@ -456,37 +458,54 @@ _obstack_memory_used (h)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Define the error handler. */
|
/* Define the error handler. */
|
||||||
#ifndef _
|
# ifndef _
|
||||||
# if defined HAVE_LIBINTL_H || defined _LIBC
|
# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
|
||||||
# include <libintl.h>
|
# include <libintl.h>
|
||||||
# ifndef _
|
# ifndef _
|
||||||
# define _(Str) gettext (Str)
|
# define _(Str) gettext (Str)
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# define _(Str) (Str)
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# if defined _LIBC && defined USE_IN_LIBIO
|
||||||
|
# include <libio/iolibio.h>
|
||||||
|
# define fputs(s, f) _IO_fputs (s, f)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# 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
|
# endif
|
||||||
# else
|
|
||||||
# define _(Str) (Str)
|
|
||||||
# endif
|
# endif
|
||||||
#endif
|
|
||||||
#if defined _LIBC && defined USE_IN_LIBIO
|
|
||||||
# include <libio/iolibio.h>
|
|
||||||
# define fputs(s, f) _IO_fputs (s, f)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
__attribute__ ((noreturn))
|
||||||
print_and_abort ()
|
print_and_abort ()
|
||||||
{
|
{
|
||||||
fputs (_("memory exhausted"), stderr);
|
/* Don't change any of these strings. Yes, it would be possible to add
|
||||||
fputc ('\n', stderr);
|
the newline to the string and use fputs or so. But this must not
|
||||||
|
happen because the "memory exhausted" message appears in other places
|
||||||
|
like this and the translation should be reused instead of creating
|
||||||
|
a very similar string which requires a separate translation. */
|
||||||
|
# if defined _LIBC && defined USE_IN_LIBIO
|
||||||
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
|
__fwprintf (stderr, L"%s\n", _("memory exhausted"));
|
||||||
|
else
|
||||||
|
# endif
|
||||||
|
fprintf (stderr, "%s\n", _("memory exhausted"));
|
||||||
exit (obstack_exit_failure);
|
exit (obstack_exit_failure);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
# if 0
|
||||||
/* These are now turned off because the applications do not use it
|
/* These are now turned off because the applications do not use it
|
||||||
and it uses bcopy via obstack_grow, which causes trouble on sysV. */
|
and it uses bcopy via obstack_grow, which causes trouble on sysV. */
|
||||||
|
|
||||||
/* Now define the functional versions of the obstack macros.
|
/* Now define the functional versions of the obstack macros.
|
||||||
Define them to simply use the corresponding macros to do the job. */
|
Define them to simply use the corresponding macros to do the job. */
|
||||||
|
|
||||||
#if defined (__STDC__) && __STDC__
|
# if defined __STDC__ && __STDC__
|
||||||
/* These function definitions do not work with non-ANSI preprocessors;
|
/* These function definitions do not work with non-ANSI preprocessors;
|
||||||
they won't pass through the macro names in parentheses. */
|
they won't pass through the macro names in parentheses. */
|
||||||
|
|
||||||
@@ -597,8 +616,8 @@ POINTER (obstack_copy0) (obstack, address, length)
|
|||||||
return obstack_copy0 (obstack, address, length);
|
return obstack_copy0 (obstack, address, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __STDC__ */
|
# endif /* __STDC__ */
|
||||||
|
|
||||||
#endif /* 0 */
|
# endif /* 0 */
|
||||||
|
|
||||||
#endif /* !ELIDE_CODE */
|
#endif /* !ELIDE_CODE */
|
||||||
|
|||||||
+11
-8
@@ -4,20 +4,23 @@
|
|||||||
This file is part of the GNU C Library. Its master source is NOT part of
|
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.
|
the C library, however. The master source lives in /gd/gnu/lib.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
||||||
modify it under the terms of the GNU Library General Public License as
|
Bugs can be reported to [email protected].
|
||||||
published by the Free Software Foundation; either version 2 of the
|
|
||||||
License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
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
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
License along with this program; if not, write to the Free Software
|
||||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
Boston, MA 02111-1307, USA. */
|
USA. */
|
||||||
|
|
||||||
/* Summary:
|
/* Summary:
|
||||||
|
|
||||||
|
|||||||
+22
-2
@@ -1,12 +1,32 @@
|
|||||||
|
/* quote.c - quote arguments for output
|
||||||
|
Copyright (C) 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. */
|
||||||
|
|
||||||
/* Written by Paul Eggert <[email protected]> */
|
/* Written by Paul Eggert <[email protected]> */
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
#if HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_STDDEF_H
|
||||||
|
# include <stddef.h> /* For the definition of size_t on windows w/MSVC. */
|
||||||
|
#endif
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <quotearg.h>
|
#include "quotearg.h"
|
||||||
#include <quote.h>
|
#include "quote.h"
|
||||||
|
|
||||||
/* Return an unambiguous printable representated, allocated in slot N,
|
/* Return an unambiguous printable representated, allocated in slot N,
|
||||||
for NAME, suitable for diagnostics. */
|
for NAME, suitable for diagnostics. */
|
||||||
|
|||||||
+17
-1
@@ -1,4 +1,20 @@
|
|||||||
/* prototypes for quote.c */
|
/* quote.h - prototypes for quote.c
|
||||||
|
Copyright (C) 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. */
|
||||||
|
|
||||||
|
|
||||||
#ifndef PARAMS
|
#ifndef PARAMS
|
||||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||||
|
|||||||
+25
-12
@@ -25,8 +25,8 @@
|
|||||||
# include <stddef.h> /* For the definition of size_t on windows w/MSVC. */
|
# include <stddef.h> /* For the definition of size_t on windows w/MSVC. */
|
||||||
#endif
|
#endif
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <quotearg.h>
|
#include "quotearg.h"
|
||||||
#include <xalloc.h>
|
#include "xalloc.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
@@ -44,9 +44,15 @@
|
|||||||
#ifndef CHAR_BIT
|
#ifndef CHAR_BIT
|
||||||
# define CHAR_BIT 8
|
# define CHAR_BIT 8
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef SIZE_MAX
|
||||||
|
# define SIZE_MAX ((size_t) -1)
|
||||||
|
#endif
|
||||||
#ifndef UCHAR_MAX
|
#ifndef UCHAR_MAX
|
||||||
# define UCHAR_MAX ((unsigned char) -1)
|
# define UCHAR_MAX ((unsigned char) -1)
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef UINT_MAX
|
||||||
|
# define UINT_MAX ((unsigned int) -1)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HAVE_C_BACKSLASH_A
|
#if HAVE_C_BACKSLASH_A
|
||||||
# define ALERT_CHAR '\a'
|
# define ALERT_CHAR '\a'
|
||||||
@@ -539,6 +545,7 @@ quotearg_n_options (int n, char const *arg,
|
|||||||
one small component of a "memory exhausted" message in slot 0. */
|
one small component of a "memory exhausted" message in slot 0. */
|
||||||
static char slot0[256];
|
static char slot0[256];
|
||||||
static unsigned int nslots = 1;
|
static unsigned int nslots = 1;
|
||||||
|
unsigned int n0 = n;
|
||||||
struct slotvec
|
struct slotvec
|
||||||
{
|
{
|
||||||
size_t size;
|
size_t size;
|
||||||
@@ -547,20 +554,26 @@ quotearg_n_options (int n, char const *arg,
|
|||||||
static struct slotvec slotvec0 = {sizeof slot0, slot0};
|
static struct slotvec slotvec0 = {sizeof slot0, slot0};
|
||||||
static struct slotvec *slotvec = &slotvec0;
|
static struct slotvec *slotvec = &slotvec0;
|
||||||
|
|
||||||
if (nslots <= n)
|
if (n < 0)
|
||||||
|
abort ();
|
||||||
|
|
||||||
|
if (nslots <= n0)
|
||||||
{
|
{
|
||||||
int n1 = n + 1;
|
unsigned int n1 = n0 + 1;
|
||||||
size_t s = n1 * sizeof (struct slotvec);
|
size_t s = n1 * sizeof *slotvec;
|
||||||
if (! (0 < n1 && n1 == s / sizeof (struct slotvec)))
|
|
||||||
abort ();
|
if (SIZE_MAX / UINT_MAX <= sizeof *slotvec
|
||||||
|
&& n1 != s / sizeof *slotvec)
|
||||||
|
xalloc_die ();
|
||||||
|
|
||||||
if (slotvec == &slotvec0)
|
if (slotvec == &slotvec0)
|
||||||
{
|
{
|
||||||
slotvec = (struct slotvec *) xmalloc (sizeof (struct slotvec));
|
slotvec = (struct slotvec *) xmalloc (sizeof *slotvec);
|
||||||
*slotvec = slotvec0;
|
*slotvec = slotvec0;
|
||||||
}
|
}
|
||||||
slotvec = (struct slotvec *) xrealloc (slotvec, s);
|
slotvec = (struct slotvec *) xrealloc (slotvec, s);
|
||||||
memset (slotvec + nslots, 0, (n1 - nslots) * sizeof (struct slotvec));
|
memset (slotvec + nslots, 0, (n1 - nslots) * sizeof *slotvec);
|
||||||
nslots = n;
|
nslots = n1;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -580,7 +593,7 @@ quotearg_n_options (int n, char const *arg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
quotearg_n (unsigned int n, char const *arg)
|
quotearg_n (int n, char const *arg)
|
||||||
{
|
{
|
||||||
return quotearg_n_options (n, arg, &default_quoting_options);
|
return quotearg_n_options (n, arg, &default_quoting_options);
|
||||||
}
|
}
|
||||||
@@ -592,7 +605,7 @@ quotearg (char const *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
quotearg_n_style (unsigned int n, enum quoting_style s, char const *arg)
|
quotearg_n_style (int n, enum quoting_style s, char const *arg)
|
||||||
{
|
{
|
||||||
struct quoting_options o;
|
struct quoting_options o;
|
||||||
o.style = s;
|
o.style = s;
|
||||||
|
|||||||
+2
-3
@@ -89,7 +89,7 @@ size_t quotearg_buffer PARAMS ((char *buffer, size_t buffersize,
|
|||||||
The returned value points to static storage that can be
|
The returned value points to static storage that can be
|
||||||
reused by the next call to this function with the same value of N.
|
reused by the next call to this function with the same value of N.
|
||||||
N must be nonnegative. */
|
N must be nonnegative. */
|
||||||
char *quotearg_n PARAMS ((unsigned int n, char const *arg));
|
char *quotearg_n PARAMS ((int n, char const *arg));
|
||||||
|
|
||||||
/* Equivalent to quotearg_n (0, ARG). */
|
/* Equivalent to quotearg_n (0, ARG). */
|
||||||
char *quotearg PARAMS ((char const *arg));
|
char *quotearg PARAMS ((char const *arg));
|
||||||
@@ -97,8 +97,7 @@ char *quotearg PARAMS ((char const *arg));
|
|||||||
/* Use style S and storage slot N to return a quoted version of the string ARG.
|
/* Use style S and storage slot N to return a quoted version of the string ARG.
|
||||||
This is like quotearg_n (N, ARG), except that it uses S with no other
|
This is like quotearg_n (N, ARG), except that it uses S with no other
|
||||||
options to specify the quoting method. */
|
options to specify the quoting method. */
|
||||||
char *quotearg_n_style PARAMS ((unsigned int n, enum quoting_style s,
|
char *quotearg_n_style PARAMS ((int n, enum quoting_style s, char const *arg));
|
||||||
char const *arg));
|
|
||||||
|
|
||||||
/* Equivalent to quotearg_n_style (0, S, ARG). */
|
/* Equivalent to quotearg_n_style (0, S, ARG). */
|
||||||
char *quotearg_style PARAMS ((enum quoting_style s, char const *arg));
|
char *quotearg_style PARAMS ((enum quoting_style s, char const *arg));
|
||||||
|
|||||||
@@ -0,0 +1,96 @@
|
|||||||
|
/* Open a pipe to read from a program without intermediary sh.
|
||||||
|
Copyright (C) 1992, 1997 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. */
|
||||||
|
|
||||||
|
#if HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#if __STDC__
|
||||||
|
#include <stdarg.h>
|
||||||
|
#else
|
||||||
|
#include <varargs.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_UNISTD_H
|
||||||
|
# include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Open a pipe to read from a program without intermediary sh. Checks
|
||||||
|
PATH. Sample use:
|
||||||
|
|
||||||
|
stream = readpipe ("progname", "arg1", "arg2", (char *) 0);
|
||||||
|
|
||||||
|
Return 0 on error. */
|
||||||
|
|
||||||
|
#if __STDC__
|
||||||
|
FILE *
|
||||||
|
readpipe (char *progname, ...)
|
||||||
|
#else
|
||||||
|
FILE *
|
||||||
|
readpipe (va_alist)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#if ! __STDC__
|
||||||
|
char *progname;
|
||||||
|
#endif
|
||||||
|
int fds[2];
|
||||||
|
va_list ap;
|
||||||
|
char *args[100];
|
||||||
|
int argno = 0;
|
||||||
|
|
||||||
|
/* Copy arguments into `args'. */
|
||||||
|
#if __STDC__
|
||||||
|
va_start (ap, progname);
|
||||||
|
#else
|
||||||
|
va_start (ap);
|
||||||
|
progname = va_arg (ap, char *);
|
||||||
|
#endif
|
||||||
|
args[argno++] = progname;
|
||||||
|
while ((args[argno++] = va_arg (ap, char *)) != NULL)
|
||||||
|
;
|
||||||
|
va_end (ap);
|
||||||
|
|
||||||
|
if (pipe (fds) == -1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
switch (fork ())
|
||||||
|
{
|
||||||
|
case 0: /* Child. Write to pipe. */
|
||||||
|
close (fds[0]); /* Not needed. */
|
||||||
|
if (fds[1] != 1) /* Redirect 1 (stdout) only if needed. */
|
||||||
|
{
|
||||||
|
close (1); /* We don't want the old stdout. */
|
||||||
|
if (dup (fds[1]) == 0)/* Maybe stdin was closed. */
|
||||||
|
{
|
||||||
|
dup (fds[1]); /* Guaranteed to dup to 1 (stdout). */
|
||||||
|
close (0);
|
||||||
|
}
|
||||||
|
close (fds[1]); /* No longer needed. */
|
||||||
|
}
|
||||||
|
execvp (args[0], args);
|
||||||
|
_exit (2); /* 2 for `cmp'. */
|
||||||
|
case -1: /* Error. */
|
||||||
|
return 0;
|
||||||
|
default: /* Parent. Read from pipe. */
|
||||||
|
close (fds[1]); /* Not needed. */
|
||||||
|
return fdopen (fds[0], "r");
|
||||||
|
}
|
||||||
|
}
|
||||||
+672
@@ -0,0 +1,672 @@
|
|||||||
|
/* Simple bitsets.
|
||||||
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "sbitset.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/* This file implements fixed size bitsets stored as an array
|
||||||
|
of words. Any unused bits in the last word must be zero. */
|
||||||
|
|
||||||
|
typedef struct sbitset_struct
|
||||||
|
{
|
||||||
|
unsigned int n_bits; /* Number of bits. */
|
||||||
|
bitset_word words[1]; /* The array of bits. */
|
||||||
|
}
|
||||||
|
*sbitset;
|
||||||
|
|
||||||
|
|
||||||
|
struct bitset_struct
|
||||||
|
{
|
||||||
|
struct bbitset_struct b;
|
||||||
|
struct sbitset_struct s;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void sbitset_unused_clear PARAMS ((bitset));
|
||||||
|
|
||||||
|
static int sbitset_small_list PARAMS ((bitset, bitset_bindex *, bitset_bindex,
|
||||||
|
bitset_bindex *));
|
||||||
|
|
||||||
|
static void sbitset_set PARAMS ((bitset, bitset_bindex));
|
||||||
|
static void sbitset_reset PARAMS ((bitset, bitset_bindex));
|
||||||
|
static int sbitset_test PARAMS ((bitset, bitset_bindex));
|
||||||
|
static int sbitset_size PARAMS ((bitset));
|
||||||
|
static int sbitset_op1 PARAMS ((bitset, enum bitset_ops));
|
||||||
|
static int sbitset_op2 PARAMS ((bitset, bitset, enum bitset_ops));
|
||||||
|
static int sbitset_op3 PARAMS ((bitset, bitset, bitset, enum bitset_ops));
|
||||||
|
static int sbitset_op4 PARAMS ((bitset, bitset, bitset, bitset,
|
||||||
|
enum bitset_ops));
|
||||||
|
static int sbitset_list PARAMS ((bitset, bitset_bindex *, bitset_bindex,
|
||||||
|
bitset_bindex *));
|
||||||
|
static int sbitset_reverse_list
|
||||||
|
PARAMS ((bitset, bitset_bindex *, bitset_bindex, bitset_bindex *));
|
||||||
|
|
||||||
|
#define SBITSET_N_WORDS(N) (((N) + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS)
|
||||||
|
#define SBITSET_WORDS(X) ((X)->s.words)
|
||||||
|
#define SBITSET_N_BITS(X) ((X)->s.n_bits)
|
||||||
|
|
||||||
|
|
||||||
|
/* Return size in bits of bitset SRC. */
|
||||||
|
static int
|
||||||
|
sbitset_size (src)
|
||||||
|
bitset src;
|
||||||
|
{
|
||||||
|
return SBITSET_N_BITS (src);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Find list of up to NUM bits set in BSET starting from and including
|
||||||
|
*NEXT and store in array LIST. Return with actual number of bits
|
||||||
|
found and with *NEXT indicating where search stopped. */
|
||||||
|
static int
|
||||||
|
sbitset_small_list (src, list, num, next)
|
||||||
|
bitset src;
|
||||||
|
bitset_bindex *list;
|
||||||
|
bitset_bindex num;
|
||||||
|
bitset_bindex *next;
|
||||||
|
{
|
||||||
|
bitset_bindex bitno;
|
||||||
|
bitset_bindex count;
|
||||||
|
bitset_windex size;
|
||||||
|
bitset_word word;
|
||||||
|
|
||||||
|
word = SBITSET_WORDS (src)[0];
|
||||||
|
|
||||||
|
/* Short circuit common case. */
|
||||||
|
if (!word)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
size = SBITSET_N_BITS (src);
|
||||||
|
bitno = *next;
|
||||||
|
if (bitno >= size)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
word >>= bitno;
|
||||||
|
|
||||||
|
/* If num is 1, we could speed things up with a binary search
|
||||||
|
of the word of interest. */
|
||||||
|
|
||||||
|
if (num >= BITSET_WORD_BITS)
|
||||||
|
{
|
||||||
|
for (count = 0; word; bitno++)
|
||||||
|
{
|
||||||
|
if (word & 1)
|
||||||
|
list[count++] = bitno;
|
||||||
|
word >>= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (count = 0; word; bitno++)
|
||||||
|
{
|
||||||
|
if (word & 1)
|
||||||
|
{
|
||||||
|
list[count++] = bitno;
|
||||||
|
if (count >= num)
|
||||||
|
{
|
||||||
|
bitno++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
word >>= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*next = bitno;
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Set bit BITNO in bitset DST. */
|
||||||
|
static void
|
||||||
|
sbitset_set (dst, bitno)
|
||||||
|
bitset dst ATTRIBUTE_UNUSED;
|
||||||
|
bitset_bindex bitno ATTRIBUTE_UNUSED;
|
||||||
|
{
|
||||||
|
/* This should never occur for sbitsets. */
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Reset bit BITNO in bitset DST. */
|
||||||
|
static void
|
||||||
|
sbitset_reset (dst, bitno)
|
||||||
|
bitset dst ATTRIBUTE_UNUSED;
|
||||||
|
bitset_bindex bitno ATTRIBUTE_UNUSED;
|
||||||
|
{
|
||||||
|
/* This should never occur for sbitsets. */
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Test bit BITNO in bitset SRC. */
|
||||||
|
static int
|
||||||
|
sbitset_test (src, bitno)
|
||||||
|
bitset src ATTRIBUTE_UNUSED;
|
||||||
|
bitset_bindex bitno ATTRIBUTE_UNUSED;
|
||||||
|
{
|
||||||
|
/* This should never occur for sbitsets. */
|
||||||
|
abort ();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Find list of up to NUM bits set in BSET in reverse order, starting
|
||||||
|
from and including NEXT and store in array LIST. Return with
|
||||||
|
actual number of bits found and with *NEXT indicating where search
|
||||||
|
stopped. */
|
||||||
|
static int
|
||||||
|
sbitset_reverse_list (src, list, num, next)
|
||||||
|
bitset src;
|
||||||
|
bitset_bindex *list;
|
||||||
|
bitset_bindex num;
|
||||||
|
bitset_bindex *next;
|
||||||
|
{
|
||||||
|
bitset_bindex bitno;
|
||||||
|
bitset_bindex rbitno;
|
||||||
|
bitset_bindex count;
|
||||||
|
bitset_windex windex;
|
||||||
|
unsigned int bitcnt;
|
||||||
|
bitset_bindex bitoff;
|
||||||
|
bitset_word word;
|
||||||
|
bitset_word *srcp = SBITSET_WORDS (src);
|
||||||
|
bitset_bindex n_bits = SBITSET_N_BITS (src);
|
||||||
|
|
||||||
|
rbitno = *next;
|
||||||
|
|
||||||
|
/* If num is 1, we could speed things up with a binary search
|
||||||
|
of the word of interest. */
|
||||||
|
|
||||||
|
if (rbitno >= n_bits)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
count = 0;
|
||||||
|
|
||||||
|
bitno = n_bits - (rbitno + 1);
|
||||||
|
|
||||||
|
windex = bitno / BITSET_WORD_BITS;
|
||||||
|
bitcnt = bitno % BITSET_WORD_BITS;
|
||||||
|
bitoff = windex * BITSET_WORD_BITS;
|
||||||
|
|
||||||
|
for (; windex != ~0U; windex--, bitoff -= BITSET_WORD_BITS,
|
||||||
|
bitcnt = BITSET_WORD_BITS - 1)
|
||||||
|
{
|
||||||
|
word = srcp[windex] << (BITSET_WORD_BITS - 1 - bitcnt);
|
||||||
|
for (; word; bitcnt--)
|
||||||
|
{
|
||||||
|
if (word & BITSET_MSB)
|
||||||
|
{
|
||||||
|
list[count++] = bitoff + bitcnt;
|
||||||
|
if (count >= num)
|
||||||
|
{
|
||||||
|
*next = n_bits - (bitoff + bitcnt);
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
word <<= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*next = n_bits - (bitoff + 1);
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Find list of up to NUM bits set in BSET starting from and including
|
||||||
|
*NEXT and store in array LIST. Return with actual number of bits
|
||||||
|
found and with *NEXT indicating where search stopped. */
|
||||||
|
static int
|
||||||
|
sbitset_list (src, list, num, next)
|
||||||
|
bitset src;
|
||||||
|
bitset_bindex *list;
|
||||||
|
bitset_bindex num;
|
||||||
|
bitset_bindex *next;
|
||||||
|
{
|
||||||
|
bitset_bindex bitno;
|
||||||
|
bitset_bindex count;
|
||||||
|
bitset_windex windex;
|
||||||
|
bitset_bindex bitoff;
|
||||||
|
bitset_windex size = src->b.csize;
|
||||||
|
bitset_word *srcp = SBITSET_WORDS (src);
|
||||||
|
bitset_word word;
|
||||||
|
|
||||||
|
bitno = *next;
|
||||||
|
|
||||||
|
count = 0;
|
||||||
|
if (!bitno)
|
||||||
|
{
|
||||||
|
/* Many bitsets are zero, so make this common case fast. */
|
||||||
|
for (windex = 0; windex < size && !srcp[windex]; windex++)
|
||||||
|
continue;
|
||||||
|
if (windex >= size)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* If num is 1, we could speed things up with a binary search
|
||||||
|
of the current word. */
|
||||||
|
|
||||||
|
bitoff = windex * BITSET_WORD_BITS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (bitno >= SBITSET_N_BITS (src))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
windex = bitno / BITSET_WORD_BITS;
|
||||||
|
bitno = bitno % BITSET_WORD_BITS;
|
||||||
|
|
||||||
|
if (bitno)
|
||||||
|
{
|
||||||
|
/* Handle the case where we start within a word.
|
||||||
|
Most often, this is executed with large bitsets
|
||||||
|
with many set bits where we filled the array
|
||||||
|
on the previous call to this function. */
|
||||||
|
|
||||||
|
bitoff = windex * BITSET_WORD_BITS;
|
||||||
|
word = srcp[windex] >> bitno;
|
||||||
|
for (bitno = bitoff + bitno; word; bitno++)
|
||||||
|
{
|
||||||
|
if (word & 1)
|
||||||
|
{
|
||||||
|
list[count++] = bitno;
|
||||||
|
if (count >= num)
|
||||||
|
{
|
||||||
|
*next = bitno + 1;
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
word >>= 1;
|
||||||
|
}
|
||||||
|
windex++;
|
||||||
|
}
|
||||||
|
bitoff = windex * BITSET_WORD_BITS;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; windex < size; windex++, bitoff += BITSET_WORD_BITS)
|
||||||
|
{
|
||||||
|
if (!(word = srcp[windex]))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ((count + BITSET_WORD_BITS) < num)
|
||||||
|
{
|
||||||
|
for (bitno = bitoff; word; bitno++)
|
||||||
|
{
|
||||||
|
if (word & 1)
|
||||||
|
list[count++] = bitno;
|
||||||
|
word >>= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (bitno = bitoff; word; bitno++)
|
||||||
|
{
|
||||||
|
if (word & 1)
|
||||||
|
{
|
||||||
|
list[count++] = bitno;
|
||||||
|
if (count >= num)
|
||||||
|
{
|
||||||
|
*next = bitno + 1;
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
word >>= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*next = bitoff;
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Ensure that any unused bits within the last word are clear. */
|
||||||
|
static inline void
|
||||||
|
sbitset_unused_clear (dst)
|
||||||
|
bitset dst;
|
||||||
|
{
|
||||||
|
unsigned int last_bit;
|
||||||
|
|
||||||
|
last_bit = SBITSET_N_BITS (dst) % BITSET_WORD_BITS;
|
||||||
|
if (last_bit)
|
||||||
|
SBITSET_WORDS (dst)[dst->b.csize - 1] &=
|
||||||
|
(bitset_word) ((1 << last_bit) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
sbitset_op1 (dst, op)
|
||||||
|
bitset dst;
|
||||||
|
enum bitset_ops op;
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
bitset_word *dstp = SBITSET_WORDS (dst);
|
||||||
|
unsigned int bytes;
|
||||||
|
|
||||||
|
bytes = sizeof (bitset_word) * dst->b.csize;
|
||||||
|
|
||||||
|
switch (op)
|
||||||
|
{
|
||||||
|
case BITSET_OP_ZERO:
|
||||||
|
memset (dstp, 0, bytes);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BITSET_OP_ONES:
|
||||||
|
memset (dstp, ~0, bytes);
|
||||||
|
sbitset_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
|
||||||
|
sbitset_op2 (dst, src, op)
|
||||||
|
bitset dst;
|
||||||
|
bitset src;
|
||||||
|
enum bitset_ops op;
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
bitset_word *srcp = SBITSET_WORDS (src);
|
||||||
|
bitset_word *dstp = SBITSET_WORDS (dst);
|
||||||
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
|
#ifdef ENABLE_CHECKING
|
||||||
|
/* Check for compatiblity. */
|
||||||
|
if (SBITSET_N_BITS (src) != SBITSET_N_BITS (dst))
|
||||||
|
abort ();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
switch (op)
|
||||||
|
{
|
||||||
|
case BITSET_OP_COPY:
|
||||||
|
if (srcp == dstp)
|
||||||
|
break;
|
||||||
|
memcpy (dstp, srcp, sizeof (bitset_word) * size);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BITSET_OP_NOT:
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
|
*dstp++ = ~(*srcp++);
|
||||||
|
sbitset_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
|
||||||
|
sbitset_op3 (dst, src1, src2, op)
|
||||||
|
bitset dst;
|
||||||
|
bitset src1;
|
||||||
|
bitset src2;
|
||||||
|
enum bitset_ops op;
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
int changed = 0;
|
||||||
|
bitset_word *src1p = SBITSET_WORDS (src1);
|
||||||
|
bitset_word *src2p = SBITSET_WORDS (src2);
|
||||||
|
bitset_word *dstp = SBITSET_WORDS (dst);
|
||||||
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
|
#ifdef ENABLE_CHECKING
|
||||||
|
/* Check for compatiblity. */
|
||||||
|
if (SBITSET_N_BITS (src1) != SBITSET_N_BITS (dst)
|
||||||
|
SBITSET_N_BITS (src2) != SBITSET_N_BITS (dst))
|
||||||
|
abort ();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
switch (op)
|
||||||
|
{
|
||||||
|
case BITSET_OP_OR:
|
||||||
|
for (i = 0; i < size; i++, dstp++)
|
||||||
|
{
|
||||||
|
bitset_word tmp = *src1p++ | *src2p++;
|
||||||
|
|
||||||
|
if (*dstp != tmp)
|
||||||
|
{
|
||||||
|
changed = 1;
|
||||||
|
*dstp = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BITSET_OP_AND:
|
||||||
|
for (i = 0; i < size; i++, dstp++)
|
||||||
|
{
|
||||||
|
bitset_word tmp = *src1p++ & *src2p++;
|
||||||
|
|
||||||
|
if (*dstp != tmp)
|
||||||
|
{
|
||||||
|
changed = 1;
|
||||||
|
*dstp = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BITSET_OP_XOR:
|
||||||
|
for (i = 0; i < size; i++, dstp++)
|
||||||
|
{
|
||||||
|
bitset_word tmp = *src1p++ ^ *src2p++;
|
||||||
|
|
||||||
|
if (*dstp != tmp)
|
||||||
|
{
|
||||||
|
changed = 1;
|
||||||
|
*dstp = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BITSET_OP_ANDN:
|
||||||
|
for (i = 0; i < size; i++, dstp++)
|
||||||
|
{
|
||||||
|
bitset_word tmp = *src1p++ & ~(*src2p++);
|
||||||
|
|
||||||
|
if (*dstp != tmp)
|
||||||
|
{
|
||||||
|
changed = 1;
|
||||||
|
*dstp = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
sbitset_op4 (dst, src1, src2, src3, op)
|
||||||
|
bitset dst;
|
||||||
|
bitset src1;
|
||||||
|
bitset src2;
|
||||||
|
bitset src3;
|
||||||
|
enum bitset_ops op;
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
int changed = 0;
|
||||||
|
bitset_word *src1p = SBITSET_WORDS (src1);
|
||||||
|
bitset_word *src2p = SBITSET_WORDS (src2);
|
||||||
|
bitset_word *src3p = SBITSET_WORDS (src3);
|
||||||
|
bitset_word *dstp = SBITSET_WORDS (dst);
|
||||||
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
|
#ifdef ENABLE_CHECKING
|
||||||
|
/* Check for compatiblity. */
|
||||||
|
if (SBITSET_N_BITS (src1) != SBITSET_N_BITS (dst)
|
||||||
|
|| SBITSET_N_BITS (src2) != SBITSET_N_BITS (dst)
|
||||||
|
|| SBITSET_N_BITS (src3) != SBITSET_N_BITS (dst))
|
||||||
|
abort ();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
switch (op)
|
||||||
|
{
|
||||||
|
case BITSET_OP_OR_AND:
|
||||||
|
for (i = 0; i < size; i++, dstp++)
|
||||||
|
{
|
||||||
|
bitset_word tmp = (*src1p++ | *src2p++) & *src3p++;
|
||||||
|
|
||||||
|
if (*dstp != tmp)
|
||||||
|
{
|
||||||
|
changed = 1;
|
||||||
|
*dstp = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BITSET_OP_AND_OR:
|
||||||
|
for (i = 0; i < size; i++, dstp++)
|
||||||
|
{
|
||||||
|
bitset_word tmp = (*src1p++ & *src2p++) | *src3p++;
|
||||||
|
|
||||||
|
if (*dstp != tmp)
|
||||||
|
{
|
||||||
|
changed = 1;
|
||||||
|
*dstp = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BITSET_OP_ANDN_OR:
|
||||||
|
for (i = 0; i < size; i++, dstp++)
|
||||||
|
{
|
||||||
|
bitset_word tmp = (*src1p++ & ~(*src2p++)) | *src3p++;
|
||||||
|
|
||||||
|
if (*dstp != tmp)
|
||||||
|
{
|
||||||
|
changed = 1;
|
||||||
|
*dstp = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Vector of operations for single word bitsets. */
|
||||||
|
struct bitset_ops_struct sbitset_small_ops = {
|
||||||
|
sbitset_set,
|
||||||
|
sbitset_reset,
|
||||||
|
sbitset_test,
|
||||||
|
sbitset_size,
|
||||||
|
sbitset_op1,
|
||||||
|
sbitset_op2,
|
||||||
|
sbitset_op3,
|
||||||
|
sbitset_op4,
|
||||||
|
sbitset_small_list,
|
||||||
|
sbitset_reverse_list,
|
||||||
|
NULL,
|
||||||
|
BITSET_ARRAY
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Vector of operations for multiple word bitsets. */
|
||||||
|
struct bitset_ops_struct sbitset_ops = {
|
||||||
|
sbitset_set,
|
||||||
|
sbitset_reset,
|
||||||
|
sbitset_test,
|
||||||
|
sbitset_size,
|
||||||
|
sbitset_op1,
|
||||||
|
sbitset_op2,
|
||||||
|
sbitset_op3,
|
||||||
|
sbitset_op4,
|
||||||
|
sbitset_list,
|
||||||
|
sbitset_reverse_list,
|
||||||
|
NULL,
|
||||||
|
BITSET_ARRAY
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
sbitset_bytes (n_bits)
|
||||||
|
bitset_bindex n_bits;
|
||||||
|
{
|
||||||
|
unsigned int bytes, size;
|
||||||
|
|
||||||
|
size = SBITSET_N_WORDS (n_bits);
|
||||||
|
bytes = size * sizeof (bitset_word);
|
||||||
|
return sizeof (struct bitset_struct) + bytes - sizeof (bitset_word);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bitset
|
||||||
|
sbitset_init (bset, n_bits)
|
||||||
|
bitset bset;
|
||||||
|
bitset_bindex n_bits;
|
||||||
|
{
|
||||||
|
bitset_windex size;
|
||||||
|
|
||||||
|
size = SBITSET_N_WORDS (n_bits);
|
||||||
|
SBITSET_N_BITS (bset) = n_bits;
|
||||||
|
|
||||||
|
/* Use optimized routines if bitset fits within a single word.
|
||||||
|
There is probably little merit if using caching since
|
||||||
|
the small bitset will always fit in the cache. */
|
||||||
|
if (size == 1)
|
||||||
|
bset->b.ops = &sbitset_small_ops;
|
||||||
|
else
|
||||||
|
bset->b.ops = &sbitset_ops;
|
||||||
|
|
||||||
|
bset->b.cindex = 0;
|
||||||
|
bset->b.csize = size;
|
||||||
|
bset->b.cdata = SBITSET_WORDS (bset);
|
||||||
|
return bset;
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
/* Functions to support sbitsets.
|
||||||
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifndef _SBITSET_H
|
||||||
|
#define _SBITSET_H
|
||||||
|
|
||||||
|
#include "bbitset.h"
|
||||||
|
|
||||||
|
extern int sbitset_bytes PARAMS ((bitset_bindex));
|
||||||
|
|
||||||
|
extern bitset sbitset_init PARAMS ((bitset, bitset_bindex));
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/* Copyright (C) 2001 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; see the file COPYING.LIB. 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 HAVE_STRING_H
|
||||||
|
# include <string.h>
|
||||||
|
#else
|
||||||
|
# include <strings.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
char *
|
||||||
|
strchr (const char *s, int c)
|
||||||
|
{
|
||||||
|
return index (s, c);
|
||||||
|
}
|
||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
/* Find the length of STRING, but scan at most MAXLEN characters.
|
/* Find the length of STRING, but scan at most MAXLEN characters.
|
||||||
Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
|
Copyright (C) 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@@ -51,7 +51,7 @@ size_t
|
|||||||
__strnlen (const char *string, size_t maxlen)
|
__strnlen (const char *string, size_t maxlen)
|
||||||
{
|
{
|
||||||
const char *end = memchr (string, '\0', maxlen);
|
const char *end = memchr (string, '\0', maxlen);
|
||||||
return end ? end - string : maxlen;
|
return end ? (size_t) (end - string) : maxlen;
|
||||||
}
|
}
|
||||||
#ifdef weak_alias
|
#ifdef weak_alias
|
||||||
weak_alias (__strnlen, strnlen)
|
weak_alias (__strnlen, strnlen)
|
||||||
|
|||||||
+343
@@ -0,0 +1,343 @@
|
|||||||
|
/* Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library 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
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with the GNU C Library; 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
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#ifndef __set_errno
|
||||||
|
# define __set_errno(Val) errno = (Val)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#ifndef P_tmpdir
|
||||||
|
# define P_tmpdir "/tmp"
|
||||||
|
#endif
|
||||||
|
#ifndef TMP_MAX
|
||||||
|
# define TMP_MAX 238328
|
||||||
|
#endif
|
||||||
|
#ifndef __GT_FILE
|
||||||
|
# define __GT_FILE 0
|
||||||
|
# define __GT_BIGFILE 1
|
||||||
|
# define __GT_DIR 2
|
||||||
|
# define __GT_NOCREATE 3
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if STDC_HEADERS || _LIBC
|
||||||
|
# include <stddef.h>
|
||||||
|
# include <string.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#if HAVE_FCNTL_H || _LIBC
|
||||||
|
# include <fcntl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_SYS_TIME_H || _LIBC
|
||||||
|
# include <sys/time.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_STDINT_H || _LIBC
|
||||||
|
# include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_UNISTD_H || _LIBC
|
||||||
|
# include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#if STAT_MACROS_BROKEN
|
||||||
|
# undef S_ISDIR
|
||||||
|
#endif
|
||||||
|
#if !defined S_ISDIR && defined S_IFDIR
|
||||||
|
# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
|
||||||
|
#endif
|
||||||
|
#if !S_IRUSR && S_IREAD
|
||||||
|
# define S_IRUSR S_IREAD
|
||||||
|
#endif
|
||||||
|
#if !S_IRUSR
|
||||||
|
# define S_IRUSR 00400
|
||||||
|
#endif
|
||||||
|
#if !S_IWUSR && S_IWRITE
|
||||||
|
# define S_IWUSR S_IWRITE
|
||||||
|
#endif
|
||||||
|
#if !S_IWUSR
|
||||||
|
# define S_IWUSR 00200
|
||||||
|
#endif
|
||||||
|
#if !S_IXUSR && S_IEXEC
|
||||||
|
# define S_IXUSR S_IEXEC
|
||||||
|
#endif
|
||||||
|
#if !S_IXUSR
|
||||||
|
# define S_IXUSR 00100
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if _LIBC
|
||||||
|
# define struct_stat64 struct stat64
|
||||||
|
#else
|
||||||
|
# define struct_stat64 struct stat
|
||||||
|
# define __getpid getpid
|
||||||
|
# define __gettimeofday gettimeofday
|
||||||
|
# define __mkdir mkdir
|
||||||
|
# define __open open
|
||||||
|
# define __open64 open
|
||||||
|
# define __lxstat64(version, path, buf) lstat (path, buf)
|
||||||
|
# define __xstat64(version, path, buf) stat (path, buf)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ! (HAVE___SECURE_GETENV || _LIBC)
|
||||||
|
# define __secure_getenv getenv
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
# include <hp-timing.h>
|
||||||
|
# if HP_TIMING_AVAIL
|
||||||
|
# define RANDOM_BITS(Var) \
|
||||||
|
if (__builtin_expect (value == UINT64_C (0), 0)) \
|
||||||
|
{ \
|
||||||
|
/* If this is the first time this function is used initialize \
|
||||||
|
the variable we accumulate the value in to some somewhat \
|
||||||
|
random value. If we'd not do this programs at startup time \
|
||||||
|
might have a reduced set of possible names, at least on slow \
|
||||||
|
machines. */ \
|
||||||
|
struct timeval tv; \
|
||||||
|
__gettimeofday (&tv, NULL); \
|
||||||
|
value = ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec; \
|
||||||
|
} \
|
||||||
|
HP_TIMING_NOW (Var)
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Use the widest available unsigned type if uint64_t is not
|
||||||
|
available. The algorithm below extracts a number less than 62**6
|
||||||
|
(approximately 2**35.725) from uint64_t, so ancient hosts where
|
||||||
|
uintmax_t is only 32 bits lose about 3.725 bits of randomness,
|
||||||
|
which is better than not having mkstemp at all. */
|
||||||
|
#if !defined UINT64_MAX && !defined uint64_t
|
||||||
|
# define uint64_t uintmax_t
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Return nonzero if DIR is an existent directory. */
|
||||||
|
static int
|
||||||
|
direxists (const char *dir)
|
||||||
|
{
|
||||||
|
struct_stat64 buf;
|
||||||
|
return __xstat64 (_STAT_VER, dir, &buf) == 0 && S_ISDIR (buf.st_mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is
|
||||||
|
non-null and exists, uses it; otherwise uses the first of $TMPDIR,
|
||||||
|
P_tmpdir, /tmp that exists. Copies into TMPL a template suitable
|
||||||
|
for use with mk[s]temp. Will fail (-1) if DIR is non-null and
|
||||||
|
doesn't exist, none of the searched dirs exists, or there's not
|
||||||
|
enough space in TMPL. */
|
||||||
|
int
|
||||||
|
__path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
|
||||||
|
int try_tmpdir)
|
||||||
|
{
|
||||||
|
const char *d;
|
||||||
|
size_t dlen, plen;
|
||||||
|
|
||||||
|
if (!pfx || !pfx[0])
|
||||||
|
{
|
||||||
|
pfx = "file";
|
||||||
|
plen = 4;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
plen = strlen (pfx);
|
||||||
|
if (plen > 5)
|
||||||
|
plen = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (try_tmpdir)
|
||||||
|
{
|
||||||
|
d = __secure_getenv ("TMPDIR");
|
||||||
|
if (d != NULL && direxists (d))
|
||||||
|
dir = d;
|
||||||
|
else if (dir != NULL && direxists (dir))
|
||||||
|
/* nothing */ ;
|
||||||
|
else
|
||||||
|
dir = NULL;
|
||||||
|
}
|
||||||
|
if (dir == NULL)
|
||||||
|
{
|
||||||
|
if (direxists (P_tmpdir))
|
||||||
|
dir = P_tmpdir;
|
||||||
|
else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp"))
|
||||||
|
dir = "/tmp";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
__set_errno (ENOENT);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dlen = strlen (dir);
|
||||||
|
while (dlen > 1 && dir[dlen - 1] == '/')
|
||||||
|
dlen--; /* remove trailing slashes */
|
||||||
|
|
||||||
|
/* check we have room for "${dir}/${pfx}XXXXXX\0" */
|
||||||
|
if (tmpl_len < dlen + 1 + plen + 6 + 1)
|
||||||
|
{
|
||||||
|
__set_errno (EINVAL);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* These are the characters used in temporary filenames. */
|
||||||
|
static const char letters[] =
|
||||||
|
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||||
|
|
||||||
|
/* Generate a temporary file name based on TMPL. TMPL must match the
|
||||||
|
rules for mk[s]temp (i.e. end in "XXXXXX"). The name constructed
|
||||||
|
does not exist at the time of the call to __gen_tempname. TMPL is
|
||||||
|
overwritten with the result.
|
||||||
|
|
||||||
|
KIND may be one of:
|
||||||
|
__GT_NOCREATE: simply verify that the name does not exist
|
||||||
|
at the time of the call.
|
||||||
|
__GT_FILE: create the file using open(O_CREAT|O_EXCL)
|
||||||
|
and return a read-write fd. The file is mode 0600.
|
||||||
|
__GT_BIGFILE: same as __GT_FILE but use open64().
|
||||||
|
__GT_DIR: create a directory, which will be mode 0700.
|
||||||
|
|
||||||
|
We use a clever algorithm to get hard-to-predict names. */
|
||||||
|
int
|
||||||
|
__gen_tempname (char *tmpl, int kind)
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
char *XXXXXX;
|
||||||
|
static uint64_t value;
|
||||||
|
uint64_t random_time_bits;
|
||||||
|
unsigned int count;
|
||||||
|
int fd = -1;
|
||||||
|
int save_errno = errno;
|
||||||
|
struct_stat64 st;
|
||||||
|
|
||||||
|
/* A lower bound on the number of temporary files to attempt to
|
||||||
|
generate. The maximum total number of temporary file names that
|
||||||
|
can exist for a given template is 62**6. It should never be
|
||||||
|
necessary to try all these combinations. Instead if a reasonable
|
||||||
|
number of names is tried (we define reasonable as 62**3) fail to
|
||||||
|
give the system administrator the chance to remove the problems. */
|
||||||
|
unsigned int attempts_min = 62 * 62 * 62;
|
||||||
|
|
||||||
|
/* The number of times to attempt to generate a temporary file. To
|
||||||
|
conform to POSIX, this must be no smaller than TMP_MAX. */
|
||||||
|
unsigned int attempts = attempts_min < TMP_MAX ? TMP_MAX : attempts_min;
|
||||||
|
|
||||||
|
len = strlen (tmpl);
|
||||||
|
if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX"))
|
||||||
|
{
|
||||||
|
__set_errno (EINVAL);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This is where the Xs start. */
|
||||||
|
XXXXXX = &tmpl[len - 6];
|
||||||
|
|
||||||
|
/* Get some more or less random data. */
|
||||||
|
#ifdef RANDOM_BITS
|
||||||
|
RANDOM_BITS (random_time_bits);
|
||||||
|
#else
|
||||||
|
# if HAVE_GETTIMEOFDAY || _LIBC
|
||||||
|
{
|
||||||
|
struct timeval tv;
|
||||||
|
__gettimeofday (&tv, NULL);
|
||||||
|
random_time_bits = ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec;
|
||||||
|
}
|
||||||
|
# else
|
||||||
|
random_time_bits = time (NULL);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
value += random_time_bits ^ __getpid ();
|
||||||
|
|
||||||
|
for (count = 0; count < attempts; value += 7777, ++count)
|
||||||
|
{
|
||||||
|
uint64_t v = value;
|
||||||
|
|
||||||
|
/* Fill in the random bits. */
|
||||||
|
XXXXXX[0] = letters[v % 62];
|
||||||
|
v /= 62;
|
||||||
|
XXXXXX[1] = letters[v % 62];
|
||||||
|
v /= 62;
|
||||||
|
XXXXXX[2] = letters[v % 62];
|
||||||
|
v /= 62;
|
||||||
|
XXXXXX[3] = letters[v % 62];
|
||||||
|
v /= 62;
|
||||||
|
XXXXXX[4] = letters[v % 62];
|
||||||
|
v /= 62;
|
||||||
|
XXXXXX[5] = letters[v % 62];
|
||||||
|
|
||||||
|
switch (kind)
|
||||||
|
{
|
||||||
|
case __GT_FILE:
|
||||||
|
fd = __open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case __GT_BIGFILE:
|
||||||
|
fd = __open64 (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case __GT_DIR:
|
||||||
|
fd = __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case __GT_NOCREATE:
|
||||||
|
/* This case is backward from the other three. __gen_tempname
|
||||||
|
succeeds if __xstat fails because the name does not exist.
|
||||||
|
Note the continue to bypass the common logic at the bottom
|
||||||
|
of the loop. */
|
||||||
|
if (__lxstat64 (_STAT_VER, tmpl, &st) < 0)
|
||||||
|
{
|
||||||
|
if (errno == ENOENT)
|
||||||
|
{
|
||||||
|
__set_errno (save_errno);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* Give up now. */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
|
||||||
|
default:
|
||||||
|
assert (! "invalid KIND in __gen_tempname");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fd >= 0)
|
||||||
|
{
|
||||||
|
__set_errno (save_errno);
|
||||||
|
return fd;
|
||||||
|
}
|
||||||
|
else if (errno != EEXIST)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We got out of the loop because we ran out of combinations to try. */
|
||||||
|
__set_errno (EEXIST);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
+2
-2
@@ -47,11 +47,11 @@ void free ();
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_DONE_WORKING_MALLOC_CHECK
|
#ifndef HAVE_DONE_WORKING_MALLOC_CHECK
|
||||||
you must run the autoconf test for a properly working malloc -- see malloc.m4
|
"you must run the autoconf test for a properly working malloc -- see malloc.m4"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_DONE_WORKING_REALLOC_CHECK
|
#ifndef HAVE_DONE_WORKING_REALLOC_CHECK
|
||||||
you must run the autoconf test for a properly working realloc -- see realloc.m4
|
"you must run the autoconf test for a properly working realloc --see realloc.m4"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Exit value when the requested amount of memory is not available.
|
/* Exit value when the requested amount of memory is not available.
|
||||||
|
|||||||
+2
-10
@@ -1,5 +1,5 @@
|
|||||||
/* xstrdup.c -- copy a string with out of memory checking
|
/* xstrdup.c -- copy a string with out of memory checking
|
||||||
Copyright (C) 1990, 1996, 1998 Free Software Foundation, Inc.
|
Copyright (C) 1990, 1996, 1998, 2001 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
|
||||||
@@ -19,14 +19,6 @@
|
|||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PARAMS
|
|
||||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
|
||||||
# define PARAMS(Args) Args
|
|
||||||
# else
|
|
||||||
# define PARAMS(Args) ()
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if STDC_HEADERS || HAVE_STRING_H
|
#if STDC_HEADERS || HAVE_STRING_H
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
#else
|
#else
|
||||||
@@ -35,7 +27,7 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
char *xmalloc PARAMS ((size_t n));
|
#include "xalloc.h"
|
||||||
|
|
||||||
/* Return a newly allocated copy of STRING. */
|
/* Return a newly allocated copy of STRING. */
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
/* Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
|
/* Copyright (C) 2001 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
|
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
|
under the terms of the GNU General Public License as published by the
|
||||||
@@ -17,20 +14,20 @@
|
|||||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#if HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#if STDC_HEADERS || HAVE_STRING_H
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#if defined _LIBC || defined STDC_HEADERS
|
|
||||||
# include <stdlib.h>
|
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
#else
|
#else
|
||||||
char *malloc ();
|
# include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include "xalloc.h"
|
||||||
|
|
||||||
#ifndef HAVE_DECL_STRNLEN
|
#ifndef HAVE_DECL_STRNLEN
|
||||||
"this configure-time declaration test was not run"
|
"this configure-time declaration test was not run"
|
||||||
#endif
|
#endif
|
||||||
@@ -38,18 +35,13 @@ char *malloc ();
|
|||||||
size_t strnlen ();
|
size_t strnlen ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef __strndup
|
char *xstrndup (const char *s, size_t n);
|
||||||
#undef strndup
|
|
||||||
|
|
||||||
#ifndef weak_alias
|
|
||||||
# define __strndup strndup
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
__strndup (const char *s, size_t n)
|
xstrndup (const char *s, size_t n)
|
||||||
{
|
{
|
||||||
size_t len = strnlen (s, n);
|
size_t len = strnlen (s, n);
|
||||||
char *new = malloc (len + 1);
|
char *new = xmalloc (len + 1);
|
||||||
|
|
||||||
if (new == NULL)
|
if (new == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -57,6 +49,3 @@ __strndup (const char *s, size_t n)
|
|||||||
new[len] = '\0';
|
new[len] = '\0';
|
||||||
return (char *) memcpy (new, s, len);
|
return (char *) memcpy (new, s, len);
|
||||||
}
|
}
|
||||||
#ifdef weak_alias
|
|
||||||
weak_alias (__strndup, strndup)
|
|
||||||
#endif
|
|
||||||
@@ -1 +1,14 @@
|
|||||||
Makefile
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
|
||||||
|
# From Gettext
|
||||||
|
codeset.m4
|
||||||
|
gettext.m4
|
||||||
|
glibc21.m4
|
||||||
|
iconv.m4
|
||||||
|
isc-posix.m4
|
||||||
|
lcmessage.m4
|
||||||
|
lib-ld.m4
|
||||||
|
lib-link.m4
|
||||||
|
lib-prefix.m4
|
||||||
|
progtest.m4
|
||||||
|
|||||||
+2
-1
@@ -1,5 +1,5 @@
|
|||||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = lib-ld.m4 lib-link.m4 lib-prefix.m4 \
|
||||||
c-bs-a.m4 \
|
c-bs-a.m4 \
|
||||||
codeset.m4 \
|
codeset.m4 \
|
||||||
dmalloc.m4 \
|
dmalloc.m4 \
|
||||||
@@ -13,6 +13,7 @@ m4.m4 \
|
|||||||
malloc.m4 \
|
malloc.m4 \
|
||||||
mbrtowc.m4 \
|
mbrtowc.m4 \
|
||||||
mbstate_t.m4 \
|
mbstate_t.m4 \
|
||||||
|
mkstemp.m4 \
|
||||||
prereq.m4 \
|
prereq.m4 \
|
||||||
progtest.m4 \
|
progtest.m4 \
|
||||||
realloc.m4 \
|
realloc.m4 \
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
#serial 3
|
#serial 4
|
||||||
|
|
||||||
dnl From Paul Eggert.
|
dnl From Paul Eggert.
|
||||||
|
|
||||||
AC_DEFUN(AC_C_BACKSLASH_A,
|
AC_DEFUN([AC_C_BACKSLASH_A],
|
||||||
[
|
[
|
||||||
AC_CACHE_CHECK([whether backslash-a works in strings], ac_cv_c_backslash_a,
|
AC_CACHE_CHECK([whether backslash-a works in strings], ac_cv_c_backslash_a,
|
||||||
[AC_TRY_COMPILE([],
|
[AC_TRY_COMPILE([],
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
#serial AM1
|
|
||||||
|
|
||||||
dnl From Bruno Haible.
|
|
||||||
|
|
||||||
AC_DEFUN([AM_LANGINFO_CODESET],
|
|
||||||
[
|
|
||||||
AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
|
|
||||||
[AC_TRY_LINK([#include <langinfo.h>],
|
|
||||||
[char* cs = nl_langinfo(CODESET);],
|
|
||||||
am_cv_langinfo_codeset=yes,
|
|
||||||
am_cv_langinfo_codeset=no)
|
|
||||||
])
|
|
||||||
if test $am_cv_langinfo_codeset = yes; then
|
|
||||||
AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
|
|
||||||
[Define if you have <langinfo.h> and nl_langinfo(CODESET).])
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
+5
-4
@@ -1,12 +1,13 @@
|
|||||||
#serial 1
|
#serial 4
|
||||||
|
|
||||||
dnl FIXME: put these prerequisite-only *.m4 files in a separate
|
dnl FIXME: put these prerequisite-only *.m4 files in a separate
|
||||||
dnl directory -- otherwise, they'll conflict with existing files.
|
dnl directory -- otherwise, they'll conflict with existing files.
|
||||||
|
|
||||||
dnl These are the prerequisite macros for GNU's error.c file.
|
dnl These are the prerequisite macros for GNU's error.c file.
|
||||||
AC_DEFUN(jm_PREREQ_ERROR,
|
AC_DEFUN([jm_PREREQ_ERROR],
|
||||||
[
|
[
|
||||||
AC_CHECK_FUNCS(strerror strerror_r vprintf doprnt)
|
AC_CHECK_FUNCS(strerror vprintf doprnt)
|
||||||
AC_HEADER_STDC
|
AC_CHECK_DECLS([strerror])
|
||||||
AC_FUNC_STRERROR_R
|
AC_FUNC_STRERROR_R
|
||||||
|
AC_HEADER_STDC
|
||||||
])
|
])
|
||||||
|
|||||||
-368
@@ -1,368 +0,0 @@
|
|||||||
# Macro to add for using GNU gettext.
|
|
||||||
# Ulrich Drepper <[email protected]>, 1995.
|
|
||||||
#
|
|
||||||
# This file can be copied and used freely without restrictions. It can
|
|
||||||
# be used in projects which are not available under the GNU General Public
|
|
||||||
# License but which still want to provide support for the GNU gettext
|
|
||||||
# functionality.
|
|
||||||
# Please note that the actual code of GNU gettext is covered by the GNU
|
|
||||||
# General Public License and is *not* in the public domain.
|
|
||||||
|
|
||||||
# serial 10
|
|
||||||
|
|
||||||
dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]).
|
|
||||||
dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
|
|
||||||
dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
|
|
||||||
dnl depending on --{enable,disable}-{shared,static} and on the presence of
|
|
||||||
dnl AM-DISABLE-SHARED). Otherwise, a static library
|
|
||||||
dnl $(top_builddir)/intl/libintl.a will be created.
|
|
||||||
dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
|
|
||||||
dnl implementations (in libc or libintl) without the ngettext() function
|
|
||||||
dnl will be ignored.
|
|
||||||
dnl LIBDIR is used to find the intl libraries. If empty,
|
|
||||||
dnl the value `$(top_builddir)/intl/' is used.
|
|
||||||
dnl
|
|
||||||
dnl The result of the configuration is one of three cases:
|
|
||||||
dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
|
|
||||||
dnl and used.
|
|
||||||
dnl Catalog format: GNU --> install in $(datadir)
|
|
||||||
dnl Catalog extension: .mo after installation, .gmo in source tree
|
|
||||||
dnl 2) GNU gettext has been found in the system's C library.
|
|
||||||
dnl Catalog format: GNU --> install in $(datadir)
|
|
||||||
dnl Catalog extension: .mo after installation, .gmo in source tree
|
|
||||||
dnl 3) No internationalization, always use English msgid.
|
|
||||||
dnl Catalog format: none
|
|
||||||
dnl Catalog extension: none
|
|
||||||
dnl The use of .gmo is historical (it was needed to avoid overwriting the
|
|
||||||
dnl GNU format catalogs when building on a platform with an X/Open gettext),
|
|
||||||
dnl but we keep it in order not to force irrelevant filename changes on the
|
|
||||||
dnl maintainers.
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([AM_WITH_NLS],
|
|
||||||
[AC_MSG_CHECKING([whether NLS is requested])
|
|
||||||
dnl Default is enabled NLS
|
|
||||||
AC_ARG_ENABLE(nls,
|
|
||||||
[ --disable-nls do not use Native Language Support],
|
|
||||||
USE_NLS=$enableval, USE_NLS=yes)
|
|
||||||
AC_MSG_RESULT($USE_NLS)
|
|
||||||
AC_SUBST(USE_NLS)
|
|
||||||
|
|
||||||
BUILD_INCLUDED_LIBINTL=no
|
|
||||||
USE_INCLUDED_LIBINTL=no
|
|
||||||
INTLLIBS=
|
|
||||||
|
|
||||||
dnl If we use NLS figure out what method
|
|
||||||
if test "$USE_NLS" = "yes"; then
|
|
||||||
AC_DEFINE(ENABLE_NLS, 1,
|
|
||||||
[Define to 1 if translation of program messages to the user's native language
|
|
||||||
is requested.])
|
|
||||||
AC_MSG_CHECKING([whether included gettext is requested])
|
|
||||||
AC_ARG_WITH(included-gettext,
|
|
||||||
[ --with-included-gettext use the GNU gettext library included here],
|
|
||||||
nls_cv_force_use_gnu_gettext=$withval,
|
|
||||||
nls_cv_force_use_gnu_gettext=no)
|
|
||||||
AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
|
|
||||||
|
|
||||||
nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
|
|
||||||
if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
|
|
||||||
dnl User does not insist on using GNU NLS library. Figure out what
|
|
||||||
dnl to use. If GNU gettext is available we use this. Else we have
|
|
||||||
dnl to fall back to GNU NLS library.
|
|
||||||
CATOBJEXT=NONE
|
|
||||||
|
|
||||||
dnl Add a version number to the cache macros.
|
|
||||||
define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])
|
|
||||||
define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])
|
|
||||||
|
|
||||||
AC_CHECK_HEADER(libintl.h,
|
|
||||||
[AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
|
|
||||||
[AC_TRY_LINK([#include <libintl.h>
|
|
||||||
extern int _nl_msg_cat_cntr;],
|
|
||||||
[bindtextdomain ("", "");
|
|
||||||
return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
|
|
||||||
gt_cv_func_gnugettext_libc=yes,
|
|
||||||
gt_cv_func_gnugettext_libc=no)])
|
|
||||||
|
|
||||||
if test "$gt_cv_func_gnugettext_libc" != "yes"; then
|
|
||||||
AC_CACHE_CHECK([for GNU gettext in libintl],
|
|
||||||
gt_cv_func_gnugettext_libintl,
|
|
||||||
[gt_save_LIBS="$LIBS"
|
|
||||||
LIBS="$LIBS -lintl $LIBICONV"
|
|
||||||
AC_TRY_LINK([#include <libintl.h>
|
|
||||||
extern int _nl_msg_cat_cntr;],
|
|
||||||
[bindtextdomain ("", "");
|
|
||||||
return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
|
|
||||||
gt_cv_func_gnugettext_libintl=yes,
|
|
||||||
gt_cv_func_gnugettext_libintl=no)
|
|
||||||
LIBS="$gt_save_LIBS"])
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl If an already present or preinstalled GNU gettext() is found,
|
|
||||||
dnl use it. But if this macro is used in GNU gettext, and GNU
|
|
||||||
dnl gettext is already preinstalled in libintl, we update this
|
|
||||||
dnl libintl. (Cf. the install rule in intl/Makefile.in.)
|
|
||||||
if test "$gt_cv_func_gnugettext_libc" = "yes" \
|
|
||||||
|| { test "$gt_cv_func_gnugettext_libintl" = "yes" \
|
|
||||||
&& test "$PACKAGE" != gettext; }; then
|
|
||||||
AC_DEFINE(HAVE_GETTEXT, 1,
|
|
||||||
[Define if the GNU gettext() function is already present or preinstalled.])
|
|
||||||
|
|
||||||
if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
|
|
||||||
dnl If iconv() is in a separate libiconv library, then anyone
|
|
||||||
dnl linking with libintl{.a,.so} also needs to link with
|
|
||||||
dnl libiconv.
|
|
||||||
INTLLIBS="-lintl $LIBICONV"
|
|
||||||
fi
|
|
||||||
|
|
||||||
gt_save_LIBS="$LIBS"
|
|
||||||
LIBS="$LIBS $INTLLIBS"
|
|
||||||
AC_CHECK_FUNCS(dcgettext)
|
|
||||||
LIBS="$gt_save_LIBS"
|
|
||||||
|
|
||||||
dnl Search for GNU msgfmt in the PATH.
|
|
||||||
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
|
||||||
[$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
|
|
||||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
|
||||||
|
|
||||||
dnl Search for GNU xgettext in the PATH.
|
|
||||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
|
||||||
[$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
|
|
||||||
|
|
||||||
CATOBJEXT=.gmo
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
|
|
||||||
if test "$CATOBJEXT" = "NONE"; then
|
|
||||||
dnl GNU gettext is not found in the C library.
|
|
||||||
dnl Fall back on GNU gettext library.
|
|
||||||
nls_cv_use_gnu_gettext=yes
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "$nls_cv_use_gnu_gettext" = "yes"; then
|
|
||||||
dnl Mark actions used to generate GNU NLS library.
|
|
||||||
INTLOBJS="\$(GETTOBJS)"
|
|
||||||
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
|
||||||
[$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
|
|
||||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
|
||||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
|
||||||
[$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
|
|
||||||
AC_SUBST(MSGFMT)
|
|
||||||
BUILD_INCLUDED_LIBINTL=yes
|
|
||||||
USE_INCLUDED_LIBINTL=yes
|
|
||||||
CATOBJEXT=.gmo
|
|
||||||
INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
|
|
||||||
LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
|
|
||||||
dnl Test whether we really found GNU msgfmt.
|
|
||||||
if test "$GMSGFMT" != ":"; then
|
|
||||||
dnl If it is no GNU msgfmt we define it as : so that the
|
|
||||||
dnl Makefiles still can work.
|
|
||||||
if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then
|
|
||||||
: ;
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT(
|
|
||||||
[found msgfmt program is not GNU msgfmt; ignore it])
|
|
||||||
GMSGFMT=":"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
|
|
||||||
dnl Test whether we really found GNU xgettext.
|
|
||||||
if test "$XGETTEXT" != ":"; then
|
|
||||||
dnl If it is no GNU xgettext we define it as : so that the
|
|
||||||
dnl Makefiles still can work.
|
|
||||||
if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then
|
|
||||||
: ;
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT(
|
|
||||||
[found xgettext program is not GNU xgettext; ignore it])
|
|
||||||
XGETTEXT=":"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl We need to process the po/ directory.
|
|
||||||
POSUB=po
|
|
||||||
fi
|
|
||||||
AC_OUTPUT_COMMANDS(
|
|
||||||
[for ac_file in $CONFIG_FILES; do
|
|
||||||
# Support "outfile[:infile[:infile...]]"
|
|
||||||
case "$ac_file" in
|
|
||||||
*:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
|
|
||||||
esac
|
|
||||||
# PO directories have a Makefile.in generated from Makefile.in.in.
|
|
||||||
case "$ac_file" in */Makefile.in)
|
|
||||||
# Adjust a relative srcdir.
|
|
||||||
ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
|
|
||||||
ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
|
|
||||||
ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
|
|
||||||
# In autoconf-2.13 it is called $ac_given_srcdir.
|
|
||||||
# In autoconf-2.50 it is called $srcdir.
|
|
||||||
test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
|
|
||||||
case "$ac_given_srcdir" in
|
|
||||||
.) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
|
|
||||||
/*) top_srcdir="$ac_given_srcdir" ;;
|
|
||||||
*) top_srcdir="$ac_dots$ac_given_srcdir" ;;
|
|
||||||
esac
|
|
||||||
if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
|
|
||||||
rm -f "$ac_dir/POTFILES"
|
|
||||||
test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
|
|
||||||
sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
|
|
||||||
test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
|
|
||||||
sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done])
|
|
||||||
|
|
||||||
|
|
||||||
dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
|
|
||||||
dnl to 'yes' because some of the testsuite requires it.
|
|
||||||
if test "$PACKAGE" = gettext; then
|
|
||||||
BUILD_INCLUDED_LIBINTL=yes
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl intl/plural.c is generated from intl/plural.y. It requires bison,
|
|
||||||
dnl because plural.y uses bison specific features. It requires at least
|
|
||||||
dnl bison-1.26 because earlier versions generate a plural.c that doesn't
|
|
||||||
dnl compile.
|
|
||||||
dnl bison is only needed for the maintainer (who touches plural.y). But in
|
|
||||||
dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
|
|
||||||
dnl the rule in general Makefile. Now, some people carelessly touch the
|
|
||||||
dnl files or have a broken "make" program, hence the plural.c rule will
|
|
||||||
dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
|
|
||||||
dnl present or too old.
|
|
||||||
AC_CHECK_PROGS([INTLBISON], [bison])
|
|
||||||
if test -z "$INTLBISON"; then
|
|
||||||
ac_verc_fail=yes
|
|
||||||
else
|
|
||||||
dnl Found it, now check the version.
|
|
||||||
AC_MSG_CHECKING([version of bison])
|
|
||||||
changequote(<<,>>)dnl
|
|
||||||
ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison .* \([0-9]*\.[0-9.]*\).*$/\1/p'`
|
|
||||||
case $ac_prog_version in
|
|
||||||
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
|
|
||||||
1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
|
|
||||||
changequote([,])dnl
|
|
||||||
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
|
|
||||||
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
|
|
||||||
esac
|
|
||||||
AC_MSG_RESULT([$ac_prog_version])
|
|
||||||
fi
|
|
||||||
if test $ac_verc_fail = yes; then
|
|
||||||
INTLBISON=:
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl These rules are solely for the distribution goal. While doing this
|
|
||||||
dnl we only have to keep exactly one list of the available catalogs
|
|
||||||
dnl in configure.in.
|
|
||||||
for lang in $ALL_LINGUAS; do
|
|
||||||
GMOFILES="$GMOFILES $lang.gmo"
|
|
||||||
POFILES="$POFILES $lang.po"
|
|
||||||
done
|
|
||||||
|
|
||||||
dnl Make all variables we use known to autoconf.
|
|
||||||
AC_SUBST(BUILD_INCLUDED_LIBINTL)
|
|
||||||
AC_SUBST(USE_INCLUDED_LIBINTL)
|
|
||||||
AC_SUBST(CATALOGS)
|
|
||||||
AC_SUBST(CATOBJEXT)
|
|
||||||
AC_SUBST(GMOFILES)
|
|
||||||
AC_SUBST(INTLLIBS)
|
|
||||||
AC_SUBST(INTLOBJS)
|
|
||||||
AC_SUBST(POFILES)
|
|
||||||
AC_SUBST(POSUB)
|
|
||||||
|
|
||||||
dnl For backward compatibility. Some configure.ins may be using this.
|
|
||||||
nls_cv_header_intl=
|
|
||||||
nls_cv_header_libgt=
|
|
||||||
|
|
||||||
dnl For backward compatibility. Some Makefiles may be using this.
|
|
||||||
DATADIRNAME=share
|
|
||||||
AC_SUBST(DATADIRNAME)
|
|
||||||
|
|
||||||
dnl For backward compatibility. Some Makefiles may be using this.
|
|
||||||
INSTOBJEXT=.mo
|
|
||||||
AC_SUBST(INSTOBJEXT)
|
|
||||||
|
|
||||||
dnl For backward compatibility. Some Makefiles may be using this.
|
|
||||||
GENCAT=gencat
|
|
||||||
AC_SUBST(GENCAT)
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl Usage: Just like AM_WITH_NLS, which see.
|
|
||||||
AC_DEFUN([AM_GNU_GETTEXT],
|
|
||||||
[AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
|
||||||
AC_REQUIRE([AC_PROG_CC])dnl
|
|
||||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
|
||||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
|
||||||
AC_REQUIRE([AC_ISC_POSIX])dnl
|
|
||||||
AC_REQUIRE([AC_HEADER_STDC])dnl
|
|
||||||
AC_REQUIRE([AC_C_CONST])dnl
|
|
||||||
AC_REQUIRE([AC_C_INLINE])dnl
|
|
||||||
AC_REQUIRE([AC_TYPE_OFF_T])dnl
|
|
||||||
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
|
|
||||||
AC_REQUIRE([AC_FUNC_ALLOCA])dnl
|
|
||||||
AC_REQUIRE([AC_FUNC_MMAP])dnl
|
|
||||||
AC_REQUIRE([jm_GLIBC21])dnl
|
|
||||||
|
|
||||||
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
|
|
||||||
stdlib.h string.h unistd.h sys/param.h])
|
|
||||||
AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
|
|
||||||
getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
|
|
||||||
strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
|
|
||||||
|
|
||||||
AM_ICONV
|
|
||||||
AM_LANGINFO_CODESET
|
|
||||||
AM_LC_MESSAGES
|
|
||||||
AM_WITH_NLS([$1],[$2],[$3])
|
|
||||||
|
|
||||||
if test "x$CATOBJEXT" != "x"; then
|
|
||||||
if test "x$ALL_LINGUAS" = "x"; then
|
|
||||||
LINGUAS=
|
|
||||||
else
|
|
||||||
AC_MSG_CHECKING(for catalogs to be installed)
|
|
||||||
NEW_LINGUAS=
|
|
||||||
for presentlang in $ALL_LINGUAS; do
|
|
||||||
useit=no
|
|
||||||
for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do
|
|
||||||
# Use the presentlang catalog if desiredlang is
|
|
||||||
# a. equal to presentlang, or
|
|
||||||
# b. a variant of presentlang (because in this case,
|
|
||||||
# presentlang can be used as a fallback for messages
|
|
||||||
# which are not translated in the desiredlang catalog).
|
|
||||||
case "$desiredlang" in
|
|
||||||
"$presentlang"*) useit=yes;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
if test $useit = yes; then
|
|
||||||
NEW_LINGUAS="$NEW_LINGUAS $presentlang"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
LINGUAS=$NEW_LINGUAS
|
|
||||||
AC_MSG_RESULT($LINGUAS)
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl Construct list of names of catalog files to be constructed.
|
|
||||||
if test -n "$LINGUAS"; then
|
|
||||||
for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
|
|
||||||
dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
|
|
||||||
dnl Try to locate is.
|
|
||||||
MKINSTALLDIRS=
|
|
||||||
if test -n "$ac_aux_dir"; then
|
|
||||||
MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
|
|
||||||
fi
|
|
||||||
if test -z "$MKINSTALLDIRS"; then
|
|
||||||
MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
|
|
||||||
fi
|
|
||||||
AC_SUBST(MKINSTALLDIRS)
|
|
||||||
|
|
||||||
dnl Enable libtool support if the surrounding package wishes it.
|
|
||||||
INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
|
|
||||||
AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
|
|
||||||
])
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
#serial 2
|
|
||||||
|
|
||||||
# Test for the GNU C Library, version 2.1 or newer.
|
|
||||||
# From Bruno Haible.
|
|
||||||
|
|
||||||
AC_DEFUN([jm_GLIBC21],
|
|
||||||
[
|
|
||||||
AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
|
|
||||||
ac_cv_gnu_library_2_1,
|
|
||||||
[AC_EGREP_CPP([Lucky GNU user],
|
|
||||||
[
|
|
||||||
#include <features.h>
|
|
||||||
#ifdef __GNU_LIBRARY__
|
|
||||||
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
|
|
||||||
Lucky GNU user
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
],
|
|
||||||
ac_cv_gnu_library_2_1=yes,
|
|
||||||
ac_cv_gnu_library_2_1=no)
|
|
||||||
]
|
|
||||||
)
|
|
||||||
AC_SUBST(GLIBC21)
|
|
||||||
GLIBC21="$ac_cv_gnu_library_2_1"
|
|
||||||
]
|
|
||||||
)
|
|
||||||
-69
@@ -1,69 +0,0 @@
|
|||||||
#serial AM2
|
|
||||||
|
|
||||||
dnl From Bruno Haible.
|
|
||||||
|
|
||||||
AC_DEFUN([AM_ICONV],
|
|
||||||
[
|
|
||||||
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
|
|
||||||
dnl those with the standalone portable GNU libiconv installed).
|
|
||||||
|
|
||||||
AC_ARG_WITH([libiconv-prefix],
|
|
||||||
[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
|
|
||||||
for dir in `echo "$withval" | tr : ' '`; do
|
|
||||||
if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
|
|
||||||
if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
|
|
||||||
done
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
|
|
||||||
am_cv_func_iconv="no, consider installing GNU libiconv"
|
|
||||||
am_cv_lib_iconv=no
|
|
||||||
AC_TRY_LINK([#include <stdlib.h>
|
|
||||||
#include <iconv.h>],
|
|
||||||
[iconv_t cd = iconv_open("","");
|
|
||||||
iconv(cd,NULL,NULL,NULL,NULL);
|
|
||||||
iconv_close(cd);],
|
|
||||||
am_cv_func_iconv=yes)
|
|
||||||
if test "$am_cv_func_iconv" != yes; then
|
|
||||||
am_save_LIBS="$LIBS"
|
|
||||||
LIBS="$LIBS -liconv"
|
|
||||||
AC_TRY_LINK([#include <stdlib.h>
|
|
||||||
#include <iconv.h>],
|
|
||||||
[iconv_t cd = iconv_open("","");
|
|
||||||
iconv(cd,NULL,NULL,NULL,NULL);
|
|
||||||
iconv_close(cd);],
|
|
||||||
am_cv_lib_iconv=yes
|
|
||||||
am_cv_func_iconv=yes)
|
|
||||||
LIBS="$am_save_LIBS"
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
if test "$am_cv_func_iconv" = yes; then
|
|
||||||
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
|
|
||||||
AC_MSG_CHECKING([for iconv declaration])
|
|
||||||
AC_CACHE_VAL(am_cv_proto_iconv, [
|
|
||||||
AC_TRY_COMPILE([
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <iconv.h>
|
|
||||||
extern
|
|
||||||
#ifdef __cplusplus
|
|
||||||
"C"
|
|
||||||
#endif
|
|
||||||
#if defined(__STDC__) || defined(__cplusplus)
|
|
||||||
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
|
|
||||||
#else
|
|
||||||
size_t iconv();
|
|
||||||
#endif
|
|
||||||
], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
|
|
||||||
am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
|
|
||||||
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
|
|
||||||
AC_MSG_RESULT([$]{ac_t:-
|
|
||||||
}[$]am_cv_proto_iconv)
|
|
||||||
AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
|
|
||||||
[Define as const if the declaration of iconv() needs const.])
|
|
||||||
fi
|
|
||||||
LIBICONV=
|
|
||||||
if test "$am_cv_lib_iconv" = yes; then
|
|
||||||
LIBICONV="-liconv"
|
|
||||||
fi
|
|
||||||
AC_SUBST(LIBICONV)
|
|
||||||
])
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#serial 1
|
|
||||||
# This test replaces the one in autoconf.
|
|
||||||
# Currently this macro should have the same name as the autoconf macro
|
|
||||||
# because gettext's gettext.m4 (distributed in the automake package)
|
|
||||||
# still uses it. Otherwise, the use in gettext.m4 makes autoheader
|
|
||||||
# give these diagnostics:
|
|
||||||
# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
|
|
||||||
# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
|
|
||||||
|
|
||||||
undefine([AC_ISC_POSIX])
|
|
||||||
|
|
||||||
AC_DEFUN([AC_ISC_POSIX],
|
|
||||||
[
|
|
||||||
dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
|
|
||||||
AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
|
|
||||||
]
|
|
||||||
)
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
# Check whether LC_MESSAGES is available in <locale.h>.
|
|
||||||
# Ulrich Drepper <[email protected]>, 1995.
|
|
||||||
#
|
|
||||||
# This file can be copied and used freely without restrictions. It can
|
|
||||||
# be used in projects which are not available under the GNU General Public
|
|
||||||
# License but which still want to provide support for the GNU gettext
|
|
||||||
# functionality.
|
|
||||||
# Please note that the actual code of GNU gettext is covered by the GNU
|
|
||||||
# General Public License and is *not* in the public domain.
|
|
||||||
|
|
||||||
# serial 2
|
|
||||||
|
|
||||||
AC_DEFUN([AM_LC_MESSAGES],
|
|
||||||
[if test $ac_cv_header_locale_h = yes; then
|
|
||||||
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
|
|
||||||
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
|
|
||||||
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
|
|
||||||
if test $am_cv_val_LC_MESSAGES = yes; then
|
|
||||||
AC_DEFINE(HAVE_LC_MESSAGES, 1,
|
|
||||||
[Define if your <locale.h> file defines LC_MESSAGES.])
|
|
||||||
fi
|
|
||||||
fi])
|
|
||||||
@@ -1,16 +1,29 @@
|
|||||||
# serial 1 -*- Autoconf -*-
|
# Copyright 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.
|
||||||
|
|
||||||
# BISON_AC_PROG_GNU_M4
|
# BISON_PROG_GNU_M4
|
||||||
# --------------------
|
# -----------------
|
||||||
# Check for GNU m4, at least 1.3 (supports frozen files).
|
# Check for GNU m4, at least 1.3 (supports frozen files).
|
||||||
AC_DEFUN([BISON_AC_PROG_GNU_M4],
|
AC_DEFUN([BISON_PROG_GNU_M4],
|
||||||
[AC_PATH_PROGS(M4, gm4 gnum4 m4, m4)
|
[AC_PATH_PROGS(M4, gm4 gnum4 m4, m4)
|
||||||
AC_CACHE_CHECK([whether m4 supports frozen files],
|
AC_CACHE_CHECK(whether m4 supports frozen files, ac_cv_prog_gnu_m4,
|
||||||
[ac_cv_prog_gnu_m4],
|
|
||||||
[ac_cv_prog_gnu_m4=no
|
[ac_cv_prog_gnu_m4=no
|
||||||
if test x"$M4" != x; then
|
if test x"$M4" != x; then
|
||||||
case `$M4 --help < /dev/null 2>&1` in
|
case `$M4 --help < /dev/null 2>&1` in
|
||||||
*reload-state*) ac_cv_prog_gnu_m4=yes ;;
|
*reload-state*) ac_cv_prog_gnu_m4=yes ;;
|
||||||
esac
|
esac
|
||||||
fi])
|
fi])])
|
||||||
])# BISON_AC_PROG_GNU_M4
|
|
||||||
|
|||||||
+6
-7
@@ -1,16 +1,16 @@
|
|||||||
#serial 3
|
#serial 5
|
||||||
|
|
||||||
dnl From Jim Meyering.
|
dnl From Jim Meyering.
|
||||||
dnl Determine whether malloc accepts 0 as its argument.
|
dnl Determine whether malloc accepts 0 as its argument.
|
||||||
dnl If it doesn't, arrange to use the replacement function.
|
dnl If it doesn't, arrange to use the replacement function.
|
||||||
dnl
|
dnl
|
||||||
|
|
||||||
AC_DEFUN(jm_FUNC_MALLOC,
|
AC_DEFUN([jm_FUNC_MALLOC],
|
||||||
[
|
[
|
||||||
dnl xmalloc.c requires that this symbol be defined so it doesn't
|
dnl xmalloc.c requires that this symbol be defined so it doesn't
|
||||||
dnl mistakenly use a broken malloc -- as it might if this test were omitted.
|
dnl mistakenly use a broken malloc -- as it might if this test were omitted.
|
||||||
AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_MALLOC_CHECK, 1,
|
AC_DEFINE(HAVE_DONE_WORKING_MALLOC_CHECK, 1,
|
||||||
[Define if the malloc check has been performed. ])
|
[Define if the malloc check has been performed. ])
|
||||||
|
|
||||||
AC_CACHE_CHECK([for working malloc], jm_cv_func_working_malloc,
|
AC_CACHE_CHECK([for working malloc], jm_cv_func_working_malloc,
|
||||||
[AC_TRY_RUN([
|
[AC_TRY_RUN([
|
||||||
@@ -27,9 +27,8 @@ AC_DEFUN(jm_FUNC_MALLOC,
|
|||||||
jm_cv_func_working_malloc=no)
|
jm_cv_func_working_malloc=no)
|
||||||
])
|
])
|
||||||
if test $jm_cv_func_working_malloc = no; then
|
if test $jm_cv_func_working_malloc = no; then
|
||||||
AC_SUBST(LIBOBJS)
|
AC_LIBOBJ(malloc)
|
||||||
LIBOBJS="$LIBOBJS malloc.$ac_objext"
|
AC_DEFINE(malloc, rpl_malloc,
|
||||||
AC_DEFINE_UNQUOTED(malloc, rpl_malloc,
|
|
||||||
[Define to rpl_malloc if the replacement function should be used.])
|
[Define to rpl_malloc if the replacement function should be used.])
|
||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
# serial 8
|
# serial 9
|
||||||
|
|
||||||
# From Paul Eggert.
|
# From Paul Eggert.
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
# (at least glibc-2.1.3) because the "_XOPEN_SOURCE 500" definition elicits
|
# (at least glibc-2.1.3) because the "_XOPEN_SOURCE 500" definition elicits
|
||||||
# a syntax error in wchar.h due to the use of undefined __int32_t.
|
# a syntax error in wchar.h due to the use of undefined __int32_t.
|
||||||
|
|
||||||
AC_DEFUN(AC_MBSTATE_T,
|
AC_DEFUN([AC_MBSTATE_T],
|
||||||
[
|
[
|
||||||
AC_CHECK_HEADERS(stdlib.h)
|
AC_CHECK_HEADERS(stdlib.h)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
#serial 1
|
||||||
|
|
||||||
|
# On some systems (e.g., HPUX-10.20, SunOS4.1.4, solaris2.5.1), mkstemp has the
|
||||||
|
# silly limit that it can create no more than 26 files from a given template.
|
||||||
|
# Other systems lack mkstemp altogether. On either type of system, arrange
|
||||||
|
# to use the replacement function.
|
||||||
|
AC_DEFUN([UTILS_FUNC_MKSTEMP],
|
||||||
|
[dnl
|
||||||
|
AC_REPLACE_FUNCS(mkstemp)
|
||||||
|
if test $ac_cv_func_mkstemp = no; then
|
||||||
|
utils_cv_func_mkstemp_limitations=yes
|
||||||
|
else
|
||||||
|
AC_CACHE_CHECK([for mkstemp limitations],
|
||||||
|
utils_cv_func_mkstemp_limitations,
|
||||||
|
[
|
||||||
|
AC_TRY_RUN([
|
||||||
|
# include <stdlib.h>
|
||||||
|
int main ()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < 30; i++)
|
||||||
|
{
|
||||||
|
char template[] = "conftestXXXXXX";
|
||||||
|
int fd = mkstemp (template);
|
||||||
|
if (fd == -1)
|
||||||
|
exit (1);
|
||||||
|
close (fd);
|
||||||
|
}
|
||||||
|
exit (0);
|
||||||
|
}
|
||||||
|
],
|
||||||
|
utils_cv_func_mkstemp_limitations=no,
|
||||||
|
utils_cv_func_mkstemp_limitations=yes,
|
||||||
|
utils_cv_func_mkstemp_limitations=yes
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test $utils_cv_func_mkstemp_limitations = yes; then
|
||||||
|
AC_LIBOBJ(mkstemp)
|
||||||
|
AC_LIBOBJ(tempname)
|
||||||
|
AC_DEFINE(mkstemp, rpl_mkstemp,
|
||||||
|
[Define to rpl_mkstemp if the replacement function should be used.])
|
||||||
|
fi
|
||||||
|
])
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
# Search path for a program which passes the given test.
|
|
||||||
# Ulrich Drepper <[email protected]>, 1996.
|
|
||||||
#
|
|
||||||
# This file can be copied and used freely without restrictions. It can
|
|
||||||
# be used in projects which are not available under the GNU General Public
|
|
||||||
# License but which still want to provide support for the GNU gettext
|
|
||||||
# functionality.
|
|
||||||
# Please note that the actual code of GNU gettext is covered by the GNU
|
|
||||||
# General Public License and is *not* in the public domain.
|
|
||||||
|
|
||||||
# serial 2
|
|
||||||
|
|
||||||
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
|
|
||||||
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
|
|
||||||
AC_DEFUN([AM_PATH_PROG_WITH_TEST],
|
|
||||||
[# Extract the first word of "$2", so it can be a program name with args.
|
|
||||||
set dummy $2; ac_word=[$]2
|
|
||||||
AC_MSG_CHECKING([for $ac_word])
|
|
||||||
AC_CACHE_VAL(ac_cv_path_$1,
|
|
||||||
[case "[$]$1" in
|
|
||||||
/*)
|
|
||||||
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
|
||||||
for ac_dir in ifelse([$5], , $PATH, [$5]); do
|
|
||||||
test -z "$ac_dir" && ac_dir=.
|
|
||||||
if test -f $ac_dir/$ac_word; then
|
|
||||||
if [$3]; then
|
|
||||||
ac_cv_path_$1="$ac_dir/$ac_word"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
IFS="$ac_save_ifs"
|
|
||||||
dnl If no 4th arg is given, leave the cache variable unset,
|
|
||||||
dnl so AC_PATH_PROGS will keep looking.
|
|
||||||
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
|
|
||||||
])dnl
|
|
||||||
;;
|
|
||||||
esac])dnl
|
|
||||||
$1="$ac_cv_path_$1"
|
|
||||||
if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
|
|
||||||
AC_MSG_RESULT([$]$1)
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
fi
|
|
||||||
AC_SUBST($1)dnl
|
|
||||||
])
|
|
||||||
+6
-7
@@ -1,16 +1,16 @@
|
|||||||
#serial 3
|
#serial 5
|
||||||
|
|
||||||
dnl From Jim Meyering.
|
dnl From Jim Meyering.
|
||||||
dnl Determine whether realloc works when both arguments are 0.
|
dnl Determine whether realloc works when both arguments are 0.
|
||||||
dnl If it doesn't, arrange to use the replacement function.
|
dnl If it doesn't, arrange to use the replacement function.
|
||||||
dnl
|
dnl
|
||||||
|
|
||||||
AC_DEFUN(jm_FUNC_REALLOC,
|
AC_DEFUN([jm_FUNC_REALLOC],
|
||||||
[
|
[
|
||||||
dnl xmalloc.c requires that this symbol be defined so it doesn't
|
dnl xmalloc.c requires that this symbol be defined so it doesn't
|
||||||
dnl mistakenly use a broken realloc -- as it might if this test were omitted.
|
dnl mistakenly use a broken realloc -- as it might if this test were omitted.
|
||||||
AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_REALLOC_CHECK, 1,
|
AC_DEFINE(HAVE_DONE_WORKING_REALLOC_CHECK, 1,
|
||||||
[Define if the realloc check has been performed. ])
|
[Define if the realloc check has been performed. ])
|
||||||
|
|
||||||
AC_CACHE_CHECK([for working realloc], jm_cv_func_working_realloc,
|
AC_CACHE_CHECK([for working realloc], jm_cv_func_working_realloc,
|
||||||
[AC_TRY_RUN([
|
[AC_TRY_RUN([
|
||||||
@@ -27,9 +27,8 @@ AC_DEFUN(jm_FUNC_REALLOC,
|
|||||||
jm_cv_func_working_realloc=no)
|
jm_cv_func_working_realloc=no)
|
||||||
])
|
])
|
||||||
if test $jm_cv_func_working_realloc = no; then
|
if test $jm_cv_func_working_realloc = no; then
|
||||||
AC_SUBST(LIBOBJS)
|
AC_LIBOBJ(realloc)
|
||||||
LIBOBJS="$LIBOBJS realloc.$ac_objext"
|
AC_DEFINE(realloc, rpl_realloc,
|
||||||
AC_DEFINE_UNQUOTED(realloc, rpl_realloc,
|
|
||||||
[Define to rpl_realloc if the replacement function should be used.])
|
[Define to rpl_realloc if the replacement function should be used.])
|
||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
|||||||
+38
-45
@@ -1,9 +1,23 @@
|
|||||||
#serial 1002
|
#serial 1003
|
||||||
# Experimental replacement for the function in the latest CVS autoconf.
|
# Experimental replacement for the function in the latest CVS autoconf.
|
||||||
# If the compile-test says strerror_r doesn't work, then resort to a
|
|
||||||
# `run'-test that works on BeOS and segfaults on DEC Unix.
|
|
||||||
# Use with the error.c file in ../lib.
|
# Use with the error.c file in ../lib.
|
||||||
|
|
||||||
|
# Copyright 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. */
|
||||||
|
|
||||||
undefine([AC_FUNC_STRERROR_R])
|
undefine([AC_FUNC_STRERROR_R])
|
||||||
|
|
||||||
# AC_FUNC_STRERROR_R
|
# AC_FUNC_STRERROR_R
|
||||||
@@ -11,56 +25,35 @@ undefine([AC_FUNC_STRERROR_R])
|
|||||||
AC_DEFUN([AC_FUNC_STRERROR_R],
|
AC_DEFUN([AC_FUNC_STRERROR_R],
|
||||||
[AC_CHECK_DECLS([strerror_r])
|
[AC_CHECK_DECLS([strerror_r])
|
||||||
AC_CHECK_FUNCS([strerror_r])
|
AC_CHECK_FUNCS([strerror_r])
|
||||||
if test $ac_cv_func_strerror_r = yes; then
|
AC_CACHE_CHECK([whether strerror_r returns char *],
|
||||||
AC_CHECK_HEADERS(string.h)
|
ac_cv_func_strerror_r_char_p,
|
||||||
AC_CACHE_CHECK([for working strerror_r],
|
|
||||||
ac_cv_func_strerror_r_works,
|
|
||||||
[
|
[
|
||||||
AC_TRY_COMPILE(
|
ac_cv_func_strerror_r_char_p=no
|
||||||
[
|
if test $ac_cv_have_decl_strerror_r = yes; then
|
||||||
# include <stdio.h>
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
|
||||||
# if HAVE_STRING_H
|
[[
|
||||||
# include <string.h>
|
char buf[100];
|
||||||
# endif
|
char x = *strerror_r (0, buf, sizeof buf);
|
||||||
],
|
char *p = strerror_r (0, buf, sizeof buf);
|
||||||
[
|
]])],
|
||||||
char buf[100];
|
ac_cv_func_strerror_r_char_p=yes)
|
||||||
char x = *strerror_r (0, buf, sizeof buf);
|
else
|
||||||
],
|
# strerror_r is not declared. Choose between
|
||||||
ac_cv_func_strerror_r_works=yes,
|
|
||||||
ac_cv_func_strerror_r_works=no
|
|
||||||
)
|
|
||||||
if test $ac_cv_func_strerror_r_works = no; then
|
|
||||||
# strerror_r seems not to work, but now we have to choose between
|
|
||||||
# systems that have relatively inaccessible declarations for the
|
# systems that have relatively inaccessible declarations for the
|
||||||
# function. BeOS and DEC UNIX 4.0 fall in this category, but the
|
# function. BeOS and DEC UNIX 4.0 fall in this category, but the
|
||||||
# former has a strerror_r that returns char*, while the latter
|
# former has a strerror_r that returns char*, while the latter
|
||||||
# has a strerror_r that returns `int'.
|
# has a strerror_r that returns `int'.
|
||||||
# This test should segfault on the DEC system.
|
# This test should segfault on the DEC system.
|
||||||
AC_TRY_RUN(
|
AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
|
||||||
[
|
extern char *strerror_r ();],
|
||||||
# include <stdio.h>
|
[[char buf[100];
|
||||||
# include <string.h>
|
|
||||||
# include <ctype.h>
|
|
||||||
|
|
||||||
extern char *strerror_r ();
|
|
||||||
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
char buf[100];
|
|
||||||
char x = *strerror_r (0, buf, sizeof buf);
|
char x = *strerror_r (0, buf, sizeof buf);
|
||||||
exit (!isalpha (x));
|
exit (!isalpha (x));]])],
|
||||||
}
|
ac_cv_func_strerror_r_char_p=yes, , :)
|
||||||
],
|
|
||||||
ac_cv_func_strerror_r_works=yes,
|
|
||||||
ac_cv_func_strerror_r_works=no,
|
|
||||||
ac_cv_func_strerror_r_works=no)
|
|
||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
if test $ac_cv_func_strerror_r_works = yes; then
|
if test $ac_cv_func_strerror_r_char_p = yes; then
|
||||||
AC_DEFINE_UNQUOTED(HAVE_WORKING_STRERROR_R, 1,
|
AC_DEFINE([STRERROR_R_CHAR_P], 1,
|
||||||
[Define to 1 if `strerror_r' returns a string.])
|
[Define to 1 if strerror_r returns char *.])
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
])# AC_FUNC_STRERROR_R
|
])# AC_FUNC_STRERROR_R
|
||||||
|
|||||||
@@ -5,3 +5,4 @@ POTFILES
|
|||||||
bison.pot
|
bison.pot
|
||||||
stamp-cat-id
|
stamp-cat-id
|
||||||
*.gmo
|
*.gmo
|
||||||
|
Makefile.in
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
2001-10-10 gettextize <[email protected]>
|
||||||
|
|
||||||
|
* Makefile.in.in: Upgrade to gettext-0.10.40.
|
||||||
|
* cat-id-tbl.c: Remove file.
|
||||||
|
|
||||||
|
2001-10-08 gettextize <[email protected]>
|
||||||
|
|
||||||
|
* Makefile.in.in: Upgrade to gettext-0.10.40.
|
||||||
|
|
||||||
2001-10-04 gettextize <[email protected]>
|
2001-10-04 gettextize <[email protected]>
|
||||||
|
|
||||||
* Makefile.in.in: Upgrade to gettext-0.10.40.
|
* Makefile.in.in: Upgrade to gettext-0.10.40.
|
||||||
|
|||||||
+197
-76
@@ -1,18 +1,16 @@
|
|||||||
# Makefile for program source directory in GNU NLS utilities package.
|
# Makefile for PO directory in any package using GNU gettext.
|
||||||
# Copyright (C) 1995-1997, 2000, 2001 by Ulrich Drepper <[email protected]>
|
# Copyright (C) 1995-1997, 2000-2002 by Ulrich Drepper <[email protected]>
|
||||||
#
|
#
|
||||||
# This file file be copied and used freely without restrictions. It can
|
# This file can be copied and used freely without restrictions. It can
|
||||||
# be used in projects which are not available under the GNU General Public License
|
# be used in projects which are not available under the GNU General Public
|
||||||
# but which still want to provide support for the GNU gettext functionality.
|
# License but which still want to provide support for the GNU gettext
|
||||||
# Please note that the actual code is *not* freely available.
|
# functionality.
|
||||||
|
# Please note that the actual code of GNU gettext is covered by the GNU
|
||||||
|
# General Public License and is *not* in the public domain.
|
||||||
|
|
||||||
PACKAGE = @PACKAGE@
|
PACKAGE = @PACKAGE@
|
||||||
VERSION = @VERSION@
|
VERSION = @VERSION@
|
||||||
|
|
||||||
# These two variables depend on the location of this directory.
|
|
||||||
subdir = po
|
|
||||||
top_builddir = ..
|
|
||||||
|
|
||||||
SHELL = /bin/sh
|
SHELL = /bin/sh
|
||||||
@SET_MAKE@
|
@SET_MAKE@
|
||||||
|
|
||||||
@@ -31,45 +29,47 @@ INSTALL_DATA = @INSTALL_DATA@
|
|||||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||||
mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac`
|
mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac`
|
||||||
|
|
||||||
CC = @CC@
|
|
||||||
GMSGFMT = @GMSGFMT@
|
GMSGFMT = @GMSGFMT@
|
||||||
MSGFMT = @MSGFMT@
|
MSGFMT = @MSGFMT@
|
||||||
XGETTEXT = @XGETTEXT@
|
XGETTEXT = @XGETTEXT@
|
||||||
MSGMERGE = msgmerge
|
MSGMERGE = msgmerge
|
||||||
|
MSGMERGE_UPDATE = @MSGMERGE@ --update
|
||||||
DEFS = @DEFS@
|
MSGINIT = msginit
|
||||||
CFLAGS = @CFLAGS@
|
MSGCONV = msgconv
|
||||||
CPPFLAGS = @CPPFLAGS@
|
MSGFILTER = msgfilter
|
||||||
|
|
||||||
INCLUDES = -I.. -I$(top_srcdir)/intl
|
|
||||||
|
|
||||||
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
|
|
||||||
|
|
||||||
POFILES = @POFILES@
|
POFILES = @POFILES@
|
||||||
GMOFILES = @GMOFILES@
|
GMOFILES = @GMOFILES@
|
||||||
DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
|
UPDATEPOFILES = @UPDATEPOFILES@
|
||||||
$(POFILES) $(GMOFILES)
|
DUMMYPOFILES = @DUMMYPOFILES@
|
||||||
|
DISTFILES.common = Makefile.in.in Makevars remove-potcdate.sin \
|
||||||
|
$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
|
||||||
|
DISTFILES = $(DISTFILES.common) POTFILES.in $(DOMAIN).pot \
|
||||||
|
$(POFILES) $(GMOFILES) \
|
||||||
|
$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
|
||||||
|
|
||||||
POTFILES = \
|
POTFILES = \
|
||||||
|
|
||||||
CATALOGS = @CATALOGS@
|
CATALOGS = @CATALOGS@
|
||||||
|
|
||||||
|
# Makevars gets inserted here. (Don't remove this line!)
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
.SUFFIXES: .c .o .po .pox .gmo .mo
|
.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-update
|
||||||
|
|
||||||
.c.o:
|
|
||||||
$(COMPILE) $<
|
|
||||||
|
|
||||||
.po.pox:
|
|
||||||
$(MAKE) $(PACKAGE).pot
|
|
||||||
$(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
|
|
||||||
|
|
||||||
.po.mo:
|
.po.mo:
|
||||||
$(MSGFMT) -o $@ $<
|
@echo "$(MSGFMT) -c -o $@ $<"; \
|
||||||
|
$(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
|
||||||
|
|
||||||
.po.gmo:
|
.po.gmo:
|
||||||
file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
|
@lang=`echo $* | sed -e 's,.*/,,'`; \
|
||||||
&& rm -f $$file && $(GMSGFMT) --statistics -o $$file $<
|
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
|
||||||
|
echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
|
||||||
|
cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
|
||||||
|
|
||||||
|
.sin.sed:
|
||||||
|
sed -e '/^#/d' $< > t-$@
|
||||||
|
mv t-$@ $@
|
||||||
|
|
||||||
|
|
||||||
all: all-@USE_NLS@
|
all: all-@USE_NLS@
|
||||||
@@ -77,17 +77,38 @@ all: all-@USE_NLS@
|
|||||||
all-yes: $(CATALOGS)
|
all-yes: $(CATALOGS)
|
||||||
all-no:
|
all-no:
|
||||||
|
|
||||||
# Note: Target 'all' must not depend on target '$(srcdir)/$(PACKAGE).pot',
|
# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
|
||||||
# otherwise packages like GCC can not be built if only parts of the source
|
# otherwise packages like GCC can not be built if only parts of the source
|
||||||
# have been downloaded.
|
# have been downloaded.
|
||||||
|
|
||||||
$(srcdir)/$(PACKAGE).pot: $(POTFILES) $(srcdir)/POTFILES.in
|
$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
|
||||||
$(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
|
$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
|
||||||
--add-comments --keyword=_ --keyword=N_ \
|
--add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
|
||||||
--files-from=$(srcdir)/POTFILES.in \
|
--files-from=$(srcdir)/POTFILES.in \
|
||||||
&& test ! -f $(PACKAGE).po \
|
--copyright-holder='$(COPYRIGHT_HOLDER)'
|
||||||
|| ( rm -f $(srcdir)/$(PACKAGE).pot \
|
test ! -f $(DOMAIN).po || { \
|
||||||
&& mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot )
|
if test -f $(srcdir)/$(DOMAIN).pot; then \
|
||||||
|
sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
|
||||||
|
sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
|
||||||
|
if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
|
||||||
|
rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
|
||||||
|
else \
|
||||||
|
rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
|
||||||
|
mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
|
||||||
|
fi; \
|
||||||
|
else \
|
||||||
|
mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
|
||||||
|
fi; \
|
||||||
|
}
|
||||||
|
|
||||||
|
$(srcdir)/$(DOMAIN).pot:
|
||||||
|
$(MAKE) $(DOMAIN).pot-update
|
||||||
|
|
||||||
|
$(POFILES): $(srcdir)/$(DOMAIN).pot
|
||||||
|
@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
|
||||||
|
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
|
||||||
|
echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
|
||||||
|
cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot
|
||||||
|
|
||||||
|
|
||||||
install: install-exec install-data
|
install: install-exec install-data
|
||||||
@@ -95,8 +116,10 @@ install-exec:
|
|||||||
install-data: install-data-@USE_NLS@
|
install-data: install-data-@USE_NLS@
|
||||||
if test "$(PACKAGE)" = "gettext"; then \
|
if test "$(PACKAGE)" = "gettext"; then \
|
||||||
$(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
|
$(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
|
||||||
$(INSTALL_DATA) $(srcdir)/Makefile.in.in \
|
for file in $(DISTFILES.common); do \
|
||||||
$(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
|
$(INSTALL_DATA) $(srcdir)/$$file \
|
||||||
|
$(DESTDIR)$(gettextsrcdir)/$$file; \
|
||||||
|
done; \
|
||||||
else \
|
else \
|
||||||
: ; \
|
: ; \
|
||||||
fi
|
fi
|
||||||
@@ -106,41 +129,117 @@ install-data-yes: all
|
|||||||
@catalogs='$(CATALOGS)'; \
|
@catalogs='$(CATALOGS)'; \
|
||||||
for cat in $$catalogs; do \
|
for cat in $$catalogs; do \
|
||||||
cat=`basename $$cat`; \
|
cat=`basename $$cat`; \
|
||||||
lang=`echo $$cat | sed 's/\.gmo$$//'`; \
|
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
|
||||||
dir=$(localedir)/$$lang/LC_MESSAGES; \
|
dir=$(localedir)/$$lang/LC_MESSAGES; \
|
||||||
$(mkinstalldirs) $(DESTDIR)$$dir; \
|
$(mkinstalldirs) $(DESTDIR)$$dir; \
|
||||||
if test -r $$cat; then \
|
if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
|
||||||
$(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
|
$(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
|
||||||
echo "installing $$cat as $(DESTDIR)$$dir/$(PACKAGE).mo"; \
|
echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
|
||||||
else \
|
for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
|
||||||
$(INSTALL_DATA) $(srcdir)/$$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
|
if test -n "$$lc"; then \
|
||||||
echo "installing $(srcdir)/$$cat as" \
|
if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
|
||||||
"$(DESTDIR)$$dir/$(PACKAGE).mo"; \
|
link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
|
||||||
fi; \
|
mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
|
||||||
|
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
|
||||||
|
(cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
|
||||||
|
for file in *; do \
|
||||||
|
if test -f $$file; then \
|
||||||
|
ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
|
||||||
|
fi; \
|
||||||
|
done); \
|
||||||
|
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
|
||||||
|
else \
|
||||||
|
if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
|
||||||
|
:; \
|
||||||
|
else \
|
||||||
|
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
|
||||||
|
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
|
||||||
|
fi; \
|
||||||
|
fi; \
|
||||||
|
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
|
||||||
|
ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
|
||||||
|
ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
|
||||||
|
cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
|
||||||
|
echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
|
||||||
|
fi; \
|
||||||
|
done; \
|
||||||
|
done
|
||||||
|
|
||||||
|
install-strip: install
|
||||||
|
|
||||||
|
installdirs: installdirs-exec installdirs-data
|
||||||
|
installdirs-exec:
|
||||||
|
installdirs-data: installdirs-data-@USE_NLS@
|
||||||
|
if test "$(PACKAGE)" = "gettext"; then \
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
|
||||||
|
else \
|
||||||
|
: ; \
|
||||||
|
fi
|
||||||
|
installdirs-data-no:
|
||||||
|
installdirs-data-yes:
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(datadir)
|
||||||
|
@catalogs='$(CATALOGS)'; \
|
||||||
|
for cat in $$catalogs; do \
|
||||||
|
cat=`basename $$cat`; \
|
||||||
|
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
|
||||||
|
dir=$(localedir)/$$lang/LC_MESSAGES; \
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$$dir; \
|
||||||
|
for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
|
||||||
|
if test -n "$$lc"; then \
|
||||||
|
if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
|
||||||
|
link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
|
||||||
|
mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
|
||||||
|
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
|
||||||
|
(cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
|
||||||
|
for file in *; do \
|
||||||
|
if test -f $$file; then \
|
||||||
|
ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
|
||||||
|
fi; \
|
||||||
|
done); \
|
||||||
|
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
|
||||||
|
else \
|
||||||
|
if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
|
||||||
|
:; \
|
||||||
|
else \
|
||||||
|
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
|
||||||
|
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
|
||||||
|
fi; \
|
||||||
|
fi; \
|
||||||
|
fi; \
|
||||||
|
done; \
|
||||||
done
|
done
|
||||||
|
|
||||||
# Define this as empty until I found a useful application.
|
# Define this as empty until I found a useful application.
|
||||||
installcheck:
|
installcheck:
|
||||||
|
|
||||||
uninstall:
|
uninstall: uninstall-exec uninstall-data
|
||||||
catalogs='$(CATALOGS)'; \
|
uninstall-exec:
|
||||||
for cat in $$catalogs; do \
|
uninstall-data: uninstall-data-@USE_NLS@
|
||||||
cat=`basename $$cat`; \
|
|
||||||
lang=`echo $$cat | sed 's/\.gmo$$//'`; \
|
|
||||||
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
|
|
||||||
done
|
|
||||||
if test "$(PACKAGE)" = "gettext"; then \
|
if test "$(PACKAGE)" = "gettext"; then \
|
||||||
rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
|
for file in $(DISTFILES.common); do \
|
||||||
|
rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
|
||||||
|
done; \
|
||||||
else \
|
else \
|
||||||
: ; \
|
: ; \
|
||||||
fi
|
fi
|
||||||
|
uninstall-data-no:
|
||||||
|
uninstall-data-yes:
|
||||||
|
catalogs='$(CATALOGS)'; \
|
||||||
|
for cat in $$catalogs; do \
|
||||||
|
cat=`basename $$cat`; \
|
||||||
|
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
|
||||||
|
for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
|
||||||
|
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
|
||||||
|
done; \
|
||||||
|
done
|
||||||
|
|
||||||
check: all
|
check: all
|
||||||
|
|
||||||
dvi info tags TAGS ID:
|
dvi info tags TAGS ID:
|
||||||
|
|
||||||
mostlyclean:
|
mostlyclean:
|
||||||
rm -f core core.* *.pox $(PACKAGE).po *.new.po
|
rm -f remove-potcdate.sed
|
||||||
|
rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
|
||||||
rm -fr *.o
|
rm -fr *.o
|
||||||
|
|
||||||
clean: mostlyclean
|
clean: mostlyclean
|
||||||
@@ -160,29 +259,49 @@ dist distdir:
|
|||||||
# This is a separate target because 'update-po' must be executed before.
|
# This is a separate target because 'update-po' must be executed before.
|
||||||
dist2: $(DISTFILES)
|
dist2: $(DISTFILES)
|
||||||
dists="$(DISTFILES)"; \
|
dists="$(DISTFILES)"; \
|
||||||
|
if test -f $(srcdir)/ChangeLog; then dists="$$dists ChangeLog"; fi; \
|
||||||
|
if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
|
||||||
for file in $$dists; do \
|
for file in $$dists; do \
|
||||||
if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
|
if test -f $$file; then \
|
||||||
cp -p $$dir/$$file $(distdir); \
|
cp -p $$file $(distdir); \
|
||||||
|
else \
|
||||||
|
cp -p $(srcdir)/$$file $(distdir); \
|
||||||
|
fi; \
|
||||||
done
|
done
|
||||||
|
|
||||||
update-po: Makefile
|
update-po: Makefile
|
||||||
$(MAKE) $(PACKAGE).pot
|
$(MAKE) $(DOMAIN).pot-update
|
||||||
if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \
|
$(MAKE) $(UPDATEPOFILES)
|
||||||
cd $(srcdir); \
|
|
||||||
catalogs='$(GMOFILES)'; \
|
|
||||||
for cat in $$catalogs; do \
|
|
||||||
cat=`basename $$cat`; \
|
|
||||||
lang=`echo $$cat | sed 's/\.gmo$$//'`; \
|
|
||||||
echo "$$lang:"; \
|
|
||||||
if $(MSGMERGE) $$lang.po $(PACKAGE).pot -o $$lang.new.po; then \
|
|
||||||
mv -f $$lang.new.po $$lang.po; \
|
|
||||||
else \
|
|
||||||
echo "msgmerge for $$cat failed!"; \
|
|
||||||
rm -f $$lang.new.po; \
|
|
||||||
fi; \
|
|
||||||
done
|
|
||||||
$(MAKE) update-gmo
|
$(MAKE) update-gmo
|
||||||
|
|
||||||
|
# General rule for updating PO files.
|
||||||
|
|
||||||
|
.nop.po-update:
|
||||||
|
@lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
|
||||||
|
if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \
|
||||||
|
tmpdir=`pwd`; \
|
||||||
|
echo "$$lang:"; \
|
||||||
|
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
|
||||||
|
echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
|
||||||
|
cd $(srcdir); \
|
||||||
|
if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
|
||||||
|
if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
|
||||||
|
rm -f $$tmpdir/$$lang.new.po; \
|
||||||
|
else \
|
||||||
|
if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
|
||||||
|
:; \
|
||||||
|
else \
|
||||||
|
echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
|
||||||
|
exit 1; \
|
||||||
|
fi; \
|
||||||
|
fi; \
|
||||||
|
else \
|
||||||
|
echo "msgmerge for $$lang.po failed!" 1>&2; \
|
||||||
|
rm -f $$tmpdir/$$lang.new.po; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
$(DUMMYPOFILES):
|
||||||
|
|
||||||
update-gmo: Makefile $(GMOFILES)
|
update-gmo: Makefile $(GMOFILES)
|
||||||
@:
|
@:
|
||||||
|
|
||||||
@@ -191,6 +310,8 @@ Makefile: Makefile.in.in $(top_builddir)/config.status POTFILES.in
|
|||||||
&& CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
|
&& CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
|
||||||
$(SHELL) ./config.status
|
$(SHELL) ./config.status
|
||||||
|
|
||||||
|
force:
|
||||||
|
|
||||||
# Tell versions [3.59,3.63) of GNU make not to export all variables.
|
# Tell versions [3.59,3.63) of GNU make not to export all variables.
|
||||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
.NOEXPORT:
|
.NOEXPORT:
|
||||||
|
|||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
# Makefile variables for PO directory in any package using GNU gettext.
|
||||||
|
|
||||||
|
# Usually the message domain is the same as the package name.
|
||||||
|
DOMAIN = $(PACKAGE)
|
||||||
|
|
||||||
|
# These two variables depend on the location of this directory.
|
||||||
|
subdir = po
|
||||||
|
top_builddir = ..
|
||||||
|
|
||||||
|
# These options get passed to xgettext.
|
||||||
|
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
|
||||||
|
|
||||||
|
# This is the copyright holder that gets inserted into the header of the
|
||||||
|
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
|
||||||
|
# package. (Note that the msgstr strings, extracted from the package's
|
||||||
|
# sources, belong to the copyright holder of the package.) Translators are
|
||||||
|
# expected to transfer the copyright for their translations to this person
|
||||||
|
# or entity, or to disclaim their copyright. The empty string stands for
|
||||||
|
# the public domain; in this case the translators are expected to disclaim
|
||||||
|
# their copyright.
|
||||||
|
COPYRIGHT_HOLDER = Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This is the list of locale categories, beyond LC_MESSAGES, for which the
|
||||||
|
# message catalogs shall be used. It is usually empty.
|
||||||
|
EXTRA_LOCALE_CATEGORIES =
|
||||||
@@ -1,16 +1,11 @@
|
|||||||
src/LR0.c
|
src/LR0.c
|
||||||
src/complain.c
|
src/complain.c
|
||||||
src/conflicts.c
|
src/conflicts.c
|
||||||
src/derives.c
|
|
||||||
src/files.c
|
src/files.c
|
||||||
src/getargs.c
|
src/getargs.c
|
||||||
src/lalr.c
|
src/lalr.c
|
||||||
src/lex.c
|
src/lex.c
|
||||||
src/main.c
|
|
||||||
src/nullable.c
|
|
||||||
src/output.c
|
|
||||||
src/print.c
|
src/print.c
|
||||||
src/print_graph.c
|
|
||||||
src/reader.c
|
src/reader.c
|
||||||
src/reduce.c
|
src/reduce.c
|
||||||
|
|
||||||
|
|||||||
-188
@@ -1,188 +0,0 @@
|
|||||||
/* Automatically generated by po2tbl.sed from bison.pot. */
|
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
|
||||||
# include <config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "libgettext.h"
|
|
||||||
|
|
||||||
const struct _msg_ent _msg_tbl[] = {
|
|
||||||
{"", 1},
|
|
||||||
{"too many states (max %d)", 2},
|
|
||||||
{"Conflict in state %d between rule %d and token %s resolved as %s.\n", 3},
|
|
||||||
{"reduce", 4},
|
|
||||||
{"shift", 5},
|
|
||||||
{"an error", 6},
|
|
||||||
{" 1 shift/reduce conflict", 7},
|
|
||||||
{" %d shift/reduce conflicts", 8},
|
|
||||||
{" and", 9},
|
|
||||||
{" 1 reduce/reduce conflict", 10},
|
|
||||||
{" %d reduce/reduce conflicts", 11},
|
|
||||||
{"State %d contains", 12},
|
|
||||||
{"conflicts: ", 13},
|
|
||||||
{" %d shift/reduce", 14},
|
|
||||||
{" %d reduce/reduce", 15},
|
|
||||||
{"%s contains", 16},
|
|
||||||
{" %-4s\t[reduce using rule %d (%s)]\n", 17},
|
|
||||||
{"\
|
|
||||||
$default\treduce using rule %d (%s)\n\
|
|
||||||
\n", 18},
|
|
||||||
{" %-4s\treduce using rule %d (%s)\n", 19},
|
|
||||||
{" $default\treduce using rule %d (%s)\n", 20},
|
|
||||||
{"DERIVES", 21},
|
|
||||||
{"%s derives", 22},
|
|
||||||
{"GNU bison generates parsers for LALR(1) grammars.\n", 23},
|
|
||||||
{"Usage: %s [OPTION]... FILE\n", 24},
|
|
||||||
{"\
|
|
||||||
If a long option shows an argument as mandatory, then it is mandatory\n\
|
|
||||||
for the equivalent short option also. Similarly for optional arguments.\n", 25},
|
|
||||||
{"\
|
|
||||||
Operation modes:\n\
|
|
||||||
-h, --help display this help and exit\n\
|
|
||||||
-V, --version output version information and exit\n\
|
|
||||||
-y, --yacc emulate POSIX yacc\n", 26},
|
|
||||||
{"\
|
|
||||||
Parser:\n\
|
|
||||||
-S, --skeleton=FILE specify the skeleton to use\n\
|
|
||||||
-t, --debug instrument the parser for debugging\n\
|
|
||||||
--locations enable locations computation\n\
|
|
||||||
-p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n\
|
|
||||||
-l, --no-lines don't generate `#line' directives\n\
|
|
||||||
-n, --no-parser generate the tables only\n\
|
|
||||||
-r, --raw number the tokens from 3\n\
|
|
||||||
-k, --token-table include a table of token names\n", 27},
|
|
||||||
{"\
|
|
||||||
Output:\n\
|
|
||||||
-d, --defines also produce a header file\n\
|
|
||||||
-v, --verbose also produce an explanation of the automaton\n\
|
|
||||||
-b, --file-prefix=PREFIX specify a PREFIX for output files\n\
|
|
||||||
-o, --output-file=FILE leave output to FILE\n", 28},
|
|
||||||
{"Report bugs to <[email protected]>.\n", 29},
|
|
||||||
{"bison (GNU Bison) %s", 30},
|
|
||||||
{"\
|
|
||||||
Copyright 1984, 1986, 1989, 1992, 2000, 2001 Free Software Foundation, Inc.\n", 31},
|
|
||||||
{"\
|
|
||||||
This is free software; see the source for copying conditions. There is NO\n\
|
|
||||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", 32},
|
|
||||||
{"Try `%s --help' for more information.\n", 33},
|
|
||||||
{"%s: no grammar file given\n", 34},
|
|
||||||
{"%s: extra arguments ignored after `%s'\n", 35},
|
|
||||||
{"too many gotos (max %d)", 36},
|
|
||||||
{"unexpected `/' found and ignored", 37},
|
|
||||||
{"unterminated comment", 38},
|
|
||||||
{"unexpected end of file", 39},
|
|
||||||
{"unescaped newline in constant", 40},
|
|
||||||
{"octal value outside range 0...255: `\\%o'", 41},
|
|
||||||
{"hexadecimal value above 255: `\\x%x'", 42},
|
|
||||||
{"unknown escape sequence: `\\' followed by `%s'", 43},
|
|
||||||
{"unterminated type name at end of file", 44},
|
|
||||||
{"unterminated type name", 45},
|
|
||||||
{"use \"...\" for multi-character literal tokens", 46},
|
|
||||||
{"%s: internal error: %s\n", 47},
|
|
||||||
{"Entering set_nullable", 48},
|
|
||||||
{"maximum table size (%d) exceeded", 49},
|
|
||||||
{" type %d is %s\n", 50},
|
|
||||||
{" (rule %d)", 51},
|
|
||||||
{" $default\taccept\n", 52},
|
|
||||||
{" NO ACTIONS\n", 53},
|
|
||||||
{" $ \tgo to state %d\n", 54},
|
|
||||||
{" %-4s\tshift, and go to state %d\n", 55},
|
|
||||||
{" %-4s\terror (nonassociative)\n", 56},
|
|
||||||
{" %-4s\tgo to state %d\n", 57},
|
|
||||||
{"state %d", 58},
|
|
||||||
{"Grammar", 59},
|
|
||||||
{"rule %-4d %s ->", 60},
|
|
||||||
{"\t\t/* empty */", 61},
|
|
||||||
{"Terminals, with rules where they appear", 62},
|
|
||||||
{"Nonterminals, with rules where they appear", 63},
|
|
||||||
{" on left:", 64},
|
|
||||||
{" on right:", 65},
|
|
||||||
{" Skipping to next \\n", 66},
|
|
||||||
{" Skipping to next %c", 67},
|
|
||||||
{"invalid $ value", 68},
|
|
||||||
{"unterminated string at end of file", 69},
|
|
||||||
{"unterminated string", 70},
|
|
||||||
{"%s is invalid", 71},
|
|
||||||
{"$$ of `%s' has no declared type", 72},
|
|
||||||
{"$%d of `%s' has no declared type", 73},
|
|
||||||
{"unterminated `%{' definition", 74},
|
|
||||||
{"Premature EOF after %s", 75},
|
|
||||||
{"symbol `%s' used more than once as a literal string", 76},
|
|
||||||
{"symbol `%s' given more than one literal string", 77},
|
|
||||||
{"symbol %s redefined", 78},
|
|
||||||
{"type redeclaration for %s", 79},
|
|
||||||
{"`%s' is invalid in %s", 80},
|
|
||||||
{"multiple %s declarations", 81},
|
|
||||||
{"invalid %s declaration", 82},
|
|
||||||
{"%type declaration has no <typename>", 83},
|
|
||||||
{"invalid %%type declaration due to item: %s", 84},
|
|
||||||
{"redefining precedence of %s", 85},
|
|
||||||
{"invalid text (%s) - number should be after identifier", 86},
|
|
||||||
{"unexpected item: %s", 87},
|
|
||||||
{"unmatched %s", 88},
|
|
||||||
{"argument of %%expect is not an integer", 89},
|
|
||||||
{"unrecognized item %s, expected an identifier", 90},
|
|
||||||
{"expected string constant instead of %s", 91},
|
|
||||||
{"unrecognized: %s", 92},
|
|
||||||
{"no input grammar", 93},
|
|
||||||
{"unknown character: %s", 94},
|
|
||||||
{"unterminated %guard clause", 95},
|
|
||||||
{"ill-formed rule: initial symbol not followed by colon", 96},
|
|
||||||
{"grammar starts with vertical bar", 97},
|
|
||||||
{"rule given for %s, which is a token", 98},
|
|
||||||
{"two @prec's in a row", 99},
|
|
||||||
{"%%guard present but %%semantic_parser not specified", 100},
|
|
||||||
{"two actions at end of one rule", 101},
|
|
||||||
{"type clash (`%s' `%s') on default action", 102},
|
|
||||||
{"empty rule for typed nonterminal, and no action", 103},
|
|
||||||
{"invalid input: %s", 104},
|
|
||||||
{"too many symbols (tokens plus nonterminals); maximum %d", 105},
|
|
||||||
{"no rules in the input grammar", 106},
|
|
||||||
{"symbol %s is used, but is not defined as a token and has no rules", 107},
|
|
||||||
{"conflicting precedences for %s and %s", 108},
|
|
||||||
{"conflicting assoc values for %s and %s", 109},
|
|
||||||
{"tokens %s and %s both assigned number %d", 110},
|
|
||||||
{"the start symbol %s is undefined", 111},
|
|
||||||
{"the start symbol %s is a token", 112},
|
|
||||||
{"Useless nonterminals:", 113},
|
|
||||||
{"Terminals which are not used:", 114},
|
|
||||||
{"Useless rules:", 115},
|
|
||||||
{"\
|
|
||||||
Variables\n\
|
|
||||||
---------\n\
|
|
||||||
\n", 116},
|
|
||||||
{"Value Sprec Sassoc Tag\n", 117},
|
|
||||||
{"\
|
|
||||||
Rules\n\
|
|
||||||
-----\n\
|
|
||||||
\n", 118},
|
|
||||||
{"\
|
|
||||||
Rules interpreted\n\
|
|
||||||
-----------------\n\
|
|
||||||
\n", 119},
|
|
||||||
{"%d rules never reduced\n", 120},
|
|
||||||
{"%s contains ", 121},
|
|
||||||
{"%d useless nonterminal%s", 122},
|
|
||||||
{" and ", 123},
|
|
||||||
{"%d useless rule%s", 124},
|
|
||||||
{"Start symbol %s does not derive any sentence", 125},
|
|
||||||
{"\
|
|
||||||
reduced %s defines %d terminal%s, %d nonterminal%s, and %d production%s.\n", 126},
|
|
||||||
{"Unknown system error", 127},
|
|
||||||
{"%s: option `%s' is ambiguous\n", 128},
|
|
||||||
{"%s: option `--%s' doesn't allow an argument\n", 129},
|
|
||||||
{"%s: option `%c%s' doesn't allow an argument\n", 130},
|
|
||||||
{"%s: option `%s' requires an argument\n", 131},
|
|
||||||
{"%s: unrecognized option `--%s'\n", 132},
|
|
||||||
{"%s: unrecognized option `%c%s'\n", 133},
|
|
||||||
{"%s: illegal option -- %c\n", 134},
|
|
||||||
{"%s: invalid option -- %c\n", 135},
|
|
||||||
{"%s: option requires an argument -- %c\n", 136},
|
|
||||||
{"%s: option `-W %s' is ambiguous\n", 137},
|
|
||||||
{"%s: option `-W %s' doesn't allow an argument\n", 138},
|
|
||||||
{"memory exhausted", 139},
|
|
||||||
{"`", 140},
|
|
||||||
{"'", 141},
|
|
||||||
};
|
|
||||||
|
|
||||||
int _msg_tbl_length = 141;
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user