mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-13 20:55:15 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf2e198269 | ||
|
|
af4483a0ab | ||
|
|
674fd9acbc | ||
|
|
6fedd4d1d6 | ||
|
|
abe1baa044 | ||
|
|
33285af04d | ||
|
|
cd7f95831e | ||
|
|
1b9a8440cd | ||
|
|
aead559e00 | ||
|
|
92b69b7f09 | ||
|
|
6e303f08d6 | ||
|
|
3dfc01e247 | ||
|
|
1503820f54 | ||
|
|
bc9bb28004 | ||
|
|
16c4a35041 | ||
|
|
f0451dba71 | ||
|
|
a9f37dee0c | ||
|
|
4b0979fcf3 | ||
|
|
cc35239e1b | ||
|
|
2e2cbb3fad | ||
|
|
adb4edee47 | ||
|
|
65490badba | ||
|
|
8b044b8540 | ||
|
|
0704bc9b8e | ||
|
|
2b7c2ef124 | ||
|
|
48e38d301e | ||
|
|
560757768c | ||
|
|
238b8134ec | ||
|
|
483642486d | ||
|
|
146ad4c8d0 | ||
|
|
f2a4c94506 | ||
|
|
65fae038b9 | ||
|
|
e1cb5fb523 | ||
|
|
64fabbb49f | ||
|
|
3b2925a060 | ||
|
|
83bcf86639 | ||
|
|
8639df64a6 | ||
|
|
377bd7c9a2 | ||
|
|
b4a7a230f1 | ||
|
|
c1586e58fe | ||
|
|
50766eee39 | ||
|
|
dc3b81cd67 | ||
|
|
c555896775 | ||
|
|
35f61cb998 | ||
|
|
9291f914de | ||
|
|
ff1581dddb | ||
|
|
4b9170b2c0 | ||
|
|
523a9eafdc | ||
|
|
bcdf932ed9 | ||
|
|
e2aabb3dc6 | ||
|
|
e8ebe4b0c7 | ||
|
|
9043475828 | ||
|
|
d80a86e0b5 | ||
|
|
cfc3acf242 | ||
|
|
93337ac41c | ||
|
|
0d7803637b | ||
|
|
a62c863ec3 | ||
|
|
1e883de90c | ||
|
|
efcff8cd5c | ||
|
|
3e85a00236 | ||
|
|
f85c981ac1 | ||
|
|
5cb10dae3c | ||
|
|
26e1ca45ba | ||
|
|
8888e43b2c | ||
|
|
d9ca2df2aa | ||
|
|
e8def3ff6e | ||
|
|
76e734e5ed | ||
|
|
b8b4a730a0 | ||
|
|
b9d2d2a881 | ||
|
|
78986eff74 | ||
|
|
1393a78454 | ||
|
|
de11686376 | ||
|
|
badfc69c26 | ||
|
|
fb28699f95 | ||
|
|
6b307af66c | ||
|
|
dad56b10d3 | ||
|
|
5f1ff7cd74 | ||
|
|
b6cac93afa | ||
|
|
86d5a1ed5c | ||
|
|
97e9ee3ad5 | ||
|
|
d81e5db73f | ||
|
|
029806c785 | ||
|
|
a2874a4e5d | ||
|
|
d54387b4bc | ||
|
|
a4c22fa4bf | ||
|
|
0d214b93b0 | ||
|
|
3c5d71ca8b | ||
|
|
d61c57b70c | ||
|
|
ea57e0a3c4 | ||
|
|
57c429f305 | ||
|
|
239e5c1a9a | ||
|
|
ae9b5e5a4f | ||
|
|
7ae1c5929e | ||
|
|
1d708336d4 | ||
|
|
705131d1de | ||
|
|
5c2a5a8970 | ||
|
|
6b784f8552 | ||
|
|
32a1edfccd | ||
|
|
63cf44e7ac | ||
|
|
9507085cf3 | ||
|
|
8d3c8c3643 | ||
|
|
16c9da79ef | ||
|
|
d0132d6bec | ||
|
|
1306676ce3 | ||
|
|
e18cda8b5e | ||
|
|
ddf896eb8e | ||
|
|
9aadbdf371 | ||
|
|
f1b769ff28 | ||
|
|
94ff2b9475 | ||
|
|
470d206b2e | ||
|
|
08f0a4e409 | ||
|
|
00fda01856 | ||
|
|
bf31619762 | ||
|
|
31a743b2bb | ||
|
|
48b43d9d83 | ||
|
|
4b9e71f993 | ||
|
|
16cd214585 | ||
|
|
f2c7ab2c1f | ||
|
|
2c377512c2 | ||
|
|
74c3b26d85 | ||
|
|
72ab1d45d2 | ||
|
|
d9302e4b73 | ||
|
|
f1394282f0 | ||
|
|
d8b1af2801 | ||
|
|
445cb4e989 | ||
|
|
f40703a29a | ||
|
|
e348b12ae0 | ||
|
|
ba6f6bf90f | ||
|
|
d9af6cc62f | ||
|
|
ab30845981 | ||
|
|
0b3870c112 | ||
|
|
e92a5d5bae | ||
|
|
02cbcfc577 | ||
|
|
8c67836b58 | ||
|
|
cae30a7df4 | ||
|
|
9fb2ad6738 | ||
|
|
8bce355d7c | ||
|
|
ae7c7ada67 | ||
|
|
9e42f7b625 | ||
|
|
f87fc33f87 | ||
|
|
7ba81a101f | ||
|
|
9190f3e726 | ||
|
|
330de47708 | ||
|
|
bb84601097 | ||
|
|
9a96ccfa20 | ||
|
|
6051d37287 | ||
|
|
2aec1bc1de | ||
|
|
c6e1f6235a | ||
|
|
ab6fbb02ad | ||
|
|
f2632e420f | ||
|
|
19f01e885f | ||
|
|
6792619fa8 | ||
|
|
645ff8cdee | ||
|
|
a726df0b44 | ||
|
|
ce209526ed | ||
|
|
b94bf14aac | ||
|
|
2a4426474d | ||
|
|
9022c575cc | ||
|
|
dae9263b7b | ||
|
|
cdd11a9322 | ||
|
|
da7ab9b7b0 | ||
|
|
0899b02570 | ||
|
|
0f23d6d25b | ||
|
|
47cef7a2ff | ||
|
|
7972022dac | ||
|
|
ea4f4c4c1b | ||
|
|
d97207ad77 | ||
|
|
3068221b53 | ||
|
|
6f0d1fd89d | ||
|
|
6526f6dbf7 | ||
|
|
817e461c23 | ||
|
|
c4e3dae3ac | ||
|
|
8cedc168fa | ||
|
|
3b14996787 | ||
|
|
041cad1677 | ||
|
|
31478b7ab7 | ||
|
|
e957bbb7d4 | ||
|
|
b5f513ef2c | ||
|
|
3afa674b1d | ||
|
|
ac481f3b08 | ||
|
|
010c94a243 | ||
|
|
d37a7c45b3 | ||
|
|
d63e24071f | ||
|
|
afd36419df | ||
|
|
6918b5fcc9 | ||
|
|
38e616f0f5 | ||
|
|
db433e9db8 | ||
|
|
870f12c270 | ||
|
|
e0a53a7f4a | ||
|
|
27c1ceb8da | ||
|
|
8f5d3a2dd5 | ||
|
|
adfd774c80 | ||
|
|
057194c61e | ||
|
|
a6f622cd50 | ||
|
|
2b8ce46775 | ||
|
|
19553c4e06 | ||
|
|
b1722803ec | ||
|
|
6f5e0eea04 | ||
|
|
e4ad4676be | ||
|
|
7b50efe542 | ||
|
|
cf90ca5d46 | ||
|
|
e373aad966 | ||
|
|
3e4c37cf7b | ||
|
|
dfaa776005 | ||
|
|
aecd294cb0 | ||
|
|
52eddd8c33 | ||
|
|
60403d1bc1 | ||
|
|
dd9f12de60 | ||
|
|
6085f203e1 | ||
|
|
7a360eeaed | ||
|
|
af550e2927 | ||
|
|
78632bbcdc | ||
|
|
483c899a17 | ||
|
|
8c7d6a3de8 | ||
|
|
e795bd7376 | ||
|
|
7cae438bd8 | ||
|
|
c427611526 | ||
|
|
45f8dd1ec5 | ||
|
|
e5aa395b38 | ||
|
|
0b8afb7723 | ||
|
|
683e29a634 | ||
|
|
f0130d39ff | ||
|
|
f9a8293a3f | ||
|
|
150ca7a72e | ||
|
|
0a3b9e5fb5 | ||
|
|
69b5cec495 | ||
|
|
f2b5126e47 | ||
|
|
4ecbf79698 | ||
|
|
95fb566259 | ||
|
|
78d09da9a5 | ||
|
|
5a009f2c4c | ||
|
|
1e41465a20 | ||
|
|
79282c6c57 | ||
|
|
fabd3b431d | ||
|
|
ec0926311c | ||
|
|
b02deb443c | ||
|
|
c67a198d15 | ||
|
|
09a6de7e50 | ||
|
|
b77b9ee0a3 | ||
|
|
a940e84e29 | ||
|
|
6f42a3e682 | ||
|
|
f1c63ceddc | ||
|
|
3e259915e1 | ||
|
|
ca96bc2d17 | ||
|
|
fd6b609da9 | ||
|
|
b6de699170 | ||
|
|
459ff06402 | ||
|
|
4e8ef709e6 | ||
|
|
08a161353c | ||
|
|
fdc6758b79 | ||
|
|
957d4dbf16 | ||
|
|
600cad3b84 | ||
|
|
0eca3194d6 | ||
|
|
976e528f02 | ||
|
|
20e8e5cadf | ||
|
|
c4b661269e | ||
|
|
ea4e548a4a | ||
|
|
3e3da79762 | ||
|
|
78348431f2 | ||
|
|
22c2cbc078 | ||
|
|
ce4d5ce009 | ||
|
|
7333d40316 | ||
|
|
8416323152 | ||
|
|
8303fc422a | ||
|
|
70a84437e1 | ||
|
|
2ce1014469 | ||
|
|
1e3e4bc116 | ||
|
|
42b45b7fab | ||
|
|
8f13fe33b7 | ||
|
|
df3b6776d3 | ||
|
|
be64244492 | ||
|
|
dc2825ae89 | ||
|
|
fdb5fc3863 | ||
|
|
b37ba92cf6 | ||
|
|
45faaf3f26 | ||
|
|
b0ce604668 | ||
|
|
d01c415b93 | ||
|
|
459dd1a681 | ||
|
|
53b74c0c4c | ||
|
|
d995fee754 | ||
|
|
234a3be303 | ||
|
|
847bf1f538 | ||
|
|
73975f004c | ||
|
|
35b995c934 | ||
|
|
d074a105ae | ||
|
|
b99357cde6 | ||
|
|
3419715d61 | ||
|
|
62ab6972e8 | ||
|
|
45bed1a559 | ||
|
|
1e24cc5b41 | ||
|
|
32dfccf8f8 | ||
|
|
cd5bd6ac4f | ||
|
|
5141b01619 | ||
|
|
447992b9f1 | ||
|
|
274d42cecb | ||
|
|
22c821f312 | ||
|
|
66075dcfc8 | ||
|
|
18569462db | ||
|
|
0d8f3c8a7a | ||
|
|
7400308fa3 | ||
|
|
f17bcd1f66 | ||
|
|
511e79b3d4 | ||
|
|
0d6508efab | ||
|
|
6deb44470e | ||
|
|
dde188fc64 | ||
|
|
a4b0592b5a | ||
|
|
705db0b507 | ||
|
|
ff4423cc28 | ||
|
|
956dba3a7c | ||
|
|
337bab46f2 | ||
|
|
5d3214b854 | ||
|
|
29092a5740 | ||
|
|
ea5607fd01 | ||
|
|
27110317b8 | ||
|
|
19c50364f3 | ||
|
|
573c1d9ff8 | ||
|
|
ef7ddeddaa | ||
|
|
ff61dabdba | ||
|
|
55b9634155 | ||
|
|
358c15b71e | ||
|
|
7de3329eea | ||
|
|
bfb0787482 | ||
|
|
1addd145c2 | ||
|
|
c95f2d781f | ||
|
|
69b4e0c5ea | ||
|
|
3abcd45995 | ||
|
|
2a91a95e9e | ||
|
|
14d3eb9bf4 | ||
|
|
d7045ec672 | ||
|
|
6fd54b73c3 | ||
|
|
4c50eae6a0 | ||
|
|
a35f64eade | ||
|
|
7de23534ac | ||
|
|
aa7815f5c6 | ||
|
|
5af1f54933 | ||
|
|
553e2b222f | ||
|
|
8a4f41d6ed | ||
|
|
090c5ebfa8 | ||
|
|
095a3fb52f | ||
|
|
d1cdce7c1c | ||
|
|
9311529bc5 | ||
|
|
d16e8d3cd7 | ||
|
|
d8880f69ff | ||
|
|
0dbb648e3f | ||
|
|
896fe5c10a | ||
|
|
dd60faeca4 | ||
|
|
8c7ebe4946 | ||
|
|
77aee78982 | ||
|
|
f1320c03a4 | ||
|
|
43591cec98 | ||
|
|
1e9798d569 | ||
|
|
f282676b7e | ||
|
|
550a72a3be | ||
|
|
131e2fef68 | ||
|
|
79282c5ad0 | ||
|
|
ff4a34be27 | ||
|
|
14ded68250 | ||
|
|
8e03724b11 | ||
|
|
a9e64249c8 | ||
|
|
42a0c7760b | ||
|
|
e02cf9e74a | ||
|
|
da9abf4366 | ||
|
|
8f52a1e790 | ||
|
|
c33638bb30 | ||
|
|
444c570aad | ||
|
|
89cab50df1 | ||
|
|
d6c2cba06d | ||
|
|
5a35a6cb71 | ||
|
|
71da9eeacc | ||
|
|
95e36146a5 | ||
|
|
d7020c2078 | ||
|
|
1916f98ef8 | ||
|
|
d7913476c4 | ||
|
|
340ef48922 | ||
|
|
b2ca4022ea | ||
|
|
403b315bb1 | ||
|
|
07a58c1301 | ||
|
|
0619caf0b1 | ||
|
|
3519ec76a3 | ||
|
|
85bcaacc59 | ||
|
|
015acc4834 | ||
|
|
8963a27bde | ||
|
|
a70083a3ed | ||
|
|
abadc11757 | ||
|
|
720d742f8e | ||
|
|
f2acea59d9 | ||
|
|
d019d65507 | ||
|
|
6c89f1c138 | ||
|
|
d5796688b1 | ||
|
|
d9efd18111 | ||
|
|
c29240e74b | ||
|
|
2fa6973e6f | ||
|
|
499daa504f | ||
|
|
cc84fd5dc7 | ||
|
|
db5b3a89b4 | ||
|
|
ceed8467b7 | ||
|
|
05a1d24b1e | ||
|
|
cbd25751d4 | ||
|
|
1386333308 | ||
|
|
0d533154e4 | ||
|
|
e79137accc | ||
|
|
8aa892b461 | ||
|
|
4a120d45e6 | ||
|
|
27821bff0f | ||
|
|
dd877b0c39 | ||
|
|
ab3bec2946 | ||
|
|
00f4332938 | ||
|
|
630f521258 | ||
|
|
e1edb685d9 | ||
|
|
cfe5fbc0a1 | ||
|
|
cb7db13e45 | ||
|
|
3628146521 | ||
|
|
a0f6b07611 | ||
|
|
10a9273b34 | ||
|
|
1853982561 | ||
|
|
9f306f2a73 | ||
|
|
c7a71c07ca | ||
|
|
adf5fa1318 | ||
|
|
1c9c92b1c2 | ||
|
|
0ba347b638 | ||
|
|
aa5fd0ee9a | ||
|
|
dbe7f27171 | ||
|
|
75bbe78d87 | ||
|
|
7b306f528a | ||
|
|
e87b57008e | ||
|
|
ae3c316400 | ||
|
|
4dc58e7c76 | ||
|
|
0a6384c401 | ||
|
|
3cef001a70 | ||
|
|
ca36d2efbc | ||
|
|
6666f98f4f | ||
|
|
41aca2e038 | ||
|
|
dc08c1d53b | ||
|
|
9ee3c97bce | ||
|
|
0de741ca66 | ||
|
|
bb10be5408 | ||
|
|
b07b484a41 | ||
|
|
361f60b34e | ||
|
|
8c44d3ec49 | ||
|
|
f95997e708 | ||
|
|
aefb051ce0 | ||
|
|
583ad9fe3a | ||
|
|
8dc26b76ae | ||
|
|
65c7d7aa04 | ||
|
|
eefc3a8c5f | ||
|
|
f87a220598 | ||
|
|
96042d8155 | ||
|
|
ff2ecbaee1 | ||
|
|
9ecbd1257c | ||
|
|
5191ef2421 | ||
|
|
649d71cc96 | ||
|
|
abf14fb697 | ||
|
|
bb99b87ec3 | ||
|
|
d2e00347cb | ||
|
|
3e2bf5adf6 | ||
|
|
8ae7664ea0 | ||
|
|
6822137867 | ||
|
|
6ed6122606 | ||
|
|
2411ba6bea | ||
|
|
6d42748fae | ||
|
|
0f3e47c1b3 | ||
|
|
dad49092a9 | ||
|
|
66a69320b2 | ||
|
|
86b7964abb | ||
|
|
8a278a045d | ||
|
|
e0d27f5f08 | ||
|
|
3114db31fd | ||
|
|
4723d52125 | ||
|
|
8ebbae2a91 | ||
|
|
eba41a1d10 | ||
|
|
3dcf6735ff | ||
|
|
e5335b7401 | ||
|
|
f9b730cd59 | ||
|
|
bbcb769c0e | ||
|
|
ca1d9e53ce | ||
|
|
1c7aefa94e | ||
|
|
7903d3b5de | ||
|
|
59b31ad972 | ||
|
|
5aafad1ddf | ||
|
|
e7ae9cfb47 | ||
|
|
5c31c3c2c8 | ||
|
|
e569a4351c | ||
|
|
9eceb6c6d3 | ||
|
|
315f05ae6c | ||
|
|
f35167cb24 | ||
|
|
8cd0d0f2ce | ||
|
|
f51dbca105 | ||
|
|
97088b85c5 | ||
|
|
8d57fff0a9 | ||
|
|
cbbe75051d | ||
|
|
2686a6e713 | ||
|
|
a693bf18ef | ||
|
|
29620c5d9c | ||
|
|
2d97f5ccb7 | ||
|
|
c49a8e71ce | ||
|
|
c9c4ffaa5d | ||
|
|
74a53b4b48 | ||
|
|
a889d44ce2 | ||
|
|
e6011337c3 | ||
|
|
d2729d44ab | ||
|
|
4be07551f5 | ||
|
|
0308924772 | ||
|
|
3202e65182 | ||
|
|
bd088c911c | ||
|
|
118fb2053c | ||
|
|
7bb4d91420 | ||
|
|
bd2a2393ed | ||
|
|
bd773d7399 | ||
|
|
de4d0c7525 | ||
|
|
792d6b7cda | ||
|
|
df1af54c81 | ||
|
|
c55c697eb1 | ||
|
|
9e4e995adb | ||
|
|
604cc97b12 | ||
|
|
5b2a15fd2f | ||
|
|
f310d2132a | ||
|
|
6f82addcd5 | ||
|
|
4562bb7764 | ||
|
|
341a3cfb10 | ||
|
|
5b2e3c8982 | ||
|
|
d968a24b6e | ||
|
|
6f515a274e | ||
|
|
5c9ba6311a | ||
|
|
bc77bc1cd2 | ||
|
|
11443f4acf | ||
|
|
ab1375029c | ||
|
|
b059f9990f |
+12
@@ -0,0 +1,12 @@
|
|||||||
|
Makefile
|
||||||
|
config.cache
|
||||||
|
config.h
|
||||||
|
config.log
|
||||||
|
config.status
|
||||||
|
stamp-h*
|
||||||
|
bison-*
|
||||||
|
patches
|
||||||
|
*.patch *.log log patches applied
|
||||||
|
*.prj
|
||||||
|
releases
|
||||||
|
autom4te.cache
|
||||||
@@ -0,0 +1,324 @@
|
|||||||
|
Notes on the Free Translation Project
|
||||||
|
*************************************
|
||||||
|
|
||||||
|
Free software is going international! The Free Translation Project
|
||||||
|
is a way to get maintainers of free software, translators, and users all
|
||||||
|
together, so that will gradually become able to speak many languages.
|
||||||
|
A few packages already provide translations for their messages.
|
||||||
|
|
||||||
|
If you found this `ABOUT-NLS' file inside a distribution, you may
|
||||||
|
assume that the distributed package does use GNU `gettext' internally,
|
||||||
|
itself available at your nearest GNU archive site. But you do _not_
|
||||||
|
need to install GNU `gettext' prior to configuring, installing or using
|
||||||
|
this package with messages translated.
|
||||||
|
|
||||||
|
Installers will find here some useful hints. These notes also
|
||||||
|
explain how users should proceed for getting the programs to use the
|
||||||
|
available translations. They tell how people wanting to contribute and
|
||||||
|
work at translations should contact the appropriate team.
|
||||||
|
|
||||||
|
When reporting bugs in the `intl/' directory or bugs which may be
|
||||||
|
related to internationalization, you should tell about the version of
|
||||||
|
`gettext' which is used. The information can be found in the
|
||||||
|
`intl/VERSION' file, in internationalized packages.
|
||||||
|
|
||||||
|
Quick configuration advice
|
||||||
|
==========================
|
||||||
|
|
||||||
|
If you want to exploit the full power of internationalization, you
|
||||||
|
should configure it using
|
||||||
|
|
||||||
|
./configure --with-included-gettext
|
||||||
|
|
||||||
|
to force usage of internationalizing routines provided within this
|
||||||
|
package, despite the existence of internationalizing capabilities in the
|
||||||
|
operating system where this package is being installed. So far, only
|
||||||
|
the `gettext' implementation in the GNU C library version 2 provides as
|
||||||
|
many features (such as locale alias, message inheritance, automatic
|
||||||
|
charset conversion or plural form handling) as the implementation here.
|
||||||
|
It is also not possible to offer this additional functionality on top
|
||||||
|
of a `catgets' implementation. Future versions of GNU `gettext' will
|
||||||
|
very likely convey even more functionality. So it might be a good idea
|
||||||
|
to change to GNU `gettext' as soon as possible.
|
||||||
|
|
||||||
|
So you need _not_ provide this option if you are using GNU libc 2 or
|
||||||
|
you have installed a recent copy of the GNU gettext package with the
|
||||||
|
included `libintl'.
|
||||||
|
|
||||||
|
INSTALL Matters
|
||||||
|
===============
|
||||||
|
|
||||||
|
Some packages are "localizable" when properly installed; the
|
||||||
|
programs they contain can be made to speak your own native language.
|
||||||
|
Most such packages use GNU `gettext'. Other packages have their own
|
||||||
|
ways to internationalization, predating GNU `gettext'.
|
||||||
|
|
||||||
|
By default, this package will be installed to allow translation of
|
||||||
|
messages. It will automatically detect whether the system already
|
||||||
|
provides the GNU `gettext' functions. If not, the GNU `gettext' own
|
||||||
|
library will be used. This library is wholly contained within this
|
||||||
|
package, usually in the `intl/' subdirectory, so prior installation of
|
||||||
|
the GNU `gettext' package is _not_ required. Installers may use
|
||||||
|
special options at configuration time for changing the default
|
||||||
|
behaviour. The commands:
|
||||||
|
|
||||||
|
./configure --with-included-gettext
|
||||||
|
./configure --disable-nls
|
||||||
|
|
||||||
|
will respectively bypass any pre-existing `gettext' to use the
|
||||||
|
internationalizing routines provided within this package, or else,
|
||||||
|
_totally_ disable translation of messages.
|
||||||
|
|
||||||
|
When you already have GNU `gettext' installed on your system and run
|
||||||
|
configure without an option for your new package, `configure' will
|
||||||
|
probably detect the previously built and installed `libintl.a' file and
|
||||||
|
will decide to use this. This might be not what is desirable. You
|
||||||
|
should use the more recent version of the GNU `gettext' library. I.e.
|
||||||
|
if the file `intl/VERSION' shows that the library which comes with this
|
||||||
|
package is more recent, you should use
|
||||||
|
|
||||||
|
./configure --with-included-gettext
|
||||||
|
|
||||||
|
to prevent auto-detection.
|
||||||
|
|
||||||
|
The configuration process will not test for the `catgets' function
|
||||||
|
and therefore it will not be used. The reason is that even an
|
||||||
|
emulation of `gettext' on top of `catgets' could not provide all the
|
||||||
|
extensions of the GNU `gettext' library.
|
||||||
|
|
||||||
|
Internationalized packages have usually many `po/LL.po' files, where
|
||||||
|
LL gives an ISO 639 two-letter code identifying the language. Unless
|
||||||
|
translations have been forbidden at `configure' time by using the
|
||||||
|
`--disable-nls' switch, all available translations are installed
|
||||||
|
together with the package. However, the environment variable `LINGUAS'
|
||||||
|
may be set, prior to configuration, to limit the installed set.
|
||||||
|
`LINGUAS' should then contain a space separated list of two-letter
|
||||||
|
codes, stating which languages are allowed.
|
||||||
|
|
||||||
|
Using This Package
|
||||||
|
==================
|
||||||
|
|
||||||
|
As a user, if your language has been installed for this package, you
|
||||||
|
only have to set the `LANG' environment variable to the appropriate
|
||||||
|
`LL_CC' combination. Here `LL' is an ISO 639 two-letter language code,
|
||||||
|
and `CC' is an ISO 3166 two-letter country code. For example, let's
|
||||||
|
suppose that you speak German and live in Germany. At the shell
|
||||||
|
prompt, merely execute `setenv LANG de_DE' (in `csh'),
|
||||||
|
`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash').
|
||||||
|
This can be done from your `.login' or `.profile' file, once and for
|
||||||
|
all.
|
||||||
|
|
||||||
|
You might think that the country code specification is redundant.
|
||||||
|
But in fact, some languages have dialects in different countries. For
|
||||||
|
example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The
|
||||||
|
country code serves to distinguish the dialects.
|
||||||
|
|
||||||
|
Not all programs have translations for all languages. By default, an
|
||||||
|
English message is shown in place of a nonexistent translation. If you
|
||||||
|
understand other languages, you can set up a priority list of languages.
|
||||||
|
This is done through a different environment variable, called
|
||||||
|
`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG'
|
||||||
|
for the purpose of message handling, but you still need to have `LANG'
|
||||||
|
set to the primary language; this is required by other parts of the
|
||||||
|
system libraries. For example, some Swedish users who would rather
|
||||||
|
read translations in German than English for when Swedish is not
|
||||||
|
available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'.
|
||||||
|
|
||||||
|
In the `LANGUAGE' environment variable, but not in the `LANG'
|
||||||
|
environment variable, `LL_CC' combinations can be abbreviated as `LL'
|
||||||
|
to denote the language's main dialect. For example, `de' is equivalent
|
||||||
|
to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT'
|
||||||
|
(Portuguese as spoken in Portugal) in this context.
|
||||||
|
|
||||||
|
Translating Teams
|
||||||
|
=================
|
||||||
|
|
||||||
|
For the Free Translation Project to be a success, we need interested
|
||||||
|
people who like their own language and write it well, and who are also
|
||||||
|
able to synergize with other translators speaking the same language.
|
||||||
|
Each translation team has its own mailing list. The up-to-date list of
|
||||||
|
teams can be found at the Free Translation Project's homepage,
|
||||||
|
`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams"
|
||||||
|
area.
|
||||||
|
|
||||||
|
If you'd like to volunteer to _work_ at translating messages, you
|
||||||
|
should become a member of the translating team for your own language.
|
||||||
|
The subscribing address is _not_ the same as the list itself, it has
|
||||||
|
`-request' appended. For example, speakers of Swedish can send a
|
||||||
|
message to `[email protected]', having this message body:
|
||||||
|
|
||||||
|
subscribe
|
||||||
|
|
||||||
|
Keep in mind that team members are expected to participate
|
||||||
|
_actively_ in translations, or at solving translational difficulties,
|
||||||
|
rather than merely lurking around. If your team does not exist yet and
|
||||||
|
you want to start one, or if you are unsure about what to do or how to
|
||||||
|
get started, please write to `[email protected]' to reach the
|
||||||
|
coordinator for all translator teams.
|
||||||
|
|
||||||
|
The English team is special. It works at improving and uniformizing
|
||||||
|
the terminology in use. Proven linguistic skill are praised more than
|
||||||
|
programming skill, here.
|
||||||
|
|
||||||
|
Available Packages
|
||||||
|
==================
|
||||||
|
|
||||||
|
Languages are not equally supported in all packages. The following
|
||||||
|
matrix shows the current state of internationalization, as of September
|
||||||
|
2001. The matrix shows, in regard of each package, for which languages
|
||||||
|
PO files have been submitted to translation coordination, with a
|
||||||
|
translation percentage of at least 50%.
|
||||||
|
|
||||||
|
Ready PO files bg cs da de el en eo es et fi fr gl he hr id it ja
|
||||||
|
+----------------------------------------------------+
|
||||||
|
a2ps | [] [] [] |
|
||||||
|
bash | [] [] [] [] |
|
||||||
|
bfd | |
|
||||||
|
binutils | [] |
|
||||||
|
bison | [] [] [] [] [] |
|
||||||
|
clisp | [] [] [] [] |
|
||||||
|
cpio | [] [] [] [] [] |
|
||||||
|
diffutils | [] [] [] [] [] [] [] |
|
||||||
|
enscript | [] [] |
|
||||||
|
error | [] [] |
|
||||||
|
fetchmail | |
|
||||||
|
fileutils | [] [] [] [] [] [] [] [] |
|
||||||
|
findutils | [] [] [] [] [] [] [] [] |
|
||||||
|
flex | [] [] [] |
|
||||||
|
freetype | |
|
||||||
|
gas | |
|
||||||
|
gawk | [] [] |
|
||||||
|
gcal | |
|
||||||
|
gcc | |
|
||||||
|
gettext | [] [] [] [] [] [] [] [] [] [] |
|
||||||
|
gnupg | [] [] [] [] [] [] [] |
|
||||||
|
gprof | |
|
||||||
|
grep | [] [] [] [] [] [] [] [] |
|
||||||
|
hello | [] [] [] [] [] [] [] [] [] [] [] |
|
||||||
|
id-utils | [] [] [] |
|
||||||
|
indent | [] [] [] [] [] |
|
||||||
|
jpilot | [] |
|
||||||
|
kbd | |
|
||||||
|
ld | [] |
|
||||||
|
libc | [] [] [] [] [] [] [] [] |
|
||||||
|
lilypond | [] |
|
||||||
|
lynx | [] [] [] [] |
|
||||||
|
m4 | [] [] [] [] [] [] [] [] |
|
||||||
|
make | [] [] [] [] [] [] |
|
||||||
|
mysecretdiary | [] |
|
||||||
|
nano | [] [] [] |
|
||||||
|
opcodes | |
|
||||||
|
parted | [] [] [] |
|
||||||
|
ptx | [] [] [] [] [] [] [] |
|
||||||
|
python | |
|
||||||
|
recode | [] [] [] [] [] [] [] [] [] |
|
||||||
|
sed | [] [] [] [] [] [] [] [] [] [] [] [] |
|
||||||
|
sh-utils | [] [] [] [] [] [] [] [] [] [] |
|
||||||
|
sharutils | [] [] [] [] [] [] [] [] |
|
||||||
|
sketch | |
|
||||||
|
soundtracker | [] [] [] |
|
||||||
|
sp | |
|
||||||
|
tar | [] [] [] [] [] [] [] [] |
|
||||||
|
texinfo | [] [] [] [] [] [] |
|
||||||
|
textutils | [] [] [] [] [] [] [] [] |
|
||||||
|
util-linux | [] [] |
|
||||||
|
wdiff | [] [] [] |
|
||||||
|
wget | [] [] [] [] [] [] [] [] [] [] |
|
||||||
|
+----------------------------------------------------+
|
||||||
|
bg cs da de el en eo es et fi fr gl he hr id it ja
|
||||||
|
0 14 24 32 11 1 8 23 13 1 33 22 4 0 7 9 18
|
||||||
|
|
||||||
|
ko lv nb nl nn no pl pt pt_BR ru sk sl sv tr uk zh
|
||||||
|
+----------------------------------------------------+
|
||||||
|
a2ps | [] [] [] | 6
|
||||||
|
bash | | 4
|
||||||
|
bfd | | 0
|
||||||
|
binutils | | 1
|
||||||
|
bison | [] | 6
|
||||||
|
clisp | [] | 5
|
||||||
|
cpio | [] [] [] [] [] | 10
|
||||||
|
diffutils | [] [] [] [] | 11
|
||||||
|
enscript | [] [] [] | 5
|
||||||
|
error | [] [] | 4
|
||||||
|
fetchmail | | 0
|
||||||
|
fileutils | [] [] [] [] [] [] [] [] [] | 17
|
||||||
|
findutils | [] [] [] [] [] [] [] [] | 16
|
||||||
|
flex | [] [] [] | 6
|
||||||
|
freetype | | 0
|
||||||
|
gas | | 0
|
||||||
|
gawk | [] | 3
|
||||||
|
gcal | | 0
|
||||||
|
gcc | | 0
|
||||||
|
gettext | [] [] [] [] [] [] [] [] | 18
|
||||||
|
gnupg | [] [] [] | 10
|
||||||
|
gprof | | 0
|
||||||
|
grep | [] [] [] [] | 12
|
||||||
|
hello | [] [] [] [] [] [] [] [] [] [] [] | 22
|
||||||
|
id-utils | [] [] [] | 6
|
||||||
|
indent | [] [] [] [] [] [] [] | 12
|
||||||
|
jpilot | | 1
|
||||||
|
kbd | [] | 1
|
||||||
|
ld | | 1
|
||||||
|
libc | [] [] [] [] [] [] [] [] | 16
|
||||||
|
lilypond | [] [] | 3
|
||||||
|
lynx | [] [] [] [] | 8
|
||||||
|
m4 | [] [] [] [] | 12
|
||||||
|
make | [] [] [] [] [] [] | 12
|
||||||
|
mysecretdiary | | 1
|
||||||
|
nano | [] | 4
|
||||||
|
opcodes | [] | 1
|
||||||
|
parted | [] [] | 5
|
||||||
|
ptx | [] [] [] [] [] [] [] [] | 15
|
||||||
|
python | | 0
|
||||||
|
recode | [] [] [] [] | 13
|
||||||
|
sed | [] [] [] [] [] [] [] | 19
|
||||||
|
sh-utils | [] [] [] [] [] [] [] [] [] [] [] | 21
|
||||||
|
sharutils | [] [] [] | 11
|
||||||
|
sketch | | 0
|
||||||
|
soundtracker | | 3
|
||||||
|
sp | | 0
|
||||||
|
tar | [] [] [] [] [] [] [] | 15
|
||||||
|
texinfo | [] | 7
|
||||||
|
textutils | [] [] [] [] [] [] [] [] | 16
|
||||||
|
util-linux | [] [] | 4
|
||||||
|
wdiff | [] [] [] [] | 7
|
||||||
|
wget | [] [] [] [] [] [] [] | 17
|
||||||
|
+----------------------------------------------------+
|
||||||
|
33 teams ko lv nb nl nn no pl pt pt_BR ru sk sl sv tr uk zh
|
||||||
|
53 domains 9 1 6 20 0 6 17 1 13 25 10 11 23 21 2 2 387
|
||||||
|
|
||||||
|
Some counters in the preceding matrix are higher than the number of
|
||||||
|
visible blocks let us expect. This is because a few extra PO files are
|
||||||
|
used for implementing regional variants of languages, or language
|
||||||
|
dialects.
|
||||||
|
|
||||||
|
For a PO file in the matrix above to be effective, the package to
|
||||||
|
which it applies should also have been internationalized and
|
||||||
|
distributed as such by its maintainer. There might be an observable
|
||||||
|
lag between the mere existence a PO file and its wide availability in a
|
||||||
|
distribution.
|
||||||
|
|
||||||
|
If September 2001 seems to be old, you may fetch a more recent copy
|
||||||
|
of this `ABOUT-NLS' file on most GNU archive sites. The most
|
||||||
|
up-to-date matrix with full percentage details can be found at
|
||||||
|
`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'.
|
||||||
|
|
||||||
|
Using `gettext' in new packages
|
||||||
|
===============================
|
||||||
|
|
||||||
|
If you are writing a freely available program and want to
|
||||||
|
internationalize it you are welcome to use GNU `gettext' in your
|
||||||
|
package. Of course you have to respect the GNU Library General Public
|
||||||
|
License which covers the use of the GNU `gettext' library. This means
|
||||||
|
in particular that even non-free programs can use `libintl' as a shared
|
||||||
|
library, whereas only free software can use `libintl' as a static
|
||||||
|
library or use modified versions of `libintl'.
|
||||||
|
|
||||||
|
Once the sources are changed appropriately and the setup can handle
|
||||||
|
to use of `gettext' the only thing missing are the translations. The
|
||||||
|
Free Translation Project is also available for packages which are not
|
||||||
|
developed inside the GNU project. Therefore the information given above
|
||||||
|
applies also for every other Free Software Project. Contact
|
||||||
|
`[email protected]' to make the `.pot' files available to
|
||||||
|
the translation teams.
|
||||||
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
Authors of GNU Bison.
|
||||||
|
|
||||||
|
Bison was written primarily by Robert Corbett.
|
||||||
|
|
||||||
|
Richard Stallman made it Yacc-compatible.
|
||||||
|
|
||||||
|
Wilfred Hansen of Carnegie Mellon University added multicharacter
|
||||||
|
string literals and other features.
|
||||||
@@ -0,0 +1,340 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Library General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Library General
|
||||||
|
Public License instead of this License.
|
||||||
+32
@@ -0,0 +1,32 @@
|
|||||||
|
# Having a separate GNUmakefile lets me `include' the dynamically
|
||||||
|
# generated rules created via Makefile.maint as well as Makefile.maint itself.
|
||||||
|
# This makefile is used only if you run GNU Make.
|
||||||
|
# It is necessary if you want to build targets usually of interest
|
||||||
|
# only to the maintainer.
|
||||||
|
|
||||||
|
# Systems where /bin/sh is not the default shell need this. The $(shell)
|
||||||
|
# command below won't work with e.g. stock DOS/Windows shells.
|
||||||
|
SHELL = /bin/sh
|
||||||
|
|
||||||
|
have-Makefile := $(shell test -f Makefile && echo yes)
|
||||||
|
|
||||||
|
# If the user runs GNU make but has not yet run ./configure,
|
||||||
|
# give them a diagnostic.
|
||||||
|
ifeq ($(have-Makefile),yes)
|
||||||
|
|
||||||
|
include Makefile
|
||||||
|
include $(srcdir)/Makefile.maint
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
all:
|
||||||
|
@echo There seems to be no Makefile in this directory.
|
||||||
|
@echo "You must run ./configure before running \`make'."
|
||||||
|
@exit 1
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Tell version 3.79 and up of GNU make to not build goals in this
|
||||||
|
# directory in parallel. This is necessary in case someone tries to
|
||||||
|
# build multiple targets on one command line.
|
||||||
|
.NOTPARALLEL:
|
||||||
@@ -0,0 +1,231 @@
|
|||||||
|
Copyright 1994, 1995, 1996, 1999, 2000, 2001 Free Software Foundation,
|
||||||
|
Inc.
|
||||||
|
|
||||||
|
This file is free documentation; the Free Software Foundation gives
|
||||||
|
unlimited permission to copy, distribute and modify it.
|
||||||
|
|
||||||
|
Basic Installation
|
||||||
|
==================
|
||||||
|
|
||||||
|
These are generic installation instructions.
|
||||||
|
|
||||||
|
The `configure' shell script attempts to guess correct values for
|
||||||
|
various system-dependent variables used during compilation. It uses
|
||||||
|
those values to create a `Makefile' in each directory of the package.
|
||||||
|
It may also create one or more `.h' files containing system-dependent
|
||||||
|
definitions. Finally, it creates a shell script `config.status' that
|
||||||
|
you can run in the future to recreate the current configuration, and a
|
||||||
|
file `config.log' containing compiler output (useful mainly for
|
||||||
|
debugging `configure').
|
||||||
|
|
||||||
|
It can also use an optional file (typically called `config.cache'
|
||||||
|
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
||||||
|
the results of its tests to speed up reconfiguring. (Caching is
|
||||||
|
disabled by default to prevent problems with accidental use of stale
|
||||||
|
cache files.)
|
||||||
|
|
||||||
|
If you need to do unusual things to compile the package, please try
|
||||||
|
to figure out how `configure' could check whether to do them, and mail
|
||||||
|
diffs or instructions to the address given in the `README' so they can
|
||||||
|
be considered for the next release. If you are using the cache, and at
|
||||||
|
some point `config.cache' contains results you don't want to keep, you
|
||||||
|
may remove or edit it.
|
||||||
|
|
||||||
|
The file `configure.ac' (or `configure.in') is used to create
|
||||||
|
`configure' by a program called `autoconf'. You only need
|
||||||
|
`configure.ac' if you want to change it or regenerate `configure' using
|
||||||
|
a newer version of `autoconf'.
|
||||||
|
|
||||||
|
The simplest way to compile this package is:
|
||||||
|
|
||||||
|
1. `cd' to the directory containing the package's source code and type
|
||||||
|
`./configure' to configure the package for your system. If you're
|
||||||
|
using `csh' on an old version of System V, you might need to type
|
||||||
|
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||||
|
`configure' itself.
|
||||||
|
|
||||||
|
Running `configure' takes awhile. While running, it prints some
|
||||||
|
messages telling which features it is checking for.
|
||||||
|
|
||||||
|
2. Type `make' to compile the package.
|
||||||
|
|
||||||
|
3. Optionally, type `make check' to run any self-tests that come with
|
||||||
|
the package.
|
||||||
|
|
||||||
|
4. Type `make install' to install the programs and any data files and
|
||||||
|
documentation.
|
||||||
|
|
||||||
|
5. You can remove the program binaries and object files from the
|
||||||
|
source code directory by typing `make clean'. To also remove the
|
||||||
|
files that `configure' created (so you can compile the package for
|
||||||
|
a different kind of computer), type `make distclean'. There is
|
||||||
|
also a `make maintainer-clean' target, but that is intended mainly
|
||||||
|
for the package's developers. If you use it, you may have to get
|
||||||
|
all sorts of other programs in order to regenerate files that came
|
||||||
|
with the distribution.
|
||||||
|
|
||||||
|
Compilers and Options
|
||||||
|
=====================
|
||||||
|
|
||||||
|
Some systems require unusual options for compilation or linking that
|
||||||
|
the `configure' script does not know about. Run `./configure --help'
|
||||||
|
for details on some of the pertinent environment variables.
|
||||||
|
|
||||||
|
You can give `configure' initial values for variables by setting
|
||||||
|
them in the environment. You can do that on the command line like this:
|
||||||
|
|
||||||
|
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
|
||||||
|
|
||||||
|
*Note Defining Variables::, for more details.
|
||||||
|
|
||||||
|
Compiling For Multiple Architectures
|
||||||
|
====================================
|
||||||
|
|
||||||
|
You can compile the package for more than one kind of computer at the
|
||||||
|
same time, by placing the object files for each architecture in their
|
||||||
|
own directory. To do this, you must use a version of `make' that
|
||||||
|
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||||
|
directory where you want the object files and executables to go and run
|
||||||
|
the `configure' script. `configure' automatically checks for the
|
||||||
|
source code in the directory that `configure' is in and in `..'.
|
||||||
|
|
||||||
|
If you have to use a `make' that does not support the `VPATH'
|
||||||
|
variable, you have to compile the package for one architecture at a
|
||||||
|
time in the source code directory. After you have installed the
|
||||||
|
package for one architecture, use `make distclean' before reconfiguring
|
||||||
|
for another architecture.
|
||||||
|
|
||||||
|
Installation Names
|
||||||
|
==================
|
||||||
|
|
||||||
|
By default, `make install' will install the package's files in
|
||||||
|
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||||
|
installation prefix other than `/usr/local' by giving `configure' the
|
||||||
|
option `--prefix=PATH'.
|
||||||
|
|
||||||
|
You can specify separate installation prefixes for
|
||||||
|
architecture-specific files and architecture-independent files. If you
|
||||||
|
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||||
|
PATH as the prefix for installing programs and libraries.
|
||||||
|
Documentation and other data files will still use the regular prefix.
|
||||||
|
|
||||||
|
In addition, if you use an unusual directory layout you can give
|
||||||
|
options like `--bindir=PATH' to specify different values for particular
|
||||||
|
kinds of files. Run `configure --help' for a list of the directories
|
||||||
|
you can set and what kinds of files go in them.
|
||||||
|
|
||||||
|
If the package supports it, you can cause programs to be installed
|
||||||
|
with an extra prefix or suffix on their names by giving `configure' the
|
||||||
|
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||||
|
|
||||||
|
Optional Features
|
||||||
|
=================
|
||||||
|
|
||||||
|
Some packages pay attention to `--enable-FEATURE' options to
|
||||||
|
`configure', where FEATURE indicates an optional part of the package.
|
||||||
|
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||||
|
is something like `gnu-as' or `x' (for the X Window System). The
|
||||||
|
`README' should mention any `--enable-' and `--with-' options that the
|
||||||
|
package recognizes.
|
||||||
|
|
||||||
|
For packages that use the X Window System, `configure' can usually
|
||||||
|
find the X include and library files automatically, but if it doesn't,
|
||||||
|
you can use the `configure' options `--x-includes=DIR' and
|
||||||
|
`--x-libraries=DIR' to specify their locations.
|
||||||
|
|
||||||
|
Specifying the System Type
|
||||||
|
==========================
|
||||||
|
|
||||||
|
There may be some features `configure' cannot figure out
|
||||||
|
automatically, but needs to determine by the type of host the package
|
||||||
|
will run on. Usually `configure' can figure that out, but if it prints
|
||||||
|
a message saying it cannot guess the host type, give it the
|
||||||
|
`--build=TYPE' option. TYPE can either be a short name for the system
|
||||||
|
type, such as `sun4', or a canonical name which has the form:
|
||||||
|
|
||||||
|
CPU-COMPANY-SYSTEM
|
||||||
|
|
||||||
|
where SYSTEM can have one of these forms:
|
||||||
|
|
||||||
|
OS KERNEL-OS
|
||||||
|
|
||||||
|
See the file `config.sub' for the possible values of each field. If
|
||||||
|
`config.sub' isn't included in this package, then this package doesn't
|
||||||
|
need to know the host type.
|
||||||
|
|
||||||
|
If you are _building_ compiler tools for cross-compiling, you should
|
||||||
|
use the `--target=TYPE' option to select the type of system they will
|
||||||
|
produce code for.
|
||||||
|
|
||||||
|
If you want to _use_ a cross compiler, that generates code for a
|
||||||
|
platform different from the build platform, you should specify the host
|
||||||
|
platform (i.e., that on which the generated programs will eventually be
|
||||||
|
run) with `--host=TYPE'. In this case, you should also specify the
|
||||||
|
build platform with `--build=TYPE', because, in this case, it may not
|
||||||
|
be possible to guess the build platform (it sometimes involves
|
||||||
|
compiling and running simple test programs, and this can't be done if
|
||||||
|
the compiler is a cross compiler).
|
||||||
|
|
||||||
|
Sharing Defaults
|
||||||
|
================
|
||||||
|
|
||||||
|
If you want to set default values for `configure' scripts to share,
|
||||||
|
you can create a site shell script called `config.site' that gives
|
||||||
|
default values for variables like `CC', `cache_file', and `prefix'.
|
||||||
|
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||||
|
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||||
|
`CONFIG_SITE' environment variable to the location of the site script.
|
||||||
|
A warning: not all `configure' scripts look for a site script.
|
||||||
|
|
||||||
|
Defining Variables
|
||||||
|
==================
|
||||||
|
|
||||||
|
Variables not defined in a site shell script can be set in the
|
||||||
|
environment passed to `configure'. However, some packages may run
|
||||||
|
configure again during the build, and the customized values of these
|
||||||
|
variables may be lost. In order to avoid this problem, you should set
|
||||||
|
them in the `configure' command line, using `VAR=value'. For example:
|
||||||
|
|
||||||
|
./configure CC=/usr/local2/bin/gcc
|
||||||
|
|
||||||
|
will cause the specified gcc to be used as the C compiler (unless it is
|
||||||
|
overridden in the site shell script).
|
||||||
|
|
||||||
|
`configure' Invocation
|
||||||
|
======================
|
||||||
|
|
||||||
|
`configure' recognizes the following options to control how it
|
||||||
|
operates.
|
||||||
|
|
||||||
|
`--help'
|
||||||
|
`-h'
|
||||||
|
Print a summary of the options to `configure', and exit.
|
||||||
|
|
||||||
|
`--version'
|
||||||
|
`-V'
|
||||||
|
Print the version of Autoconf used to generate the `configure'
|
||||||
|
script, and exit.
|
||||||
|
|
||||||
|
`--cache-file=FILE'
|
||||||
|
Enable the cache: use and save the results of the tests in FILE,
|
||||||
|
traditionally `config.cache'. FILE defaults to `/dev/null' to
|
||||||
|
disable caching.
|
||||||
|
|
||||||
|
`--config-cache'
|
||||||
|
`-C'
|
||||||
|
Alias for `--cache-file=config.cache'.
|
||||||
|
|
||||||
|
`--quiet'
|
||||||
|
`--silent'
|
||||||
|
`-q'
|
||||||
|
Do not print messages saying which checks are being made. To
|
||||||
|
suppress all normal output, redirect it to `/dev/null' (any error
|
||||||
|
messages will still be shown).
|
||||||
|
|
||||||
|
`--srcdir=DIR'
|
||||||
|
Look for the package's source code in directory DIR. Usually
|
||||||
|
`configure' can determine that directory automatically.
|
||||||
|
|
||||||
|
`configure' also accepts some other, not widely useful, options. Run
|
||||||
|
`configure --help' for more details.
|
||||||
|
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
|
AUTOMAKE_OPTIONS = 1.5 check-news readme-alpha dist-bzip2
|
||||||
|
|
||||||
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
|
SUBDIRS = config intl po lib src doc m4 tests
|
||||||
|
|
||||||
|
EXTRA_DIST = REFERENCES configure.bat OChangeLog Makefile.maint GNUmakefile
|
||||||
|
|
||||||
|
DISTCLEANFILES = intl/libintl.h
|
||||||
|
|
||||||
|
|
||||||
|
## ---------------------------- ##
|
||||||
|
## Customizing Makefile.maint. ##
|
||||||
|
## ---------------------------- ##
|
||||||
|
|
||||||
|
move_if_change = $(srcdir)/config/move-if-change
|
||||||
|
prev_version_file = $(srcdir)/config/prev-version.txt
|
||||||
|
release_archive_dir = releases
|
||||||
|
|
||||||
|
# Uploading betas.
|
||||||
|
hosts = alpha
|
||||||
|
alpha_host = alpha.gnu.org
|
||||||
|
alpha_url_dir = gnu/bison
|
||||||
|
|
||||||
|
# Files to update automatically.
|
||||||
|
wget_files = $(srcdir)/config/config.guess $(srcdir)/config/config.sub \
|
||||||
|
$(srcdir)/config/texinfo.tex
|
||||||
|
|
||||||
|
cvs_files = $(srcdir)/config/missing
|
||||||
+425
-168
@@ -1,200 +1,457 @@
|
|||||||
# Makefile for bison
|
# Makefile.in generated by automake 1.5a from Makefile.am.
|
||||||
# Copyright (C) 1988, 1989, 1991, 1993 Bob Corbett and Free Software Foundation, Inc.
|
# @configure_input@
|
||||||
#
|
|
||||||
# This file is part of Bison, the GNU Compiler Compiler.
|
|
||||||
#
|
|
||||||
# Bison is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# Bison is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Bison; see the file COPYING. If not, write to
|
|
||||||
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
|
|
||||||
#### Start of system configuration section. ####
|
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||||
|
# Free Software Foundation, Inc.
|
||||||
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
# with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
@SET_MAKE@
|
||||||
|
|
||||||
|
SHELL = @SHELL@
|
||||||
|
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
|
top_srcdir = @top_srcdir@
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
|
|
||||||
CC = @CC@
|
|
||||||
INSTALL = @INSTALL@
|
|
||||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
|
||||||
INSTALL_DATA = @INSTALL_DATA@
|
|
||||||
MAKEINFO = makeinfo
|
|
||||||
|
|
||||||
# Things you might add to DEFS:
|
|
||||||
# -DSTDC_HEADERS If you have ANSI C headers and libraries.
|
|
||||||
# -DHAVE_STRING_H If you don't have ANSI C headers but have string.h.
|
|
||||||
# -DHAVE_MEMORY_H If you don't have ANSI C headers and have memory.h.
|
|
||||||
# -DHAVE_STRERROR If you have strerror function.
|
|
||||||
DEFS = @DEFS@
|
|
||||||
|
|
||||||
CFLAGS = @CFLAGS@
|
|
||||||
LDFLAGS = @LDFLAGS@
|
|
||||||
|
|
||||||
LIBS = @LIBS@
|
|
||||||
|
|
||||||
# Some System V machines do not come with libPW. If this is true, use
|
|
||||||
# the GNU alloca.o here.
|
|
||||||
ALLOCA = @ALLOCA@
|
|
||||||
|
|
||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
exec_prefix = @exec_prefix@
|
exec_prefix = @exec_prefix@
|
||||||
|
|
||||||
# where the installed binary goes
|
bindir = @bindir@
|
||||||
bindir = $(exec_prefix)/bin
|
sbindir = @sbindir@
|
||||||
|
libexecdir = @libexecdir@
|
||||||
|
datadir = @datadir@
|
||||||
|
sysconfdir = @sysconfdir@
|
||||||
|
sharedstatedir = @sharedstatedir@
|
||||||
|
localstatedir = @localstatedir@
|
||||||
|
libdir = @libdir@
|
||||||
|
infodir = @infodir@
|
||||||
|
mandir = @mandir@
|
||||||
|
includedir = @includedir@
|
||||||
|
oldincludedir = /usr/include
|
||||||
|
pkgdatadir = $(datadir)/@PACKAGE@
|
||||||
|
pkglibdir = $(libdir)/@PACKAGE@
|
||||||
|
pkgincludedir = $(includedir)/@PACKAGE@
|
||||||
|
top_builddir = .
|
||||||
|
|
||||||
# where the parsers go
|
ACLOCAL = @ACLOCAL@
|
||||||
datadir = $(prefix)/share
|
AUTOCONF = @AUTOCONF@
|
||||||
|
AUTOMAKE = @AUTOMAKE@
|
||||||
|
AUTOHEADER = @AUTOHEADER@
|
||||||
|
|
||||||
# where the info files go
|
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||||
infodir = $(prefix)/info
|
INSTALL = @INSTALL@
|
||||||
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
|
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||||
|
INSTALL_HEADER = $(INSTALL_DATA)
|
||||||
|
transform = @program_transform_name@
|
||||||
|
NORMAL_INSTALL = :
|
||||||
|
PRE_INSTALL = :
|
||||||
|
POST_INSTALL = :
|
||||||
|
NORMAL_UNINSTALL = :
|
||||||
|
PRE_UNINSTALL = :
|
||||||
|
POST_UNINSTALL = :
|
||||||
|
host_alias = @host_alias@
|
||||||
|
host_triplet = @host@
|
||||||
|
|
||||||
# where manual pages go and what their extensions should be
|
EXEEXT = @EXEEXT@
|
||||||
mandir = $(prefix)/man/man$(manext)
|
OBJEXT = @OBJEXT@
|
||||||
manext = 1
|
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||||
|
AMTAR = @AMTAR@
|
||||||
|
AUTOM4TE = @AUTOM4TE@
|
||||||
|
AWK = @AWK@
|
||||||
|
BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
|
||||||
|
CATALOGS = @CATALOGS@
|
||||||
|
CATOBJEXT = @CATOBJEXT@
|
||||||
|
CC = @CC@
|
||||||
|
CPP = @CPP@
|
||||||
|
DATADIRNAME = @DATADIRNAME@
|
||||||
|
DEPDIR = @DEPDIR@
|
||||||
|
GCC = @GCC@
|
||||||
|
GENCAT = @GENCAT@
|
||||||
|
GLIBC21 = @GLIBC21@
|
||||||
|
GMOFILES = @GMOFILES@
|
||||||
|
GMSGFMT = @GMSGFMT@
|
||||||
|
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||||
|
INSTOBJEXT = @INSTOBJEXT@
|
||||||
|
INTLBISON = @INTLBISON@
|
||||||
|
INTLLIBS = @INTLLIBS@
|
||||||
|
INTLOBJS = @INTLOBJS@
|
||||||
|
INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
|
||||||
|
LIB = @LIB@
|
||||||
|
LIBICONV = @LIBICONV@
|
||||||
|
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||||
|
MSGFMT = @MSGFMT@
|
||||||
|
PACKAGE = @PACKAGE@
|
||||||
|
POFILES = @POFILES@
|
||||||
|
POSUB = @POSUB@
|
||||||
|
RANLIB = @RANLIB@
|
||||||
|
U = @U@
|
||||||
|
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||||
|
USE_NLS = @USE_NLS@
|
||||||
|
VERSION = @VERSION@
|
||||||
|
WARNING_CFLAGS = @WARNING_CFLAGS@
|
||||||
|
am__include = @am__include@
|
||||||
|
am__quote = @am__quote@
|
||||||
|
install_sh = @install_sh@
|
||||||
|
|
||||||
# hope this works on non-gnu makes.
|
AUTOMAKE_OPTIONS = 1.5 check-news readme-alpha dist-bzip2
|
||||||
bison_version = `sed -e '/version_string/!d' -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q version.c`
|
|
||||||
|
|
||||||
#### End of system configuration section. ####
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
DISTFILES = COPYING ChangeLog Makefile.in configure configure.in \
|
SUBDIRS = config intl po lib src doc m4 tests
|
||||||
REFERENCES bison.1 bison.rnh configure.bat \
|
|
||||||
bison.simple bison.hairy \
|
EXTRA_DIST = REFERENCES configure.bat OChangeLog Makefile.maint GNUmakefile
|
||||||
LR0.c allocate.c closure.c conflicts.c derives.c \
|
|
||||||
files.c getargs.c gram.c lalr.c lex.c main.c nullable.c \
|
DISTCLEANFILES = intl/libintl.h
|
||||||
output.c print.c reader.c reduce.c symtab.c version.c \
|
|
||||||
warshall.c files.h gram.h lex.h machine.h alloc.h state.h \
|
move_if_change = $(srcdir)/config/move-if-change
|
||||||
symtab.h system.h types.h bison.cld build.com vmsgetargs.c \
|
prev_version_file = $(srcdir)/config/prev-version.txt
|
||||||
vmshlp.mar README INSTALL NEWS bison.texinfo bison.info* texinfo.tex \
|
release_archive_dir = releases
|
||||||
getopt.c getopt.h getopt1.c alloca.c mkinstalldirs install-sh
|
|
||||||
|
# Uploading betas.
|
||||||
|
hosts = alpha
|
||||||
|
alpha_host = alpha.gnu.org
|
||||||
|
alpha_url_dir = gnu/bison
|
||||||
|
|
||||||
|
# Files to update automatically.
|
||||||
|
wget_files = $(srcdir)/config/config.guess $(srcdir)/config/config.sub \
|
||||||
|
$(srcdir)/config/texinfo.tex
|
||||||
|
|
||||||
|
|
||||||
SHELL = /bin/sh
|
cvs_files = $(srcdir)/config/missing
|
||||||
|
subdir = .
|
||||||
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
|
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
|
||||||
|
CONFIG_HEADER = config.h
|
||||||
|
CONFIG_CLEAN_FILES = intl/Makefile
|
||||||
|
DIST_SOURCES =
|
||||||
|
|
||||||
# This rule allows us to supply the necessary -D options
|
RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
|
||||||
# in addition to whatever the user asks for.
|
uninstall-info-recursive all-recursive install-data-recursive \
|
||||||
.c.o:
|
install-exec-recursive installdirs-recursive install-recursive \
|
||||||
$(CC) -c $(DEFS) -I$(srcdir)/../include $(CPPFLAGS) $(CFLAGS) $<
|
uninstall-recursive check-recursive installcheck-recursive
|
||||||
|
DIST_COMMON = README ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL \
|
||||||
|
Makefile.am Makefile.in NEWS README-alpha THANKS aclocal.m4 \
|
||||||
|
config.hin configure configure.in
|
||||||
|
DIST_SUBDIRS = $(SUBDIRS)
|
||||||
|
all: config.h
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||||
|
|
||||||
# names of parser files
|
.SUFFIXES:
|
||||||
PFILE = bison.simple
|
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||||
PFILE1 = bison.hairy
|
cd $(top_srcdir) && \
|
||||||
|
$(AUTOMAKE) --gnu Makefile
|
||||||
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
|
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||||
|
|
||||||
PFILES = -DXPFILE=\"$(datadir)/$(PFILE)\" \
|
$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||||
-DXPFILE1=\"$(datadir)/$(PFILE1)\"
|
$(SHELL) ./config.status --recheck
|
||||||
|
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||||
|
cd $(srcdir) && $(AUTOCONF)
|
||||||
|
|
||||||
OBJECTS = LR0.o allocate.o closure.o conflicts.o derives.o files.o \
|
$(ACLOCAL_M4): configure.in m4/c-bs-a.m4 m4/codeset.m4 m4/dmalloc.m4 m4/error.m4 m4/gettext.m4 m4/glibc21.m4 m4/iconv.m4 m4/isc-posix.m4 m4/lcmessage.m4 m4/malloc.m4 m4/mbrtowc.m4 m4/mbstate_t.m4 m4/prereq.m4 m4/progtest.m4 m4/realloc.m4 m4/strerror_r.m4 m4/warning.m4
|
||||||
getargs.o gram.o lalr.o lex.o \
|
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||||
main.o nullable.o output.o print.o reader.o reduce.o symtab.o \
|
|
||||||
warshall.o version.o \
|
|
||||||
getopt.o getopt1.o $(ALLOCA)
|
|
||||||
|
|
||||||
all: bison bison.info bison.s1
|
config.h: stamp-h1
|
||||||
|
@if test ! -f $@; then \
|
||||||
|
rm -f stamp-h1; \
|
||||||
|
$(MAKE) stamp-h1; \
|
||||||
|
else :; fi
|
||||||
|
|
||||||
Makefile: config.status Makefile.in
|
stamp-h1: $(srcdir)/config.hin $(top_builddir)/config.status
|
||||||
CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
|
@rm -f stamp-h1
|
||||||
|
cd $(top_builddir) && $(SHELL) ./config.status config.h
|
||||||
|
|
||||||
config.status: configure
|
$(srcdir)/config.hin: $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||||
./config.status --recheck
|
cd $(top_srcdir) && $(AUTOHEADER)
|
||||||
|
touch $(srcdir)/config.hin
|
||||||
|
|
||||||
configure: configure.in
|
distclean-hdr:
|
||||||
cd $(srcdir) && autoconf
|
-rm -f config.h
|
||||||
|
intl/Makefile: $(top_builddir)/config.status $(top_srcdir)/intl/Makefile.in
|
||||||
|
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||||
|
uninstall-info-am:
|
||||||
|
|
||||||
# Copy bison.simple, inserting directory name into the #line commands.
|
# This directory's subdirectories are mostly independent; you can cd
|
||||||
bison.s1: bison.simple
|
# into them and run `make' without going through this Makefile.
|
||||||
-rm -f bison.s1
|
# To change the values of `make' variables: instead of editing Makefiles,
|
||||||
sed -e "/^#line/ s|bison|$(datadir)/bison|" -e "s/@bison_version@/$(bison_version)/" < $(srcdir)/$(PFILE) > $@-tmp
|
# (1) if the variable is set in `config.status', edit `config.status'
|
||||||
mv $@-tmp $@
|
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||||
|
# (2) otherwise, pass the desired values on the `make' command line.
|
||||||
|
$(RECURSIVE_TARGETS):
|
||||||
|
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||||
|
dot_seen=no; \
|
||||||
|
target=`echo $@ | sed s/-recursive//`; \
|
||||||
|
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||||
|
echo "Making $$target in $$subdir"; \
|
||||||
|
if test "$$subdir" = "."; then \
|
||||||
|
dot_seen=yes; \
|
||||||
|
local_target="$$target-am"; \
|
||||||
|
else \
|
||||||
|
local_target="$$target"; \
|
||||||
|
fi; \
|
||||||
|
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||||
|
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||||
|
done; \
|
||||||
|
if test "$$dot_seen" = "no"; then \
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||||
|
fi; test -z "$$fail"
|
||||||
|
|
||||||
clean:
|
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||||
rm -f *.o core bison bison.s1 config.status config.log
|
maintainer-clean-recursive:
|
||||||
|
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||||
mostlyclean: clean
|
dot_seen=no; \
|
||||||
|
case "$@" in \
|
||||||
distclean: clean
|
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||||
rm -f Makefile
|
*) list='$(SUBDIRS)' ;; \
|
||||||
|
esac; \
|
||||||
realclean: distclean
|
rev=''; for subdir in $$list; do \
|
||||||
rm -f TAGS *.info*
|
if test "$$subdir" = "."; then :; else \
|
||||||
|
rev="$$subdir $$rev"; \
|
||||||
# Most of these deps are in case using RCS.
|
fi; \
|
||||||
install: all bison.1 $(srcdir)/$(PFILE) $(srcdir)/$(PFILE1) installdirs uninstall
|
done; \
|
||||||
$(INSTALL_PROGRAM) bison $(bindir)/bison
|
rev="$$rev ."; \
|
||||||
$(INSTALL_DATA) bison.s1 $(datadir)/$(PFILE)
|
target=`echo $@ | sed s/-recursive//`; \
|
||||||
$(INSTALL_DATA) $(srcdir)/$(PFILE1) $(datadir)/$(PFILE1)
|
for subdir in $$rev; do \
|
||||||
cd $(srcdir); for f in bison.info*; \
|
echo "Making $$target in $$subdir"; \
|
||||||
do $(INSTALL_DATA) $$f $(infodir)/$$f; done
|
if test "$$subdir" = "."; then \
|
||||||
-$(INSTALL_DATA) $(srcdir)/bison.1 $(mandir)/bison.$(manext)
|
local_target="$$target-am"; \
|
||||||
|
else \
|
||||||
# Make sure all installation directories, e.g. $(bindir) actually exist by
|
local_target="$$target"; \
|
||||||
# making them if necessary.
|
fi; \
|
||||||
installdirs:
|
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||||
-sh $(srcdir)/mkinstalldirs $(bindir) $(datadir) $(libdir) $(infodir) $(mandir)
|
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||||
|
done && test -z "$$fail"
|
||||||
uninstall:
|
tags-recursive:
|
||||||
rm -f $(bindir)/bison
|
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||||
-cd $(datadir); rm -f $(PFILE) $(PFILE1)
|
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||||
rm -f $(mandir)/bison.$(manext) $(infodir)/bison.info*
|
|
||||||
|
|
||||||
check:
|
|
||||||
@echo "No checks implemented (yet)."
|
|
||||||
|
|
||||||
bison: $(OBJECTS)
|
|
||||||
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJECTS) $(LIBS)
|
|
||||||
|
|
||||||
# We don't use $(srcdir) in this rule
|
|
||||||
# because it is normally used in the master source dir
|
|
||||||
# in which configure has not been run.
|
|
||||||
dist: bison.info
|
|
||||||
echo bison-$(bison_version) > .fname
|
|
||||||
-rm -rf `cat .fname`
|
|
||||||
mkdir `cat .fname`
|
|
||||||
dst=`cat .fname`; for f in $(DISTFILES); do \
|
|
||||||
if test -L $$f; then \
|
|
||||||
cp $$f $$dst/$$f; chmod a-w $$dst/$$f; \
|
|
||||||
else \
|
|
||||||
ln $$f $$dst/$$f; \
|
|
||||||
fi \
|
|
||||||
done
|
done
|
||||||
tar --gzip -chf `cat .fname`.tar.gz `cat .fname`
|
|
||||||
-rm -rf `cat .fname` .fname
|
|
||||||
|
|
||||||
bison.info: bison.texinfo
|
tags: TAGS
|
||||||
$(MAKEINFO) $(srcdir)/bison.texinfo
|
|
||||||
|
|
||||||
TAGS: *.c *.h
|
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||||
etags *.c *.h
|
list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
|
||||||
|
unique=`for i in $$list; do \
|
||||||
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
|
done | \
|
||||||
|
$(AWK) ' { files[$$0] = 1; } \
|
||||||
|
END { for (i in files) print i; }'`; \
|
||||||
|
mkid -fID $$unique $(LISP)
|
||||||
|
|
||||||
# This file is different to pass the parser file names to the compiler.
|
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.hin $(TAGS_DEPENDENCIES) \
|
||||||
files.o: files.c
|
$(TAGS_FILES) $(LISP)
|
||||||
$(CC) -c $(PFILES) $(DEFS) $(CPPFLAGS) $(CFLAGS) \
|
tags=; \
|
||||||
$(srcdir)/files.c $(OUTPUT_OPTION)
|
here=`pwd`; \
|
||||||
|
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||||
|
if test "$$subdir" = .; then :; else \
|
||||||
|
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||||
|
fi; \
|
||||||
|
done; \
|
||||||
|
list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
|
||||||
|
unique=`for i in $$list; do \
|
||||||
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
|
done | \
|
||||||
|
$(AWK) ' { files[$$0] = 1; } \
|
||||||
|
END { for (i in files) print i; }'`; \
|
||||||
|
test -z "$(ETAGS_ARGS)config.hin$$unique$(LISP)$$tags" \
|
||||||
|
|| etags $(ETAGS_ARGS) $$tags config.hin $$unique $(LISP)
|
||||||
|
|
||||||
LR0.o: system.h machine.h alloc.h gram.h state.h
|
GTAGS:
|
||||||
allocate.o: system.h
|
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||||
closure.o: system.h machine.h alloc.h gram.h
|
&& cd $(top_srcdir) \
|
||||||
conflicts.o: system.h machine.h alloc.h files.h gram.h state.h
|
&& gtags -i $(GTAGS_ARGS) $$here
|
||||||
derives.o: system.h alloc.h types.h gram.h
|
|
||||||
files.o: system.h files.h alloc.h gram.h
|
|
||||||
getargs.o: system.h files.h
|
|
||||||
lalr.o: system.h machine.h types.h state.h alloc.h gram.h
|
|
||||||
lex.o: system.h files.h symtab.h lex.h
|
|
||||||
main.o: system.h machine.h
|
|
||||||
nullable.o: system.h types.h gram.h alloc.h
|
|
||||||
output.o: system.h machine.h alloc.h files.h gram.h state.h
|
|
||||||
print.o: system.h machine.h alloc.h files.h gram.h state.h
|
|
||||||
reader.o: system.h files.h alloc.h symtab.h lex.h gram.h
|
|
||||||
reduce.o: system.h machine.h files.h alloc.h gram.h
|
|
||||||
symtab.o: system.h alloc.h symtab.h gram.h
|
|
||||||
warshall.o: system.h machine.h
|
|
||||||
|
|
||||||
# Prevent GNU make v3 from overflowing arg limit on SysV.
|
distclean-tags:
|
||||||
|
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
|
||||||
|
|
||||||
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
|
||||||
|
top_distdir = .
|
||||||
|
# Avoid unsightly `./'.
|
||||||
|
distdir = $(PACKAGE)-$(VERSION)
|
||||||
|
|
||||||
|
GZIP_ENV = --best
|
||||||
|
|
||||||
|
distdir: $(DISTFILES)
|
||||||
|
@if sed 15q $(srcdir)/NEWS | fgrep -e "$(VERSION)" >/dev/null; \
|
||||||
|
then :; else \
|
||||||
|
echo "NEWS not updated; not releasing" 1>&2; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
|
||||||
|
mkdir $(distdir)
|
||||||
|
$(mkinstalldirs) $(distdir)/intl $(distdir)/po $(distdir)/tests
|
||||||
|
@for file in $(DISTFILES); do \
|
||||||
|
if test -f $$file; then d=.; else d=$(srcdir); fi; \
|
||||||
|
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||||
|
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||||
|
$(mkinstalldirs) "$(distdir)/$$dir"; \
|
||||||
|
fi; \
|
||||||
|
if test -d $$d/$$file; then \
|
||||||
|
cp -pR $$d/$$file $(distdir) \
|
||||||
|
|| exit 1; \
|
||||||
|
else \
|
||||||
|
test -f $(distdir)/$$file \
|
||||||
|
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||||
|
|| exit 1; \
|
||||||
|
fi; \
|
||||||
|
done
|
||||||
|
for subdir in $(SUBDIRS); do \
|
||||||
|
if test "$$subdir" = .; then :; else \
|
||||||
|
test -d $(distdir)/$$subdir \
|
||||||
|
|| mkdir $(distdir)/$$subdir \
|
||||||
|
|| exit 1; \
|
||||||
|
(cd $$subdir && \
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) \
|
||||||
|
top_distdir="$(top_distdir)" \
|
||||||
|
distdir=../$(distdir)/$$subdir \
|
||||||
|
distdir) \
|
||||||
|
|| exit 1; \
|
||||||
|
fi; \
|
||||||
|
done
|
||||||
|
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
|
||||||
|
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||||
|
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||||
|
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|
||||||
|
|| chmod -R a+r $(distdir)
|
||||||
|
dist-gzip: distdir
|
||||||
|
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||||
|
-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
|
||||||
|
|
||||||
|
dist-bzip2: distdir
|
||||||
|
$(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2
|
||||||
|
-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
|
||||||
|
|
||||||
|
dist dist-all: distdir
|
||||||
|
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||||
|
$(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2
|
||||||
|
-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
|
||||||
|
|
||||||
|
# This target untars the dist file and tries a VPATH configuration. Then
|
||||||
|
# it guarantees that the distribution is self-contained by making another
|
||||||
|
# tarfile.
|
||||||
|
distcheck: dist
|
||||||
|
-chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
|
||||||
|
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
|
||||||
|
chmod -R a-w $(distdir); chmod a+w $(distdir)
|
||||||
|
mkdir $(distdir)/=build
|
||||||
|
mkdir $(distdir)/=inst
|
||||||
|
chmod a-w $(distdir)
|
||||||
|
dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \
|
||||||
|
&& cd $(distdir)/=build \
|
||||||
|
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
|
||||||
|
--with-included-gettext \
|
||||||
|
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||||
|
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||||
|
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||||
|
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||||
|
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||||
|
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||||
|
&& (test `find $$dc_install_base -type f -print | wc -l` -le 1 \
|
||||||
|
|| { echo "ERROR: files left after uninstall:" ; \
|
||||||
|
find $$dc_install_base -type f -print ; \
|
||||||
|
exit 1; } >&2 ) \
|
||||||
|
&& $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
|
||||||
|
&& $(MAKE) $(AM_MAKEFLAGS) distclean \
|
||||||
|
&& rm -f $(distdir).tar.gz \
|
||||||
|
&& (test `find . -type f -print | wc -l` -eq 0 \
|
||||||
|
|| { echo "ERROR: files left after distclean:" ; \
|
||||||
|
find . -type f -print ; \
|
||||||
|
exit 1; } >&2 )
|
||||||
|
-chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
|
||||||
|
@echo "$(distdir).tar.gz is ready for distribution" | \
|
||||||
|
sed 'h;s/./=/g;p;x;p;x'
|
||||||
|
check-am: all-am
|
||||||
|
check: check-recursive
|
||||||
|
all-am: Makefile config.h
|
||||||
|
installdirs: installdirs-recursive
|
||||||
|
installdirs-am:
|
||||||
|
|
||||||
|
install: install-recursive
|
||||||
|
install-exec: install-exec-recursive
|
||||||
|
install-data: install-data-recursive
|
||||||
|
uninstall: uninstall-recursive
|
||||||
|
|
||||||
|
install-am: all-am
|
||||||
|
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||||
|
|
||||||
|
installcheck: installcheck-recursive
|
||||||
|
install-strip:
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||||
|
`test -z '$(STRIP)' || \
|
||||||
|
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||||
|
mostlyclean-generic:
|
||||||
|
|
||||||
|
clean-generic:
|
||||||
|
|
||||||
|
distclean-generic:
|
||||||
|
-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
|
||||||
|
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
|
||||||
|
|
||||||
|
maintainer-clean-generic:
|
||||||
|
@echo "This command is intended for maintainers to use"
|
||||||
|
@echo "it deletes files that may require special tools to rebuild."
|
||||||
|
clean: clean-recursive
|
||||||
|
|
||||||
|
clean-am: clean-generic mostlyclean-am
|
||||||
|
|
||||||
|
distclean: distclean-recursive
|
||||||
|
-rm -f config.status config.cache config.log
|
||||||
|
distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
|
||||||
|
|
||||||
|
dvi: dvi-recursive
|
||||||
|
|
||||||
|
dvi-am:
|
||||||
|
|
||||||
|
info: info-recursive
|
||||||
|
|
||||||
|
info-am:
|
||||||
|
|
||||||
|
install-data-am:
|
||||||
|
|
||||||
|
install-exec-am:
|
||||||
|
|
||||||
|
install-info: install-info-recursive
|
||||||
|
|
||||||
|
install-man:
|
||||||
|
|
||||||
|
installcheck-am:
|
||||||
|
|
||||||
|
maintainer-clean: maintainer-clean-recursive
|
||||||
|
|
||||||
|
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||||
|
|
||||||
|
mostlyclean: mostlyclean-recursive
|
||||||
|
|
||||||
|
mostlyclean-am: mostlyclean-generic
|
||||||
|
|
||||||
|
uninstall-am: uninstall-info-am
|
||||||
|
|
||||||
|
uninstall-info: uninstall-info-recursive
|
||||||
|
|
||||||
|
.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
|
||||||
|
clean-generic clean-recursive dist dist-all dist-bzip2 \
|
||||||
|
dist-gzip distcheck distclean distclean-generic distclean-hdr \
|
||||||
|
distclean-recursive distclean-tags distdir dvi dvi-am \
|
||||||
|
dvi-recursive info info-am info-recursive install install-am \
|
||||||
|
install-data install-data-am install-data-recursive \
|
||||||
|
install-exec install-exec-am install-exec-recursive \
|
||||||
|
install-info install-info-am install-info-recursive install-man \
|
||||||
|
install-recursive install-strip installcheck installcheck-am \
|
||||||
|
installdirs installdirs-am installdirs-recursive \
|
||||||
|
maintainer-clean maintainer-clean-generic \
|
||||||
|
maintainer-clean-recursive mostlyclean mostlyclean-generic \
|
||||||
|
mostlyclean-recursive tags tags-recursive uninstall \
|
||||||
|
uninstall-am uninstall-info-am uninstall-info-recursive \
|
||||||
|
uninstall-recursive
|
||||||
|
|
||||||
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||||
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
.NOEXPORT:
|
.NOEXPORT:
|
||||||
|
|||||||
+346
@@ -0,0 +1,346 @@
|
|||||||
|
# -*-Makefile-*-
|
||||||
|
# This Makefile fragment is shared between fileutils, sh-utils, textutils,
|
||||||
|
# CPPI, Bison, and Autoconf.
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
||||||
|
# Do not save the original name or timestamp in the .tar.gz file.
|
||||||
|
GZIP_ENV = '--no-name --best'
|
||||||
|
|
||||||
|
CVS = cvs
|
||||||
|
|
||||||
|
prev_version_file ?= .prev-version
|
||||||
|
|
||||||
|
THIS_VERSION_REGEXP = $(subst .,\.,$(VERSION))
|
||||||
|
PREV_VERSION := $(shell cat $(prev_version_file))
|
||||||
|
PREV_VERSION_REGEXP := $(shell echo $(PREV_VERSION)|sed 's/\./\\./g')
|
||||||
|
|
||||||
|
tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
|
||||||
|
tag-this-version = $(subst .,_,$(VERSION))
|
||||||
|
tag-prev-version = $(subst .,_,$(PREV_VERSION))
|
||||||
|
this-cvs-tag = $(tag-package)-$(tag-this-version)
|
||||||
|
prev-cvs-tag = $(tag-package)-$(tag-prev-version)
|
||||||
|
my_distdir = $(PACKAGE)-$(VERSION)
|
||||||
|
|
||||||
|
# Old releases are stored here.
|
||||||
|
# Used for diffs and xdeltas.
|
||||||
|
release_archive_dir ?= ../release
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## ---------------- ##
|
||||||
|
## Updating files. ##
|
||||||
|
## ---------------- ##
|
||||||
|
|
||||||
|
WGET = wget
|
||||||
|
ftp-gnu = ftp://ftp.gnu.org/gnu
|
||||||
|
|
||||||
|
# Use mv, if you don't have/want move-if-change.
|
||||||
|
move_if_change ?= move-if-change
|
||||||
|
|
||||||
|
# ------------------- #
|
||||||
|
# Updating PO files. #
|
||||||
|
# ------------------- #
|
||||||
|
|
||||||
|
po_repo = http://www.iro.umontreal.ca/contrib/po/maint/$(PACKAGE)
|
||||||
|
.PHONY: do-po-update po-update
|
||||||
|
do-po-update:
|
||||||
|
tmppo=/tmp/$(PACKAGE)-$(VERSION)-po &&\
|
||||||
|
rm -rf $$tmppo && \
|
||||||
|
mkdir $$tmppo && \
|
||||||
|
(cd $$tmppo && $(WGET) -r -l1 -nd --no-parent -A '*.po' $(po_repo)) &&\
|
||||||
|
cp $$tmppo/*.po po
|
||||||
|
cd po && $(MAKE) update-po
|
||||||
|
$(MAKE) po-check
|
||||||
|
|
||||||
|
po-update:
|
||||||
|
if test -d "po"; then \
|
||||||
|
$(MAKE) do-po-update; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# -------------------------- #
|
||||||
|
# Updating GNU build tools. #
|
||||||
|
# -------------------------- #
|
||||||
|
|
||||||
|
# The following pseudo table associates a local directory and a URL
|
||||||
|
# with each of the files that belongs to some other package and is
|
||||||
|
# regularly updated from the specified URL.
|
||||||
|
wget_files ?= $(srcdir)/config.guess $(srcdir)/config.sub \
|
||||||
|
$(srcdir)/src/ansi2knr.c \
|
||||||
|
$(srcdir)/doc/texinfo.tex
|
||||||
|
wget-targets = $(patsubst %, get-%, $(wget_files))
|
||||||
|
|
||||||
|
config.guess-url_prefix = $(ftp-gnu)/config/
|
||||||
|
config.sub-url_prefix = $(ftp-gnu)/config/
|
||||||
|
|
||||||
|
ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
|
||||||
|
|
||||||
|
texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
|
||||||
|
|
||||||
|
standards.texi-url_prefix = $(ftp-gnu)/GNUinfo/
|
||||||
|
make-stds.texi-url_prefix = $(ftp-gnu)/GNUinfo/
|
||||||
|
|
||||||
|
target = $(patsubst get-%, %, $@)
|
||||||
|
url = $($(notdir $(target))-url_prefix)$(notdir $(target))
|
||||||
|
|
||||||
|
.PHONY: $(wget-targets)
|
||||||
|
$(wget-targets):
|
||||||
|
$(WGET) $(url) -O $(target).t \
|
||||||
|
&& $(move_if_change) $(target).t $(target)
|
||||||
|
|
||||||
|
.PHONY: wget-update
|
||||||
|
wget-update: $(wget-targets)
|
||||||
|
|
||||||
|
|
||||||
|
# Updating tools via CVS.
|
||||||
|
cvs_files ?= depcomp missing
|
||||||
|
cvs-targets = $(patsubst %, get-%, $(cvs_files))
|
||||||
|
|
||||||
|
automake_repo = :pserver:[email protected]:/cvs/automake
|
||||||
|
.PHONY: $(cvs-targets)
|
||||||
|
$(cvs-targets):
|
||||||
|
$(CVS) -d $(automake_repo) co -p automake/lib/$(notdir $(target)) \
|
||||||
|
>$(target).t \
|
||||||
|
&& $(move_if_change) $(target).t $(target);
|
||||||
|
|
||||||
|
.PHONY: cvs-update
|
||||||
|
cvs-update: $(cvs-targets)
|
||||||
|
|
||||||
|
|
||||||
|
# --------------------- #
|
||||||
|
# Updating everything. #
|
||||||
|
# --------------------- #
|
||||||
|
|
||||||
|
.PHONY: update
|
||||||
|
update: wget-update cvs-update po-update
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## --------------- ##
|
||||||
|
## Sanity checks. ##
|
||||||
|
## --------------- ##
|
||||||
|
|
||||||
|
# Checks that don't require cvs. Run `changelog-check' last as
|
||||||
|
# previous test may reveal problems requiring new ChangeLog entries.
|
||||||
|
local-check: po-check copyright-check writable-files changelog-check
|
||||||
|
|
||||||
|
changelog-check:
|
||||||
|
if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
|
||||||
|
:; \
|
||||||
|
else \
|
||||||
|
echo "$(VERSION) not in ChangeLog" 1>&2; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Verify that all source files using _() are listed in po/POTFILES.in.
|
||||||
|
po-check:
|
||||||
|
if test -f po/POTFILES.in; then \
|
||||||
|
grep -E -v '^(#|$$)' po/POTFILES.in | sort > $@-1; \
|
||||||
|
grep -E -l '\b_\(' lib/*.c src/*.c | sort > $@-2; \
|
||||||
|
diff -u $@-1 $@-2 || exit 1; \
|
||||||
|
rm -f $@-1 $@-2; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check that `make alpha' will not fail at the end of the process.
|
||||||
|
writable-files:
|
||||||
|
if test -d $(release_archive_dir); then :; else \
|
||||||
|
mkdir $(release_archive_dir); \
|
||||||
|
fi
|
||||||
|
for file in $(distdir).tar.gz $(xd-delta) \
|
||||||
|
$(release_archive_dir)/$(distdir).tar.gz \
|
||||||
|
$(release_archive_dir)/$(xd-delta); do \
|
||||||
|
test -e $$file || continue; \
|
||||||
|
test -w $$file \
|
||||||
|
|| { echo ERROR: $$file is not writable; fail=1; }; \
|
||||||
|
done; \
|
||||||
|
test "$$fail" && exit 1 || :
|
||||||
|
|
||||||
|
# Make sure that the copyright date in lib/version-etc.c is up to date.
|
||||||
|
copyright-check:
|
||||||
|
@if test -f lib/version-etc.c; then \
|
||||||
|
grep 'N_("Copyright (C) $(shell date +%Y) Free' lib/version-etc.c \
|
||||||
|
>/dev/null \
|
||||||
|
|| { echo 'out of date copyright in $<; update it' 1>&2; exit 1; }; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Sanity checks with the CVS repository.
|
||||||
|
cvs-tag-check:
|
||||||
|
echo $(this-cvs-tag); \
|
||||||
|
if $(CVS) -n log -h README | grep -e $(this-cvs-tag): >/dev/null; then \
|
||||||
|
echo "$(this-cvs-tag) as already been used; not tagging" 1>&2; \
|
||||||
|
exit 1; \
|
||||||
|
else :; fi
|
||||||
|
|
||||||
|
cvs-diff-check:
|
||||||
|
if $(CVS) diff >cvs-diffs; then \
|
||||||
|
rm cvs-diffs; \
|
||||||
|
else \
|
||||||
|
echo "Some files are locally modified:" 1>&2; \
|
||||||
|
cat cvs-diffs; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
cvs-check: cvs-diff-check cvs-tag-check
|
||||||
|
|
||||||
|
maintainer-distcheck: changelog-check
|
||||||
|
$(MAKE) distcheck
|
||||||
|
$(MAKE) my-distcheck
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## -------------- ##
|
||||||
|
## Making dists. ##
|
||||||
|
## -------------- ##
|
||||||
|
|
||||||
|
|
||||||
|
# Tag before making distribution. Also, don't make a distribution if
|
||||||
|
# checks fail. Also, make sure the NEWS file is up-to-date.
|
||||||
|
# FIXME: use dist-hook/my-dist like distcheck-hook/my-distcheck.
|
||||||
|
cvs-dist: local-check cvs-check maintainer-distcheck
|
||||||
|
$(CVS) update po
|
||||||
|
$(CVS) tag -c $(this-cvs-tag)
|
||||||
|
$(MAKE) dist
|
||||||
|
|
||||||
|
# Use this to make sure we don't run these programs when building
|
||||||
|
# from a virgin tgz file, below.
|
||||||
|
null_AM_MAKEFLAGS = \
|
||||||
|
ACLOCAL=false \
|
||||||
|
AUTOCONF=false \
|
||||||
|
AUTOM4TE=false \
|
||||||
|
AUTOMAKE=false \
|
||||||
|
AUTOHEADER=false \
|
||||||
|
MAKEINFO=false
|
||||||
|
|
||||||
|
# Detect format-string/arg-list mismatches that would normally be obscured
|
||||||
|
# by the use of _(). The --disable-nls effectively defines away that macro,
|
||||||
|
# and building with CFLAGS='-Wformat -Werror' causes any format warning to be
|
||||||
|
# treated as a failure.
|
||||||
|
t=./=test
|
||||||
|
my-distcheck: writable-files po-check
|
||||||
|
-rm -rf $(t)
|
||||||
|
mkdir $(t)
|
||||||
|
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
|
||||||
|
cd $(t)/$(distdir) \
|
||||||
|
&& ./configure --disable-nls \
|
||||||
|
&& $(MAKE) CFLAGS='-Wformat -Werror' \
|
||||||
|
AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
|
||||||
|
&& $(MAKE) dvi \
|
||||||
|
&& $(MAKE) check \
|
||||||
|
&& $(MAKE) distclean
|
||||||
|
cd $(t) && mv $(distdir) $(distdir).old \
|
||||||
|
&& $(AMTAR) -zxf ../$(distdir).tar.gz
|
||||||
|
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
|
||||||
|
-rm -rf $(t)
|
||||||
|
@echo "========================"; \
|
||||||
|
echo "$(distdir).tar.gz is ready for distribution"; \
|
||||||
|
echo "========================"
|
||||||
|
|
||||||
|
# This must be the same name on both hosts.
|
||||||
|
# Make it a symlink that points to the right place.
|
||||||
|
real_dir = fetish-ftp
|
||||||
|
|
||||||
|
url_dir_list = $(foreach x,$(hosts),ftp://$($(x)_host)/$($(x)_url_dir))
|
||||||
|
|
||||||
|
tgz-md5 = $(shell md5sum < $(my_distdir).tar.gz|sed 's/ -//')
|
||||||
|
tgz-sha1 = $(shell sha1sum < $(my_distdir).tar.gz|sed 's/ -//')
|
||||||
|
bz2-md5 = $(shell md5sum < $(my_distdir).tar.bz2|sed 's/ -//')
|
||||||
|
bz2-sha1 = $(shell sha1sum < $(my_distdir).tar.bz2|sed 's/ -//')
|
||||||
|
tgz-size = $(shell du --human $(my_distdir).tar.gz|sed 's/\([Mk]\).*/ \1B/')
|
||||||
|
bz2-size = $(shell du --human $(my_distdir).tar.bz2|sed 's/\([Mk]\).*/ \1B/')
|
||||||
|
xd-size = $(shell du --human $(xd-delta)|sed 's/\([Mk]\).*/ \1B/')
|
||||||
|
|
||||||
|
rel-check:
|
||||||
|
tarz=/tmp/rel-check-tarz-$$$$; \
|
||||||
|
md5_tmp=/tmp/rel-check-md5-$$$$; \
|
||||||
|
set -e; \
|
||||||
|
trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \
|
||||||
|
$(WGET) -q --output-document=$$tarz $(url); \
|
||||||
|
echo "$(md5) -" > $$md5_tmp; \
|
||||||
|
md5sum -c $$md5_tmp < $$tarz
|
||||||
|
|
||||||
|
prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
|
||||||
|
xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
|
||||||
|
|
||||||
|
GZIP = gzip
|
||||||
|
BZIP2 = bzip2
|
||||||
|
$(my_distdir).tar.bz2: $(my_distdir).tar.gz
|
||||||
|
$(GZIP) -dc $< > $(my_distdir).tar
|
||||||
|
rm -f $@
|
||||||
|
$(BZIP2) -9 $(my_distdir).tar
|
||||||
|
|
||||||
|
rel-files = $(xd-delta) $(distdir).tar.bz2 $(distdir).tar.gz
|
||||||
|
announcement: NEWS ChangeLog $(rel-files)
|
||||||
|
@( \
|
||||||
|
echo Subject: $(my_distdir) released; \
|
||||||
|
echo; \
|
||||||
|
echo FIXME: put comments here; \
|
||||||
|
echo; \
|
||||||
|
for url in $(url_dir_list); do \
|
||||||
|
echo " $$url/$(my_distdir).tar.gz ($(tgz-size))"; \
|
||||||
|
echo " $$url/$(my_distdir).tar.bz2 ($(bz2-size))"; \
|
||||||
|
done; \
|
||||||
|
echo; \
|
||||||
|
echo And here are xdelta-style diffs; \
|
||||||
|
echo; \
|
||||||
|
for url in $(url_dir_list); do \
|
||||||
|
echo " $$url/$(xd-delta) ($(xd-size))"; \
|
||||||
|
done; \
|
||||||
|
echo; \
|
||||||
|
echo "Here are the MD5 and SHA1 signatures for the compressed tar files:"; \
|
||||||
|
echo; \
|
||||||
|
echo "$(tgz-md5) $(my_distdir).tar.gz"; \
|
||||||
|
echo "$(bz2-md5) $(my_distdir).tar.bz2"; \
|
||||||
|
echo "$(tgz-sha1) $(my_distdir).tar.gz"; \
|
||||||
|
echo "$(bz2-sha1) $(my_distdir).tar.bz2"; \
|
||||||
|
echo; \
|
||||||
|
echo NEWS:; \
|
||||||
|
sed -n "/$(THIS_VERSION_REGEXP)[]:]/,/$(PREV_VERSION_REGEXP)[]:]/p" NEWS \
|
||||||
|
| grep -v '^\['; \
|
||||||
|
echo; \
|
||||||
|
echo ChangeLog entries:; \
|
||||||
|
find . -name ChangeLog -maxdepth 2 \
|
||||||
|
| xargs $(CVS) diff -up -r$(prev-cvs-tag) -rHEAD \
|
||||||
|
| sed -n 's/^+//p' \
|
||||||
|
| perl -ne 'm!^\+\+ (\./)?! or print,next;' \
|
||||||
|
-e 'print "\n"."*"x70 ."\n"; s///; print; print "*"x70 ."\n"'; \
|
||||||
|
)
|
||||||
|
|
||||||
|
define emit-rsync-commands
|
||||||
|
echo =====================================
|
||||||
|
echo =====================================
|
||||||
|
echo 'for host in $(a_host) $(b_host); do \'
|
||||||
|
echo ' rsync -e ssh --pro -av $(xd-delta) $(my_distdir).tar.bz2 \'
|
||||||
|
echo ' $(my_distdir).tar.gz $$host:$(real_dir); done'
|
||||||
|
echo '# send the /tmp/announcement e-mail'
|
||||||
|
echo =====================================
|
||||||
|
echo =====================================
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz
|
||||||
|
xdelta delta -9 $^ $@ || :
|
||||||
|
|
||||||
|
alpha:
|
||||||
|
$(MAKE) cvs-dist
|
||||||
|
$(MAKE) $(xd-delta)
|
||||||
|
$(MAKE) -s announcement > /tmp/announce-$(my_distdir)
|
||||||
|
ln $(rel-files) $(release_archive_dir)
|
||||||
|
chmod a-w $(rel-files)
|
||||||
|
echo $(VERSION) > $(prev_version_file)
|
||||||
|
$(CVS) ci -m. $(prev_version_file)
|
||||||
|
@$(emit-rsync-commands)
|
||||||
@@ -1,11 +1,154 @@
|
|||||||
Bison News
|
Bison News
|
||||||
----------
|
----------
|
||||||
|
|
||||||
Change in version 1.25:
|
Changes in version 1.30e:
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
|
Changes in version 1.30d:
|
||||||
|
|
||||||
|
* 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 VCG output
|
||||||
|
Was broken when strings aliases for symbols were used.
|
||||||
|
|
||||||
|
Changes in version 1.30c:
|
||||||
|
|
||||||
|
* Fixed a few warnings.
|
||||||
|
|
||||||
|
* Some portability issues.
|
||||||
|
|
||||||
|
Changes in version 1.30b:
|
||||||
|
|
||||||
|
* Fixed parser memory leaks.
|
||||||
|
When the generated parser was using malloc to extend its stacks, the
|
||||||
|
previous allocations were not freed.
|
||||||
|
|
||||||
|
* Fixed verbose output file.
|
||||||
|
Some newlines were missing.
|
||||||
|
Some conflicts in state descriptions were missing.
|
||||||
|
|
||||||
|
* Fixed conflict report.
|
||||||
|
Option -v was needed to get the result.
|
||||||
|
|
||||||
|
* %expect
|
||||||
|
Was not used.
|
||||||
|
Mismatches are errors, not warnings.
|
||||||
|
|
||||||
|
* Fixed incorrect processing of some invalid input.
|
||||||
|
|
||||||
|
* Fixed CPP guards: 9foo.h uses BISON_9FOO_H instead of 9FOO_H.
|
||||||
|
|
||||||
|
* Fixed some typos in the documentation.
|
||||||
|
|
||||||
|
* %token MY_EOF 0 is supported.
|
||||||
|
Before, MY_EOF was silently renumbered as 257.
|
||||||
|
|
||||||
|
* doc/refcard.tex is updated.
|
||||||
|
|
||||||
|
* %output, %file-prefix, %name-prefix.
|
||||||
|
New.
|
||||||
|
|
||||||
|
* --output
|
||||||
|
New, aliasing `--output-file'.
|
||||||
|
|
||||||
|
Changes in version 1.30, 2001-10-26:
|
||||||
|
|
||||||
|
* `--defines' and `--graph' have now an optionnal argument which is the
|
||||||
|
output file name. `-d' and `-g' do not change, they do not take any
|
||||||
|
argument.
|
||||||
|
|
||||||
|
* `%source_extension' and `%header_extension' are removed, failed
|
||||||
|
experiment.
|
||||||
|
|
||||||
|
* Portability fixes.
|
||||||
|
|
||||||
|
Changes in version 1.29, 2001-09-07:
|
||||||
|
|
||||||
|
* The output file does not define const, as this caused problems when used
|
||||||
|
with common autoconfiguration schemes. If you still use ancient compilers
|
||||||
|
that lack const, compile with the equivalent of the C compiler option
|
||||||
|
`-Dconst='. autoconf's AC_C_CONST macro provides one way to do this.
|
||||||
|
|
||||||
|
* Added `-g' and `--graph'.
|
||||||
|
|
||||||
|
* The Bison manual is now distributed under the terms of the GNU FDL.
|
||||||
|
|
||||||
|
* The input and the output files has automatically a similar extension.
|
||||||
|
|
||||||
|
* Russian translation added.
|
||||||
|
|
||||||
|
* NLS support updated; should hopefully be less troublesome.
|
||||||
|
|
||||||
|
* Added the old Bison reference card.
|
||||||
|
|
||||||
|
* Added `--locations' and `%locations'.
|
||||||
|
|
||||||
|
* Added `-S' and `--skeleton'.
|
||||||
|
|
||||||
|
* `%raw', `-r', `--raw' is disabled.
|
||||||
|
|
||||||
|
* Special characters are escaped when output. This solves the problems
|
||||||
|
of the #line lines with path names including backslashes.
|
||||||
|
|
||||||
|
* New directives.
|
||||||
|
`%yacc', `%fixed_output_files', `%defines', `%no_parser', `%verbose',
|
||||||
|
`%debug', `%source_extension' and `%header_extension'.
|
||||||
|
|
||||||
|
* @$
|
||||||
|
Automatic location tracking.
|
||||||
|
|
||||||
|
Changes in version 1.28, 1999-07-06:
|
||||||
|
|
||||||
|
* Should compile better now with K&R compilers.
|
||||||
|
|
||||||
|
* Added NLS.
|
||||||
|
|
||||||
|
* Fixed a problem with escaping the double quote character.
|
||||||
|
|
||||||
|
* There is now a FAQ.
|
||||||
|
|
||||||
|
Changes in version 1.27:
|
||||||
|
|
||||||
|
* The make rule which prevented bison.simple from being created on
|
||||||
|
some systems has been fixed.
|
||||||
|
|
||||||
|
Changes in version 1.26:
|
||||||
|
|
||||||
|
* Bison now uses automake.
|
||||||
|
|
||||||
|
* New mailing lists: <[email protected]> and <[email protected]>.
|
||||||
|
|
||||||
|
* Token numbers now start at 257 as previously documented, not 258.
|
||||||
|
|
||||||
|
* Bison honors the TMPDIR environment variable.
|
||||||
|
|
||||||
|
* A couple of buffer overruns have been fixed.
|
||||||
|
|
||||||
|
* Problems when closing files should now be reported.
|
||||||
|
|
||||||
|
* Generated parsers should now work even on operating systems which do
|
||||||
|
not provide alloca().
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
* Tokens can now be specified as multiple-character strings: for
|
* Tokens can now be specified as multiple-character strings: for
|
||||||
example, you could use "<=" for a token which looks like <=, instead
|
example, you could use "<=" for a token which looks like <=, instead
|
||||||
of chosing a name like LESSEQ.
|
of chosing a name like LESSEQ.
|
||||||
@@ -42,3 +185,7 @@ 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:
|
||||||
|
|||||||
+1500
File diff suppressed because it is too large
Load Diff
-20
@@ -1,20 +0,0 @@
|
|||||||
# List of files which contain translatable strings.
|
|
||||||
# Copyright (C) 1996 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
# Package source files
|
|
||||||
allocate.c
|
|
||||||
closure.c
|
|
||||||
conflicts.c
|
|
||||||
derives.c
|
|
||||||
getargs.c
|
|
||||||
lalr.c
|
|
||||||
lex.c
|
|
||||||
main.c
|
|
||||||
nullable.c
|
|
||||||
output.c
|
|
||||||
print.c
|
|
||||||
reader.c
|
|
||||||
reduce.c
|
|
||||||
|
|
||||||
# Common library files
|
|
||||||
getopt.c
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
This directory contains the Bison parser generator.
|
This directory contains the Bison parser generator.
|
||||||
|
|
||||||
See the file INSTALL for compilation and installation instructions.
|
See the file INSTALL for compilation and installation instructions.
|
||||||
|
See the file doc/FAQ for frequently asked questions.
|
||||||
|
|
||||||
It was once true that, when installing Bison on Sequent (or Pyramid?)
|
It was once true that, when installing Bison on Sequent (or Pyramid?)
|
||||||
systems, you had to be in the Berkeley universe. This may no longer
|
systems, you had to be in the Berkeley universe. This may no longer
|
||||||
@@ -10,6 +11,14 @@ On VMS, you will probably have to create Makefile from Makefile.in by
|
|||||||
hand. Remember to do `SET COMMAND BISON' to install the data in
|
hand. Remember to do `SET COMMAND BISON' to install the data in
|
||||||
`BISON.CLD'.
|
`BISON.CLD'.
|
||||||
|
|
||||||
Send bug reports to [email protected]. Please include the
|
VMS and MS-DOS builds are probably broken right now. If you are able
|
||||||
version number from `bison --version', and a complete, self-contained
|
to build Bison on either platform and you need to make changes to do
|
||||||
test case in each bug report.
|
so, please submit those changes as a bug report.
|
||||||
|
|
||||||
|
Send bug reports to [email protected]. Please include the version
|
||||||
|
number from `bison --version', and a complete, self-contained test
|
||||||
|
case in each bug report.
|
||||||
|
|
||||||
|
If you have questions about using Bison which the documentation does
|
||||||
|
not answer, send mail to [email protected].
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
-*- text -*-
|
||||||
|
|
||||||
|
This is a test release of this package. Using it more or less
|
||||||
|
implicitly signs you up to help us find whatever problems you report.
|
||||||
|
|
||||||
|
The documentation still needs more work. Suggestions welcome.
|
||||||
|
Patches even more welcome.
|
||||||
|
|
||||||
|
Please send comments and problem reports about this test release to
|
||||||
|
[email protected]. This program will get better only if you report
|
||||||
|
the problems you encounter.
|
||||||
|
|
||||||
|
Please, *do not package this*, *do not distribute it* widely, it is
|
||||||
|
not ready for full scale use. Because it is not fully functional, if
|
||||||
|
you distribute this package, we will be buried under bug reports from
|
||||||
|
panicked users. We don't have time to spend on this, and nor do the
|
||||||
|
users.
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
Bison was originally written by Robert Corbett. It would not be what
|
||||||
|
it is today without the invaluable help of these people:
|
||||||
|
|
||||||
|
Airy Andre [email protected]
|
||||||
|
Akim Demaille [email protected]
|
||||||
|
Albert Chin-A-Young [email protected]
|
||||||
|
Alexander Belopolsky [email protected]
|
||||||
|
Daniel Hagerty [email protected]
|
||||||
|
David J. MacKenzie [email protected]
|
||||||
|
Dick Streefland [email protected]
|
||||||
|
Fabrice Bauzac [email protected]
|
||||||
|
Golubev I. N [email protected]
|
||||||
|
Hans Aberg [email protected]
|
||||||
|
Jesse Thilo [email protected]
|
||||||
|
Jim Meyering [email protected]
|
||||||
|
Juan Manuel Guerrero [email protected]
|
||||||
|
Keith Browne [email protected]
|
||||||
|
Laurent Mascherpa [email protected]
|
||||||
|
Marc Autret [email protected]
|
||||||
|
Neil Booth [email protected]
|
||||||
|
Noah Friedman [email protected]
|
||||||
|
Pascal Bart [email protected]
|
||||||
|
Paul Eggert [email protected]
|
||||||
|
Per Allansson [email protected]
|
||||||
|
Piotr Gackiewicz [email protected]
|
||||||
|
Richard Stallman [email protected]
|
||||||
|
Robert Anisko [email protected]
|
||||||
|
Shura [email protected]
|
||||||
|
Tom Lane [email protected]
|
||||||
|
Wolfram Wagner [email protected]
|
||||||
|
Wwp [email protected]
|
||||||
|
|
||||||
|
Many people are not named here because we lost track of them. We
|
||||||
|
thank them! Please, help us keeping this list up to date.
|
||||||
|
|
||||||
|
Local Variables:
|
||||||
|
mode: text
|
||||||
|
End:
|
||||||
Vendored
+1714
File diff suppressed because it is too large
Load Diff
-760
@@ -1,760 +0,0 @@
|
|||||||
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
|
|
||||||
#line 3 "bison.simple"
|
|
||||||
/* This file comes from bison-@bison_version@. */
|
|
||||||
|
|
||||||
/* Skeleton output parser for bison,
|
|
||||||
Copyright (C) 1984, 1989, 1990 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., 675 Mass Ave, Cambridge, MA 02139, 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. */
|
|
||||||
|
|
||||||
/* This is the parser code that is written into each bison parser
|
|
||||||
when the %semantic_parser declaration is not specified in the grammar.
|
|
||||||
It was written by Richard Stallman by simplifying the hairy parser
|
|
||||||
used when %semantic_parser is specified. */
|
|
||||||
|
|
||||||
#ifndef YYSTACK_USE_ALLOCA
|
|
||||||
#ifdef alloca
|
|
||||||
#define YYSTACK_USE_ALLOCA
|
|
||||||
#else /* alloca not defined */
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#define YYSTACK_USE_ALLOCA
|
|
||||||
#define alloca __builtin_alloca
|
|
||||||
#else /* not GNU C. */
|
|
||||||
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
|
|
||||||
#define YYSTACK_USE_ALLOCA
|
|
||||||
#include <alloca.h>
|
|
||||||
#else /* not sparc */
|
|
||||||
/* We think this test detects Watcom and Microsoft C. */
|
|
||||||
/* This used to test MSDOS, but that is a bad idea
|
|
||||||
since that symbol is in the user namespace. */
|
|
||||||
#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
|
|
||||||
#if 0 /* No need for malloc.h, which pollutes the namespace;
|
|
||||||
instead, just don't use alloca. */
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
#else /* not MSDOS, or __TURBOC__ */
|
|
||||||
#if defined(_AIX)
|
|
||||||
/* I don't know what this was needed for, but it pollutes the namespace.
|
|
||||||
So I turned it off. rms, 2 May 1997. */
|
|
||||||
/* #include <malloc.h> */
|
|
||||||
#pragma alloca
|
|
||||||
#define YYSTACK_USE_ALLOCA
|
|
||||||
#else /* not MSDOS, or __TURBOC__, or _AIX */
|
|
||||||
#if 0
|
|
||||||
#ifdef __hpux /* [email protected] says this works for HPUX 9.05 and up,
|
|
||||||
and on HPUX 10. Eventually we can turn this on. */
|
|
||||||
#define YYSTACK_USE_ALLOCA
|
|
||||||
#define alloca __builtin_alloca
|
|
||||||
#endif /* __hpux */
|
|
||||||
#endif
|
|
||||||
#endif /* not _AIX */
|
|
||||||
#endif /* not MSDOS, or __TURBOC__ */
|
|
||||||
#endif /* not sparc */
|
|
||||||
#endif /* not GNU C */
|
|
||||||
#endif /* alloca not defined */
|
|
||||||
#endif /* YYSTACK_USE_ALLOCA not defined */
|
|
||||||
|
|
||||||
#ifdef YYSTACK_USE_ALLOCA
|
|
||||||
#define YYSTACK_ALLOC alloca
|
|
||||||
#else
|
|
||||||
#define YYSTACK_ALLOC malloc
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Note: there must be only one dollar sign in this file.
|
|
||||||
It is replaced by the list of actions, each action
|
|
||||||
as one case of the switch. */
|
|
||||||
|
|
||||||
#define yyerrok (yyerrstatus = 0)
|
|
||||||
#define yyclearin (yychar = YYEMPTY)
|
|
||||||
#define YYEMPTY -2
|
|
||||||
#define YYEOF 0
|
|
||||||
#define YYACCEPT goto yyacceptlab
|
|
||||||
#define YYABORT goto yyabortlab
|
|
||||||
#define YYERROR goto yyerrlab1
|
|
||||||
/* Like YYERROR except do call yyerror.
|
|
||||||
This remains here temporarily to ease the
|
|
||||||
transition to the new meaning of YYERROR, for GCC.
|
|
||||||
Once GCC version 2 has supplanted version 1, this can go. */
|
|
||||||
#define YYFAIL goto yyerrlab
|
|
||||||
#define YYRECOVERING() (!!yyerrstatus)
|
|
||||||
#define YYBACKUP(token, value) \
|
|
||||||
do \
|
|
||||||
if (yychar == YYEMPTY && yylen == 1) \
|
|
||||||
{ yychar = (token), yylval = (value); \
|
|
||||||
yychar1 = YYTRANSLATE (yychar); \
|
|
||||||
YYPOPSTACK; \
|
|
||||||
goto yybackup; \
|
|
||||||
} \
|
|
||||||
else \
|
|
||||||
{ yyerror ("syntax error: cannot back up"); YYERROR; } \
|
|
||||||
while (0)
|
|
||||||
|
|
||||||
#define YYTERROR 1
|
|
||||||
#define YYERRCODE 256
|
|
||||||
|
|
||||||
#ifndef YYPURE
|
|
||||||
#define YYLEX yylex()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef YYPURE
|
|
||||||
#ifdef YYLSP_NEEDED
|
|
||||||
#ifdef YYLEX_PARAM
|
|
||||||
#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
|
|
||||||
#else
|
|
||||||
#define YYLEX yylex(&yylval, &yylloc)
|
|
||||||
#endif
|
|
||||||
#else /* not YYLSP_NEEDED */
|
|
||||||
#ifdef YYLEX_PARAM
|
|
||||||
#define YYLEX yylex(&yylval, YYLEX_PARAM)
|
|
||||||
#else
|
|
||||||
#define YYLEX yylex(&yylval)
|
|
||||||
#endif
|
|
||||||
#endif /* not YYLSP_NEEDED */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If nonreentrant, generate the variables here */
|
|
||||||
|
|
||||||
#ifndef YYPURE
|
|
||||||
|
|
||||||
int yychar; /* the lookahead symbol */
|
|
||||||
YYSTYPE yylval; /* the semantic value of the */
|
|
||||||
/* lookahead symbol */
|
|
||||||
|
|
||||||
#ifdef YYLSP_NEEDED
|
|
||||||
YYLTYPE yylloc; /* location data for the lookahead */
|
|
||||||
/* symbol */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int yynerrs; /* number of parse errors so far */
|
|
||||||
#endif /* not YYPURE */
|
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
int yydebug; /* nonzero means print parse trace */
|
|
||||||
/* Since this is uninitialized, it does not stop multiple parsers
|
|
||||||
from coexisting. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* YYINITDEPTH indicates the initial size of the parser's stacks */
|
|
||||||
|
|
||||||
#ifndef YYINITDEPTH
|
|
||||||
#define YYINITDEPTH 200
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* YYMAXDEPTH is the maximum size the stacks can grow to
|
|
||||||
(effective only if the built-in stack extension method is used). */
|
|
||||||
|
|
||||||
#if YYMAXDEPTH == 0
|
|
||||||
#undef YYMAXDEPTH
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef YYMAXDEPTH
|
|
||||||
#define YYMAXDEPTH 10000
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Define __yy_memcpy. Note that the size argument
|
|
||||||
should be passed with type unsigned int, because that is what the non-GCC
|
|
||||||
definitions require. With GCC, __builtin_memcpy takes an arg
|
|
||||||
of type size_t, but it can handle unsigned int. */
|
|
||||||
|
|
||||||
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
|
|
||||||
#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
|
|
||||||
#else /* not GNU C or C++ */
|
|
||||||
#ifndef __cplusplus
|
|
||||||
|
|
||||||
/* This is the most reliable way to avoid incompatibilities
|
|
||||||
in available built-in functions on various systems. */
|
|
||||||
static void
|
|
||||||
__yy_memcpy (to, from, count)
|
|
||||||
char *to;
|
|
||||||
char *from;
|
|
||||||
unsigned int count;
|
|
||||||
{
|
|
||||||
register char *f = from;
|
|
||||||
register char *t = to;
|
|
||||||
register int i = count;
|
|
||||||
|
|
||||||
while (i-- > 0)
|
|
||||||
*t++ = *f++;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else /* __cplusplus */
|
|
||||||
|
|
||||||
/* This is the most reliable way to avoid incompatibilities
|
|
||||||
in available built-in functions on various systems. */
|
|
||||||
static void
|
|
||||||
__yy_memcpy (char *to, char *from, unsigned int count)
|
|
||||||
{
|
|
||||||
register char *t = to;
|
|
||||||
register char *f = from;
|
|
||||||
register int i = count;
|
|
||||||
|
|
||||||
while (i-- > 0)
|
|
||||||
*t++ = *f++;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#line 216 "bison.simple"
|
|
||||||
|
|
||||||
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
|
|
||||||
into yyparse. The argument should have type void *.
|
|
||||||
It should actually point to an object.
|
|
||||||
Grammar actions can access the variable by casting it
|
|
||||||
to the proper pointer type. */
|
|
||||||
|
|
||||||
#ifdef YYPARSE_PARAM
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
|
|
||||||
#define YYPARSE_PARAM_DECL
|
|
||||||
#else /* not __cplusplus */
|
|
||||||
#define YYPARSE_PARAM_ARG YYPARSE_PARAM
|
|
||||||
#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
|
|
||||||
#endif /* not __cplusplus */
|
|
||||||
#else /* not YYPARSE_PARAM */
|
|
||||||
#define YYPARSE_PARAM_ARG
|
|
||||||
#define YYPARSE_PARAM_DECL
|
|
||||||
#endif /* not YYPARSE_PARAM */
|
|
||||||
|
|
||||||
/* Prevent warning if -Wstrict-prototypes. */
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#ifdef YYPARSE_PARAM
|
|
||||||
int yyparse (void *);
|
|
||||||
#else
|
|
||||||
int yyparse (void);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
|
||||||
yyparse(YYPARSE_PARAM_ARG)
|
|
||||||
YYPARSE_PARAM_DECL
|
|
||||||
{
|
|
||||||
register int yystate;
|
|
||||||
register int yyn;
|
|
||||||
register short *yyssp;
|
|
||||||
register YYSTYPE *yyvsp;
|
|
||||||
int yyerrstatus; /* number of tokens to shift before error messages enabled */
|
|
||||||
int yychar1 = 0; /* lookahead token as an internal (translated) token number */
|
|
||||||
|
|
||||||
short yyssa[YYINITDEPTH]; /* the state stack */
|
|
||||||
YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
|
|
||||||
|
|
||||||
short *yyss = yyssa; /* refer to the stacks thru separate pointers */
|
|
||||||
YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
|
|
||||||
|
|
||||||
#ifdef YYLSP_NEEDED
|
|
||||||
YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
|
|
||||||
YYLTYPE *yyls = yylsa;
|
|
||||||
YYLTYPE *yylsp;
|
|
||||||
|
|
||||||
#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
|
|
||||||
#else
|
|
||||||
#define YYPOPSTACK (yyvsp--, yyssp--)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int yystacksize = YYINITDEPTH;
|
|
||||||
int yyfree_stacks = 0;
|
|
||||||
|
|
||||||
#ifdef YYPURE
|
|
||||||
int yychar;
|
|
||||||
YYSTYPE yylval;
|
|
||||||
int yynerrs;
|
|
||||||
#ifdef YYLSP_NEEDED
|
|
||||||
YYLTYPE yylloc;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
YYSTYPE yyval; /* the variable used to return */
|
|
||||||
/* semantic values from the action */
|
|
||||||
/* routines */
|
|
||||||
|
|
||||||
int yylen;
|
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
|
||||||
fprintf(stderr, "Starting parse\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
yystate = 0;
|
|
||||||
yyerrstatus = 0;
|
|
||||||
yynerrs = 0;
|
|
||||||
yychar = YYEMPTY; /* Cause a token to be read. */
|
|
||||||
|
|
||||||
/* Initialize stack pointers.
|
|
||||||
Waste one element of value and location stack
|
|
||||||
so that they stay on the same level as the state stack.
|
|
||||||
The wasted elements are never initialized. */
|
|
||||||
|
|
||||||
yyssp = yyss - 1;
|
|
||||||
yyvsp = yyvs;
|
|
||||||
#ifdef YYLSP_NEEDED
|
|
||||||
yylsp = yyls;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Push a new state, which is found in yystate . */
|
|
||||||
/* In all cases, when you get here, the value and location stacks
|
|
||||||
have just been pushed. so pushing a state here evens the stacks. */
|
|
||||||
yynewstate:
|
|
||||||
|
|
||||||
*++yyssp = yystate;
|
|
||||||
|
|
||||||
if (yyssp >= yyss + yystacksize - 1)
|
|
||||||
{
|
|
||||||
/* Give user a chance to reallocate the stack */
|
|
||||||
/* Use copies of these so that the &'s don't force the real ones into memory. */
|
|
||||||
YYSTYPE *yyvs1 = yyvs;
|
|
||||||
short *yyss1 = yyss;
|
|
||||||
#ifdef YYLSP_NEEDED
|
|
||||||
YYLTYPE *yyls1 = yyls;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Get the current used size of the three stacks, in elements. */
|
|
||||||
int size = yyssp - yyss + 1;
|
|
||||||
|
|
||||||
#ifdef yyoverflow
|
|
||||||
/* Each stack pointer address is followed by the size of
|
|
||||||
the data in use in that stack, in bytes. */
|
|
||||||
#ifdef YYLSP_NEEDED
|
|
||||||
/* This used to be a conditional around just the two extra args,
|
|
||||||
but that might be undefined if yyoverflow is a macro. */
|
|
||||||
yyoverflow("parser stack overflow",
|
|
||||||
&yyss1, size * sizeof (*yyssp),
|
|
||||||
&yyvs1, size * sizeof (*yyvsp),
|
|
||||||
&yyls1, size * sizeof (*yylsp),
|
|
||||||
&yystacksize);
|
|
||||||
#else
|
|
||||||
yyoverflow("parser stack overflow",
|
|
||||||
&yyss1, size * sizeof (*yyssp),
|
|
||||||
&yyvs1, size * sizeof (*yyvsp),
|
|
||||||
&yystacksize);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
yyss = yyss1; yyvs = yyvs1;
|
|
||||||
#ifdef YYLSP_NEEDED
|
|
||||||
yyls = yyls1;
|
|
||||||
#endif
|
|
||||||
#else /* no yyoverflow */
|
|
||||||
/* Extend the stack our own way. */
|
|
||||||
if (yystacksize >= YYMAXDEPTH)
|
|
||||||
{
|
|
||||||
yyerror("parser stack overflow");
|
|
||||||
if (yyfree_stacks)
|
|
||||||
{
|
|
||||||
free (yyss);
|
|
||||||
free (yyvs);
|
|
||||||
#ifdef YYLSP_NEEDED
|
|
||||||
free (yyls);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
yystacksize *= 2;
|
|
||||||
if (yystacksize > YYMAXDEPTH)
|
|
||||||
yystacksize = YYMAXDEPTH;
|
|
||||||
#ifndef YYSTACK_USE_ALLOCA
|
|
||||||
yyfree_stacks = 1;
|
|
||||||
#endif
|
|
||||||
yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
|
|
||||||
__yy_memcpy ((char *)yyss, (char *)yyss1,
|
|
||||||
size * (unsigned int) sizeof (*yyssp));
|
|
||||||
yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
|
|
||||||
__yy_memcpy ((char *)yyvs, (char *)yyvs1,
|
|
||||||
size * (unsigned int) sizeof (*yyvsp));
|
|
||||||
#ifdef YYLSP_NEEDED
|
|
||||||
yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
|
|
||||||
__yy_memcpy ((char *)yyls, (char *)yyls1,
|
|
||||||
size * (unsigned int) sizeof (*yylsp));
|
|
||||||
#endif
|
|
||||||
#endif /* no yyoverflow */
|
|
||||||
|
|
||||||
yyssp = yyss + size - 1;
|
|
||||||
yyvsp = yyvs + size - 1;
|
|
||||||
#ifdef YYLSP_NEEDED
|
|
||||||
yylsp = yyls + size - 1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
|
||||||
fprintf(stderr, "Stack size increased to %d\n", yystacksize);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (yyssp >= yyss + yystacksize - 1)
|
|
||||||
YYABORT;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
|
||||||
fprintf(stderr, "Entering state %d\n", yystate);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
goto yybackup;
|
|
||||||
yybackup:
|
|
||||||
|
|
||||||
/* Do appropriate processing given the current state. */
|
|
||||||
/* Read a lookahead token if we need one and don't already have one. */
|
|
||||||
/* yyresume: */
|
|
||||||
|
|
||||||
/* First try to decide what to do without reference to lookahead token. */
|
|
||||||
|
|
||||||
yyn = yypact[yystate];
|
|
||||||
if (yyn == YYFLAG)
|
|
||||||
goto yydefault;
|
|
||||||
|
|
||||||
/* Not known => get a lookahead token if don't already have one. */
|
|
||||||
|
|
||||||
/* yychar is either YYEMPTY or YYEOF
|
|
||||||
or a valid token in external form. */
|
|
||||||
|
|
||||||
if (yychar == YYEMPTY)
|
|
||||||
{
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
|
||||||
fprintf(stderr, "Reading a token: ");
|
|
||||||
#endif
|
|
||||||
yychar = YYLEX;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Convert token to internal form (in yychar1) for indexing tables with */
|
|
||||||
|
|
||||||
if (yychar <= 0) /* This means end of input. */
|
|
||||||
{
|
|
||||||
yychar1 = 0;
|
|
||||||
yychar = YYEOF; /* Don't call YYLEX any more */
|
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
|
||||||
fprintf(stderr, "Now at end of input.\n");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
yychar1 = YYTRANSLATE(yychar);
|
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
|
||||||
{
|
|
||||||
fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
|
|
||||||
/* Give the individual parser a way to print the precise meaning
|
|
||||||
of a token, for further debugging info. */
|
|
||||||
#ifdef YYPRINT
|
|
||||||
YYPRINT (stderr, yychar, yylval);
|
|
||||||
#endif
|
|
||||||
fprintf (stderr, ")\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
yyn += yychar1;
|
|
||||||
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
|
|
||||||
goto yydefault;
|
|
||||||
|
|
||||||
yyn = yytable[yyn];
|
|
||||||
|
|
||||||
/* yyn is what to do for this token type in this state.
|
|
||||||
Negative => reduce, -yyn is rule number.
|
|
||||||
Positive => shift, yyn is new state.
|
|
||||||
New state is final state => don't bother to shift,
|
|
||||||
just return success.
|
|
||||||
0, or most negative number => error. */
|
|
||||||
|
|
||||||
if (yyn < 0)
|
|
||||||
{
|
|
||||||
if (yyn == YYFLAG)
|
|
||||||
goto yyerrlab;
|
|
||||||
yyn = -yyn;
|
|
||||||
goto yyreduce;
|
|
||||||
}
|
|
||||||
else if (yyn == 0)
|
|
||||||
goto yyerrlab;
|
|
||||||
|
|
||||||
if (yyn == YYFINAL)
|
|
||||||
YYACCEPT;
|
|
||||||
|
|
||||||
/* Shift the lookahead token. */
|
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
|
||||||
fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Discard the token being shifted unless it is eof. */
|
|
||||||
if (yychar != YYEOF)
|
|
||||||
yychar = YYEMPTY;
|
|
||||||
|
|
||||||
*++yyvsp = yylval;
|
|
||||||
#ifdef YYLSP_NEEDED
|
|
||||||
*++yylsp = yylloc;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* count tokens shifted since error; after three, turn off error status. */
|
|
||||||
if (yyerrstatus) yyerrstatus--;
|
|
||||||
|
|
||||||
yystate = yyn;
|
|
||||||
goto yynewstate;
|
|
||||||
|
|
||||||
/* Do the default action for the current state. */
|
|
||||||
yydefault:
|
|
||||||
|
|
||||||
yyn = yydefact[yystate];
|
|
||||||
if (yyn == 0)
|
|
||||||
goto yyerrlab;
|
|
||||||
|
|
||||||
/* Do a reduction. yyn is the number of a rule to reduce with. */
|
|
||||||
yyreduce:
|
|
||||||
yylen = yyr2[yyn];
|
|
||||||
if (yylen > 0)
|
|
||||||
yyval = yyvsp[1-yylen]; /* implement default value of the action */
|
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
fprintf (stderr, "Reducing via rule %d (line %d), ",
|
|
||||||
yyn, yyrline[yyn]);
|
|
||||||
|
|
||||||
/* Print the symbols being reduced, and their result. */
|
|
||||||
for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
|
|
||||||
fprintf (stderr, "%s ", yytname[yyrhs[i]]);
|
|
||||||
fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
$ /* the action file gets copied in in place of this dollarsign */
|
|
||||||
#line 542 "bison.simple"
|
|
||||||
|
|
||||||
yyvsp -= yylen;
|
|
||||||
yyssp -= yylen;
|
|
||||||
#ifdef YYLSP_NEEDED
|
|
||||||
yylsp -= yylen;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
|
||||||
{
|
|
||||||
short *ssp1 = yyss - 1;
|
|
||||||
fprintf (stderr, "state stack now");
|
|
||||||
while (ssp1 != yyssp)
|
|
||||||
fprintf (stderr, " %d", *++ssp1);
|
|
||||||
fprintf (stderr, "\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
*++yyvsp = yyval;
|
|
||||||
|
|
||||||
#ifdef YYLSP_NEEDED
|
|
||||||
yylsp++;
|
|
||||||
if (yylen == 0)
|
|
||||||
{
|
|
||||||
yylsp->first_line = yylloc.first_line;
|
|
||||||
yylsp->first_column = yylloc.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;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Now "shift" the result of the reduction.
|
|
||||||
Determine what state that goes to,
|
|
||||||
based on the state we popped back to
|
|
||||||
and the rule number reduced by. */
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
yyerrlab: /* here on detecting error */
|
|
||||||
|
|
||||||
if (! yyerrstatus)
|
|
||||||
/* If not already recovering from an error, report this error. */
|
|
||||||
{
|
|
||||||
++yynerrs;
|
|
||||||
|
|
||||||
#ifdef YYERROR_VERBOSE
|
|
||||||
yyn = yypact[yystate];
|
|
||||||
|
|
||||||
if (yyn > YYFLAG && yyn < YYLAST)
|
|
||||||
{
|
|
||||||
int size = 0;
|
|
||||||
char *msg;
|
|
||||||
int x, count;
|
|
||||||
|
|
||||||
count = 0;
|
|
||||||
/* Start X at -yyn if nec to avoid negative indexes in yycheck. */
|
|
||||||
for (x = (yyn < 0 ? -yyn : 0);
|
|
||||||
x < (sizeof(yytname) / sizeof(char *)); x++)
|
|
||||||
if (yycheck[x + yyn] == x)
|
|
||||||
size += strlen(yytname[x]) + 15, count++;
|
|
||||||
msg = (char *) malloc(size + 15);
|
|
||||||
if (msg != 0)
|
|
||||||
{
|
|
||||||
strcpy(msg, "parse error");
|
|
||||||
|
|
||||||
if (count < 5)
|
|
||||||
{
|
|
||||||
count = 0;
|
|
||||||
for (x = (yyn < 0 ? -yyn : 0);
|
|
||||||
x < (sizeof(yytname) / sizeof(char *)); x++)
|
|
||||||
if (yycheck[x + yyn] == x)
|
|
||||||
{
|
|
||||||
strcat(msg, count == 0 ? ", expecting `" : " or `");
|
|
||||||
strcat(msg, yytname[x]);
|
|
||||||
strcat(msg, "'");
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
yyerror(msg);
|
|
||||||
free(msg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
yyerror ("parse error; also virtual memory exceeded");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif /* YYERROR_VERBOSE */
|
|
||||||
yyerror("parse error");
|
|
||||||
}
|
|
||||||
|
|
||||||
goto yyerrlab1;
|
|
||||||
yyerrlab1: /* here on error raised explicitly by an action */
|
|
||||||
|
|
||||||
if (yyerrstatus == 3)
|
|
||||||
{
|
|
||||||
/* if just tried and failed to reuse lookahead token after an error, discard it. */
|
|
||||||
|
|
||||||
/* return failure if at end of input */
|
|
||||||
if (yychar == YYEOF)
|
|
||||||
YYABORT;
|
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
|
||||||
fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
yychar = YYEMPTY;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Else will try to reuse lookahead token
|
|
||||||
after shifting the error token. */
|
|
||||||
|
|
||||||
yyerrstatus = 3; /* Each real token shifted decrements this */
|
|
||||||
|
|
||||||
goto yyerrhandle;
|
|
||||||
|
|
||||||
yyerrdefault: /* current state does not do anything special for the error token. */
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* This is wrong; only states that explicitly want error tokens
|
|
||||||
should shift them. */
|
|
||||||
yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
|
|
||||||
if (yyn) goto yydefault;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
yyerrpop: /* pop the current state because it cannot handle the error token */
|
|
||||||
|
|
||||||
if (yyssp == yyss) YYABORT;
|
|
||||||
yyvsp--;
|
|
||||||
yystate = *--yyssp;
|
|
||||||
#ifdef YYLSP_NEEDED
|
|
||||||
yylsp--;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
|
||||||
{
|
|
||||||
short *ssp1 = yyss - 1;
|
|
||||||
fprintf (stderr, "Error: state stack now");
|
|
||||||
while (ssp1 != yyssp)
|
|
||||||
fprintf (stderr, " %d", *++ssp1);
|
|
||||||
fprintf (stderr, "\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
yyerrhandle:
|
|
||||||
|
|
||||||
yyn = yypact[yystate];
|
|
||||||
if (yyn == YYFLAG)
|
|
||||||
goto yyerrdefault;
|
|
||||||
|
|
||||||
yyn += YYTERROR;
|
|
||||||
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
|
|
||||||
goto yyerrdefault;
|
|
||||||
|
|
||||||
yyn = yytable[yyn];
|
|
||||||
if (yyn < 0)
|
|
||||||
{
|
|
||||||
if (yyn == YYFLAG)
|
|
||||||
goto yyerrpop;
|
|
||||||
yyn = -yyn;
|
|
||||||
goto yyreduce;
|
|
||||||
}
|
|
||||||
else if (yyn == 0)
|
|
||||||
goto yyerrpop;
|
|
||||||
|
|
||||||
if (yyn == YYFINAL)
|
|
||||||
YYACCEPT;
|
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
|
||||||
fprintf(stderr, "Shifting error token, ");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
*++yyvsp = yylval;
|
|
||||||
#ifdef YYLSP_NEEDED
|
|
||||||
*++yylsp = yylloc;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
yystate = yyn;
|
|
||||||
goto yynewstate;
|
|
||||||
|
|
||||||
yyacceptlab:
|
|
||||||
/* YYACCEPT comes here. */
|
|
||||||
if (yyfree_stacks)
|
|
||||||
{
|
|
||||||
free (yyss);
|
|
||||||
free (yyvs);
|
|
||||||
#ifdef YYLSP_NEEDED
|
|
||||||
free (yyls);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
yyabortlab:
|
|
||||||
/* YYABORT comes here. */
|
|
||||||
if (yyfree_stacks)
|
|
||||||
{
|
|
||||||
free (yyss);
|
|
||||||
free (yyvs);
|
|
||||||
#ifdef YYLSP_NEEDED
|
|
||||||
free (yyls);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
+300
@@ -0,0 +1,300 @@
|
|||||||
|
/* 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 to 1 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 to 1 if you have `alloca', as a function or macro. */
|
||||||
|
#undef HAVE_ALLOCA
|
||||||
|
|
||||||
|
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
|
||||||
|
*/
|
||||||
|
#undef HAVE_ALLOCA_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <argz.h> header file. */
|
||||||
|
#undef HAVE_ARGZ_H
|
||||||
|
|
||||||
|
/* Define to 1 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 to 1 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', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
#undef HAVE_DECL_STRERROR
|
||||||
|
|
||||||
|
/* 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 to 1 if you have the `doprnt' function. */
|
||||||
|
#undef HAVE_DOPRNT
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `feof_unlocked' function. */
|
||||||
|
#undef HAVE_FEOF_UNLOCKED
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `fgets_unlocked' function. */
|
||||||
|
#undef HAVE_FGETS_UNLOCKED
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getcwd' function. */
|
||||||
|
#undef HAVE_GETCWD
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getegid' function. */
|
||||||
|
#undef HAVE_GETEGID
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `geteuid' function. */
|
||||||
|
#undef HAVE_GETEUID
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getgid' function. */
|
||||||
|
#undef HAVE_GETGID
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getpagesize' function. */
|
||||||
|
#undef HAVE_GETPAGESIZE
|
||||||
|
|
||||||
|
/* Define if the GNU gettext() function is already present or preinstalled. */
|
||||||
|
#undef HAVE_GETTEXT
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getuid' function. */
|
||||||
|
#undef HAVE_GETUID
|
||||||
|
|
||||||
|
/* Define if you have the iconv() function. */
|
||||||
|
#undef HAVE_ICONV
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
|
#undef HAVE_INTTYPES_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `isascii' function. */
|
||||||
|
#undef HAVE_ISASCII
|
||||||
|
|
||||||
|
/* Define to 1 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 to 1 if you have the <limits.h> header file. */
|
||||||
|
#undef HAVE_LIMITS_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <locale.h> header file. */
|
||||||
|
#undef HAVE_LOCALE_H
|
||||||
|
|
||||||
|
/* Define to 1 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 to 1 if you have the `mbsinit' function. */
|
||||||
|
#undef HAVE_MBSINIT
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `memchr' function. */
|
||||||
|
#undef HAVE_MEMCHR
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <memory.h> header file. */
|
||||||
|
#undef HAVE_MEMORY_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `mempcpy' function. */
|
||||||
|
#undef HAVE_MEMPCPY
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `mkstemp' function. */
|
||||||
|
#undef HAVE_MKSTEMP
|
||||||
|
|
||||||
|
/* Define to 1 if you have a working `mmap' system call. */
|
||||||
|
#undef HAVE_MMAP
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `munmap' function. */
|
||||||
|
#undef HAVE_MUNMAP
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <nl_types.h> header file. */
|
||||||
|
#undef HAVE_NL_TYPES_H
|
||||||
|
|
||||||
|
/* Define to 1 if libc includes obstacks. */
|
||||||
|
#undef HAVE_OBSTACK
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `putenv' function. */
|
||||||
|
#undef HAVE_PUTENV
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `setenv' function. */
|
||||||
|
#undef HAVE_SETENV
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `setlocale' function. */
|
||||||
|
#undef HAVE_SETLOCALE
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stddef.h> header file. */
|
||||||
|
#undef HAVE_STDDEF_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdint.h> header file. */
|
||||||
|
#undef HAVE_STDINT_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||||
|
#undef HAVE_STDLIB_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `stpcpy' function. */
|
||||||
|
#undef HAVE_STPCPY
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strcasecmp' function. */
|
||||||
|
#undef HAVE_STRCASECMP
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strchr' function. */
|
||||||
|
#undef HAVE_STRCHR
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strdup' function. */
|
||||||
|
#undef HAVE_STRDUP
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strerror' function. */
|
||||||
|
#undef HAVE_STRERROR
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strerror_r' function. */
|
||||||
|
#undef HAVE_STRERROR_R
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <strings.h> header file. */
|
||||||
|
#undef HAVE_STRINGS_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <string.h> header file. */
|
||||||
|
#undef HAVE_STRING_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strndup' function. */
|
||||||
|
#undef HAVE_STRNDUP
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strnlen' function. */
|
||||||
|
#undef HAVE_STRNLEN
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strspn' function. */
|
||||||
|
#undef HAVE_STRSPN
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strtoul' function. */
|
||||||
|
#undef HAVE_STRTOUL
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||||
|
#undef HAVE_SYS_PARAM_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||||
|
#undef HAVE_SYS_STAT_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||||
|
#undef HAVE_SYS_TYPES_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `tsearch' function. */
|
||||||
|
#undef HAVE_TSEARCH
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <unistd.h> header file. */
|
||||||
|
#undef HAVE_UNISTD_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `vprintf' function. */
|
||||||
|
#undef HAVE_VPRINTF
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <wchar.h> header file. */
|
||||||
|
#undef HAVE_WCHAR_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <wctype.h> header file. */
|
||||||
|
#undef HAVE_WCTYPE_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `__argz_count' function. */
|
||||||
|
#undef HAVE___ARGZ_COUNT
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `__argz_next' function. */
|
||||||
|
#undef HAVE___ARGZ_NEXT
|
||||||
|
|
||||||
|
/* Define to 1 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 to 1 if you have the ANSI C header files. */
|
||||||
|
#undef STDC_HEADERS
|
||||||
|
|
||||||
|
/* Define to 1 if strerror_r returns char *. */
|
||||||
|
#undef STRERROR_R_CHAR_P
|
||||||
|
|
||||||
|
/* 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 to 1 if on MINIX. */
|
||||||
|
#undef _MINIX
|
||||||
|
|
||||||
|
/* Define to 2 if the system does not provide POSIX.1 features except with
|
||||||
|
this defined. */
|
||||||
|
#undef _POSIX_1_SOURCE
|
||||||
|
|
||||||
|
/* Define to 1 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
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Makefile
|
||||||
|
*.t
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
|
EXTRA_DIST = move-if-change prev-version.txt
|
||||||
@@ -0,0 +1,221 @@
|
|||||||
|
# Makefile.in generated by automake 1.5a from Makefile.am.
|
||||||
|
# @configure_input@
|
||||||
|
|
||||||
|
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||||
|
# Free Software Foundation, Inc.
|
||||||
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
# with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
@SET_MAKE@
|
||||||
|
|
||||||
|
SHELL = @SHELL@
|
||||||
|
|
||||||
|
srcdir = @srcdir@
|
||||||
|
top_srcdir = @top_srcdir@
|
||||||
|
VPATH = @srcdir@
|
||||||
|
prefix = @prefix@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
|
||||||
|
bindir = @bindir@
|
||||||
|
sbindir = @sbindir@
|
||||||
|
libexecdir = @libexecdir@
|
||||||
|
datadir = @datadir@
|
||||||
|
sysconfdir = @sysconfdir@
|
||||||
|
sharedstatedir = @sharedstatedir@
|
||||||
|
localstatedir = @localstatedir@
|
||||||
|
libdir = @libdir@
|
||||||
|
infodir = @infodir@
|
||||||
|
mandir = @mandir@
|
||||||
|
includedir = @includedir@
|
||||||
|
oldincludedir = /usr/include
|
||||||
|
pkgdatadir = $(datadir)/@PACKAGE@
|
||||||
|
pkglibdir = $(libdir)/@PACKAGE@
|
||||||
|
pkgincludedir = $(includedir)/@PACKAGE@
|
||||||
|
top_builddir = ..
|
||||||
|
|
||||||
|
ACLOCAL = @ACLOCAL@
|
||||||
|
AUTOCONF = @AUTOCONF@
|
||||||
|
AUTOMAKE = @AUTOMAKE@
|
||||||
|
AUTOHEADER = @AUTOHEADER@
|
||||||
|
|
||||||
|
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
|
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||||
|
INSTALL_HEADER = $(INSTALL_DATA)
|
||||||
|
transform = @program_transform_name@
|
||||||
|
NORMAL_INSTALL = :
|
||||||
|
PRE_INSTALL = :
|
||||||
|
POST_INSTALL = :
|
||||||
|
NORMAL_UNINSTALL = :
|
||||||
|
PRE_UNINSTALL = :
|
||||||
|
POST_UNINSTALL = :
|
||||||
|
host_alias = @host_alias@
|
||||||
|
host_triplet = @host@
|
||||||
|
|
||||||
|
EXEEXT = @EXEEXT@
|
||||||
|
OBJEXT = @OBJEXT@
|
||||||
|
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||||
|
AMTAR = @AMTAR@
|
||||||
|
AUTOM4TE = @AUTOM4TE@
|
||||||
|
AWK = @AWK@
|
||||||
|
BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
|
||||||
|
CATALOGS = @CATALOGS@
|
||||||
|
CATOBJEXT = @CATOBJEXT@
|
||||||
|
CC = @CC@
|
||||||
|
CPP = @CPP@
|
||||||
|
DATADIRNAME = @DATADIRNAME@
|
||||||
|
DEPDIR = @DEPDIR@
|
||||||
|
GCC = @GCC@
|
||||||
|
GENCAT = @GENCAT@
|
||||||
|
GLIBC21 = @GLIBC21@
|
||||||
|
GMOFILES = @GMOFILES@
|
||||||
|
GMSGFMT = @GMSGFMT@
|
||||||
|
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||||
|
INSTOBJEXT = @INSTOBJEXT@
|
||||||
|
INTLBISON = @INTLBISON@
|
||||||
|
INTLLIBS = @INTLLIBS@
|
||||||
|
INTLOBJS = @INTLOBJS@
|
||||||
|
INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
|
||||||
|
LIB = @LIB@
|
||||||
|
LIBICONV = @LIBICONV@
|
||||||
|
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||||
|
MSGFMT = @MSGFMT@
|
||||||
|
PACKAGE = @PACKAGE@
|
||||||
|
POFILES = @POFILES@
|
||||||
|
POSUB = @POSUB@
|
||||||
|
RANLIB = @RANLIB@
|
||||||
|
U = @U@
|
||||||
|
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||||
|
USE_NLS = @USE_NLS@
|
||||||
|
VERSION = @VERSION@
|
||||||
|
WARNING_CFLAGS = @WARNING_CFLAGS@
|
||||||
|
am__include = @am__include@
|
||||||
|
am__quote = @am__quote@
|
||||||
|
install_sh = @install_sh@
|
||||||
|
|
||||||
|
EXTRA_DIST = move-if-change prev-version.txt
|
||||||
|
subdir = config
|
||||||
|
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
|
||||||
|
CONFIG_HEADER = $(top_builddir)/config.h
|
||||||
|
CONFIG_CLEAN_FILES =
|
||||||
|
DIST_SOURCES =
|
||||||
|
DIST_COMMON = Makefile.am Makefile.in config.guess config.sub depcomp \
|
||||||
|
install-sh mdate-sh missing mkinstalldirs texinfo.tex
|
||||||
|
all: all-am
|
||||||
|
|
||||||
|
.SUFFIXES:
|
||||||
|
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||||
|
cd $(top_srcdir) && \
|
||||||
|
$(AUTOMAKE) --gnu config/Makefile
|
||||||
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
|
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
|
||||||
|
uninstall-info-am:
|
||||||
|
tags: TAGS
|
||||||
|
TAGS:
|
||||||
|
|
||||||
|
|
||||||
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
|
||||||
|
top_distdir = ..
|
||||||
|
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
|
||||||
|
|
||||||
|
distdir: $(DISTFILES)
|
||||||
|
@for file in $(DISTFILES); do \
|
||||||
|
if test -f $$file; then d=.; else d=$(srcdir); fi; \
|
||||||
|
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||||
|
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||||
|
$(mkinstalldirs) "$(distdir)/$$dir"; \
|
||||||
|
fi; \
|
||||||
|
if test -d $$d/$$file; then \
|
||||||
|
cp -pR $$d/$$file $(distdir) \
|
||||||
|
|| exit 1; \
|
||||||
|
else \
|
||||||
|
test -f $(distdir)/$$file \
|
||||||
|
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||||
|
|| exit 1; \
|
||||||
|
fi; \
|
||||||
|
done
|
||||||
|
check-am: all-am
|
||||||
|
check: check-am
|
||||||
|
all-am: Makefile
|
||||||
|
|
||||||
|
installdirs:
|
||||||
|
|
||||||
|
install: install-am
|
||||||
|
install-exec: install-exec-am
|
||||||
|
install-data: install-data-am
|
||||||
|
uninstall: uninstall-am
|
||||||
|
|
||||||
|
install-am: all-am
|
||||||
|
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||||
|
|
||||||
|
installcheck: installcheck-am
|
||||||
|
install-strip:
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||||
|
`test -z '$(STRIP)' || \
|
||||||
|
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||||
|
mostlyclean-generic:
|
||||||
|
|
||||||
|
clean-generic:
|
||||||
|
|
||||||
|
distclean-generic:
|
||||||
|
-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
|
||||||
|
|
||||||
|
maintainer-clean-generic:
|
||||||
|
@echo "This command is intended for maintainers to use"
|
||||||
|
@echo "it deletes files that may require special tools to rebuild."
|
||||||
|
clean: clean-am
|
||||||
|
|
||||||
|
clean-am: clean-generic mostlyclean-am
|
||||||
|
|
||||||
|
distclean: distclean-am
|
||||||
|
|
||||||
|
distclean-am: clean-am distclean-generic
|
||||||
|
|
||||||
|
dvi: dvi-am
|
||||||
|
|
||||||
|
dvi-am:
|
||||||
|
|
||||||
|
info: info-am
|
||||||
|
|
||||||
|
info-am:
|
||||||
|
|
||||||
|
install-data-am:
|
||||||
|
|
||||||
|
install-exec-am:
|
||||||
|
|
||||||
|
install-info: install-info-am
|
||||||
|
|
||||||
|
install-man:
|
||||||
|
|
||||||
|
installcheck-am:
|
||||||
|
|
||||||
|
maintainer-clean: maintainer-clean-am
|
||||||
|
|
||||||
|
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||||
|
|
||||||
|
mostlyclean: mostlyclean-am
|
||||||
|
|
||||||
|
mostlyclean-am: mostlyclean-generic
|
||||||
|
|
||||||
|
uninstall-am: uninstall-info-am
|
||||||
|
|
||||||
|
.PHONY: all all-am check check-am clean clean-generic distclean \
|
||||||
|
distclean-generic distdir dvi dvi-am info info-am install \
|
||||||
|
install-am install-data install-data-am install-exec \
|
||||||
|
install-exec-am install-info install-info-am install-man \
|
||||||
|
install-strip installcheck installcheck-am installdirs \
|
||||||
|
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||||
|
mostlyclean-generic uninstall uninstall-am uninstall-info-am
|
||||||
|
|
||||||
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||||
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
|
.NOEXPORT:
|
||||||
+1308
File diff suppressed because it is too large
Load Diff
+1420
File diff suppressed because it is too large
Load Diff
Executable
+411
@@ -0,0 +1,411 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
# depcomp - compile a program generating dependencies as side-effects
|
||||||
|
# Copyright 1999, 2000 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
# 02111-1307, USA.
|
||||||
|
|
||||||
|
# As a special exception to the GNU General Public License, if you
|
||||||
|
# distribute this file as part of a program that contains a
|
||||||
|
# configuration script generated by Autoconf, you may include it under
|
||||||
|
# the same distribution terms that you use for the rest of that program.
|
||||||
|
|
||||||
|
# Originally written by Alexandre Oliva <[email protected]>.
|
||||||
|
|
||||||
|
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||||
|
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# `libtool' can also be set to `yes' or `no'.
|
||||||
|
|
||||||
|
depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`}
|
||||||
|
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||||
|
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
|
||||||
|
# Some modes work just like other modes, but use different flags. We
|
||||||
|
# parameterize here, but still list the modes in the big case below,
|
||||||
|
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||||
|
# here, because this file can only contain one case statement.
|
||||||
|
if test "$depmode" = hp; then
|
||||||
|
# HP compiler uses -M and no extra arg.
|
||||||
|
gccflag=-M
|
||||||
|
depmode=gcc
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$depmode" = dashXmstdout; then
|
||||||
|
# This is just like dashmstdout with a different argument.
|
||||||
|
dashmflag=-xM
|
||||||
|
depmode=dashmstdout
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$depmode" in
|
||||||
|
gcc3)
|
||||||
|
## gcc 3 implements dependency tracking that does exactly what
|
||||||
|
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||||
|
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||||
|
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
|
||||||
|
stat=$?
|
||||||
|
if test $stat -eq 0; then :
|
||||||
|
else
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
exit $stat
|
||||||
|
fi
|
||||||
|
mv "$tmpdepfile" "$depfile"
|
||||||
|
;;
|
||||||
|
|
||||||
|
gcc)
|
||||||
|
## There are various ways to get dependency output from gcc. Here's
|
||||||
|
## why we pick this rather obscure method:
|
||||||
|
## - Don't want to use -MD because we'd like the dependencies to end
|
||||||
|
## up in a subdir. Having to rename by hand is ugly.
|
||||||
|
## (We might end up doing this anyway to support other compilers.)
|
||||||
|
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||||
|
## -MM, not -M (despite what the docs say).
|
||||||
|
## - Using -M directly means running the compiler twice (even worse
|
||||||
|
## than renaming).
|
||||||
|
if test -z "$gccflag"; then
|
||||||
|
gccflag=-MD,
|
||||||
|
fi
|
||||||
|
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||||
|
stat=$?
|
||||||
|
if test $stat -eq 0; then :
|
||||||
|
else
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
exit $stat
|
||||||
|
fi
|
||||||
|
rm -f "$depfile"
|
||||||
|
echo "$object : \\" > "$depfile"
|
||||||
|
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||||
|
## The second -e expression handles DOS-style file names with drive letters.
|
||||||
|
sed -e 's/^[^:]*: / /' \
|
||||||
|
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||||
|
## This next piece of magic avoids the `deleted header file' problem.
|
||||||
|
## The problem is that when a header file which appears in a .P file
|
||||||
|
## is deleted, the dependency causes make to die (because there is
|
||||||
|
## typically no way to rebuild the header). We avoid this by adding
|
||||||
|
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||||
|
## this for us directly.
|
||||||
|
tr ' ' '
|
||||||
|
' < "$tmpdepfile" |
|
||||||
|
## Some versions of gcc put a space before the `:'. On the theory
|
||||||
|
## that the space means something, we add a space to the output as
|
||||||
|
## well.
|
||||||
|
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||||
|
## correctly. Breaking it into two sed invocations is a workaround.
|
||||||
|
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
;;
|
||||||
|
|
||||||
|
hp)
|
||||||
|
# This case exists only to let depend.m4 do its work. It works by
|
||||||
|
# looking at the text of this script. This case will never be run,
|
||||||
|
# since it is checked for above.
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
|
sgi)
|
||||||
|
if test "$libtool" = yes; then
|
||||||
|
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||||
|
else
|
||||||
|
"$@" -MDupdate "$tmpdepfile"
|
||||||
|
fi
|
||||||
|
stat=$?
|
||||||
|
if test $stat -eq 0; then :
|
||||||
|
else
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
exit $stat
|
||||||
|
fi
|
||||||
|
rm -f "$depfile"
|
||||||
|
|
||||||
|
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||||
|
echo "$object : \\" > "$depfile"
|
||||||
|
|
||||||
|
# Clip off the initial element (the dependent). Don't try to be
|
||||||
|
# clever and replace this with sed code, as IRIX sed won't handle
|
||||||
|
# lines with more than a fixed number of characters (4096 in
|
||||||
|
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||||
|
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||||
|
# dependency line.
|
||||||
|
tr ' ' '
|
||||||
|
' < "$tmpdepfile" \
|
||||||
|
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||||
|
tr '
|
||||||
|
' ' ' >> $depfile
|
||||||
|
echo >> $depfile
|
||||||
|
|
||||||
|
# The second pass generates a dummy entry for each header file.
|
||||||
|
tr ' ' '
|
||||||
|
' < "$tmpdepfile" \
|
||||||
|
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||||
|
>> $depfile
|
||||||
|
else
|
||||||
|
# The sourcefile does not contain any dependencies, so just
|
||||||
|
# store a dummy comment line, to avoid errors with the Makefile
|
||||||
|
# "include basename.Plo" scheme.
|
||||||
|
echo "#dummy" > "$depfile"
|
||||||
|
fi
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
;;
|
||||||
|
|
||||||
|
aix)
|
||||||
|
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||||
|
# in a .u file. This file always lives in the current directory.
|
||||||
|
# Also, the AIX compiler puts `$object:' at the start of each line;
|
||||||
|
# $object doesn't have directory information.
|
||||||
|
stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
|
||||||
|
tmpdepfile="$stripped.u"
|
||||||
|
outname="$stripped.o"
|
||||||
|
if test "$libtool" = yes; then
|
||||||
|
"$@" -Wc,-M
|
||||||
|
else
|
||||||
|
"$@" -M
|
||||||
|
fi
|
||||||
|
|
||||||
|
stat=$?
|
||||||
|
if test $stat -eq 0; then :
|
||||||
|
else
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
exit $stat
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -f "$tmpdepfile"; then
|
||||||
|
# Each line is of the form `foo.o: dependent.h'.
|
||||||
|
# Do two passes, one to just change these to
|
||||||
|
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||||
|
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
|
||||||
|
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
|
||||||
|
else
|
||||||
|
# The sourcefile does not contain any dependencies, so just
|
||||||
|
# store a dummy comment line, to avoid errors with the Makefile
|
||||||
|
# "include basename.Plo" scheme.
|
||||||
|
echo "#dummy" > "$depfile"
|
||||||
|
fi
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
;;
|
||||||
|
|
||||||
|
tru64)
|
||||||
|
# The Tru64 AIX compiler uses -MD to generate dependencies as a side
|
||||||
|
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||||
|
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||||
|
# dependencies in `foo.d' instead, so we check for that too.
|
||||||
|
# Subdirectories are respected.
|
||||||
|
|
||||||
|
tmpdepfile1="$object.d"
|
||||||
|
tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'`
|
||||||
|
if test "$libtool" = yes; then
|
||||||
|
"$@" -Wc,-MD
|
||||||
|
else
|
||||||
|
"$@" -MD
|
||||||
|
fi
|
||||||
|
|
||||||
|
stat=$?
|
||||||
|
if test $stat -eq 0; then :
|
||||||
|
else
|
||||||
|
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||||
|
exit $stat
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -f "$tmpdepfile1"; then
|
||||||
|
tmpdepfile="$tmpdepfile1"
|
||||||
|
else
|
||||||
|
tmpdepfile="$tmpdepfile2"
|
||||||
|
fi
|
||||||
|
if test -f "$tmpdepfile"; then
|
||||||
|
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||||
|
# That's a space and a tab in the [].
|
||||||
|
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||||
|
else
|
||||||
|
echo "#dummy" > "$depfile"
|
||||||
|
fi
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
;;
|
||||||
|
|
||||||
|
#nosideeffect)
|
||||||
|
# This comment above is used by automake to tell side-effect
|
||||||
|
# dependency tracking mechanisms from slower ones.
|
||||||
|
|
||||||
|
dashmstdout)
|
||||||
|
# Important note: in order to support this mode, a compiler *must*
|
||||||
|
# always write the proprocessed file to stdout, regardless of -o,
|
||||||
|
# because we must use -o when running libtool.
|
||||||
|
test -z "$dashmflag" && dashmflag=-M
|
||||||
|
( IFS=" "
|
||||||
|
case " $* " in
|
||||||
|
*" --mode=compile "*) # this is libtool, let us make it quiet
|
||||||
|
for arg
|
||||||
|
do # cycle over the arguments
|
||||||
|
case "$arg" in
|
||||||
|
"--mode=compile")
|
||||||
|
# insert --quiet before "--mode=compile"
|
||||||
|
set fnord "$@" --quiet
|
||||||
|
shift # fnord
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
set fnord "$@" "$arg"
|
||||||
|
shift # fnord
|
||||||
|
shift # "$arg"
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
"$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||||
|
) &
|
||||||
|
proc=$!
|
||||||
|
"$@"
|
||||||
|
stat=$?
|
||||||
|
wait "$proc"
|
||||||
|
if test "$stat" != 0; then exit $stat; fi
|
||||||
|
rm -f "$depfile"
|
||||||
|
cat < "$tmpdepfile" > "$depfile"
|
||||||
|
tr ' ' '
|
||||||
|
' < "$tmpdepfile" | \
|
||||||
|
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||||
|
## correctly. Breaking it into two sed invocations is a workaround.
|
||||||
|
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
;;
|
||||||
|
|
||||||
|
dashXmstdout)
|
||||||
|
# This case only exists to satisfy depend.m4. It is never actually
|
||||||
|
# run, as this mode is specially recognized in the preamble.
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
|
makedepend)
|
||||||
|
# X makedepend
|
||||||
|
(
|
||||||
|
shift
|
||||||
|
cleared=no
|
||||||
|
for arg in "$@"; do
|
||||||
|
case $cleared in no)
|
||||||
|
set ""; shift
|
||||||
|
cleared=yes
|
||||||
|
esac
|
||||||
|
case "$arg" in
|
||||||
|
-D*|-I*)
|
||||||
|
set fnord "$@" "$arg"; shift;;
|
||||||
|
-*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
set fnord "$@" "$arg"; shift;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
obj_suffix="`echo $object | sed 's/^.*\././'`"
|
||||||
|
touch "$tmpdepfile"
|
||||||
|
${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||||
|
) &
|
||||||
|
proc=$!
|
||||||
|
"$@"
|
||||||
|
stat=$?
|
||||||
|
wait "$proc"
|
||||||
|
if test "$stat" != 0; then exit $stat; fi
|
||||||
|
rm -f "$depfile"
|
||||||
|
cat < "$tmpdepfile" > "$depfile"
|
||||||
|
tail +3 "$tmpdepfile" | tr ' ' '
|
||||||
|
' | \
|
||||||
|
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||||
|
## correctly. Breaking it into two sed invocations is a workaround.
|
||||||
|
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||||
|
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||||
|
;;
|
||||||
|
|
||||||
|
cpp)
|
||||||
|
# Important note: in order to support this mode, a compiler *must*
|
||||||
|
# always write the proprocessed file to stdout, regardless of -o,
|
||||||
|
# because we must use -o when running libtool.
|
||||||
|
( IFS=" "
|
||||||
|
case " $* " in
|
||||||
|
*" --mode=compile "*)
|
||||||
|
for arg
|
||||||
|
do # cycle over the arguments
|
||||||
|
case $arg in
|
||||||
|
"--mode=compile")
|
||||||
|
# insert --quiet before "--mode=compile"
|
||||||
|
set fnord "$@" --quiet
|
||||||
|
shift # fnord
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
set fnord "$@" "$arg"
|
||||||
|
shift # fnord
|
||||||
|
shift # "$arg"
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
"$@" -E |
|
||||||
|
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||||
|
sed '$ s: \\$::' > "$tmpdepfile"
|
||||||
|
) &
|
||||||
|
proc=$!
|
||||||
|
"$@"
|
||||||
|
stat=$?
|
||||||
|
wait "$proc"
|
||||||
|
if test "$stat" != 0; then exit $stat; fi
|
||||||
|
rm -f "$depfile"
|
||||||
|
echo "$object : \\" > "$depfile"
|
||||||
|
cat < "$tmpdepfile" >> "$depfile"
|
||||||
|
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
;;
|
||||||
|
|
||||||
|
msvisualcpp)
|
||||||
|
# Important note: in order to support this mode, a compiler *must*
|
||||||
|
# always write the proprocessed file to stdout, regardless of -o,
|
||||||
|
# because we must use -o when running libtool.
|
||||||
|
( IFS=" "
|
||||||
|
case " $* " in
|
||||||
|
*" --mode=compile "*)
|
||||||
|
for arg
|
||||||
|
do # cycle over the arguments
|
||||||
|
case $arg in
|
||||||
|
"--mode=compile")
|
||||||
|
# insert --quiet before "--mode=compile"
|
||||||
|
set fnord "$@" --quiet
|
||||||
|
shift # fnord
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
set fnord "$@" "$arg"
|
||||||
|
shift # fnord
|
||||||
|
shift # "$arg"
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
"$@" -E |
|
||||||
|
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
|
||||||
|
) &
|
||||||
|
proc=$!
|
||||||
|
"$@"
|
||||||
|
stat=$?
|
||||||
|
wait "$proc"
|
||||||
|
if test "$stat" != 0; then exit $stat; fi
|
||||||
|
rm -f "$depfile"
|
||||||
|
echo "$object : \\" > "$depfile"
|
||||||
|
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||||
|
echo " " >> "$depfile"
|
||||||
|
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
;;
|
||||||
|
|
||||||
|
none)
|
||||||
|
exec "$@"
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Unknown depmode $depmode" 1>&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
||||||
Executable
+251
@@ -0,0 +1,251 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# install - install a program, script, or datafile
|
||||||
|
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||||
|
#
|
||||||
|
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||||
|
#
|
||||||
|
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||||
|
# documentation for any purpose is hereby granted without fee, provided that
|
||||||
|
# the above copyright notice appear in all copies and that both that
|
||||||
|
# copyright notice and this permission notice appear in supporting
|
||||||
|
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||||
|
# publicity pertaining to distribution of the software without specific,
|
||||||
|
# written prior permission. M.I.T. makes no representations about the
|
||||||
|
# suitability of this software for any purpose. It is provided "as is"
|
||||||
|
# without express or implied warranty.
|
||||||
|
#
|
||||||
|
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||||
|
# `make' implicit rules from creating a file called install from it
|
||||||
|
# when there is no Makefile.
|
||||||
|
#
|
||||||
|
# This script is compatible with the BSD install script, but was written
|
||||||
|
# from scratch. It can only install one file at a time, a restriction
|
||||||
|
# shared with many OS's install programs.
|
||||||
|
|
||||||
|
|
||||||
|
# set DOITPROG to echo to test this script
|
||||||
|
|
||||||
|
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||||
|
doit="${DOITPROG-}"
|
||||||
|
|
||||||
|
|
||||||
|
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||||
|
|
||||||
|
mvprog="${MVPROG-mv}"
|
||||||
|
cpprog="${CPPROG-cp}"
|
||||||
|
chmodprog="${CHMODPROG-chmod}"
|
||||||
|
chownprog="${CHOWNPROG-chown}"
|
||||||
|
chgrpprog="${CHGRPPROG-chgrp}"
|
||||||
|
stripprog="${STRIPPROG-strip}"
|
||||||
|
rmprog="${RMPROG-rm}"
|
||||||
|
mkdirprog="${MKDIRPROG-mkdir}"
|
||||||
|
|
||||||
|
transformbasename=""
|
||||||
|
transform_arg=""
|
||||||
|
instcmd="$mvprog"
|
||||||
|
chmodcmd="$chmodprog 0755"
|
||||||
|
chowncmd=""
|
||||||
|
chgrpcmd=""
|
||||||
|
stripcmd=""
|
||||||
|
rmcmd="$rmprog -f"
|
||||||
|
mvcmd="$mvprog"
|
||||||
|
src=""
|
||||||
|
dst=""
|
||||||
|
dir_arg=""
|
||||||
|
|
||||||
|
while [ x"$1" != x ]; do
|
||||||
|
case $1 in
|
||||||
|
-c) instcmd="$cpprog"
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-d) dir_arg=true
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-m) chmodcmd="$chmodprog $2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-o) chowncmd="$chownprog $2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-g) chgrpcmd="$chgrpprog $2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-s) stripcmd="$stripprog"
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
*) if [ x"$src" = x ]
|
||||||
|
then
|
||||||
|
src=$1
|
||||||
|
else
|
||||||
|
# this colon is to work around a 386BSD /bin/sh bug
|
||||||
|
:
|
||||||
|
dst=$1
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ x"$src" = x ]
|
||||||
|
then
|
||||||
|
echo "install: no input file specified"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dir_arg" != x ]; then
|
||||||
|
dst=$src
|
||||||
|
src=""
|
||||||
|
|
||||||
|
if [ -d $dst ]; then
|
||||||
|
instcmd=:
|
||||||
|
chmodcmd=""
|
||||||
|
else
|
||||||
|
instcmd=mkdir
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
|
||||||
|
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||||
|
# might cause directories to be created, which would be especially bad
|
||||||
|
# if $src (and thus $dsttmp) contains '*'.
|
||||||
|
|
||||||
|
if [ -f $src -o -d $src ]
|
||||||
|
then
|
||||||
|
true
|
||||||
|
else
|
||||||
|
echo "install: $src does not exist"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dst" = x ]
|
||||||
|
then
|
||||||
|
echo "install: no destination specified"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If destination is a directory, append the input filename; if your system
|
||||||
|
# does not like double slashes in filenames, you may need to add some logic
|
||||||
|
|
||||||
|
if [ -d $dst ]
|
||||||
|
then
|
||||||
|
dst="$dst"/`basename $src`
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
## this sed command emulates the dirname command
|
||||||
|
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||||
|
|
||||||
|
# Make sure that the destination directory exists.
|
||||||
|
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||||
|
|
||||||
|
# Skip lots of stat calls in the usual case.
|
||||||
|
if [ ! -d "$dstdir" ]; then
|
||||||
|
defaultIFS='
|
||||||
|
'
|
||||||
|
IFS="${IFS-${defaultIFS}}"
|
||||||
|
|
||||||
|
oIFS="${IFS}"
|
||||||
|
# Some sh's can't handle IFS=/ for some reason.
|
||||||
|
IFS='%'
|
||||||
|
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||||
|
IFS="${oIFS}"
|
||||||
|
|
||||||
|
pathcomp=''
|
||||||
|
|
||||||
|
while [ $# -ne 0 ] ; do
|
||||||
|
pathcomp="${pathcomp}${1}"
|
||||||
|
shift
|
||||||
|
|
||||||
|
if [ ! -d "${pathcomp}" ] ;
|
||||||
|
then
|
||||||
|
$mkdirprog "${pathcomp}"
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
pathcomp="${pathcomp}/"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dir_arg" != x ]
|
||||||
|
then
|
||||||
|
$doit $instcmd $dst &&
|
||||||
|
|
||||||
|
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||||
|
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||||
|
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||||
|
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||||
|
else
|
||||||
|
|
||||||
|
# If we're going to rename the final executable, determine the name now.
|
||||||
|
|
||||||
|
if [ x"$transformarg" = x ]
|
||||||
|
then
|
||||||
|
dstfile=`basename $dst`
|
||||||
|
else
|
||||||
|
dstfile=`basename $dst $transformbasename |
|
||||||
|
sed $transformarg`$transformbasename
|
||||||
|
fi
|
||||||
|
|
||||||
|
# don't allow the sed command to completely eliminate the filename
|
||||||
|
|
||||||
|
if [ x"$dstfile" = x ]
|
||||||
|
then
|
||||||
|
dstfile=`basename $dst`
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make a temp file name in the proper directory.
|
||||||
|
|
||||||
|
dsttmp=$dstdir/#inst.$$#
|
||||||
|
|
||||||
|
# Move or copy the file name to the temp name
|
||||||
|
|
||||||
|
$doit $instcmd $src $dsttmp &&
|
||||||
|
|
||||||
|
trap "rm -f ${dsttmp}" 0 &&
|
||||||
|
|
||||||
|
# and set any options; do chmod last to preserve setuid bits
|
||||||
|
|
||||||
|
# If any of these fail, we abort the whole thing. If we want to
|
||||||
|
# ignore errors from any of these, just make sure not to ignore
|
||||||
|
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||||
|
|
||||||
|
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||||
|
|
||||||
|
# Now rename the file to the real destination.
|
||||||
|
|
||||||
|
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||||
|
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||||
|
|
||||||
|
fi &&
|
||||||
|
|
||||||
|
|
||||||
|
exit 0
|
||||||
Executable
+97
@@ -0,0 +1,97 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Get modification time of a file or directory and pretty-print it.
|
||||||
|
# Copyright 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
# written by Ulrich Drepper <[email protected]>, June 1995
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software Foundation,
|
||||||
|
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
# As a special exception to the GNU General Public License, if you
|
||||||
|
# distribute this file as part of a program that contains a
|
||||||
|
# configuration script generated by Autoconf, you may include it under
|
||||||
|
# the same distribution terms that you use for the rest of that program.
|
||||||
|
|
||||||
|
# Prevent date giving response in another language.
|
||||||
|
LANG=C
|
||||||
|
export LANG
|
||||||
|
LC_ALL=C
|
||||||
|
export LC_ALL
|
||||||
|
LC_TIME=C
|
||||||
|
export LC_TIME
|
||||||
|
|
||||||
|
# Get the extended ls output of the file or directory.
|
||||||
|
# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
|
||||||
|
if ls -L /dev/null 1>/dev/null 2>&1; then
|
||||||
|
set - x`ls -L -l -d $1`
|
||||||
|
else
|
||||||
|
set - x`ls -l -d $1`
|
||||||
|
fi
|
||||||
|
# The month is at least the fourth argument
|
||||||
|
# (3 shifts here, the next inside the loop).
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
|
||||||
|
# Find the month. Next argument is day, followed by the year or time.
|
||||||
|
month=
|
||||||
|
until test $month
|
||||||
|
do
|
||||||
|
shift
|
||||||
|
case $1 in
|
||||||
|
Jan) month=January; nummonth=1;;
|
||||||
|
Feb) month=February; nummonth=2;;
|
||||||
|
Mar) month=March; nummonth=3;;
|
||||||
|
Apr) month=April; nummonth=4;;
|
||||||
|
May) month=May; nummonth=5;;
|
||||||
|
Jun) month=June; nummonth=6;;
|
||||||
|
Jul) month=July; nummonth=7;;
|
||||||
|
Aug) month=August; nummonth=8;;
|
||||||
|
Sep) month=September; nummonth=9;;
|
||||||
|
Oct) month=October; nummonth=10;;
|
||||||
|
Nov) month=November; nummonth=11;;
|
||||||
|
Dec) month=December; nummonth=12;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
day=$2
|
||||||
|
|
||||||
|
# Here we have to deal with the problem that the ls output gives either
|
||||||
|
# the time of day or the year.
|
||||||
|
case $3 in
|
||||||
|
*:*) set `date`; eval year=\$$#
|
||||||
|
case $2 in
|
||||||
|
Jan) nummonthtod=1;;
|
||||||
|
Feb) nummonthtod=2;;
|
||||||
|
Mar) nummonthtod=3;;
|
||||||
|
Apr) nummonthtod=4;;
|
||||||
|
May) nummonthtod=5;;
|
||||||
|
Jun) nummonthtod=6;;
|
||||||
|
Jul) nummonthtod=7;;
|
||||||
|
Aug) nummonthtod=8;;
|
||||||
|
Sep) nummonthtod=9;;
|
||||||
|
Oct) nummonthtod=10;;
|
||||||
|
Nov) nummonthtod=11;;
|
||||||
|
Dec) nummonthtod=12;;
|
||||||
|
esac
|
||||||
|
# For the first six month of the year the time notation can also
|
||||||
|
# be used for files modified in the last year.
|
||||||
|
if (expr $nummonth \> $nummonthtod) > /dev/null;
|
||||||
|
then
|
||||||
|
year=`expr $year - 1`
|
||||||
|
fi;;
|
||||||
|
*) year=$3;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# The result.
|
||||||
|
echo $day $month $year
|
||||||
Executable
+336
@@ -0,0 +1,336 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
# Common stub for a few missing GNU programs while installing.
|
||||||
|
# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
|
||||||
|
# Originally by Fran,cois Pinard <[email protected]>, 1996.
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
# 02111-1307, USA.
|
||||||
|
|
||||||
|
# As a special exception to the GNU General Public License, if you
|
||||||
|
# distribute this file as part of a program that contains a
|
||||||
|
# configuration script generated by Autoconf, you may include it under
|
||||||
|
# the same distribution terms that you use for the rest of that program.
|
||||||
|
|
||||||
|
if test $# -eq 0; then
|
||||||
|
echo 1>&2 "Try \`$0 --help' for more information"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
run=:
|
||||||
|
|
||||||
|
# In the cases where this matters, `missing' is being run in the
|
||||||
|
# srcdir already.
|
||||||
|
if test -f configure.ac; then
|
||||||
|
configure_ac=configure.ac
|
||||||
|
else
|
||||||
|
configure_ac=configure.in
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
--run)
|
||||||
|
# Try to run requested program, and just exit if it succeeds.
|
||||||
|
run=
|
||||||
|
shift
|
||||||
|
"$@" && exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# If it does not exist, or fails to run (possibly an outdated version),
|
||||||
|
# try to emulate it.
|
||||||
|
case "$1" in
|
||||||
|
|
||||||
|
-h|--h|--he|--hel|--help)
|
||||||
|
echo "\
|
||||||
|
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||||
|
|
||||||
|
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||||
|
error status if there is no known handling for PROGRAM.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help display this help and exit
|
||||||
|
-v, --version output version information and exit
|
||||||
|
--run try to run the given command, and emulate it if it fails
|
||||||
|
|
||||||
|
Supported PROGRAM values:
|
||||||
|
aclocal touch file \`aclocal.m4'
|
||||||
|
autoconf touch file \`configure'
|
||||||
|
autoheader touch file \`config.h.in'
|
||||||
|
automake touch all \`Makefile.in' files
|
||||||
|
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||||
|
flex create \`lex.yy.c', if possible, from existing .c
|
||||||
|
help2man touch the output file
|
||||||
|
lex create \`lex.yy.c', if possible, from existing .c
|
||||||
|
makeinfo touch the output file
|
||||||
|
tar try tar, gnutar, gtar, then tar without non-portable flags
|
||||||
|
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
|
||||||
|
;;
|
||||||
|
|
||||||
|
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||||
|
echo "missing 0.4 - GNU automake"
|
||||||
|
;;
|
||||||
|
|
||||||
|
-*)
|
||||||
|
echo 1>&2 "$0: Unknown \`$1' option"
|
||||||
|
echo 1>&2 "Try \`$0 --help' for more information"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
|
aclocal)
|
||||||
|
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||||
|
# We have it, but it failed.
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
|
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
|
||||||
|
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||||
|
any GNU archive site."
|
||||||
|
touch aclocal.m4
|
||||||
|
;;
|
||||||
|
|
||||||
|
autoconf)
|
||||||
|
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||||
|
# We have it, but it failed.
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
|
you modified \`${configure_ac}'. You might want to install the
|
||||||
|
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||||
|
archive site."
|
||||||
|
touch configure
|
||||||
|
;;
|
||||||
|
|
||||||
|
autoheader)
|
||||||
|
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||||
|
# We have it, but it failed.
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
|
you modified \`acconfig.h' or \`${configure_ac}'. You might want
|
||||||
|
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||||
|
from any GNU archive site."
|
||||||
|
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
|
||||||
|
test -z "$files" && files="config.h"
|
||||||
|
touch_files=
|
||||||
|
for f in $files; do
|
||||||
|
case "$f" in
|
||||||
|
*:*) touch_files="$touch_files "`echo "$f" |
|
||||||
|
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||||
|
*) touch_files="$touch_files $f.in";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
touch $touch_files
|
||||||
|
;;
|
||||||
|
|
||||||
|
automake)
|
||||||
|
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||||
|
# We have it, but it failed.
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
|
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
|
||||||
|
You might want to install the \`Automake' and \`Perl' packages.
|
||||||
|
Grab them from any GNU archive site."
|
||||||
|
find . -type f -name Makefile.am -print |
|
||||||
|
sed 's/\.am$/.in/' |
|
||||||
|
while read f; do touch "$f"; done
|
||||||
|
;;
|
||||||
|
|
||||||
|
autom4te)
|
||||||
|
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||||
|
# We have it, but it failed.
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||||
|
system. You might have modified some files without having the
|
||||||
|
proper tools for further handling them.
|
||||||
|
You can get \`$1Help2man' as part of \`Autoconf' from any GNU
|
||||||
|
archive site."
|
||||||
|
|
||||||
|
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
|
||||||
|
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
|
||||||
|
if test -f "$file"; then
|
||||||
|
touch $file
|
||||||
|
else
|
||||||
|
test -z "$file" || exec >$file
|
||||||
|
echo "#! /bin/sh"
|
||||||
|
echo "# Created by GNU Automake missing as a replacement of"
|
||||||
|
echo "# $ $@"
|
||||||
|
echo "exit 0"
|
||||||
|
chmod +x $file
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
bison|yacc)
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
|
you modified a \`.y' file. You may need the \`Bison' package
|
||||||
|
in order for those modifications to take effect. You can get
|
||||||
|
\`Bison' from any GNU archive site."
|
||||||
|
rm -f y.tab.c y.tab.h
|
||||||
|
if [ $# -ne 1 ]; then
|
||||||
|
eval LASTARG="\${$#}"
|
||||||
|
case "$LASTARG" in
|
||||||
|
*.y)
|
||||||
|
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||||
|
if [ -f "$SRCFILE" ]; then
|
||||||
|
cp "$SRCFILE" y.tab.c
|
||||||
|
fi
|
||||||
|
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||||
|
if [ -f "$SRCFILE" ]; then
|
||||||
|
cp "$SRCFILE" y.tab.h
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
if [ ! -f y.tab.h ]; then
|
||||||
|
echo >y.tab.h
|
||||||
|
fi
|
||||||
|
if [ ! -f y.tab.c ]; then
|
||||||
|
echo 'main() { return 0; }' >y.tab.c
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
lex|flex)
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
|
you modified a \`.l' file. You may need the \`Flex' package
|
||||||
|
in order for those modifications to take effect. You can get
|
||||||
|
\`Flex' from any GNU archive site."
|
||||||
|
rm -f lex.yy.c
|
||||||
|
if [ $# -ne 1 ]; then
|
||||||
|
eval LASTARG="\${$#}"
|
||||||
|
case "$LASTARG" in
|
||||||
|
*.l)
|
||||||
|
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||||
|
if [ -f "$SRCFILE" ]; then
|
||||||
|
cp "$SRCFILE" lex.yy.c
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
if [ ! -f lex.yy.c ]; then
|
||||||
|
echo 'main() { return 0; }' >lex.yy.c
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
help2man)
|
||||||
|
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||||
|
# We have it, but it failed.
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
|
you modified a dependency of a manual page. You may need the
|
||||||
|
\`Help2man' package in order for those modifications to take
|
||||||
|
effect. You can get \`Help2man' from any GNU archive site."
|
||||||
|
|
||||||
|
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||||
|
if test -z "$file"; then
|
||||||
|
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
|
||||||
|
fi
|
||||||
|
if [ -f "$file" ]; then
|
||||||
|
touch $file
|
||||||
|
else
|
||||||
|
test -z "$file" || exec >$file
|
||||||
|
echo ".ab help2man is required to generate this page"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
makeinfo)
|
||||||
|
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
|
||||||
|
# We have makeinfo, but it failed.
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
|
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||||
|
indirectly affecting the aspect of the manual. The spurious
|
||||||
|
call might also be the consequence of using a buggy \`make' (AIX,
|
||||||
|
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||||
|
the \`GNU make' package. Grab either from any GNU archive site."
|
||||||
|
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||||
|
if test -z "$file"; then
|
||||||
|
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||||
|
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
|
||||||
|
fi
|
||||||
|
touch $file
|
||||||
|
;;
|
||||||
|
|
||||||
|
tar)
|
||||||
|
shift
|
||||||
|
if test -n "$run"; then
|
||||||
|
echo 1>&2 "ERROR: \`tar' requires --run"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# We have already tried tar in the generic part.
|
||||||
|
# Look for gnutar/gtar before invocation to avoid ugly error
|
||||||
|
# messages.
|
||||||
|
if (gnutar --version > /dev/null 2>&1); then
|
||||||
|
gnutar ${1+"$@"} && exit 0
|
||||||
|
fi
|
||||||
|
if (gtar --version > /dev/null 2>&1); then
|
||||||
|
gtar ${1+"$@"} && exit 0
|
||||||
|
fi
|
||||||
|
firstarg="$1"
|
||||||
|
if shift; then
|
||||||
|
case "$firstarg" in
|
||||||
|
*o*)
|
||||||
|
firstarg=`echo "$firstarg" | sed s/o//`
|
||||||
|
tar "$firstarg" ${1+"$@"} && exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
case "$firstarg" in
|
||||||
|
*h*)
|
||||||
|
firstarg=`echo "$firstarg" | sed s/h//`
|
||||||
|
tar "$firstarg" ${1+"$@"} && exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: I can't seem to be able to run \`tar' with the given arguments.
|
||||||
|
You may want to install GNU tar or Free paxutils, or check the
|
||||||
|
command line arguments."
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||||
|
system. You might have modified some files without having the
|
||||||
|
proper tools for further handling them. Check the \`README' file,
|
||||||
|
it often tells you about the needed prerequirements for installing
|
||||||
|
this package. You may also peek at any GNU archive site, in case
|
||||||
|
some other package would contain this missing \`$1' program."
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
||||||
Executable
+101
@@ -0,0 +1,101 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
# mkinstalldirs --- make directory hierarchy
|
||||||
|
# Author: Noah Friedman <[email protected]>
|
||||||
|
# Created: 1993-05-16
|
||||||
|
# Public domain
|
||||||
|
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
errstatus=0
|
||||||
|
dirmode=""
|
||||||
|
|
||||||
|
usage="\
|
||||||
|
Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
|
||||||
|
|
||||||
|
# process command line arguments
|
||||||
|
while test $# -gt 0 ; do
|
||||||
|
case "${1}" in
|
||||||
|
-h | --help | --h* ) # -h for help
|
||||||
|
echo "${usage}" 1>&2; exit 0 ;;
|
||||||
|
-m ) # -m PERM arg
|
||||||
|
shift
|
||||||
|
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
|
||||||
|
dirmode="${1}"
|
||||||
|
shift ;;
|
||||||
|
-- ) shift; break ;; # stop option processing
|
||||||
|
-* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
|
||||||
|
* ) break ;; # first non-opt arg
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
for file
|
||||||
|
do
|
||||||
|
if test -d "$file"; then
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
case $# in
|
||||||
|
0) exit 0 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case $dirmode in
|
||||||
|
'')
|
||||||
|
if mkdir -p -- . 2>/dev/null; then
|
||||||
|
echo "mkdir -p -- $*"
|
||||||
|
exec mkdir -p -- "$@"
|
||||||
|
fi ;;
|
||||||
|
*)
|
||||||
|
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
|
||||||
|
echo "mkdir -m $dirmode -p -- $*"
|
||||||
|
exec mkdir -m "$dirmode" -p -- "$@"
|
||||||
|
fi ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
for file
|
||||||
|
do
|
||||||
|
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||||
|
shift
|
||||||
|
|
||||||
|
pathcomp=
|
||||||
|
for d
|
||||||
|
do
|
||||||
|
pathcomp="$pathcomp$d"
|
||||||
|
case "$pathcomp" in
|
||||||
|
-* ) pathcomp=./$pathcomp ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if test ! -d "$pathcomp"; then
|
||||||
|
echo "mkdir $pathcomp"
|
||||||
|
|
||||||
|
mkdir "$pathcomp" || lasterr=$?
|
||||||
|
|
||||||
|
if test ! -d "$pathcomp"; then
|
||||||
|
errstatus=$lasterr
|
||||||
|
else
|
||||||
|
if test ! -z "$dirmode"; then
|
||||||
|
echo "chmod $dirmode $pathcomp"
|
||||||
|
|
||||||
|
lasterr=""
|
||||||
|
chmod "$dirmode" "$pathcomp" || lasterr=$?
|
||||||
|
|
||||||
|
if test ! -z "$lasterr"; then
|
||||||
|
errstatus=$lasterr
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
pathcomp="$pathcomp/"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
exit $errstatus
|
||||||
|
|
||||||
|
# Local Variables:
|
||||||
|
# mode: shell-script
|
||||||
|
# sh-indentation: 3
|
||||||
|
# End:
|
||||||
|
# mkinstalldirs ends here
|
||||||
Executable
+17
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Like mv $1 $2, but if the files are the same, just delete $1.
|
||||||
|
# Status is 0 if $2 is changed, 1 otherwise.
|
||||||
|
if
|
||||||
|
test -r $2
|
||||||
|
then
|
||||||
|
if
|
||||||
|
cmp -s $1 $2
|
||||||
|
then
|
||||||
|
echo $2 is unchanged
|
||||||
|
rm -f $1
|
||||||
|
else
|
||||||
|
mv -f $1 $2
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
mv -f $1 $2
|
||||||
|
fi
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
1.30d
|
||||||
+6288
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+95
-11
@@ -1,22 +1,106 @@
|
|||||||
dnl Process this file with autoconf to produce a configure script.
|
# Configure template for GNU Bison. -*-Autoconf-*-
|
||||||
AC_INIT(reduce.c)
|
#
|
||||||
|
# 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
|
||||||
|
|
||||||
dnl Checks for programs.
|
# We need a recent Autoconf to run a recent Autotest.
|
||||||
|
AC_PREREQ(2.52g)
|
||||||
|
|
||||||
|
AC_INIT([GNU Bison], [1.30e], [[email protected]])
|
||||||
|
AC_CONFIG_AUX_DIR(config)
|
||||||
|
|
||||||
|
AM_INIT_AUTOMAKE([bison], [1.30e])
|
||||||
|
AM_CONFIG_HEADER(config.h:config.hin)
|
||||||
|
|
||||||
|
# Initialize the test suite.
|
||||||
|
AC_CONFIG_TESTDIR(tests)
|
||||||
|
AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
|
||||||
|
AC_CONFIG_FILES([tests/Makefile tests/atlocal])
|
||||||
|
# Needed by tests/atlocal.in.
|
||||||
|
AC_SUBST([GCC])
|
||||||
|
|
||||||
|
# Checks for programs.
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_INSTALL
|
|
||||||
|
|
||||||
AC_MINIX
|
AC_MINIX
|
||||||
AC_ISC_POSIX
|
AC_ISC_POSIX
|
||||||
|
AM_PROG_CC_STDC
|
||||||
|
AC_PROG_RANLIB
|
||||||
|
AM_MISSING_PROG([AUTOM4TE], [autom4te])
|
||||||
|
|
||||||
dnl Checks for header files.
|
AC_ARG_ENABLE(gcc-warnings,
|
||||||
|
[ --enable-gcc-warnings turn on lots of GCC warnings (not recommended)],
|
||||||
|
[case "${enableval}" in
|
||||||
|
yes|no) ;;
|
||||||
|
*) AC_MSG_ERROR([bad value ${enableval} for gcc-warnings option]) ;;
|
||||||
|
esac],
|
||||||
|
[enableval=no])
|
||||||
|
if test "${enableval}" = yes; then
|
||||||
|
BISON_WARNING(-Wall)
|
||||||
|
BISON_WARNING(-W)
|
||||||
|
BISON_WARNING(-Wbad-function-cast)
|
||||||
|
BISON_WARNING(-Wcast-align)
|
||||||
|
BISON_WARNING(-Wcast-qual)
|
||||||
|
BISON_WARNING(-Wformat)
|
||||||
|
BISON_WARNING(-Wmissing-declarations)
|
||||||
|
BISON_WARNING(-Wmissing-prototypes)
|
||||||
|
BISON_WARNING(-Wnested-externs)
|
||||||
|
BISON_WARNING(-Wshadow)
|
||||||
|
BISON_WARNING(-Wstrict-prototypes)
|
||||||
|
BISON_WARNING(-Wwrite-strings)
|
||||||
|
CFLAGS="$CFLAGS $WARNING_CFLAGS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Checks for libraries.
|
||||||
|
AC_DEFINE([_GNU_SOURCE],1,[Define to 1 for GNU C library extensions.])
|
||||||
|
|
||||||
|
# Checks for header files.
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_CHECK_HEADERS(string.h stdlib.h memory.h)
|
AC_CHECK_HEADERS(ctype.h locale.h memory.h stdlib.h string.h unistd.h)
|
||||||
|
|
||||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
# Checks for typedefs.
|
||||||
|
|
||||||
|
# Checks for structures.
|
||||||
|
|
||||||
|
# Checks for compiler characteristics.
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
|
AC_C_INLINE
|
||||||
|
AM_C_PROTOTYPES
|
||||||
|
|
||||||
dnl Checks for library functions.
|
# Checks for library functions.
|
||||||
AC_FUNC_ALLOCA
|
AC_FUNC_ALLOCA
|
||||||
AC_CHECK_FUNCS(strerror)
|
AC_FUNC_OBSTACK
|
||||||
|
AC_FUNC_ERROR_AT_LINE
|
||||||
|
AC_CHECK_FUNCS(mkstemp setlocale)
|
||||||
|
AC_CHECK_DECLS([stpcpy, strndup, strnlen, memchr])
|
||||||
|
AC_REPLACE_FUNCS(stpcpy strndup strnlen strspn memchr)
|
||||||
|
jm_FUNC_MALLOC
|
||||||
|
jm_FUNC_REALLOC
|
||||||
|
jm_PREREQ_QUOTEARG
|
||||||
|
jm_PREREQ_ERROR
|
||||||
|
AM_WITH_DMALLOC
|
||||||
|
|
||||||
AC_OUTPUT(Makefile)
|
ALL_LINGUAS="de es et fr ja nl ru sv tr"
|
||||||
|
AM_GNU_GETTEXT(, need-ngettext)
|
||||||
|
|
||||||
|
# This is necessary so that .o files in LIBOBJS are also built via
|
||||||
|
# the ANSI2KNR-filtering rules.
|
||||||
|
LIB@&t@OBJS=`echo $LIB@&t@OBJS|sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'`
|
||||||
|
AC_SUBST(LIB@&t@OBJS)
|
||||||
|
|
||||||
|
AC_OUTPUT([Makefile
|
||||||
|
config/Makefile
|
||||||
|
intl/Makefile po/Makefile.in
|
||||||
|
lib/Makefile src/Makefile doc/Makefile
|
||||||
|
m4/Makefile])
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
Makefile Makefile.in
|
||||||
|
*.aux *.dvi *.log *.info* *.pdf *.ps
|
||||||
|
stamp-*
|
||||||
|
bison.cp
|
||||||
|
bison.cps
|
||||||
|
bison.fn
|
||||||
|
bison.ky
|
||||||
|
bison.pg
|
||||||
|
bison.toc
|
||||||
|
bison.tp
|
||||||
|
bison.vr
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
Frequently Asked Questions about Bison:
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Q1. Is Bison Y2K compliant?
|
||||||
|
|
||||||
|
A1. If you're looking for a guarantee or certification, I can't
|
||||||
|
provide it. With a little thought you can answer this one for
|
||||||
|
yourself, though. (Hint: does a parser generator rely on the
|
||||||
|
date or time for anything?) If you're still confused, see
|
||||||
|
http://www.gnu.org/software/year2000.html for more information.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Q2. I can't build Bison because "make" complains that "msgfmt" is not
|
||||||
|
fund. What should I do?
|
||||||
|
|
||||||
|
A2. Like most GNU packages with internationalization support, that
|
||||||
|
feature is turned on by default. If you have problems building
|
||||||
|
in the "po" subdirectory, it indicates that your system's
|
||||||
|
internationalization support is lacking. You can re-configure
|
||||||
|
Bison with "--disable-nls" to turn off this support, or you can
|
||||||
|
install GNU gettext from ftp://ftp.gnu.org/gnu/gettext/ and
|
||||||
|
re-configure Bison. See the file "ABOUT-NLS" for more
|
||||||
|
information.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Q3. I'm having trouble using Bison. Where can I find help?
|
||||||
|
|
||||||
|
A3. First, read the fine manual which comes with bison. Beyond that,
|
||||||
|
you can send mail to <[email protected]>. This mailing list is
|
||||||
|
intended to be populated with people who are willing to answer
|
||||||
|
questions about using and installing Bison. Please keep in mind
|
||||||
|
that (most of) the people on the list have aspects of their lives
|
||||||
|
which are not related to Bison (!), so you may not receive an
|
||||||
|
answer to your question right away. This can be frustrating, but
|
||||||
|
please try not to honk them off; remember that any help they
|
||||||
|
provide is purely voluntary and out of the kindness of their
|
||||||
|
hearts.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Q4. I found a bug. What should I include in the bug report?
|
||||||
|
|
||||||
|
A4. Before you send a bug report, make sure you are using the latest
|
||||||
|
version. Check ftp://ftp.gnu.org/pub/gnu/bison/ or one of its
|
||||||
|
mirrors. Be sure to include the version number in your bug
|
||||||
|
report. If the bug is present in the latest version but not in a
|
||||||
|
previous version, try to determine the most recent version which
|
||||||
|
did not contain the bug.
|
||||||
|
|
||||||
|
If the bug is parser-related, you should include the smallest
|
||||||
|
grammar you can which demonstrates the bug. The grammar file
|
||||||
|
should also be complete (i.e., I should be able to run it through
|
||||||
|
Bison without having to edit or add anything). The smaller and
|
||||||
|
simpler the grammar, the easier it will be to fix the bug.
|
||||||
|
|
||||||
|
Include information about your compilation environment, including
|
||||||
|
your operating system's name and version and your compiler's name
|
||||||
|
and version. If you have trouble compiling, you should also
|
||||||
|
include a transcript of the build session, starting with the
|
||||||
|
invocation of `configure'. Depending on the nature of the bug,
|
||||||
|
you may be asked to send additional files as well (such as
|
||||||
|
`config.h' or `config.cache').
|
||||||
|
|
||||||
|
Patches are most welcome, but not required. That is, do not
|
||||||
|
hesitate to send a bug report just because you can not provide a
|
||||||
|
fix.
|
||||||
|
|
||||||
|
Send bug reports to <[email protected]>.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Q5. Will Bison ever have C++ support?
|
||||||
|
|
||||||
|
A5. Yes, it's in the works. Things are very chaotic right now, but
|
||||||
|
what little information floats around is posted to the bug-bison
|
||||||
|
mailing list. If you're interested in testing C++ support when
|
||||||
|
it becomes available, please consider subscribing to the list,
|
||||||
|
especially if you are willing to beta test other releases as
|
||||||
|
well.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Q6. What is involved in being a beta tester?
|
||||||
|
|
||||||
|
A6. It's not terribly involved. Basically, you would download a test
|
||||||
|
release, compile it, and use it to build and run a parser or two.
|
||||||
|
After that, you would submit either a bug report or a message
|
||||||
|
saying that everything is okay. It is important to report
|
||||||
|
successes as well as failures because test releases eventually
|
||||||
|
become mainstream releases, but only if they are adequately
|
||||||
|
tested. If no one tests, development is essentially halted.
|
||||||
|
|
||||||
|
Beta testers are particularly needed for operating systems to
|
||||||
|
which I do not have access. I currently have easy access to
|
||||||
|
Linux (x86 glibc 2.1), Solaris (SPARC) 2.6 and 2.7, and HP-UX
|
||||||
|
10.20. Reports about other operating systems are especially
|
||||||
|
welcome.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Q7. How do I join the help-bison and bug-bison mailing lists?
|
||||||
|
|
||||||
|
A7. See http://www.gnu.org/ (the section about "GNU mailing lists")
|
||||||
|
for more information.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
|
AUTOMAKE_OPTIONS = 1.4
|
||||||
|
|
||||||
|
info_TEXINFOS = bison.texinfo
|
||||||
|
man_MANS = bison.1
|
||||||
|
bison_TEXINFOS = gpl.texi fdl.texi
|
||||||
|
|
||||||
|
EXTRA_DIST = FAQ bison.1 bison.rnh refcard.tex
|
||||||
|
|
||||||
|
CLEANFILES = refcard.dvi refcard.log refcard.ps
|
||||||
|
|
||||||
|
refcard.dvi: refcard.tex
|
||||||
|
tex refcard.tex
|
||||||
|
|
||||||
|
refcard.ps: refcard.dvi
|
||||||
+61
-32
@@ -10,7 +10,11 @@ bison \- GNU Project parser generator (yacc replacement)
|
|||||||
] [
|
] [
|
||||||
.B \-d
|
.B \-d
|
||||||
] [
|
] [
|
||||||
.B \-\-defines
|
.BI \-\-defines= defines-file
|
||||||
|
] [
|
||||||
|
.B \-g
|
||||||
|
] [
|
||||||
|
.BI \-\-graph= graph-file
|
||||||
] [
|
] [
|
||||||
.B \-k
|
.B \-k
|
||||||
] [
|
] [
|
||||||
@@ -32,10 +36,6 @@ bison \- GNU Project parser generator (yacc replacement)
|
|||||||
] [
|
] [
|
||||||
.BI \-\-name-prefix= prefix
|
.BI \-\-name-prefix= prefix
|
||||||
] [
|
] [
|
||||||
.B \-r
|
|
||||||
] [
|
|
||||||
.B \-\-raw
|
|
||||||
] [
|
|
||||||
.B \-t
|
.B \-t
|
||||||
] [
|
] [
|
||||||
.B \-\-debug
|
.B \-\-debug
|
||||||
@@ -75,13 +75,22 @@ Unlike
|
|||||||
.IR yacc ,
|
.IR yacc ,
|
||||||
the generated files do not have fixed names, but instead use the prefix
|
the generated files do not have fixed names, but instead use the prefix
|
||||||
of the input file.
|
of the input file.
|
||||||
|
Moreover, if you need to put
|
||||||
|
.IR C++
|
||||||
|
code in the input file, you can end his name by a C++-like extension
|
||||||
|
(.ypp or .y++), then bison will follow your extension to name the
|
||||||
|
output file (.cpp or .c++).
|
||||||
For instance, a grammar description file named
|
For instance, a grammar description file named
|
||||||
.B parse.y
|
.B parse.yxx
|
||||||
would produce the generated parser in a file named
|
would produce the generated parser in a file named
|
||||||
.BR parse.tab.c ,
|
.BR parse.tab.cxx ,
|
||||||
instead of
|
instead of
|
||||||
.IR yacc 's
|
.IR yacc 's
|
||||||
.BR y.tab.c .
|
.BR y.tab.c
|
||||||
|
or old
|
||||||
|
.IR Bison
|
||||||
|
versions
|
||||||
|
.BR parse.tab.c .
|
||||||
.PP
|
.PP
|
||||||
This description of the options that can be given to
|
This description of the options that can be given to
|
||||||
.I bison
|
.I bison
|
||||||
@@ -118,8 +127,6 @@ chosen as if the input file were named
|
|||||||
.B \-d
|
.B \-d
|
||||||
.br
|
.br
|
||||||
.ns
|
.ns
|
||||||
.TP
|
|
||||||
.B \-\-defines
|
|
||||||
Write an extra output file containing macro definitions for the token
|
Write an extra output file containing macro definitions for the token
|
||||||
type names defined in the grammar and the semantic value type
|
type names defined in the grammar and the semantic value type
|
||||||
.BR YYSTYPE ,
|
.BR YYSTYPE ,
|
||||||
@@ -140,31 +147,46 @@ in a separate source file, because
|
|||||||
needs to be able to refer to token type codes and the variable
|
needs to be able to refer to token type codes and the variable
|
||||||
.BR yylval .
|
.BR yylval .
|
||||||
.TP
|
.TP
|
||||||
.B \-r
|
.BI \-\-defines= defines-file
|
||||||
|
The behaviour of
|
||||||
|
.BI \-\-defines
|
||||||
|
is the same than
|
||||||
|
.BI \-d
|
||||||
|
option.
|
||||||
|
The only difference is that it has an optionnal argument which is
|
||||||
|
the name of the output filename.
|
||||||
|
.TP
|
||||||
|
.BI \-g
|
||||||
.br
|
.br
|
||||||
.ns
|
.ns
|
||||||
|
Output a VCG definition of the LALR(1) grammar automaton computed by
|
||||||
|
Bison. If the grammar file is
|
||||||
|
.BR foo.y
|
||||||
|
, the VCG output file will be
|
||||||
|
.BR foo.vcg .
|
||||||
.TP
|
.TP
|
||||||
.B \-\-raw
|
.BI \-\-graph= graph-file
|
||||||
The token numbers in the \fIname\fB.h\fR file are usually the Yacc compatible
|
The behaviour of
|
||||||
translations. If this switch is specified, Bison token numbers
|
.BI \-\-graph
|
||||||
are output instead. (Yacc numbers start at 257 except for single character
|
is the same than
|
||||||
tokens; Bison assigns token numbers sequentially for all tokens
|
.BI \-g
|
||||||
starting at 3.)
|
option. The only difference is that it has an optionnal argument which
|
||||||
|
is the name of the output graph filename.
|
||||||
.TP
|
.TP
|
||||||
.B \-k
|
.B \-k
|
||||||
.br
|
.br
|
||||||
.ns
|
.ns
|
||||||
.TP
|
.TP
|
||||||
.B \-\-token-table
|
.B \-\-token-table
|
||||||
This switch causes the \fIname\fB.tab.c\fR output to include a list of
|
This switch causes the \fIname\fB.tab.c\fR output to include a list of
|
||||||
token names in order by their token numbers; this is defined in the array
|
token names in order by their token numbers; this is defined in the array
|
||||||
.IR yytname .
|
.IR yytname .
|
||||||
Also generated
|
Also generated
|
||||||
are #defines for
|
are #defines for
|
||||||
.IR YYNTOKENS ,
|
.IR YYNTOKENS ,
|
||||||
.IR YYNNTS ,
|
.IR YYNNTS ,
|
||||||
.IR YYNRULES ,
|
.IR YYNRULES ,
|
||||||
and
|
and
|
||||||
.IR YYNSTATES .
|
.IR YYNSTATES .
|
||||||
.TP
|
.TP
|
||||||
.B \-l
|
.B \-l
|
||||||
@@ -188,10 +210,10 @@ parser file, treating it an independent source file in its own right.
|
|||||||
.TP
|
.TP
|
||||||
.B \-\-no-parser
|
.B \-\-no-parser
|
||||||
Do not generate the parser code into the output; generate only
|
Do not generate the parser code into the output; generate only
|
||||||
declarations. The generated \fIname\fB.tab.c\fR file will have only
|
declarations. The generated \fIname\fB.tab.c\fR file will have only
|
||||||
constant declarations. In addition, a \fIname\fB.act\fR file is
|
constant declarations. In addition, a \fIname\fB.act\fR file is
|
||||||
generated containing a switch statement body containing all the
|
generated containing a switch statement body containing all the
|
||||||
translated actions.
|
translated actions.
|
||||||
.TP
|
.TP
|
||||||
.BI \-o " outfile"
|
.BI \-o " outfile"
|
||||||
.br
|
.br
|
||||||
@@ -224,7 +246,7 @@ The precise list of symbols renamed is
|
|||||||
.BR yylex ,
|
.BR yylex ,
|
||||||
.BR yyerror ,
|
.BR yyerror ,
|
||||||
.BR yylval ,
|
.BR yylval ,
|
||||||
.BR yychar ,
|
.BR yychar ,
|
||||||
and
|
and
|
||||||
.BR yydebug .
|
.BR yydebug .
|
||||||
.sp
|
.sp
|
||||||
@@ -241,7 +263,7 @@ and so on.
|
|||||||
.TP
|
.TP
|
||||||
.B \-\-debug
|
.B \-\-debug
|
||||||
Output a definition of the macro
|
Output a definition of the macro
|
||||||
.B YYDEBUG
|
.B YYDEBUG
|
||||||
into the parser file,
|
into the parser file,
|
||||||
so that the debugging facilities are compiled.
|
so that the debugging facilities are compiled.
|
||||||
.TP
|
.TP
|
||||||
@@ -320,14 +342,21 @@ bison \-y $*
|
|||||||
.ft R
|
.ft R
|
||||||
.sp
|
.sp
|
||||||
.RE
|
.RE
|
||||||
.PP
|
|
||||||
The long-named options can be introduced with `+' as well as `\-\-',
|
|
||||||
for compatibility with previous releases. Eventually support for `+'
|
|
||||||
will be removed, because it is incompatible with the POSIX.2 standard.
|
|
||||||
.SH FILES
|
.SH FILES
|
||||||
/usr/local/lib/bison.simple simple parser
|
/usr/local/share/bison/bison.simple simple parser
|
||||||
.br
|
.br
|
||||||
/usr/local/lib/bison.hairy complicated parser
|
/usr/local/share/bison/bison.hairy complicated parser
|
||||||
|
.SH "ENVIRONMENT VARIABLES"
|
||||||
|
.TP
|
||||||
|
.SM BISON_SIMPLE
|
||||||
|
If this is set, it specifies the location in which the
|
||||||
|
.B bison.simple
|
||||||
|
parser can be found.
|
||||||
|
.TP
|
||||||
|
.SM BISON_HAIRY
|
||||||
|
If this is set, it specifies the location in which the
|
||||||
|
.B bison.hairy
|
||||||
|
parser can be found.
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.IR yacc (1)
|
.IR yacc (1)
|
||||||
.br
|
.br
|
||||||
|
|||||||
+1140
-919
File diff suppressed because it is too large
Load Diff
+401
@@ -0,0 +1,401 @@
|
|||||||
|
@node GNU Free Documentation License
|
||||||
|
@appendixsec GNU Free Documentation License
|
||||||
|
|
||||||
|
@cindex FDL, GNU Free Documentation License
|
||||||
|
@center Version 1.1, March 2000
|
||||||
|
|
||||||
|
@display
|
||||||
|
Copyright @copyright{} 2000 Free Software Foundation, Inc.
|
||||||
|
59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
@end display
|
||||||
|
|
||||||
|
@enumerate 0
|
||||||
|
@item
|
||||||
|
PREAMBLE
|
||||||
|
|
||||||
|
The purpose of this License is to make a manual, textbook, or other
|
||||||
|
written document @dfn{free} in the sense of freedom: to assure everyone
|
||||||
|
the effective freedom to copy and redistribute it, with or without
|
||||||
|
modifying it, either commercially or noncommercially. Secondarily,
|
||||||
|
this License preserves for the author and publisher a way to get
|
||||||
|
credit for their work, while not being considered responsible for
|
||||||
|
modifications made by others.
|
||||||
|
|
||||||
|
This License is a kind of ``copyleft'', which means that derivative
|
||||||
|
works of the document must themselves be free in the same sense. It
|
||||||
|
complements the GNU General Public License, which is a copyleft
|
||||||
|
license designed for free software.
|
||||||
|
|
||||||
|
We have designed this License in order to use it for manuals for free
|
||||||
|
software, because free software needs free documentation: a free
|
||||||
|
program should come with manuals providing the same freedoms that the
|
||||||
|
software does. But this License is not limited to software manuals;
|
||||||
|
it can be used for any textual work, regardless of subject matter or
|
||||||
|
whether it is published as a printed book. We recommend this License
|
||||||
|
principally for works whose purpose is instruction or reference.
|
||||||
|
|
||||||
|
@item
|
||||||
|
APPLICABILITY AND DEFINITIONS
|
||||||
|
|
||||||
|
This License applies to any manual or other work that contains a
|
||||||
|
notice placed by the copyright holder saying it can be distributed
|
||||||
|
under the terms of this License. The ``Document'', below, refers to any
|
||||||
|
such manual or work. Any member of the public is a licensee, and is
|
||||||
|
addressed as ``you''.
|
||||||
|
|
||||||
|
A ``Modified Version'' of the Document means any work containing the
|
||||||
|
Document or a portion of it, either copied verbatim, or with
|
||||||
|
modifications and/or translated into another language.
|
||||||
|
|
||||||
|
A ``Secondary Section'' is a named appendix or a front-matter section of
|
||||||
|
the Document that deals exclusively with the relationship of the
|
||||||
|
publishers or authors of the Document to the Document's overall subject
|
||||||
|
(or to related matters) and contains nothing that could fall directly
|
||||||
|
within that overall subject. (For example, if the Document is in part a
|
||||||
|
textbook of mathematics, a Secondary Section may not explain any
|
||||||
|
mathematics.) The relationship could be a matter of historical
|
||||||
|
connection with the subject or with related matters, or of legal,
|
||||||
|
commercial, philosophical, ethical or political position regarding
|
||||||
|
them.
|
||||||
|
|
||||||
|
The ``Invariant Sections'' are certain Secondary Sections whose titles
|
||||||
|
are designated, as being those of Invariant Sections, in the notice
|
||||||
|
that says that the Document is released under this License.
|
||||||
|
|
||||||
|
The ``Cover Texts'' are certain short passages of text that are listed,
|
||||||
|
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
|
||||||
|
the Document is released under this License.
|
||||||
|
|
||||||
|
A ``Transparent'' copy of the Document means a machine-readable copy,
|
||||||
|
represented in a format whose specification is available to the
|
||||||
|
general public, whose contents can be viewed and edited directly and
|
||||||
|
straightforwardly with generic text editors or (for images composed of
|
||||||
|
pixels) generic paint programs or (for drawings) some widely available
|
||||||
|
drawing editor, and that is suitable for input to text formatters or
|
||||||
|
for automatic translation to a variety of formats suitable for input
|
||||||
|
to text formatters. A copy made in an otherwise Transparent file
|
||||||
|
format whose markup has been designed to thwart or discourage
|
||||||
|
subsequent modification by readers is not Transparent. A copy that is
|
||||||
|
not ``Transparent'' is called ``Opaque''.
|
||||||
|
|
||||||
|
Examples of suitable formats for Transparent copies include plain
|
||||||
|
@sc{ascii} without markup, Texinfo input format, La@TeX{} input format,
|
||||||
|
@acronym{SGML} or @acronym{XML} using a publicly available
|
||||||
|
@acronym{DTD}, and standard-conforming simple @acronym{HTML} designed
|
||||||
|
for human modification. Opaque formats include PostScript,
|
||||||
|
@acronym{PDF}, proprietary formats that can be read and edited only by
|
||||||
|
proprietary word processors, @acronym{SGML} or @acronym{XML} for which
|
||||||
|
the @acronym{DTD} and/or processing tools are not generally available,
|
||||||
|
and the machine-generated @acronym{HTML} produced by some word
|
||||||
|
processors for output purposes only.
|
||||||
|
|
||||||
|
The ``Title Page'' means, for a printed book, the title page itself,
|
||||||
|
plus such following pages as are needed to hold, legibly, the material
|
||||||
|
this License requires to appear in the title page. For works in
|
||||||
|
formats which do not have any title page as such, ``Title Page'' means
|
||||||
|
the text near the most prominent appearance of the work's title,
|
||||||
|
preceding the beginning of the body of the text.
|
||||||
|
|
||||||
|
@item
|
||||||
|
VERBATIM COPYING
|
||||||
|
|
||||||
|
You may copy and distribute the Document in any medium, either
|
||||||
|
commercially or noncommercially, provided that this License, the
|
||||||
|
copyright notices, and the license notice saying this License applies
|
||||||
|
to the Document are reproduced in all copies, and that you add no other
|
||||||
|
conditions whatsoever to those of this License. You may not use
|
||||||
|
technical measures to obstruct or control the reading or further
|
||||||
|
copying of the copies you make or distribute. However, you may accept
|
||||||
|
compensation in exchange for copies. If you distribute a large enough
|
||||||
|
number of copies you must also follow the conditions in section 3.
|
||||||
|
|
||||||
|
You may also lend copies, under the same conditions stated above, and
|
||||||
|
you may publicly display copies.
|
||||||
|
|
||||||
|
@item
|
||||||
|
COPYING IN QUANTITY
|
||||||
|
|
||||||
|
If you publish printed copies of the Document numbering more than 100,
|
||||||
|
and the Document's license notice requires Cover Texts, you must enclose
|
||||||
|
the copies in covers that carry, clearly and legibly, all these Cover
|
||||||
|
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
|
||||||
|
the back cover. Both covers must also clearly and legibly identify
|
||||||
|
you as the publisher of these copies. The front cover must present
|
||||||
|
the full title with all words of the title equally prominent and
|
||||||
|
visible. You may add other material on the covers in addition.
|
||||||
|
Copying with changes limited to the covers, as long as they preserve
|
||||||
|
the title of the Document and satisfy these conditions, can be treated
|
||||||
|
as verbatim copying in other respects.
|
||||||
|
|
||||||
|
If the required texts for either cover are too voluminous to fit
|
||||||
|
legibly, you should put the first ones listed (as many as fit
|
||||||
|
reasonably) on the actual cover, and continue the rest onto adjacent
|
||||||
|
pages.
|
||||||
|
|
||||||
|
If you publish or distribute Opaque copies of the Document numbering
|
||||||
|
more than 100, you must either include a machine-readable Transparent
|
||||||
|
copy along with each Opaque copy, or state in or with each Opaque copy
|
||||||
|
a publicly-accessible computer-network location containing a complete
|
||||||
|
Transparent copy of the Document, free of added material, which the
|
||||||
|
general network-using public has access to download anonymously at no
|
||||||
|
charge using public-standard network protocols. If you use the latter
|
||||||
|
option, you must take reasonably prudent steps, when you begin
|
||||||
|
distribution of Opaque copies in quantity, to ensure that this
|
||||||
|
Transparent copy will remain thus accessible at the stated location
|
||||||
|
until at least one year after the last time you distribute an Opaque
|
||||||
|
copy (directly or through your agents or retailers) of that edition to
|
||||||
|
the public.
|
||||||
|
|
||||||
|
It is requested, but not required, that you contact the authors of the
|
||||||
|
Document well before redistributing any large number of copies, to give
|
||||||
|
them a chance to provide you with an updated version of the Document.
|
||||||
|
|
||||||
|
@item
|
||||||
|
MODIFICATIONS
|
||||||
|
|
||||||
|
You may copy and distribute a Modified Version of the Document under
|
||||||
|
the conditions of sections 2 and 3 above, provided that you release
|
||||||
|
the Modified Version under precisely this License, with the Modified
|
||||||
|
Version filling the role of the Document, thus licensing distribution
|
||||||
|
and modification of the Modified Version to whoever possesses a copy
|
||||||
|
of it. In addition, you must do these things in the Modified Version:
|
||||||
|
|
||||||
|
@enumerate A
|
||||||
|
@item
|
||||||
|
Use in the Title Page (and on the covers, if any) a title distinct
|
||||||
|
from that of the Document, and from those of previous versions
|
||||||
|
(which should, if there were any, be listed in the History section
|
||||||
|
of the Document). You may use the same title as a previous version
|
||||||
|
if the original publisher of that version gives permission.
|
||||||
|
|
||||||
|
@item
|
||||||
|
List on the Title Page, as authors, one or more persons or entities
|
||||||
|
responsible for authorship of the modifications in the Modified
|
||||||
|
Version, together with at least five of the principal authors of the
|
||||||
|
Document (all of its principal authors, if it has less than five).
|
||||||
|
|
||||||
|
@item
|
||||||
|
State on the Title page the name of the publisher of the
|
||||||
|
Modified Version, as the publisher.
|
||||||
|
|
||||||
|
@item
|
||||||
|
Preserve all the copyright notices of the Document.
|
||||||
|
|
||||||
|
@item
|
||||||
|
Add an appropriate copyright notice for your modifications
|
||||||
|
adjacent to the other copyright notices.
|
||||||
|
|
||||||
|
@item
|
||||||
|
Include, immediately after the copyright notices, a license notice
|
||||||
|
giving the public permission to use the Modified Version under the
|
||||||
|
terms of this License, in the form shown in the Addendum below.
|
||||||
|
|
||||||
|
@item
|
||||||
|
Preserve in that license notice the full lists of Invariant Sections
|
||||||
|
and required Cover Texts given in the Document's license notice.
|
||||||
|
|
||||||
|
@item
|
||||||
|
Include an unaltered copy of this License.
|
||||||
|
|
||||||
|
@item
|
||||||
|
Preserve the section entitled ``History'', and its title, and add to
|
||||||
|
it an item stating at least the title, year, new authors, and
|
||||||
|
publisher of the Modified Version as given on the Title Page. If
|
||||||
|
there is no section entitled ``History'' in the Document, create one
|
||||||
|
stating the title, year, authors, and publisher of the Document as
|
||||||
|
given on its Title Page, then add an item describing the Modified
|
||||||
|
Version as stated in the previous sentence.
|
||||||
|
|
||||||
|
@item
|
||||||
|
Preserve the network location, if any, given in the Document for
|
||||||
|
public access to a Transparent copy of the Document, and likewise
|
||||||
|
the network locations given in the Document for previous versions
|
||||||
|
it was based on. These may be placed in the ``History'' section.
|
||||||
|
You may omit a network location for a work that was published at
|
||||||
|
least four years before the Document itself, or if the original
|
||||||
|
publisher of the version it refers to gives permission.
|
||||||
|
|
||||||
|
@item
|
||||||
|
In any section entitled ``Acknowledgments'' or ``Dedications'',
|
||||||
|
preserve the section's title, and preserve in the section all the
|
||||||
|
substance and tone of each of the contributor acknowledgments
|
||||||
|
and/or dedications given therein.
|
||||||
|
|
||||||
|
@item
|
||||||
|
Preserve all the Invariant Sections of the Document,
|
||||||
|
unaltered in their text and in their titles. Section numbers
|
||||||
|
or the equivalent are not considered part of the section titles.
|
||||||
|
|
||||||
|
@item
|
||||||
|
Delete any section entitled ``Endorsements''. Such a section
|
||||||
|
may not be included in the Modified Version.
|
||||||
|
|
||||||
|
@item
|
||||||
|
Do not retitle any existing section as ``Endorsements''
|
||||||
|
or to conflict in title with any Invariant Section.
|
||||||
|
@end enumerate
|
||||||
|
|
||||||
|
If the Modified Version includes new front-matter sections or
|
||||||
|
appendices that qualify as Secondary Sections and contain no material
|
||||||
|
copied from the Document, you may at your option designate some or all
|
||||||
|
of these sections as invariant. To do this, add their titles to the
|
||||||
|
list of Invariant Sections in the Modified Version's license notice.
|
||||||
|
These titles must be distinct from any other section titles.
|
||||||
|
|
||||||
|
You may add a section entitled ``Endorsements'', provided it contains
|
||||||
|
nothing but endorsements of your Modified Version by various
|
||||||
|
parties---for example, statements of peer review or that the text has
|
||||||
|
been approved by an organization as the authoritative definition of a
|
||||||
|
standard.
|
||||||
|
|
||||||
|
You may add a passage of up to five words as a Front-Cover Text, and a
|
||||||
|
passage of up to 25 words as a Back-Cover Text, to the end of the list
|
||||||
|
of Cover Texts in the Modified Version. Only one passage of
|
||||||
|
Front-Cover Text and one of Back-Cover Text may be added by (or
|
||||||
|
through arrangements made by) any one entity. If the Document already
|
||||||
|
includes a cover text for the same cover, previously added by you or
|
||||||
|
by arrangement made by the same entity you are acting on behalf of,
|
||||||
|
you may not add another; but you may replace the old one, on explicit
|
||||||
|
permission from the previous publisher that added the old one.
|
||||||
|
|
||||||
|
The author(s) and publisher(s) of the Document do not by this License
|
||||||
|
give permission to use their names for publicity for or to assert or
|
||||||
|
imply endorsement of any Modified Version.
|
||||||
|
|
||||||
|
@item
|
||||||
|
COMBINING DOCUMENTS
|
||||||
|
|
||||||
|
You may combine the Document with other documents released under this
|
||||||
|
License, under the terms defined in section 4 above for modified
|
||||||
|
versions, provided that you include in the combination all of the
|
||||||
|
Invariant Sections of all of the original documents, unmodified, and
|
||||||
|
list them all as Invariant Sections of your combined work in its
|
||||||
|
license notice.
|
||||||
|
|
||||||
|
The combined work need only contain one copy of this License, and
|
||||||
|
multiple identical Invariant Sections may be replaced with a single
|
||||||
|
copy. If there are multiple Invariant Sections with the same name but
|
||||||
|
different contents, make the title of each such section unique by
|
||||||
|
adding at the end of it, in parentheses, the name of the original
|
||||||
|
author or publisher of that section if known, or else a unique number.
|
||||||
|
Make the same adjustment to the section titles in the list of
|
||||||
|
Invariant Sections in the license notice of the combined work.
|
||||||
|
|
||||||
|
In the combination, you must combine any sections entitled ``History''
|
||||||
|
in the various original documents, forming one section entitled
|
||||||
|
``History''; likewise combine any sections entitled ``Acknowledgments'',
|
||||||
|
and any sections entitled ``Dedications''. You must delete all sections
|
||||||
|
entitled ``Endorsements.''
|
||||||
|
|
||||||
|
@item
|
||||||
|
COLLECTIONS OF DOCUMENTS
|
||||||
|
|
||||||
|
You may make a collection consisting of the Document and other documents
|
||||||
|
released under this License, and replace the individual copies of this
|
||||||
|
License in the various documents with a single copy that is included in
|
||||||
|
the collection, provided that you follow the rules of this License for
|
||||||
|
verbatim copying of each of the documents in all other respects.
|
||||||
|
|
||||||
|
You may extract a single document from such a collection, and distribute
|
||||||
|
it individually under this License, provided you insert a copy of this
|
||||||
|
License into the extracted document, and follow this License in all
|
||||||
|
other respects regarding verbatim copying of that document.
|
||||||
|
|
||||||
|
@item
|
||||||
|
AGGREGATION WITH INDEPENDENT WORKS
|
||||||
|
|
||||||
|
A compilation of the Document or its derivatives with other separate
|
||||||
|
and independent documents or works, in or on a volume of a storage or
|
||||||
|
distribution medium, does not as a whole count as a Modified Version
|
||||||
|
of the Document, provided no compilation copyright is claimed for the
|
||||||
|
compilation. Such a compilation is called an ``aggregate'', and this
|
||||||
|
License does not apply to the other self-contained works thus compiled
|
||||||
|
with the Document, on account of their being thus compiled, if they
|
||||||
|
are not themselves derivative works of the Document.
|
||||||
|
|
||||||
|
If the Cover Text requirement of section 3 is applicable to these
|
||||||
|
copies of the Document, then if the Document is less than one quarter
|
||||||
|
of the entire aggregate, the Document's Cover Texts may be placed on
|
||||||
|
covers that surround only the Document within the aggregate.
|
||||||
|
Otherwise they must appear on covers around the whole aggregate.
|
||||||
|
|
||||||
|
@item
|
||||||
|
TRANSLATION
|
||||||
|
|
||||||
|
Translation is considered a kind of modification, so you may
|
||||||
|
distribute translations of the Document under the terms of section 4.
|
||||||
|
Replacing Invariant Sections with translations requires special
|
||||||
|
permission from their copyright holders, but you may include
|
||||||
|
translations of some or all Invariant Sections in addition to the
|
||||||
|
original versions of these Invariant Sections. You may include a
|
||||||
|
translation of this License provided that you also include the
|
||||||
|
original English version of this License. In case of a disagreement
|
||||||
|
between the translation and the original English version of this
|
||||||
|
License, the original English version will prevail.
|
||||||
|
|
||||||
|
@item
|
||||||
|
TERMINATION
|
||||||
|
|
||||||
|
You may not copy, modify, sublicense, or distribute the Document except
|
||||||
|
as expressly provided for under this License. Any other attempt to
|
||||||
|
copy, modify, sublicense or distribute the Document is void, and will
|
||||||
|
automatically terminate your rights under this License. However,
|
||||||
|
parties who have received copies, or rights, from you under this
|
||||||
|
License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
@item
|
||||||
|
FUTURE REVISIONS OF THIS LICENSE
|
||||||
|
|
||||||
|
The Free Software Foundation may publish new, revised versions
|
||||||
|
of the GNU Free Documentation License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns. See
|
||||||
|
@uref{http://www.gnu.org/copyleft/}.
|
||||||
|
|
||||||
|
Each version of the License is given a distinguishing version number.
|
||||||
|
If the Document specifies that a particular numbered version of this
|
||||||
|
License ``or any later version'' applies to it, you have the option of
|
||||||
|
following the terms and conditions either of that specified version or
|
||||||
|
of any later version that has been published (not as a draft) by the
|
||||||
|
Free Software Foundation. If the Document does not specify a version
|
||||||
|
number of this License, you may choose any version ever published (not
|
||||||
|
as a draft) by the Free Software Foundation.
|
||||||
|
@end enumerate
|
||||||
|
|
||||||
|
@page
|
||||||
|
@appendixsubsec ADDENDUM: How to use this License for your documents
|
||||||
|
|
||||||
|
To use this License in a document you have written, include a copy of
|
||||||
|
the License in the document and put the following copyright and
|
||||||
|
license notices just after the title page:
|
||||||
|
|
||||||
|
@smallexample
|
||||||
|
@group
|
||||||
|
Copyright (C) @var{year} @var{your name}.
|
||||||
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
|
under the terms of the GNU Free Documentation License, Version 1.1
|
||||||
|
or any later version published by the Free Software Foundation;
|
||||||
|
with the Invariant Sections being @var{list their titles}, with the
|
||||||
|
Front-Cover Texts being @var{list}, and with the Back-Cover Texts being @var{list}.
|
||||||
|
A copy of the license is included in the section entitled ``GNU
|
||||||
|
Free Documentation License''.
|
||||||
|
@end group
|
||||||
|
@end smallexample
|
||||||
|
|
||||||
|
If you have no Invariant Sections, write ``with no Invariant Sections''
|
||||||
|
instead of saying which ones are invariant. If you have no
|
||||||
|
Front-Cover Texts, write ``no Front-Cover Texts'' instead of
|
||||||
|
``Front-Cover Texts being @var{list}''; likewise for Back-Cover Texts.
|
||||||
|
|
||||||
|
If your document contains nontrivial examples of program code, we
|
||||||
|
recommend releasing these examples in parallel under your choice of
|
||||||
|
free software license, such as the GNU General Public License,
|
||||||
|
to permit their use in free software.
|
||||||
|
|
||||||
|
@c Local Variables:
|
||||||
|
@c ispell-local-pdict: "ispell-dict"
|
||||||
|
@c End:
|
||||||
+392
@@ -0,0 +1,392 @@
|
|||||||
|
@node Copying
|
||||||
|
@unnumbered GNU GENERAL PUBLIC LICENSE
|
||||||
|
@center Version 2, June 1991
|
||||||
|
|
||||||
|
@c This file is intended to be included in another file.
|
||||||
|
|
||||||
|
@display
|
||||||
|
Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
@end display
|
||||||
|
|
||||||
|
@unnumberedsec Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software---to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Library General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
@iftex
|
||||||
|
@unnumberedsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
@end iftex
|
||||||
|
@ifinfo
|
||||||
|
@center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
@end ifinfo
|
||||||
|
|
||||||
|
@enumerate 0
|
||||||
|
@item
|
||||||
|
This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The ``Program'', below,
|
||||||
|
refers to any such program or work, and a ``work based on the Program''
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term ``modification''.) Each licensee is addressed as ``you''.
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
@item
|
||||||
|
You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
@item
|
||||||
|
You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
@enumerate a
|
||||||
|
@item
|
||||||
|
You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
@item
|
||||||
|
You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
@item
|
||||||
|
If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
@end enumerate
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
@item
|
||||||
|
You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
@enumerate a
|
||||||
|
@item
|
||||||
|
Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
@item
|
||||||
|
Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
@item
|
||||||
|
Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
@end enumerate
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
@item
|
||||||
|
You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
@item
|
||||||
|
You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
@item
|
||||||
|
Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
@item
|
||||||
|
If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
@item
|
||||||
|
If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
@item
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and ``any
|
||||||
|
later version'', you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
@item
|
||||||
|
If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
@iftex
|
||||||
|
@heading NO WARRANTY
|
||||||
|
@end iftex
|
||||||
|
@ifinfo
|
||||||
|
@center NO WARRANTY
|
||||||
|
@end ifinfo
|
||||||
|
|
||||||
|
@item
|
||||||
|
BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
@item
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
@end enumerate
|
||||||
|
|
||||||
|
@iftex
|
||||||
|
@heading END OF TERMS AND CONDITIONS
|
||||||
|
@end iftex
|
||||||
|
@ifinfo
|
||||||
|
@center END OF TERMS AND CONDITIONS
|
||||||
|
@end ifinfo
|
||||||
|
|
||||||
|
@page
|
||||||
|
@unnumberedsec Appendix: How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the ``copyright'' line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
@smallexample
|
||||||
|
@var{one line to give the program's name and a brief idea of what it does.}
|
||||||
|
Copyright (C) @var{yyyy} @var{name of author}
|
||||||
|
|
||||||
|
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.
|
||||||
|
@end smallexample
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
@smallexample
|
||||||
|
Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author}
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
@end smallexample
|
||||||
|
|
||||||
|
The hypothetical commands @samp{show w} and @samp{show c} should show
|
||||||
|
the appropriate parts of the General Public License. Of course, the
|
||||||
|
commands you use may be called something other than @samp{show w} and
|
||||||
|
@samp{show c}; they could even be mouse-clicks or menu items---whatever
|
||||||
|
suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a ``copyright disclaimer'' for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
@example
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
@var{signature of Ty Coon}, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
@end example
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Library General
|
||||||
|
Public License instead of this License.
|
||||||
+512
@@ -0,0 +1,512 @@
|
|||||||
|
% Bison Quick Reference
|
||||||
|
|
||||||
|
%**start of header
|
||||||
|
\newcount\columnsperpage
|
||||||
|
|
||||||
|
% This file can be printed with 1 or 2 columns per page (see below).
|
||||||
|
% Specify how many you want here. Nothing else needs to be changed
|
||||||
|
% unless you are maintaining the documentation.
|
||||||
|
% For printing reference cards to use in books, specify one column
|
||||||
|
% per page and reduce to 80%.
|
||||||
|
% Note that if columnsperpage is set to 2, there will be a few overfull
|
||||||
|
% boxes, but they are not serious. Just uncomment \finalout.
|
||||||
|
|
||||||
|
\columnsperpage=1
|
||||||
|
|
||||||
|
% comment out this line if you want page numbers to appear.
|
||||||
|
\nopagenumbers
|
||||||
|
|
||||||
|
\def\finalout{\overfullrule=0pt}
|
||||||
|
%\finalout
|
||||||
|
|
||||||
|
% Copyright (c) 1998, 2001 Free Software Foundation, Inc.
|
||||||
|
%
|
||||||
|
% This file is part of Bison.
|
||||||
|
%
|
||||||
|
% Bison is free software; you can redistribute them and/or modify them
|
||||||
|
% under the terms of the GNU General Public License as published by the
|
||||||
|
% Free Software Foundation; either version 2, or (at your option) any
|
||||||
|
% later version.
|
||||||
|
%
|
||||||
|
% Bison is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
% for more details.
|
||||||
|
%
|
||||||
|
% You should have received a copy of the GNU General Public License
|
||||||
|
% along with either Flex or Bison; see the file COPYING. If not, write
|
||||||
|
% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
% Boston, MA 02111-1307, USA.
|
||||||
|
%
|
||||||
|
% This file is intended to be processed by plain TeX (TeX82).
|
||||||
|
%
|
||||||
|
% The final reference card has two columns:
|
||||||
|
% This file can be used to produce it in any of three ways:
|
||||||
|
% 1 column per page
|
||||||
|
% produces two separate pages, each of which needs to be reduced to 80%.
|
||||||
|
% This gives the best resolution.
|
||||||
|
% 2 columns per page
|
||||||
|
% produces a single page.
|
||||||
|
% You will still need to cut and paste.
|
||||||
|
% Which mode to use is controlled by setting \columnsperpage above.
|
||||||
|
%
|
||||||
|
% Authors:
|
||||||
|
% Brendan Kehoe
|
||||||
|
% UUCP: widener!brendan
|
||||||
|
% Internet: [email protected]
|
||||||
|
%
|
||||||
|
% Gavin Nicol
|
||||||
|
% Internet: [email protected]
|
||||||
|
%
|
||||||
|
% This refcard format was created by Steve Gildea.
|
||||||
|
%
|
||||||
|
% Thanks to Paul Rubin, Bob Chassell, Len Tower, and Richard Mlynarik
|
||||||
|
% for their many good ideas.
|
||||||
|
|
||||||
|
% We only change the following to change the version numbers and
|
||||||
|
% such.
|
||||||
|
|
||||||
|
\def\bisonversion{1.31} % the bison version
|
||||||
|
|
||||||
|
\def\refcardversion{0.5} % reference card version
|
||||||
|
\def\month{November} % month
|
||||||
|
\def\year{2001} % year
|
||||||
|
\def\version{\month\ \year, Bison Refcard Version \refcardversion}
|
||||||
|
|
||||||
|
% for copyright notices
|
||||||
|
\def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip}
|
||||||
|
\def\medium{\mediumfont\textfont2=\mediumsy\baselineskip=.8\baselineskip}
|
||||||
|
|
||||||
|
\def\copyrightnotice{
|
||||||
|
\vskip .15ex plus .25 fill
|
||||||
|
\begingroup\medium
|
||||||
|
\centerline{Copyright \copyright\ \year\ Free Software Foundation, Inc.}
|
||||||
|
\vskip .2\baselineskip
|
||||||
|
\centerline{\version}
|
||||||
|
\vskip .2\baselineskip
|
||||||
|
\centerline{designed by Brendan Kehoe and Gavin Nicol}
|
||||||
|
\vskip .2\baselineskip
|
||||||
|
\centerline{for Bison \bisonversion}
|
||||||
|
|
||||||
|
Permission is granted to make and distribute copies of this card
|
||||||
|
provided the copyright notice and this permission notice
|
||||||
|
are preserved on all copies.
|
||||||
|
\vskip .2\baselineskip
|
||||||
|
For information, write to the:
|
||||||
|
\vskip .2\baselineskip
|
||||||
|
\centerline{Free Software Foundation, Inc.}
|
||||||
|
\vskip .2\baselineskip
|
||||||
|
\centerline{59 Temple Place - Suite 330}
|
||||||
|
\vskip .2\baselineskip
|
||||||
|
\centerline{Boston, MA 02111-1307 USA}
|
||||||
|
\endgroup}
|
||||||
|
|
||||||
|
%%%% smallcopyrightnotice for two column printing on one page.
|
||||||
|
\def\smallcopyrightnotice{
|
||||||
|
\vskip .15ex plus .25 fill
|
||||||
|
\begingroup\small
|
||||||
|
\centerline{Copyright \copyright\ \year\ Free Software Foundation, Inc.}
|
||||||
|
\vskip .2\baselineskip
|
||||||
|
\centerline{\version}
|
||||||
|
\vskip .2\baselineskip
|
||||||
|
\centerline{designed by Brendan Kehoe and Gavin Nicol}
|
||||||
|
\vskip .2\baselineskip
|
||||||
|
\centerline{for Bison \bisonversion}
|
||||||
|
|
||||||
|
Permission is granted to make and distribute copies of this card
|
||||||
|
provided the copyright notice and this permission notice
|
||||||
|
are preserved on all copies.
|
||||||
|
\vskip .2\baselineskip
|
||||||
|
For information, write to the:
|
||||||
|
\vskip .2\baselineskip
|
||||||
|
\centerline{Free Software Foundation, Inc.}
|
||||||
|
\vskip .2\baselineskip
|
||||||
|
\centerline{59 Temple Place - Suite 330}
|
||||||
|
\vskip .2\baselineskip
|
||||||
|
\centerline{Boston, MA 02111-1307 USA}
|
||||||
|
\endgroup}
|
||||||
|
|
||||||
|
% make \bye not \outer so that the \def\bye in the \else clause below
|
||||||
|
% can be scanned without complaint.
|
||||||
|
\def\bye{\par\vfill\supereject\end}
|
||||||
|
|
||||||
|
\newdimen\intercolumnskip
|
||||||
|
\newbox\columna
|
||||||
|
\newbox\columnb
|
||||||
|
|
||||||
|
\def\ncolumns{\the\columnsperpage}
|
||||||
|
|
||||||
|
\message{[\ncolumns\space
|
||||||
|
column\if 1\ncolumns\else s\fi\space per page]}
|
||||||
|
|
||||||
|
\def\scaledmag#1{ scaled \magstep #1}
|
||||||
|
|
||||||
|
% This multi-way format was designed by Stephen Gildea
|
||||||
|
% October 1986.
|
||||||
|
\if 1\ncolumns
|
||||||
|
\hsize 4in
|
||||||
|
\vsize 10in
|
||||||
|
% We want output .3 inch *from top of paper edge*; i.e. -.7in from TeX default
|
||||||
|
\voffset -.7in % Comment out for xdvi viewing; include for printing.
|
||||||
|
\font\titlefont=\fontname\tenbf \scaledmag3
|
||||||
|
\font\headingfont=\fontname\tenbf \scaledmag2
|
||||||
|
\font\smallfont=cmr6
|
||||||
|
\font\smallsy=cmsy6
|
||||||
|
\font\mediumfont=cmr10
|
||||||
|
\font\mediumsy=cmsy10
|
||||||
|
|
||||||
|
|
||||||
|
% two lines below commented out in Yet Another Attempt to eliminate
|
||||||
|
% page numbers from the output.
|
||||||
|
\footline{\hss}
|
||||||
|
% \footline{\hss\folio}
|
||||||
|
\def\makefootline{\baselineskip10pt\hsize6.5in\line{\the\footline}}
|
||||||
|
\else
|
||||||
|
\hsize 3.2in
|
||||||
|
\vsize 7.95in
|
||||||
|
\hoffset -.75in
|
||||||
|
\voffset -.745in
|
||||||
|
\font\titlefont=cmbx10 \scaledmag2
|
||||||
|
\font\headingfont=cmbx10 \scaledmag1
|
||||||
|
\font\smallfont=cmr6
|
||||||
|
\font\smallsy=cmsy6
|
||||||
|
\font\eightrm=cmr8
|
||||||
|
\font\eightbf=cmbx8
|
||||||
|
\font\eightit=cmti8
|
||||||
|
\font\eighttt=cmtt8
|
||||||
|
\font\eightsy=cmsy8
|
||||||
|
\textfont0=\eightrm
|
||||||
|
\textfont2=\eightsy
|
||||||
|
\def\rm{\eightrm}
|
||||||
|
\def\bf{\eightbf}
|
||||||
|
\def\it{\eightit}
|
||||||
|
\def\tt{\eighttt}
|
||||||
|
%%%% Reduce skip from .8 to .75 to permit printing on two pages.
|
||||||
|
\normalbaselineskip=.75\normalbaselineskip
|
||||||
|
\normallineskip=.75\normallineskip
|
||||||
|
\normallineskiplimit=.75\normallineskiplimit
|
||||||
|
\normalbaselines\rm %make definitions take effect
|
||||||
|
|
||||||
|
\if 2\ncolumns
|
||||||
|
\let\maxcolumn=b
|
||||||
|
\footline{\hss\rm\folio\hss}
|
||||||
|
\def\makefootline{\vskip 2in \hsize=6.86in\line{\the\footline}}
|
||||||
|
\font\mediumfont=cmr10
|
||||||
|
\font\mediumsy=cmsy10
|
||||||
|
|
||||||
|
% Leave 3 column code here in case size increases.
|
||||||
|
\else \if 3\ncolumns
|
||||||
|
\let\maxcolumn=c
|
||||||
|
\nopagenumbers
|
||||||
|
\font\mediumfont=cmr10
|
||||||
|
\font\mediumsy=cmsy10
|
||||||
|
|
||||||
|
\else
|
||||||
|
\errhelp{You must set \columnsperpage equal to 1, 2, or 3.}
|
||||||
|
\errmessage{Illegal number of columns per page}
|
||||||
|
\fi\fi
|
||||||
|
|
||||||
|
\intercolumnskip=.46in
|
||||||
|
\def\abc{a}
|
||||||
|
\output={%
|
||||||
|
% This next line is useful when designing the layout.
|
||||||
|
%\immediate\write16{Column \folio\abc\space starts with \firstmark}
|
||||||
|
\if \maxcolumn\abc \multicolumnformat \global\def\abc{a}
|
||||||
|
\else\if a\abc
|
||||||
|
\global\setbox\columna\columnbox \global\def\abc{b}
|
||||||
|
%% in case we never use \columnb (two-column mode)
|
||||||
|
\global\setbox\columnb\hbox to -\intercolumnskip{}
|
||||||
|
\else
|
||||||
|
\global\setbox\columnb\columnbox \global\def\abc{c}\fi\fi}
|
||||||
|
\def\multicolumnformat{\shipout\vbox{\makeheadline
|
||||||
|
\hbox{\box\columna\hskip\intercolumnskip
|
||||||
|
\box\columnb\hskip\intercolumnskip\columnbox}
|
||||||
|
\makefootline}\advancepageno}
|
||||||
|
\def\columnbox{\leftline{\pagebody}}
|
||||||
|
|
||||||
|
\def\bye{\par\vfill\supereject
|
||||||
|
\if a\abc \else\null\vfill\eject\fi
|
||||||
|
\if a\abc \else\null\vfill\eject\fi
|
||||||
|
\end}
|
||||||
|
\fi
|
||||||
|
|
||||||
|
% we won't be using math mode much, so redefine some of the characters
|
||||||
|
% we might want to talk about
|
||||||
|
\catcode`\^=12
|
||||||
|
\catcode`\_=12
|
||||||
|
|
||||||
|
\chardef\\=`\\
|
||||||
|
\chardef\{=`\{
|
||||||
|
\chardef\}=`\}
|
||||||
|
|
||||||
|
\hyphenation{mini-buf-fer}
|
||||||
|
|
||||||
|
\parindent 0pt
|
||||||
|
% \parskip 1ex plus .5ex minus .5ex
|
||||||
|
\parskip 0.5ex plus .25ex minus .25ex
|
||||||
|
|
||||||
|
\outer\def\newcolumn{\vfill\eject}
|
||||||
|
|
||||||
|
\outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus .5ex}
|
||||||
|
|
||||||
|
\outer\def\section#1{\par\filbreak
|
||||||
|
\vskip 1.5ex plus 1ex minus 1ex {\headingfont #1}\mark{#1}%
|
||||||
|
\vskip 1ex plus .5ex minus 0.75ex}
|
||||||
|
|
||||||
|
\newdimen\keyindent
|
||||||
|
|
||||||
|
\def\beginindentedkeys{\keyindent=1em}
|
||||||
|
\def\endindentedkeys{\keyindent=0em}
|
||||||
|
\endindentedkeys
|
||||||
|
|
||||||
|
\def\paralign{\vskip\parskip\halign}
|
||||||
|
|
||||||
|
\def\<#1>{$\langle${\rm #1}$\rangle$}
|
||||||
|
|
||||||
|
\def\kbd#1{{\tt#1}\null} %\null so not an abbrev even if period follows
|
||||||
|
|
||||||
|
\def\beginexample{\par\leavevmode\begingroup
|
||||||
|
\obeylines\obeyspaces\parskip0pt\tt}
|
||||||
|
{\obeyspaces\global\let =\ }
|
||||||
|
\def\endexample{\endgroup}
|
||||||
|
\def\begincexample{%
|
||||||
|
\par\leavevmode\begingroup%
|
||||||
|
\obeylines\obeyspaces%
|
||||||
|
% bpk--added indentation
|
||||||
|
\advance\leftskip.25truein
|
||||||
|
% \parskip0pt%
|
||||||
|
\tt}
|
||||||
|
{\obeyspaces\global\let =\ }
|
||||||
|
\def\endcexample{\endgroup}
|
||||||
|
|
||||||
|
%%%%% Prime definition of key; redefined below to prevent overful hboxes
|
||||||
|
|
||||||
|
\def\key#1#2{\leavevmode\hbox to \hsize
|
||||||
|
{\vtop {\hsize=.67\hsize \rightskip=1em #1}
|
||||||
|
\kbd{#2}\hfil}}
|
||||||
|
|
||||||
|
\newbox\metaxbox
|
||||||
|
\setbox\metaxbox\hbox{\kbd{M-x }}
|
||||||
|
\newdimen\metaxwidth
|
||||||
|
\metaxwidth=\wd\metaxbox
|
||||||
|
|
||||||
|
\def\metax#1#2{\leavevmode\hbox to \hsize{\hbox to .75\hsize
|
||||||
|
{\hskip\keyindent\relax#1\hfil}%
|
||||||
|
\hskip -\metaxwidth minus 1fil
|
||||||
|
\kbd{#2}\hfil}}
|
||||||
|
|
||||||
|
\def\threecol#1#2#3{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad
|
||||||
|
&\kbd{#3}\quad\cr}
|
||||||
|
|
||||||
|
%**end of header
|
||||||
|
|
||||||
|
% ************
|
||||||
|
% ** BISON **
|
||||||
|
% ************
|
||||||
|
|
||||||
|
\title{Bison Quick Reference}
|
||||||
|
|
||||||
|
\section{Starting Bison}
|
||||||
|
%***********************
|
||||||
|
|
||||||
|
To use Bison, type: \kbd{bison {\it filename}}
|
||||||
|
|
||||||
|
Options can be used as: \kbd{bison {\it options} {\it filename}}
|
||||||
|
|
||||||
|
\section{Command Line Options}
|
||||||
|
%*****************************
|
||||||
|
|
||||||
|
\key{Display usage information.} {-h}
|
||||||
|
\key{Display version information.} {-V}
|
||||||
|
\key{Generate token and {\tt YYSTYPE} definitions.} {-d}
|
||||||
|
\key{Prepend a prefix to external symbols.} {-p {\it prefix}}
|
||||||
|
\key{Don't put {\tt \#line} directives in the parser.} {-l}
|
||||||
|
\key{Specify the output file.} {-o {\it filename}}
|
||||||
|
\key{Debug or {\it trace} mode.} {-t}
|
||||||
|
\key{Verbose description of the parser.} {-v}
|
||||||
|
\key{Emulate {\tt yacc} (generate {\tt y.tab.*} files).} {-y}
|
||||||
|
|
||||||
|
\vskip .10truein
|
||||||
|
{\bf Note:} The token and {\tt YYSTYPE} definitions are generated
|
||||||
|
to a file called {\tt y.tab.h} if the {\tt -y} option is used,
|
||||||
|
otherwise it will have the format {\tt {\it name}.tab.h}, where
|
||||||
|
{\it name} is the leading part of the parser definition filename.
|
||||||
|
|
||||||
|
\section{Definitions}
|
||||||
|
%********************
|
||||||
|
|
||||||
|
\key{Declare a terminal symbol.}{\%token <{\it t\/}>
|
||||||
|
{\it n}}
|
||||||
|
|
||||||
|
\key{Declare a terminal symbol, and define its association.}
|
||||||
|
{{\it association} <{\it t\/}> {\it n}}
|
||||||
|
|
||||||
|
\vskip .2\baselineskip
|
||||||
|
\key{Generate a reentrant (pure) parser.}
|
||||||
|
{\%pure_parser}
|
||||||
|
|
||||||
|
\key{Define the union of all data types used in the parser.}
|
||||||
|
{\%union\{{\it field list}\} }
|
||||||
|
|
||||||
|
\vskip .2\baselineskip
|
||||||
|
\key{Tell {\tt bison} where to start parsing.}
|
||||||
|
{\%start {\it m}}
|
||||||
|
|
||||||
|
\key{Tell {\tt bison} the data type of symbols.}
|
||||||
|
{\%type <{\it t\/}> {\it s1}\dots{\it sn}}
|
||||||
|
|
||||||
|
\vskip .10truein
|
||||||
|
|
||||||
|
In the above, {\it t} is a {\it type} defined in the {\tt \%union}
|
||||||
|
definition, {\it n} is a {\it terminal} symbol name, {\it m} is a
|
||||||
|
{\it non-terminal} symbol name, and {\it association} can be one of
|
||||||
|
{\tt \%left}, {\tt \%right}, or {\tt \%nonassoc}.
|
||||||
|
|
||||||
|
\vskip .10truein
|
||||||
|
|
||||||
|
The {\tt <{\it t\/}>} after {\tt \%token, \%left, \%right} and {\tt
|
||||||
|
\%nonassoc} is optional. Additionally, precedence may be overridden
|
||||||
|
in the rules with {\tt \%prec} commands.
|
||||||
|
|
||||||
|
\section{Parser Definition Files}
|
||||||
|
%*********************************
|
||||||
|
|
||||||
|
The general form for a parser definition is:
|
||||||
|
|
||||||
|
\begincexample
|
||||||
|
\{\%
|
||||||
|
/* Initial C code. */
|
||||||
|
\%\}
|
||||||
|
|
||||||
|
{\it Token and type definitions}
|
||||||
|
|
||||||
|
\%\%
|
||||||
|
|
||||||
|
Rule definition 1
|
||||||
|
\vdots
|
||||||
|
Rule definition {\it n}
|
||||||
|
|
||||||
|
\%\%
|
||||||
|
|
||||||
|
/* Other C code. */
|
||||||
|
\endcexample
|
||||||
|
|
||||||
|
|
||||||
|
% Decrease standard baselineskip for the second page
|
||||||
|
\baselineskip = .9\baselineskip
|
||||||
|
|
||||||
|
\section {Rule definitions}
|
||||||
|
%**************************
|
||||||
|
|
||||||
|
Rules take the form:
|
||||||
|
|
||||||
|
\vskip -\baselineskip
|
||||||
|
\beginexample
|
||||||
|
non-terminal : {\it statement} 1
|
||||||
|
| {\it statement} 2
|
||||||
|
\vdots
|
||||||
|
| {\it statement n}
|
||||||
|
;
|
||||||
|
\endexample
|
||||||
|
|
||||||
|
Where {\it statements} can be either empty, or contain
|
||||||
|
a mixture of C code (enclosed in {\tt \{...\}}), and the
|
||||||
|
symbols that make up the non-terminal. For example:
|
||||||
|
|
||||||
|
\vskip -\baselineskip
|
||||||
|
\beginexample
|
||||||
|
expression : number '$+$' number \{ \$\$ $=$ \$1 $+$ \$3 \}
|
||||||
|
| number '$-$' number \{ \$\$ $=$ \$1 $-$ \$3 \}
|
||||||
|
| number '$/$' number \{ \$\$ $=$ \$1 $/$ \$3 \}
|
||||||
|
| number '$*$' number \{ \$\$ $=$ \$1 $*$ \$3 \}
|
||||||
|
;
|
||||||
|
\endexample
|
||||||
|
|
||||||
|
For altering the precedence of a symbol use:
|
||||||
|
\vskip -\baselineskip
|
||||||
|
|
||||||
|
\beginexample
|
||||||
|
\%prec name
|
||||||
|
\endexample
|
||||||
|
|
||||||
|
For example:
|
||||||
|
\vskip -\baselineskip
|
||||||
|
\beginexample
|
||||||
|
foo : gnu bar gnu \%prec bar
|
||||||
|
;
|
||||||
|
\endexample
|
||||||
|
|
||||||
|
\section{Grammar Variables and Symbols}
|
||||||
|
%**************************************
|
||||||
|
|
||||||
|
\key{Recognize an error \& continue parsing.}{error}
|
||||||
|
\key{Access data associated with a symbol.} {\$\$, \$0\dots\${\it n}}
|
||||||
|
\key{Access a field of the data union.} {\$\$.{\it t},
|
||||||
|
\$0.{\it t}\dots\${\it n}.{\it t}}
|
||||||
|
\key{Access symbol's location.} {@\$, @0\dots@{\it n}}
|
||||||
|
\key{Access data's line location.} {@{\it x}.{\it line\_spec}}
|
||||||
|
\key{Access data's column location.} {@{\it x}.{\it column\_spec}}
|
||||||
|
|
||||||
|
|
||||||
|
\vskip .10truein
|
||||||
|
%
|
||||||
|
Where {\it t} is a type defined in the {\tt \%union}, {\it n} is a
|
||||||
|
number, {\it x} is a number or \$, {\it line\_spec} one of {\tt
|
||||||
|
first_line} and {\tt last_line}, and {\it column\_spec} is specified
|
||||||
|
as either {\tt first_column} or {\tt last_column}.
|
||||||
|
|
||||||
|
\section {Variables and Types}
|
||||||
|
%*****************************
|
||||||
|
|
||||||
|
\key{Current look ahead token.} {yychar}
|
||||||
|
\key{Debug mode flag.} {yydebug}
|
||||||
|
\key{Data associated with the current token.} {yylval}
|
||||||
|
\key{Source position of current token.} {yylloc}
|
||||||
|
\key{Number of errors encountered.} {yynerrs}
|
||||||
|
\key{Position information type.} {YYLTYPE}
|
||||||
|
\key{Data type associated with symbols.} {YYSTYPE}
|
||||||
|
|
||||||
|
\section {Functions}
|
||||||
|
%*******************
|
||||||
|
|
||||||
|
% Redefine to prevent overfull hboxes
|
||||||
|
\def\key#1#2{\leavevmode\hbox to \hsize
|
||||||
|
{\vtop {\hsize=.625\hsize \rightskip=1em #1}
|
||||||
|
\kbd{#2}\hfil}}
|
||||||
|
|
||||||
|
\key{User defined error handler.} {int yyerror(char *)}
|
||||||
|
\key{User defined lexical analyzer.} {int yylex()}
|
||||||
|
\key{The grammar parser.} {int yyparse()}
|
||||||
|
|
||||||
|
% Return to previous size
|
||||||
|
\def\key#1#2{\leavevmode\hbox to \hsize
|
||||||
|
{\vtop {\hsize=.67\hsize \rightskip=1em #1}
|
||||||
|
\kbd{#2}\hfil}}
|
||||||
|
|
||||||
|
\section{Macros}
|
||||||
|
%***************
|
||||||
|
|
||||||
|
\key{Quit parsing immediately. Return 1.} {YYABORT}
|
||||||
|
\key{Quit parsing immediately. Return 0.} {YYACCEPT}
|
||||||
|
\key{Pretend a syntax error occurred.} {YYERROR}
|
||||||
|
\key{Value in {\tt yychar} if no look-ahead token.} {YYEMPTY}
|
||||||
|
\key{Clear previous look ahead token.} {yyclearin}
|
||||||
|
\key{Recover normally from an error.} {yyerrok}
|
||||||
|
|
||||||
|
% **************
|
||||||
|
% ** The end **
|
||||||
|
% **************
|
||||||
|
|
||||||
|
\vskip \baselineskip
|
||||||
|
\if 1\ncolumns
|
||||||
|
\copyrightnotice
|
||||||
|
\else
|
||||||
|
\smallcopyrightnotice
|
||||||
|
\fi
|
||||||
|
|
||||||
|
\bye
|
||||||
|
|
||||||
|
|
||||||
|
% Local variables:
|
||||||
|
% compile-command: "tex refcard"
|
||||||
|
% End:
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
@set UPDATED 26 November 2001
|
||||||
|
@set UPDATED-MONTH November 2001
|
||||||
|
@set EDITION 1.30e
|
||||||
|
@set VERSION 1.30e
|
||||||
Executable
+300
@@ -0,0 +1,300 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
# clcommit version 0.9.5
|
||||||
|
|
||||||
|
# Copyright (C) 1999, 2000, Free Software Foundation
|
||||||
|
|
||||||
|
# This script is Free Software, and it can be copied, distributed and
|
||||||
|
# modified as defined in the GNU General Public License. A copy of
|
||||||
|
# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html
|
||||||
|
|
||||||
|
# Originally by Gary V. Vaughan <[email protected]>
|
||||||
|
# Pretty much rewritten by Alexandre Oliva <[email protected]>
|
||||||
|
|
||||||
|
# This scripts eases checking in changes to CVS-maintained projects
|
||||||
|
# with ChangeLog files. It will check that there have been no
|
||||||
|
# conflicting commits in the CVS repository and print which files it
|
||||||
|
# is going to commit to stderr. A list of files to compare and to
|
||||||
|
# check in can be given in the command line. If it is not given, all
|
||||||
|
# files in the current directory (and below, unless `-l' is given) are
|
||||||
|
# considered for check in.
|
||||||
|
|
||||||
|
# The commit message will be extracted from the differences between a
|
||||||
|
# file named ChangeLog* in the commit list, or named after -C, and the
|
||||||
|
# one in the repository (unless a message was specified with `-m' or
|
||||||
|
# `-F'). An empty message is not accepted (but a blank line is). If
|
||||||
|
# the message is acceptable, it will be presented for verification
|
||||||
|
# (and possible edition) using the $PAGER environment variable (or
|
||||||
|
# `more', if it is not set, or `cat', if the `-f' switch is given).
|
||||||
|
# If $PAGER exits successfully, the modified files (at that moment)
|
||||||
|
# are checked in, unless `-n' was specified, in which case nothing is
|
||||||
|
# checked in.
|
||||||
|
|
||||||
|
# usage: clcommit [-v] [-h] [-f] [-l] [-n] [-q] [-z N] [-C ChangeLog_file]
|
||||||
|
# [-m msg|-F msg_file|-1] [--] [file|dir ...]
|
||||||
|
|
||||||
|
# -f --force don't check (unless *followed* by -n), and just
|
||||||
|
# display commit message instead of running $PAGER
|
||||||
|
# -l --local don't descend into subdirectories
|
||||||
|
# -m msg --message=msg set commit message
|
||||||
|
# --msg=msg same as -m
|
||||||
|
# -F file --file=file read commit message from file
|
||||||
|
# -1 --first extract first entry from ChangeLog, no cvs diff
|
||||||
|
# -C file --changelog=file extract commit message from specified ChangeLog
|
||||||
|
# --fast same as --force --first
|
||||||
|
# -n --dry-run don't commit anything
|
||||||
|
# -q --quiet run cvs in quiet mode
|
||||||
|
# -zN --compress=N set compression level (0-9, 0=none, 9=max)
|
||||||
|
# -v --version print version information
|
||||||
|
# -h,-? --help print short or long help message
|
||||||
|
|
||||||
|
name=clcommit
|
||||||
|
: ${CVS=cvs}
|
||||||
|
cvsopt=
|
||||||
|
updateopt=
|
||||||
|
commitopt=
|
||||||
|
dry_run=false
|
||||||
|
commit=:
|
||||||
|
update=:
|
||||||
|
log_file="${TMPDIR-/tmp}/commitlog.$$"
|
||||||
|
first=false
|
||||||
|
|
||||||
|
rm -f "$log_file"
|
||||||
|
trap 'rm -f "$log_file"; exit 1' 1 2 15
|
||||||
|
|
||||||
|
# this just eases exit handling
|
||||||
|
main_repeat=":"
|
||||||
|
while $main_repeat; do
|
||||||
|
|
||||||
|
repeat="test $# -gt 0"
|
||||||
|
while $repeat; do
|
||||||
|
case "$1" in
|
||||||
|
--fast)
|
||||||
|
shift
|
||||||
|
set fnord --force --first ${1+"$@"}
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-f|--force)
|
||||||
|
update=false
|
||||||
|
PAGER=cat
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-l|--local)
|
||||||
|
updateopt="$updateopt -l"
|
||||||
|
commitopt="$commitopt -l"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-m|--message|--msg)
|
||||||
|
if test $# = 1; then
|
||||||
|
echo "$name: missing argument for $1" >&2
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
if $first || test -f "$log_file"; then
|
||||||
|
echo "$name: you can have at most one of -m, -F and -1" >&2
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
echo "$1" > "$log_file"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-F|--file)
|
||||||
|
if $first || test -f "$log_file"; then
|
||||||
|
echo "$name: you can have at most one of -m, -F and -1" >&2
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
if test $# = 1; then
|
||||||
|
echo "$name: missing argument for $1" >&2
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
if cat < "$1" > "$log_file"; then :; else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-1|--first)
|
||||||
|
if test -f "$log_File"; then
|
||||||
|
echo "$name: you can have at most one of -m, -F and -1" >&2
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
first=:
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-C|--[cC]hange[lL]og)
|
||||||
|
if test $# = 1; then
|
||||||
|
echo "$name: missing argument for $1" >&2
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
if test ! -f "$1"; then
|
||||||
|
echo "$name: ChangeLog file \`$1' does not exist" >&2
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
ChangeLog="$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-n|--dry-run)
|
||||||
|
commit=false
|
||||||
|
update=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-q|--quiet)
|
||||||
|
cvsopt="$cvsopt -q"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-v|--verbose)
|
||||||
|
cvsopt="$cvsopt -t"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-z|--compress)
|
||||||
|
if test $# = 1; then
|
||||||
|
echo "$name: missing argument for $1" >&2
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
case "$2" in
|
||||||
|
[0-9]) :;;
|
||||||
|
*) echo "$name: invalid argument for $1" >&2
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
cvsopt="$cvsopt -z$2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
|
-m*|-F*|-C*|-z*)
|
||||||
|
opt=`echo "$1" | sed '1s/^\(..\).*$/\1/;q'`
|
||||||
|
arg=`echo "$1" | sed '1s/^-[a-zA-Z0-9]//'`
|
||||||
|
shift
|
||||||
|
set -- "$opt" "$arg" ${1+"$@"}
|
||||||
|
;;
|
||||||
|
--message=*|--msg=*|--file=*|--[Cc]hange[Ll]og=*|--compress=*)
|
||||||
|
opt=`echo "$1" | sed '1s/^\(--[^=]*\)=.*/\1/;q'`
|
||||||
|
arg=`echo "$1" | sed '1s/^--[^=]*=//'`
|
||||||
|
shift
|
||||||
|
set -- "$opt" "$arg" ${1+"$@"}
|
||||||
|
;;
|
||||||
|
|
||||||
|
-v|--version)
|
||||||
|
sed '/^# '$name' version /,/^# Heavily modified by/ { s/^# //; p; }; d' < $0
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
-\?|-h)
|
||||||
|
sed '/^# usage:/,/# -h/ { s/^# //; p; }; d' < $0 &&
|
||||||
|
echo
|
||||||
|
echo "run \`$name --help | more' for full usage"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
--help)
|
||||||
|
sed '/^# '$name' version /,/^[^#]/ { /^[^#]/ d; s/^# //; p; }; d' < $0
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
--)
|
||||||
|
shift
|
||||||
|
repeat=false
|
||||||
|
;;
|
||||||
|
-*)
|
||||||
|
echo "$name: invalid flag $1" >&2
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
repeat=false
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
# might have used break 2 within the previous loop, but so what
|
||||||
|
$repeat && break
|
||||||
|
|
||||||
|
$update && \
|
||||||
|
if echo "$name: checking for conflicts..." >&2
|
||||||
|
($CVS $cvsopt -q -n update $updateopt ${1+"$@"} 2>/dev/null \
|
||||||
|
| while read line; do
|
||||||
|
echo "$line"
|
||||||
|
echo "$line" >&3
|
||||||
|
done | grep '^C') 3>&1 >/dev/null; then
|
||||||
|
echo "$name: some conflicts were found, aborting..." >&2
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test ! -f "$log_file"; then
|
||||||
|
if test -z "$ChangeLog"; then
|
||||||
|
for f in ${1+"$@"}; do
|
||||||
|
case "$f" in
|
||||||
|
ChangeLog* | */ChangeLog*)
|
||||||
|
if test -z "$ChangeLog"; then
|
||||||
|
ChangeLog="$f"
|
||||||
|
else
|
||||||
|
echo "$name: multiple ChangeLog files: $ChangeLog and $f" >&2
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$name: checking commit message..." >&2
|
||||||
|
if $first; then
|
||||||
|
skipping=:
|
||||||
|
sed 's,^,+,' < ${ChangeLog-ChangeLog} |
|
||||||
|
while read line; do
|
||||||
|
case "$line" in
|
||||||
|
"+2"*) if $skipping; then skipping=false; else break; fi;;
|
||||||
|
"+ "*)
|
||||||
|
echo "$name: *** Warning: lines should start with tabs, not spaces; ignoring line:" >&2
|
||||||
|
echo "$line" | sed 's/^.//' >&2;;
|
||||||
|
"+ "*)
|
||||||
|
$skipping || echo "$line" ;;
|
||||||
|
esac
|
||||||
|
done |
|
||||||
|
sed 's,^\+ ,,' > "$log_file" || break
|
||||||
|
else
|
||||||
|
$CVS $cvsopt diff -u ${ChangeLog-ChangeLog} |
|
||||||
|
while read line; do
|
||||||
|
case $line in
|
||||||
|
"--- "*) :;;
|
||||||
|
"-"*)
|
||||||
|
echo "$name: *** Warning: the following line in ChangeLog diff is suspicious:" >&2
|
||||||
|
echo "$line" | sed 's/^.//' >&2;;
|
||||||
|
"+ "*)
|
||||||
|
echo "$name: *** Warning: lines should start with tabs, not spaces; ignoring line:" >&2
|
||||||
|
echo "$line" | sed 's/^.//' >&2;;
|
||||||
|
"+") echo;;
|
||||||
|
"+ "*) echo "$line";;
|
||||||
|
esac
|
||||||
|
done |
|
||||||
|
sed -e 's,\+ ,,' -e '/./p' -e '/./d' -e '1d' -e '$d' > "$log_file" \
|
||||||
|
|| break
|
||||||
|
fi
|
||||||
|
# The sed script above removes "+TAB" from the beginning of a line, then
|
||||||
|
# deletes the first and/or the last line, when they happen to be empty
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep '[^ ]' < "$log_file" > /dev/null; then :; else
|
||||||
|
echo "$name: empty commit message, aborting" >&2
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep '^$' < "$log_file" > /dev/null; then
|
||||||
|
echo "$name: *** Warning: blank lines should not appear within commit messages." >&2
|
||||||
|
echo "$name: *** They should be used to separate distinct commits." >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
${PAGER-more} "$log_file" || break
|
||||||
|
|
||||||
|
sleep 1 # give the user some time for a ^C
|
||||||
|
|
||||||
|
# Do not check for empty $log_file again, even though the user might have
|
||||||
|
# zeroed it out. If s/he did, it was probably intentional.
|
||||||
|
|
||||||
|
if $commit; then
|
||||||
|
$CVS $cvsopt commit $commitopt -F $log_file ${1+"$@"} || break
|
||||||
|
fi
|
||||||
|
|
||||||
|
main_repeat=false
|
||||||
|
done
|
||||||
|
|
||||||
|
rm -f "$log_file"
|
||||||
|
|
||||||
|
# if main_repeat was not set to `false', we failed
|
||||||
|
$main_repeat && exit 1
|
||||||
|
exit 0
|
||||||
Executable
+16
@@ -0,0 +1,16 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
for dir in . po src doc; do
|
||||||
|
(
|
||||||
|
cd $dir && rcs2log -r -l \
|
||||||
|
-u 'akim Akim Demaille [email protected]' \
|
||||||
|
-u 'djm David J. MacKenzie [email protected]' \
|
||||||
|
-u 'eggert Paul Eggert [email protected]' \
|
||||||
|
-u 'friedman Noah Friedman [email protected]' \
|
||||||
|
-u 'hag Daniel Hagerty [email protected]' \
|
||||||
|
-u 'jthilo Jesse Thilo [email protected]' \
|
||||||
|
-u 'meyering Jim Meyering [email protected]' \
|
||||||
|
-u 'rms Richard Stallman [email protected]' \
|
||||||
|
| sed -e 's,/opt/cvs/bison/bison/,,g' > ChangeLog
|
||||||
|
)
|
||||||
|
done
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Makefile
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
2001-09-13 GNU <[email protected]>
|
||||||
|
|
||||||
|
* Version 0.10.40 released.
|
||||||
|
|
||||||
@@ -0,0 +1,313 @@
|
|||||||
|
# Makefile for directory with message catalog handling in GNU NLS Utilities.
|
||||||
|
# Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU Library General Public License as published
|
||||||
|
# by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# Library General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Library General Public
|
||||||
|
# License along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
# USA.
|
||||||
|
|
||||||
|
PACKAGE = @PACKAGE@
|
||||||
|
VERSION = @VERSION@
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
|
||||||
|
srcdir = @srcdir@
|
||||||
|
top_srcdir = @top_srcdir@
|
||||||
|
top_builddir = ..
|
||||||
|
VPATH = @srcdir@
|
||||||
|
|
||||||
|
prefix = @prefix@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
transform = @program_transform_name@
|
||||||
|
libdir = @libdir@
|
||||||
|
includedir = @includedir@
|
||||||
|
datadir = @datadir@
|
||||||
|
localedir = $(datadir)/locale
|
||||||
|
gettextsrcdir = $(datadir)/gettext/intl
|
||||||
|
aliaspath = $(localedir)
|
||||||
|
subdir = intl
|
||||||
|
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
|
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||||
|
mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac`
|
||||||
|
|
||||||
|
l = @INTL_LIBTOOL_SUFFIX_PREFIX@
|
||||||
|
|
||||||
|
AR = ar
|
||||||
|
CC = @CC@
|
||||||
|
LIBTOOL = @LIBTOOL@
|
||||||
|
RANLIB = @RANLIB@
|
||||||
|
YACC = @INTLBISON@ -y -d
|
||||||
|
YFLAGS = --name-prefix=__gettext
|
||||||
|
|
||||||
|
DEFS = -DLOCALEDIR=\"$(localedir)\" -DLOCALE_ALIAS_PATH=\"$(aliaspath)\" \
|
||||||
|
-DLIBDIR=\"$(libdir)\" @DEFS@
|
||||||
|
CPPFLAGS = @CPPFLAGS@
|
||||||
|
CFLAGS = @CFLAGS@
|
||||||
|
LDFLAGS = @LDFLAGS@
|
||||||
|
|
||||||
|
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
|
||||||
|
|
||||||
|
HEADERS = $(COMHDRS) libgnuintl.h libgettext.h loadinfo.h
|
||||||
|
COMHDRS = gettext.h gettextP.h hash-string.h
|
||||||
|
SOURCES = $(COMSRCS) intl-compat.c
|
||||||
|
COMSRCS = bindtextdom.c dcgettext.c dgettext.c gettext.c \
|
||||||
|
finddomain.c loadmsgcat.c localealias.c textdomain.c l10nflist.c \
|
||||||
|
explodename.c dcigettext.c dcngettext.c dngettext.c ngettext.c plural.y \
|
||||||
|
localcharset.c
|
||||||
|
OBJECTS = @INTLOBJS@ bindtextdom.$lo dcgettext.$lo dgettext.$lo gettext.$lo \
|
||||||
|
finddomain.$lo loadmsgcat.$lo localealias.$lo textdomain.$lo l10nflist.$lo \
|
||||||
|
explodename.$lo dcigettext.$lo dcngettext.$lo dngettext.$lo ngettext.$lo \
|
||||||
|
plural.$lo localcharset.$lo
|
||||||
|
GETTOBJS = intl-compat.$lo
|
||||||
|
DISTFILES.common = Makefile.in \
|
||||||
|
config.charset locale.alias ref-add.sin ref-del.sin $(HEADERS) $(SOURCES)
|
||||||
|
DISTFILES.generated = plural.c
|
||||||
|
DISTFILES.normal = VERSION
|
||||||
|
DISTFILES.gettext = COPYING.LIB-2 COPYING.LIB-2.1 libintl.glibc
|
||||||
|
DISTFILES.obsolete = xopen-msg.sed linux-msg.sed po2tbl.sed.in cat-compat.c
|
||||||
|
|
||||||
|
# Libtool's library version information for libintl.
|
||||||
|
# Before making a gettext release, the gettext maintainer must change this
|
||||||
|
# according to the libtool documentation, section "Library interface versions".
|
||||||
|
# Maintainers of other packages that include the intl directory must *not*
|
||||||
|
# change these values.
|
||||||
|
LTV_CURRENT=1
|
||||||
|
LTV_REVISION=1
|
||||||
|
LTV_AGE=0
|
||||||
|
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .c .y .o .lo .sin .sed
|
||||||
|
.c.o:
|
||||||
|
$(COMPILE) $<
|
||||||
|
.c.lo:
|
||||||
|
$(LIBTOOL) --mode=compile $(COMPILE) $<
|
||||||
|
|
||||||
|
.y.c:
|
||||||
|
$(YACC) $(YFLAGS) --output $@ $<
|
||||||
|
rm -f $*.h
|
||||||
|
|
||||||
|
.sin.sed:
|
||||||
|
sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $< > t-$@
|
||||||
|
mv t-$@ $@
|
||||||
|
|
||||||
|
INCLUDES = -I.. -I. -I$(top_srcdir)/intl
|
||||||
|
|
||||||
|
all: all-@USE_INCLUDED_LIBINTL@
|
||||||
|
all-yes: libintl.$la libintl.h charset.alias ref-add.sed ref-del.sed
|
||||||
|
all-no: all-no-@BUILD_INCLUDED_LIBINTL@
|
||||||
|
all-no-yes: libgnuintl.$la
|
||||||
|
all-no-no:
|
||||||
|
|
||||||
|
libintl.a libgnuintl.a: $(OBJECTS)
|
||||||
|
rm -f $@
|
||||||
|
$(AR) cru $@ $(OBJECTS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
libintl.la libgnuintl.la: $(OBJECTS)
|
||||||
|
$(LIBTOOL) --mode=link \
|
||||||
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) $(LDFLAGS) -o $@ \
|
||||||
|
$(OBJECTS) @LIBICONV@ \
|
||||||
|
-version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \
|
||||||
|
-rpath $(libdir) \
|
||||||
|
-no-undefined
|
||||||
|
|
||||||
|
libintl.h: libgnuintl.h
|
||||||
|
cp $(srcdir)/libgnuintl.h libintl.h
|
||||||
|
|
||||||
|
charset.alias: config.charset
|
||||||
|
$(SHELL) $(srcdir)/config.charset '@host@' > t-$@
|
||||||
|
mv t-$@ $@
|
||||||
|
|
||||||
|
check: all
|
||||||
|
|
||||||
|
# This installation goal is only used in GNU gettext. Packages which
|
||||||
|
# only use the library should use install instead.
|
||||||
|
|
||||||
|
# We must not install the libintl.h/libintl.a files if we are on a
|
||||||
|
# system which has the GNU gettext() function in its C library or in a
|
||||||
|
# separate library.
|
||||||
|
# If you want to use the one which comes with this version of the
|
||||||
|
# package, you have to use `configure --with-included-gettext'.
|
||||||
|
install: install-exec install-data
|
||||||
|
install-exec: all
|
||||||
|
if test "$(PACKAGE)" = "gettext" \
|
||||||
|
&& test '@INTLOBJS@' = '$(GETTOBJS)'; then \
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \
|
||||||
|
$(INSTALL_DATA) libintl.h $(DESTDIR)$(includedir)/libintl.h; \
|
||||||
|
$(LIBTOOL) --mode=install \
|
||||||
|
$(INSTALL_DATA) libintl.$la $(DESTDIR)$(libdir)/libintl.$la; \
|
||||||
|
else \
|
||||||
|
: ; \
|
||||||
|
fi
|
||||||
|
if test '@USE_INCLUDED_LIBINTL@' = yes; then \
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(libdir); \
|
||||||
|
temp=$(DESTDIR)$(libdir)/t-charset.alias; \
|
||||||
|
dest=$(DESTDIR)$(libdir)/charset.alias; \
|
||||||
|
if test -f $(DESTDIR)$(libdir)/charset.alias; then \
|
||||||
|
orig=$(DESTDIR)$(libdir)/charset.alias; \
|
||||||
|
sed -f ref-add.sed $$orig > $$temp; \
|
||||||
|
$(INSTALL_DATA) $$temp $$dest; \
|
||||||
|
rm -f $$temp; \
|
||||||
|
else \
|
||||||
|
if test @GLIBC21@ = no; then \
|
||||||
|
orig=charset.alias; \
|
||||||
|
sed -f ref-add.sed $$orig > $$temp; \
|
||||||
|
$(INSTALL_DATA) $$temp $$dest; \
|
||||||
|
rm -f $$temp; \
|
||||||
|
fi; \
|
||||||
|
fi; \
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(localedir); \
|
||||||
|
test -f $(DESTDIR)$(localedir)/locale.alias \
|
||||||
|
&& orig=$(DESTDIR)$(localedir)/locale.alias \
|
||||||
|
|| orig=$(srcdir)/locale.alias; \
|
||||||
|
temp=$(DESTDIR)$(localedir)/t-locale.alias; \
|
||||||
|
dest=$(DESTDIR)$(localedir)/locale.alias; \
|
||||||
|
sed -f ref-add.sed $$orig > $$temp; \
|
||||||
|
$(INSTALL_DATA) $$temp $$dest; \
|
||||||
|
rm -f $$temp; \
|
||||||
|
else \
|
||||||
|
: ; \
|
||||||
|
fi
|
||||||
|
install-data: all
|
||||||
|
if test "$(PACKAGE)" = "gettext"; then \
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
|
||||||
|
$(INSTALL_DATA) VERSION $(DESTDIR)$(gettextsrcdir)/VERSION; \
|
||||||
|
$(INSTALL_DATA) ChangeLog.inst $(DESTDIR)$(gettextsrcdir)/ChangeLog; \
|
||||||
|
dists="COPYING.LIB-2 COPYING.LIB-2.1 $(DISTFILES.common)"; \
|
||||||
|
for file in $$dists; do \
|
||||||
|
$(INSTALL_DATA) $(srcdir)/$$file \
|
||||||
|
$(DESTDIR)$(gettextsrcdir)/$$file; \
|
||||||
|
done; \
|
||||||
|
chmod a+x $(DESTDIR)$(gettextsrcdir)/config.charset; \
|
||||||
|
dists="$(DISTFILES.generated)"; \
|
||||||
|
for file in $$dists; do \
|
||||||
|
if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
|
||||||
|
$(INSTALL_DATA) $$dir/$$file \
|
||||||
|
$(DESTDIR)$(gettextsrcdir)/$$file; \
|
||||||
|
done; \
|
||||||
|
dists="$(DISTFILES.obsolete)"; \
|
||||||
|
for file in $$dists; do \
|
||||||
|
rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
|
||||||
|
done; \
|
||||||
|
else \
|
||||||
|
: ; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Define this as empty until I found a useful application.
|
||||||
|
installcheck:
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
if test "$(PACKAGE)" = "gettext" \
|
||||||
|
&& test '@INTLOBJS@' = '$(GETTOBJS)'; then \
|
||||||
|
rm -f $(DESTDIR)$(includedir)/libintl.h; \
|
||||||
|
$(LIBTOOL) --mode=uninstall \
|
||||||
|
rm -f $(DESTDIR)$(libdir)/libintl.$la; \
|
||||||
|
else \
|
||||||
|
: ; \
|
||||||
|
fi
|
||||||
|
if test '@USE_INCLUDED_LIBINTL@' = yes; then \
|
||||||
|
if test -f $(DESTDIR)$(libdir)/charset.alias; then \
|
||||||
|
temp=$(DESTDIR)$(libdir)/t-charset.alias; \
|
||||||
|
dest=$(DESTDIR)$(libdir)/charset.alias; \
|
||||||
|
sed -f ref-del.sed $$dest > $$temp; \
|
||||||
|
if grep '^# Packages using this file: $$' $$temp > /dev/null; then \
|
||||||
|
rm -f $$dest; \
|
||||||
|
else \
|
||||||
|
$(INSTALL_DATA) $$temp $$dest; \
|
||||||
|
fi; \
|
||||||
|
rm -f $$temp; \
|
||||||
|
fi; \
|
||||||
|
if test -f $(DESTDIR)$(localedir)/locale.alias; then \
|
||||||
|
temp=$(DESTDIR)$(localedir)/t-locale.alias; \
|
||||||
|
dest=$(DESTDIR)$(localedir)/locale.alias; \
|
||||||
|
sed -f ref-del.sed $$dest > $$temp; \
|
||||||
|
if grep '^# Packages using this file: $$' $$temp > /dev/null; then \
|
||||||
|
rm -f $$dest; \
|
||||||
|
else \
|
||||||
|
$(INSTALL_DATA) $$temp $$dest; \
|
||||||
|
fi; \
|
||||||
|
rm -f $$temp; \
|
||||||
|
fi; \
|
||||||
|
else \
|
||||||
|
: ; \
|
||||||
|
fi
|
||||||
|
if test "$(PACKAGE)" = "gettext"; then \
|
||||||
|
for file in VERSION ChangeLog COPYING.LIB-2 COPYING.LIB-2.1 $(DISTFILES.common) $(DISTFILES.generated); do \
|
||||||
|
rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
|
||||||
|
done; \
|
||||||
|
else \
|
||||||
|
: ; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
info dvi:
|
||||||
|
|
||||||
|
$(OBJECTS): ../config.h libgnuintl.h
|
||||||
|
bindtextdom.$lo finddomain.$lo loadmsgcat.$lo: gettextP.h gettext.h loadinfo.h
|
||||||
|
dcgettext.$lo: gettextP.h gettext.h hash-string.h loadinfo.h
|
||||||
|
|
||||||
|
tags: TAGS
|
||||||
|
|
||||||
|
TAGS: $(HEADERS) $(SOURCES)
|
||||||
|
here=`pwd`; cd $(srcdir) && etags -o $$here/TAGS $(HEADERS) $(SOURCES)
|
||||||
|
|
||||||
|
id: ID
|
||||||
|
|
||||||
|
ID: $(HEADERS) $(SOURCES)
|
||||||
|
here=`pwd`; cd $(srcdir) && mkid -f$$here/ID $(HEADERS) $(SOURCES)
|
||||||
|
|
||||||
|
|
||||||
|
mostlyclean:
|
||||||
|
rm -f *.a *.la *.o *.lo core core.*
|
||||||
|
rm -f libintl.h charset.alias ref-add.sed ref-del.sed
|
||||||
|
rm -f -r .libs _libs
|
||||||
|
|
||||||
|
clean: mostlyclean
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
rm -f Makefile ID TAGS
|
||||||
|
if test "$(PACKAGE)" = gettext; then \
|
||||||
|
rm -f ChangeLog.inst $(DISTFILES.normal); \
|
||||||
|
else \
|
||||||
|
: ; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
maintainer-clean: distclean
|
||||||
|
@echo "This command is intended for maintainers to use;"
|
||||||
|
@echo "it deletes files that may require special tools to rebuild."
|
||||||
|
|
||||||
|
|
||||||
|
# GNU gettext needs not contain the file `VERSION' but contains some
|
||||||
|
# other files which should not be distributed in other packages.
|
||||||
|
distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
|
||||||
|
dist distdir: Makefile
|
||||||
|
if test "$(PACKAGE)" = gettext; then \
|
||||||
|
additional="$(DISTFILES.gettext)"; \
|
||||||
|
else \
|
||||||
|
additional="$(DISTFILES.normal)"; \
|
||||||
|
fi; \
|
||||||
|
$(MAKE) $(DISTFILES.common) $(DISTFILES.generated) $$additional; \
|
||||||
|
for file in ChangeLog $(DISTFILES.common) $(DISTFILES.generated) $$additional; do \
|
||||||
|
if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
|
||||||
|
ln $$dir/$$file $(distdir) 2> /dev/null \
|
||||||
|
|| cp -p $$dir/$$file $(distdir); \
|
||||||
|
done
|
||||||
|
|
||||||
|
Makefile: Makefile.in ../config.status
|
||||||
|
cd .. \
|
||||||
|
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||||
|
|
||||||
|
# Tell versions [3.59,3.63) of GNU make not to export all variables.
|
||||||
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
|
.NOEXPORT:
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
GNU gettext library from gettext-0.10.40
|
||||||
@@ -0,0 +1,369 @@
|
|||||||
|
/* Implementation of the bindtextdomain(3) function
|
||||||
|
Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
# include <libintl.h>
|
||||||
|
#else
|
||||||
|
# include "libgnuintl.h"
|
||||||
|
#endif
|
||||||
|
#include "gettextP.h"
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
/* We have to handle multi-threaded applications. */
|
||||||
|
# include <bits/libc-lock.h>
|
||||||
|
#else
|
||||||
|
/* Provide dummy implementation if this is outside glibc. */
|
||||||
|
# define __libc_rwlock_define(CLASS, NAME)
|
||||||
|
# define __libc_rwlock_wrlock(NAME)
|
||||||
|
# define __libc_rwlock_unlock(NAME)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The internal variables in the standalone libintl.a must have different
|
||||||
|
names than the internal variables in GNU libc, otherwise programs
|
||||||
|
using libintl.a cannot be linked statically. */
|
||||||
|
#if !defined _LIBC
|
||||||
|
# define _nl_default_dirname _nl_default_dirname__
|
||||||
|
# define _nl_domain_bindings _nl_domain_bindings__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Some compilers, like SunOS4 cc, don't have offsetof in <stddef.h>. */
|
||||||
|
#ifndef offsetof
|
||||||
|
# define offsetof(type,ident) ((size_t)&(((type*)0)->ident))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* @@ end of prolog @@ */
|
||||||
|
|
||||||
|
/* Contains the default location of the message catalogs. */
|
||||||
|
extern const char _nl_default_dirname[];
|
||||||
|
|
||||||
|
/* List with bindings of specific domains. */
|
||||||
|
extern struct binding *_nl_domain_bindings;
|
||||||
|
|
||||||
|
/* Lock variable to protect the global data in the gettext implementation. */
|
||||||
|
__libc_rwlock_define (extern, _nl_state_lock)
|
||||||
|
|
||||||
|
|
||||||
|
/* Names for the libintl functions are a problem. They must not clash
|
||||||
|
with existing names and they should follow ANSI C. But this source
|
||||||
|
code is also used in GNU C Library where the names have a __
|
||||||
|
prefix. So we have to make a difference here. */
|
||||||
|
#ifdef _LIBC
|
||||||
|
# define BINDTEXTDOMAIN __bindtextdomain
|
||||||
|
# define BIND_TEXTDOMAIN_CODESET __bind_textdomain_codeset
|
||||||
|
# ifndef strdup
|
||||||
|
# define strdup(str) __strdup (str)
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define BINDTEXTDOMAIN bindtextdomain__
|
||||||
|
# define BIND_TEXTDOMAIN_CODESET bind_textdomain_codeset__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Prototypes for local functions. */
|
||||||
|
static void set_binding_values PARAMS ((const char *domainname,
|
||||||
|
const char **dirnamep,
|
||||||
|
const char **codesetp));
|
||||||
|
|
||||||
|
/* Specifies the directory name *DIRNAMEP and the output codeset *CODESETP
|
||||||
|
to be used for the DOMAINNAME message catalog.
|
||||||
|
If *DIRNAMEP or *CODESETP is NULL, the corresponding attribute is not
|
||||||
|
modified, only the current value is returned.
|
||||||
|
If DIRNAMEP or CODESETP is NULL, the corresponding attribute is neither
|
||||||
|
modified nor returned. */
|
||||||
|
static void
|
||||||
|
set_binding_values (domainname, dirnamep, codesetp)
|
||||||
|
const char *domainname;
|
||||||
|
const char **dirnamep;
|
||||||
|
const char **codesetp;
|
||||||
|
{
|
||||||
|
struct binding *binding;
|
||||||
|
int modified;
|
||||||
|
|
||||||
|
/* Some sanity checks. */
|
||||||
|
if (domainname == NULL || domainname[0] == '\0')
|
||||||
|
{
|
||||||
|
if (dirnamep)
|
||||||
|
*dirnamep = NULL;
|
||||||
|
if (codesetp)
|
||||||
|
*codesetp = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
__libc_rwlock_wrlock (_nl_state_lock);
|
||||||
|
|
||||||
|
modified = 0;
|
||||||
|
|
||||||
|
for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next)
|
||||||
|
{
|
||||||
|
int compare = strcmp (domainname, binding->domainname);
|
||||||
|
if (compare == 0)
|
||||||
|
/* We found it! */
|
||||||
|
break;
|
||||||
|
if (compare < 0)
|
||||||
|
{
|
||||||
|
/* It is not in the list. */
|
||||||
|
binding = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (binding != NULL)
|
||||||
|
{
|
||||||
|
if (dirnamep)
|
||||||
|
{
|
||||||
|
const char *dirname = *dirnamep;
|
||||||
|
|
||||||
|
if (dirname == NULL)
|
||||||
|
/* The current binding has be to returned. */
|
||||||
|
*dirnamep = binding->dirname;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* The domain is already bound. If the new value and the old
|
||||||
|
one are equal we simply do nothing. Otherwise replace the
|
||||||
|
old binding. */
|
||||||
|
char *result = binding->dirname;
|
||||||
|
if (strcmp (dirname, result) != 0)
|
||||||
|
{
|
||||||
|
if (strcmp (dirname, _nl_default_dirname) == 0)
|
||||||
|
result = (char *) _nl_default_dirname;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#if defined _LIBC || defined HAVE_STRDUP
|
||||||
|
result = strdup (dirname);
|
||||||
|
#else
|
||||||
|
size_t len = strlen (dirname) + 1;
|
||||||
|
result = (char *) malloc (len);
|
||||||
|
if (__builtin_expect (result != NULL, 1))
|
||||||
|
memcpy (result, dirname, len);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if (__builtin_expect (result != NULL, 1))
|
||||||
|
{
|
||||||
|
if (binding->dirname != _nl_default_dirname)
|
||||||
|
free (binding->dirname);
|
||||||
|
|
||||||
|
binding->dirname = result;
|
||||||
|
modified = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*dirnamep = result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (codesetp)
|
||||||
|
{
|
||||||
|
const char *codeset = *codesetp;
|
||||||
|
|
||||||
|
if (codeset == NULL)
|
||||||
|
/* The current binding has be to returned. */
|
||||||
|
*codesetp = binding->codeset;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* The domain is already bound. If the new value and the old
|
||||||
|
one are equal we simply do nothing. Otherwise replace the
|
||||||
|
old binding. */
|
||||||
|
char *result = binding->codeset;
|
||||||
|
if (result == NULL || strcmp (codeset, result) != 0)
|
||||||
|
{
|
||||||
|
#if defined _LIBC || defined HAVE_STRDUP
|
||||||
|
result = strdup (codeset);
|
||||||
|
#else
|
||||||
|
size_t len = strlen (codeset) + 1;
|
||||||
|
result = (char *) malloc (len);
|
||||||
|
if (__builtin_expect (result != NULL, 1))
|
||||||
|
memcpy (result, codeset, len);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (__builtin_expect (result != NULL, 1))
|
||||||
|
{
|
||||||
|
if (binding->codeset != NULL)
|
||||||
|
free (binding->codeset);
|
||||||
|
|
||||||
|
binding->codeset = result;
|
||||||
|
binding->codeset_cntr++;
|
||||||
|
modified = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*codesetp = result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ((dirnamep == NULL || *dirnamep == NULL)
|
||||||
|
&& (codesetp == NULL || *codesetp == NULL))
|
||||||
|
{
|
||||||
|
/* Simply return the default values. */
|
||||||
|
if (dirnamep)
|
||||||
|
*dirnamep = _nl_default_dirname;
|
||||||
|
if (codesetp)
|
||||||
|
*codesetp = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* We have to create a new binding. */
|
||||||
|
size_t len = strlen (domainname) + 1;
|
||||||
|
struct binding *new_binding =
|
||||||
|
(struct binding *) malloc (offsetof (struct binding, domainname) + len);
|
||||||
|
|
||||||
|
if (__builtin_expect (new_binding == NULL, 0))
|
||||||
|
goto failed;
|
||||||
|
|
||||||
|
memcpy (new_binding->domainname, domainname, len);
|
||||||
|
|
||||||
|
if (dirnamep)
|
||||||
|
{
|
||||||
|
const char *dirname = *dirnamep;
|
||||||
|
|
||||||
|
if (dirname == NULL)
|
||||||
|
/* The default value. */
|
||||||
|
dirname = _nl_default_dirname;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (strcmp (dirname, _nl_default_dirname) == 0)
|
||||||
|
dirname = _nl_default_dirname;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *result;
|
||||||
|
#if defined _LIBC || defined HAVE_STRDUP
|
||||||
|
result = strdup (dirname);
|
||||||
|
if (__builtin_expect (result == NULL, 0))
|
||||||
|
goto failed_dirname;
|
||||||
|
#else
|
||||||
|
size_t len = strlen (dirname) + 1;
|
||||||
|
result = (char *) malloc (len);
|
||||||
|
if (__builtin_expect (result == NULL, 0))
|
||||||
|
goto failed_dirname;
|
||||||
|
memcpy (result, dirname, len);
|
||||||
|
#endif
|
||||||
|
dirname = result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*dirnamep = dirname;
|
||||||
|
new_binding->dirname = (char *) dirname;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* The default value. */
|
||||||
|
new_binding->dirname = (char *) _nl_default_dirname;
|
||||||
|
|
||||||
|
new_binding->codeset_cntr = 0;
|
||||||
|
|
||||||
|
if (codesetp)
|
||||||
|
{
|
||||||
|
const char *codeset = *codesetp;
|
||||||
|
|
||||||
|
if (codeset != NULL)
|
||||||
|
{
|
||||||
|
char *result;
|
||||||
|
|
||||||
|
#if defined _LIBC || defined HAVE_STRDUP
|
||||||
|
result = strdup (codeset);
|
||||||
|
if (__builtin_expect (result == NULL, 0))
|
||||||
|
goto failed_codeset;
|
||||||
|
#else
|
||||||
|
size_t len = strlen (codeset) + 1;
|
||||||
|
result = (char *) malloc (len);
|
||||||
|
if (__builtin_expect (result == NULL, 0))
|
||||||
|
goto failed_codeset;
|
||||||
|
memcpy (result, codeset, len);
|
||||||
|
#endif
|
||||||
|
codeset = result;
|
||||||
|
new_binding->codeset_cntr++;
|
||||||
|
}
|
||||||
|
*codesetp = codeset;
|
||||||
|
new_binding->codeset = (char *) codeset;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
new_binding->codeset = NULL;
|
||||||
|
|
||||||
|
/* Now enqueue it. */
|
||||||
|
if (_nl_domain_bindings == NULL
|
||||||
|
|| strcmp (domainname, _nl_domain_bindings->domainname) < 0)
|
||||||
|
{
|
||||||
|
new_binding->next = _nl_domain_bindings;
|
||||||
|
_nl_domain_bindings = new_binding;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
binding = _nl_domain_bindings;
|
||||||
|
while (binding->next != NULL
|
||||||
|
&& strcmp (domainname, binding->next->domainname) > 0)
|
||||||
|
binding = binding->next;
|
||||||
|
|
||||||
|
new_binding->next = binding->next;
|
||||||
|
binding->next = new_binding;
|
||||||
|
}
|
||||||
|
|
||||||
|
modified = 1;
|
||||||
|
|
||||||
|
/* Here we deal with memory allocation failures. */
|
||||||
|
if (0)
|
||||||
|
{
|
||||||
|
failed_codeset:
|
||||||
|
if (new_binding->dirname != _nl_default_dirname)
|
||||||
|
free (new_binding->dirname);
|
||||||
|
failed_dirname:
|
||||||
|
free (new_binding);
|
||||||
|
failed:
|
||||||
|
if (dirnamep)
|
||||||
|
*dirnamep = NULL;
|
||||||
|
if (codesetp)
|
||||||
|
*codesetp = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If we modified any binding, we flush the caches. */
|
||||||
|
if (modified)
|
||||||
|
++_nl_msg_cat_cntr;
|
||||||
|
|
||||||
|
__libc_rwlock_unlock (_nl_state_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Specify that the DOMAINNAME message catalog will be found
|
||||||
|
in DIRNAME rather than in the system locale data base. */
|
||||||
|
char *
|
||||||
|
BINDTEXTDOMAIN (domainname, dirname)
|
||||||
|
const char *domainname;
|
||||||
|
const char *dirname;
|
||||||
|
{
|
||||||
|
set_binding_values (domainname, &dirname, NULL);
|
||||||
|
return (char *) dirname;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Specify the character encoding in which the messages from the
|
||||||
|
DOMAINNAME message catalog will be returned. */
|
||||||
|
char *
|
||||||
|
BIND_TEXTDOMAIN_CODESET (domainname, codeset)
|
||||||
|
const char *domainname;
|
||||||
|
const char *codeset;
|
||||||
|
{
|
||||||
|
set_binding_values (domainname, NULL, &codeset);
|
||||||
|
return (char *) codeset;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
/* Aliases for function names in GNU C Library. */
|
||||||
|
weak_alias (__bindtextdomain, bindtextdomain);
|
||||||
|
weak_alias (__bind_textdomain_codeset, bind_textdomain_codeset);
|
||||||
|
#endif
|
||||||
Executable
+438
@@ -0,0 +1,438 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
# Output a system dependent table of character encoding aliases.
|
||||||
|
#
|
||||||
|
# Copyright (C) 2000-2001 Free Software Foundation, Inc.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU Library General Public License as published
|
||||||
|
# by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# Library General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Library General Public
|
||||||
|
# License along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
# USA.
|
||||||
|
#
|
||||||
|
# The table consists of lines of the form
|
||||||
|
# ALIAS CANONICAL
|
||||||
|
#
|
||||||
|
# ALIAS is the (system dependent) result of "nl_langinfo (CODESET)".
|
||||||
|
# ALIAS is compared in a case sensitive way.
|
||||||
|
#
|
||||||
|
# CANONICAL is the GNU canonical name for this character encoding.
|
||||||
|
# It must be an encoding supported by libiconv. Support by GNU libc is
|
||||||
|
# also desirable. CANONICAL is case insensitive. Usually an upper case
|
||||||
|
# MIME charset name is preferred.
|
||||||
|
# The current list of GNU canonical charset names is as follows.
|
||||||
|
#
|
||||||
|
# name used by which systems a MIME name?
|
||||||
|
# ASCII, ANSI_X3.4-1968 glibc solaris freebsd
|
||||||
|
# ISO-8859-1 glibc aix hpux irix osf solaris freebsd yes
|
||||||
|
# ISO-8859-2 glibc aix hpux irix osf solaris freebsd yes
|
||||||
|
# ISO-8859-3 glibc yes
|
||||||
|
# ISO-8859-4 osf solaris freebsd yes
|
||||||
|
# ISO-8859-5 glibc aix hpux irix osf solaris freebsd yes
|
||||||
|
# ISO-8859-6 glibc aix hpux solaris yes
|
||||||
|
# ISO-8859-7 glibc aix hpux irix osf solaris yes
|
||||||
|
# ISO-8859-8 glibc aix hpux osf solaris yes
|
||||||
|
# ISO-8859-9 glibc aix hpux irix osf solaris yes
|
||||||
|
# ISO-8859-13 glibc
|
||||||
|
# ISO-8859-15 glibc aix osf solaris freebsd
|
||||||
|
# KOI8-R glibc solaris freebsd yes
|
||||||
|
# KOI8-U glibc freebsd yes
|
||||||
|
# CP437 dos
|
||||||
|
# CP775 dos
|
||||||
|
# CP850 aix osf dos
|
||||||
|
# CP852 dos
|
||||||
|
# CP855 dos
|
||||||
|
# CP856 aix
|
||||||
|
# CP857 dos
|
||||||
|
# CP861 dos
|
||||||
|
# CP862 dos
|
||||||
|
# CP864 dos
|
||||||
|
# CP865 dos
|
||||||
|
# CP866 freebsd dos
|
||||||
|
# CP869 dos
|
||||||
|
# CP874 win32 dos
|
||||||
|
# CP922 aix
|
||||||
|
# CP932 aix win32 dos
|
||||||
|
# CP943 aix
|
||||||
|
# CP949 osf win32 dos
|
||||||
|
# CP950 win32 dos
|
||||||
|
# CP1046 aix
|
||||||
|
# CP1124 aix
|
||||||
|
# CP1129 aix
|
||||||
|
# CP1250 win32
|
||||||
|
# CP1251 glibc win32
|
||||||
|
# CP1252 aix win32
|
||||||
|
# CP1253 win32
|
||||||
|
# CP1254 win32
|
||||||
|
# CP1255 win32
|
||||||
|
# CP1256 win32
|
||||||
|
# CP1257 win32
|
||||||
|
# GB2312 glibc aix hpux irix solaris freebsd yes
|
||||||
|
# EUC-JP glibc aix hpux irix osf solaris freebsd yes
|
||||||
|
# EUC-KR glibc aix hpux irix osf solaris freebsd yes
|
||||||
|
# EUC-TW glibc aix hpux irix osf solaris
|
||||||
|
# BIG5 glibc aix hpux osf solaris freebsd yes
|
||||||
|
# BIG5-HKSCS glibc
|
||||||
|
# GBK aix osf win32 dos
|
||||||
|
# GB18030 glibc
|
||||||
|
# SHIFT_JIS hpux osf solaris freebsd yes
|
||||||
|
# JOHAB glibc win32
|
||||||
|
# TIS-620 glibc aix hpux osf solaris
|
||||||
|
# VISCII glibc yes
|
||||||
|
# HP-ROMAN8 hpux
|
||||||
|
# HP-ARABIC8 hpux
|
||||||
|
# HP-GREEK8 hpux
|
||||||
|
# HP-HEBREW8 hpux
|
||||||
|
# HP-TURKISH8 hpux
|
||||||
|
# HP-KANA8 hpux
|
||||||
|
# DEC-KANJI osf
|
||||||
|
# DEC-HANYU osf
|
||||||
|
# UTF-8 glibc aix hpux osf solaris yes
|
||||||
|
#
|
||||||
|
# Note: Names which are not marked as being a MIME name should not be used in
|
||||||
|
# Internet protocols for information interchange (mail, news, etc.).
|
||||||
|
#
|
||||||
|
# Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications
|
||||||
|
# must understand both names and treat them as equivalent.
|
||||||
|
#
|
||||||
|
# The first argument passed to this file is the canonical host specification,
|
||||||
|
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||||
|
# or
|
||||||
|
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||||
|
|
||||||
|
host="$1"
|
||||||
|
os=`echo "$host" | sed -e 's/^[^-]*-[^-]*-\(.*\)$/\1/'`
|
||||||
|
echo "# This file contains a table of character encoding aliases,"
|
||||||
|
echo "# suitable for operating system '${os}'."
|
||||||
|
echo "# It was automatically generated from config.charset."
|
||||||
|
# List of references, updated during installation:
|
||||||
|
echo "# Packages using this file: "
|
||||||
|
case "$os" in
|
||||||
|
linux* | *-gnu*)
|
||||||
|
# With glibc-2.1 or newer, we don't need any canonicalization,
|
||||||
|
# because glibc has iconv and both glibc and libiconv support all
|
||||||
|
# GNU canonical names directly. Therefore, the Makefile does not
|
||||||
|
# need to install the alias file at all.
|
||||||
|
# The following applies only to glibc-2.0.x and older libcs.
|
||||||
|
echo "ISO_646.IRV:1983 ASCII"
|
||||||
|
;;
|
||||||
|
aix*)
|
||||||
|
echo "ISO8859-1 ISO-8859-1"
|
||||||
|
echo "ISO8859-2 ISO-8859-2"
|
||||||
|
echo "ISO8859-5 ISO-8859-5"
|
||||||
|
echo "ISO8859-6 ISO-8859-6"
|
||||||
|
echo "ISO8859-7 ISO-8859-7"
|
||||||
|
echo "ISO8859-8 ISO-8859-8"
|
||||||
|
echo "ISO8859-9 ISO-8859-9"
|
||||||
|
echo "ISO8859-15 ISO-8859-15"
|
||||||
|
echo "IBM-850 CP850"
|
||||||
|
echo "IBM-856 CP856"
|
||||||
|
echo "IBM-921 ISO-8859-13"
|
||||||
|
echo "IBM-922 CP922"
|
||||||
|
echo "IBM-932 CP932"
|
||||||
|
echo "IBM-943 CP943"
|
||||||
|
echo "IBM-1046 CP1046"
|
||||||
|
echo "IBM-1124 CP1124"
|
||||||
|
echo "IBM-1129 CP1129"
|
||||||
|
echo "IBM-1252 CP1252"
|
||||||
|
echo "IBM-eucCN GB2312"
|
||||||
|
echo "IBM-eucJP EUC-JP"
|
||||||
|
echo "IBM-eucKR EUC-KR"
|
||||||
|
echo "IBM-eucTW EUC-TW"
|
||||||
|
echo "big5 BIG5"
|
||||||
|
echo "GBK GBK"
|
||||||
|
echo "TIS-620 TIS-620"
|
||||||
|
echo "UTF-8 UTF-8"
|
||||||
|
;;
|
||||||
|
hpux*)
|
||||||
|
echo "iso88591 ISO-8859-1"
|
||||||
|
echo "iso88592 ISO-8859-2"
|
||||||
|
echo "iso88595 ISO-8859-5"
|
||||||
|
echo "iso88596 ISO-8859-6"
|
||||||
|
echo "iso88597 ISO-8859-7"
|
||||||
|
echo "iso88598 ISO-8859-8"
|
||||||
|
echo "iso88599 ISO-8859-9"
|
||||||
|
echo "iso885915 ISO-8859-15"
|
||||||
|
echo "roman8 HP-ROMAN8"
|
||||||
|
echo "arabic8 HP-ARABIC8"
|
||||||
|
echo "greek8 HP-GREEK8"
|
||||||
|
echo "hebrew8 HP-HEBREW8"
|
||||||
|
echo "turkish8 HP-TURKISH8"
|
||||||
|
echo "kana8 HP-KANA8"
|
||||||
|
echo "tis620 TIS-620"
|
||||||
|
echo "big5 BIG5"
|
||||||
|
echo "eucJP EUC-JP"
|
||||||
|
echo "eucKR EUC-KR"
|
||||||
|
echo "eucTW EUC-TW"
|
||||||
|
echo "hp15CN GB2312"
|
||||||
|
#echo "ccdc ?" # what is this?
|
||||||
|
echo "SJIS SHIFT_JIS"
|
||||||
|
echo "utf8 UTF-8"
|
||||||
|
;;
|
||||||
|
irix*)
|
||||||
|
echo "ISO8859-1 ISO-8859-1"
|
||||||
|
echo "ISO8859-2 ISO-8859-2"
|
||||||
|
echo "ISO8859-5 ISO-8859-5"
|
||||||
|
echo "ISO8859-7 ISO-8859-7"
|
||||||
|
echo "ISO8859-9 ISO-8859-9"
|
||||||
|
echo "eucCN GB2312"
|
||||||
|
echo "eucJP EUC-JP"
|
||||||
|
echo "eucKR EUC-KR"
|
||||||
|
echo "eucTW EUC-TW"
|
||||||
|
;;
|
||||||
|
osf*)
|
||||||
|
echo "ISO8859-1 ISO-8859-1"
|
||||||
|
echo "ISO8859-2 ISO-8859-2"
|
||||||
|
echo "ISO8859-4 ISO-8859-4"
|
||||||
|
echo "ISO8859-5 ISO-8859-5"
|
||||||
|
echo "ISO8859-7 ISO-8859-7"
|
||||||
|
echo "ISO8859-8 ISO-8859-8"
|
||||||
|
echo "ISO8859-9 ISO-8859-9"
|
||||||
|
echo "ISO8859-15 ISO-8859-15"
|
||||||
|
echo "cp850 CP850"
|
||||||
|
echo "big5 BIG5"
|
||||||
|
echo "dechanyu DEC-HANYU"
|
||||||
|
echo "dechanzi GB2312"
|
||||||
|
echo "deckanji DEC-KANJI"
|
||||||
|
echo "deckorean EUC-KR"
|
||||||
|
echo "eucJP EUC-JP"
|
||||||
|
echo "eucKR EUC-KR"
|
||||||
|
echo "eucTW EUC-TW"
|
||||||
|
echo "GBK GBK"
|
||||||
|
echo "KSC5601 CP949"
|
||||||
|
echo "sdeckanji EUC-JP"
|
||||||
|
echo "SJIS SHIFT_JIS"
|
||||||
|
echo "TACTIS TIS-620"
|
||||||
|
echo "UTF-8 UTF-8"
|
||||||
|
;;
|
||||||
|
solaris*)
|
||||||
|
echo "646 ASCII"
|
||||||
|
echo "ISO8859-1 ISO-8859-1"
|
||||||
|
echo "ISO8859-2 ISO-8859-2"
|
||||||
|
echo "ISO8859-4 ISO-8859-4"
|
||||||
|
echo "ISO8859-5 ISO-8859-5"
|
||||||
|
echo "ISO8859-6 ISO-8859-6"
|
||||||
|
echo "ISO8859-7 ISO-8859-7"
|
||||||
|
echo "ISO8859-8 ISO-8859-8"
|
||||||
|
echo "ISO8859-9 ISO-8859-9"
|
||||||
|
echo "ISO8859-15 ISO-8859-15"
|
||||||
|
echo "koi8-r KOI8-R"
|
||||||
|
echo "BIG5 BIG5"
|
||||||
|
echo "gb2312 GB2312"
|
||||||
|
echo "cns11643 EUC-TW"
|
||||||
|
echo "5601 EUC-KR"
|
||||||
|
echo "eucJP EUC-JP"
|
||||||
|
echo "PCK SHIFT_JIS"
|
||||||
|
echo "TIS620.2533 TIS-620"
|
||||||
|
#echo "sun_eu_greek ?" # what is this?
|
||||||
|
echo "UTF-8 UTF-8"
|
||||||
|
;;
|
||||||
|
freebsd*)
|
||||||
|
# FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
|
||||||
|
# localcharset.c falls back to using the full locale name
|
||||||
|
# from the environment variables.
|
||||||
|
echo "C ASCII"
|
||||||
|
echo "US-ASCII ASCII"
|
||||||
|
for l in la_LN lt_LN; do
|
||||||
|
echo "$l.ASCII ASCII"
|
||||||
|
done
|
||||||
|
for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
|
||||||
|
fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \
|
||||||
|
lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do
|
||||||
|
echo "$l.ISO_8859-1 ISO-8859-1"
|
||||||
|
echo "$l.DIS_8859-15 ISO-8859-15"
|
||||||
|
done
|
||||||
|
for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do
|
||||||
|
echo "$l.ISO_8859-2 ISO-8859-2"
|
||||||
|
done
|
||||||
|
for l in la_LN lt_LT; do
|
||||||
|
echo "$l.ISO_8859-4 ISO-8859-4"
|
||||||
|
done
|
||||||
|
for l in ru_RU ru_SU; do
|
||||||
|
echo "$l.KOI8-R KOI8-R"
|
||||||
|
echo "$l.ISO_8859-5 ISO-8859-5"
|
||||||
|
echo "$l.CP866 CP866"
|
||||||
|
done
|
||||||
|
echo "uk_UA.KOI8-U KOI8-U"
|
||||||
|
echo "zh_TW.BIG5 BIG5"
|
||||||
|
echo "zh_TW.Big5 BIG5"
|
||||||
|
echo "zh_CN.EUC GB2312"
|
||||||
|
echo "ja_JP.EUC EUC-JP"
|
||||||
|
echo "ja_JP.SJIS SHIFT_JIS"
|
||||||
|
echo "ja_JP.Shift_JIS SHIFT_JIS"
|
||||||
|
echo "ko_KR.EUC EUC-KR"
|
||||||
|
;;
|
||||||
|
beos*)
|
||||||
|
# BeOS has a single locale, and it has UTF-8 encoding.
|
||||||
|
echo "* UTF-8"
|
||||||
|
;;
|
||||||
|
msdosdjgpp*)
|
||||||
|
# DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore
|
||||||
|
# localcharset.c falls back to using the full locale name
|
||||||
|
# from the environment variables.
|
||||||
|
echo "#"
|
||||||
|
echo "# The encodings given here may not all be correct."
|
||||||
|
echo "# If you find that the encoding given for your language and"
|
||||||
|
echo "# country is not the one your DOS machine actually uses, just"
|
||||||
|
echo "# correct it in this file, and send a mail to"
|
||||||
|
echo "# Juan Manuel Guerrero <[email protected]>"
|
||||||
|
echo "# and Bruno Haible <[email protected]>."
|
||||||
|
echo "#"
|
||||||
|
echo "C ASCII"
|
||||||
|
# ISO-8859-1 languages
|
||||||
|
echo "ca CP850"
|
||||||
|
echo "ca_ES CP850"
|
||||||
|
echo "da CP865" # not CP850 ??
|
||||||
|
echo "da_DK CP865" # not CP850 ??
|
||||||
|
echo "de CP850"
|
||||||
|
echo "de_AT CP850"
|
||||||
|
echo "de_CH CP850"
|
||||||
|
echo "de_DE CP850"
|
||||||
|
echo "en CP850"
|
||||||
|
echo "en_AU CP850" # not CP437 ??
|
||||||
|
echo "en_CA CP850"
|
||||||
|
echo "en_GB CP850"
|
||||||
|
echo "en_NZ CP437"
|
||||||
|
echo "en_US CP437"
|
||||||
|
echo "en_ZA CP850" # not CP437 ??
|
||||||
|
echo "es CP850"
|
||||||
|
echo "es_AR CP850"
|
||||||
|
echo "es_BO CP850"
|
||||||
|
echo "es_CL CP850"
|
||||||
|
echo "es_CO CP850"
|
||||||
|
echo "es_CR CP850"
|
||||||
|
echo "es_CU CP850"
|
||||||
|
echo "es_DO CP850"
|
||||||
|
echo "es_EC CP850"
|
||||||
|
echo "es_ES CP850"
|
||||||
|
echo "es_GT CP850"
|
||||||
|
echo "es_HN CP850"
|
||||||
|
echo "es_MX CP850"
|
||||||
|
echo "es_NI CP850"
|
||||||
|
echo "es_PA CP850"
|
||||||
|
echo "es_PY CP850"
|
||||||
|
echo "es_PE CP850"
|
||||||
|
echo "es_SV CP850"
|
||||||
|
echo "es_UY CP850"
|
||||||
|
echo "es_VE CP850"
|
||||||
|
echo "et CP850"
|
||||||
|
echo "et_EE CP850"
|
||||||
|
echo "eu CP850"
|
||||||
|
echo "eu_ES CP850"
|
||||||
|
echo "fi CP850"
|
||||||
|
echo "fi_FI CP850"
|
||||||
|
echo "fr CP850"
|
||||||
|
echo "fr_BE CP850"
|
||||||
|
echo "fr_CA CP850"
|
||||||
|
echo "fr_CH CP850"
|
||||||
|
echo "fr_FR CP850"
|
||||||
|
echo "ga CP850"
|
||||||
|
echo "ga_IE CP850"
|
||||||
|
echo "gd CP850"
|
||||||
|
echo "gd_GB CP850"
|
||||||
|
echo "gl CP850"
|
||||||
|
echo "gl_ES CP850"
|
||||||
|
echo "id CP850" # not CP437 ??
|
||||||
|
echo "id_ID CP850" # not CP437 ??
|
||||||
|
echo "is CP861" # not CP850 ??
|
||||||
|
echo "is_IS CP861" # not CP850 ??
|
||||||
|
echo "it CP850"
|
||||||
|
echo "it_CH CP850"
|
||||||
|
echo "it_IT CP850"
|
||||||
|
echo "lt CP775"
|
||||||
|
echo "lt_LT CP775"
|
||||||
|
echo "lv CP775"
|
||||||
|
echo "lv_LV CP775"
|
||||||
|
echo "nb CP865" # not CP850 ??
|
||||||
|
echo "nb_NO CP865" # not CP850 ??
|
||||||
|
echo "nl CP850"
|
||||||
|
echo "nl_BE CP850"
|
||||||
|
echo "nl_NL CP850"
|
||||||
|
echo "nn CP865" # not CP850 ??
|
||||||
|
echo "nn_NO CP865" # not CP850 ??
|
||||||
|
echo "no CP865" # not CP850 ??
|
||||||
|
echo "no_NO CP865" # not CP850 ??
|
||||||
|
echo "pt CP850"
|
||||||
|
echo "pt_BR CP850"
|
||||||
|
echo "pt_PT CP850"
|
||||||
|
echo "sv CP850"
|
||||||
|
echo "sv_SE CP850"
|
||||||
|
# ISO-8859-2 languages
|
||||||
|
echo "cs CP852"
|
||||||
|
echo "cs_CZ CP852"
|
||||||
|
echo "hr CP852"
|
||||||
|
echo "hr_HR CP852"
|
||||||
|
echo "hu CP852"
|
||||||
|
echo "hu_HU CP852"
|
||||||
|
echo "pl CP852"
|
||||||
|
echo "pl_PL CP852"
|
||||||
|
echo "ro CP852"
|
||||||
|
echo "ro_RO CP852"
|
||||||
|
echo "sk CP852"
|
||||||
|
echo "sk_SK CP852"
|
||||||
|
echo "sl CP852"
|
||||||
|
echo "sl_SI CP852"
|
||||||
|
echo "sq CP852"
|
||||||
|
echo "sq_AL CP852"
|
||||||
|
echo "sr CP852" # CP852 or CP866 or CP855 ??
|
||||||
|
echo "sr_YU CP852" # CP852 or CP866 or CP855 ??
|
||||||
|
# ISO-8859-3 languages
|
||||||
|
echo "mt CP850"
|
||||||
|
echo "mt_MT CP850"
|
||||||
|
# ISO-8859-5 languages
|
||||||
|
echo "be CP866"
|
||||||
|
echo "be_BE CP866"
|
||||||
|
echo "bg CP866" # not CP855 ??
|
||||||
|
echo "bg_BG CP866" # not CP855 ??
|
||||||
|
echo "mk CP866" # not CP855 ??
|
||||||
|
echo "mk_MK CP866" # not CP855 ??
|
||||||
|
echo "ru KOI8-R" # not CP866 ??
|
||||||
|
echo "ru_RU KOI8-R" # not CP866 ??
|
||||||
|
# ISO-8859-6 languages
|
||||||
|
echo "ar CP864"
|
||||||
|
echo "ar_AE CP864"
|
||||||
|
echo "ar_DZ CP864"
|
||||||
|
echo "ar_EG CP864"
|
||||||
|
echo "ar_IQ CP864"
|
||||||
|
echo "ar_IR CP864"
|
||||||
|
echo "ar_JO CP864"
|
||||||
|
echo "ar_KW CP864"
|
||||||
|
echo "ar_MA CP864"
|
||||||
|
echo "ar_OM CP864"
|
||||||
|
echo "ar_QA CP864"
|
||||||
|
echo "ar_SA CP864"
|
||||||
|
echo "ar_SY CP864"
|
||||||
|
# ISO-8859-7 languages
|
||||||
|
echo "el CP869"
|
||||||
|
echo "el_GR CP869"
|
||||||
|
# ISO-8859-8 languages
|
||||||
|
echo "he CP862"
|
||||||
|
echo "he_IL CP862"
|
||||||
|
# ISO-8859-9 languages
|
||||||
|
echo "tr CP857"
|
||||||
|
echo "tr_TR CP857"
|
||||||
|
# Japanese
|
||||||
|
echo "ja CP932"
|
||||||
|
echo "ja_JP CP932"
|
||||||
|
# Chinese
|
||||||
|
echo "zh_CN GBK"
|
||||||
|
echo "zh_TW CP950" # not CP938 ??
|
||||||
|
# Korean
|
||||||
|
echo "kr CP949" # not CP934 ??
|
||||||
|
echo "kr_KR CP949" # not CP934 ??
|
||||||
|
# Thai
|
||||||
|
echo "th CP874"
|
||||||
|
echo "th_TH CP874"
|
||||||
|
# Other
|
||||||
|
echo "eo CP850"
|
||||||
|
echo "eo_EO CP850"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/* Implementation of the dcgettext(3) function.
|
||||||
|
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "gettextP.h"
|
||||||
|
#ifdef _LIBC
|
||||||
|
# include <libintl.h>
|
||||||
|
#else
|
||||||
|
# include "libgnuintl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* @@ end of prolog @@ */
|
||||||
|
|
||||||
|
/* Names for the libintl functions are a problem. They must not clash
|
||||||
|
with existing names and they should follow ANSI C. But this source
|
||||||
|
code is also used in GNU C Library where the names have a __
|
||||||
|
prefix. So we have to make a difference here. */
|
||||||
|
#ifdef _LIBC
|
||||||
|
# define DCGETTEXT __dcgettext
|
||||||
|
# define DCIGETTEXT __dcigettext
|
||||||
|
#else
|
||||||
|
# define DCGETTEXT dcgettext__
|
||||||
|
# define DCIGETTEXT dcigettext__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
||||||
|
locale. */
|
||||||
|
char *
|
||||||
|
DCGETTEXT (domainname, msgid, category)
|
||||||
|
const char *domainname;
|
||||||
|
const char *msgid;
|
||||||
|
int category;
|
||||||
|
{
|
||||||
|
return DCIGETTEXT (domainname, msgid, NULL, 0, 0, category);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
/* Alias for function name in GNU C Library. */
|
||||||
|
weak_alias (__dcgettext, dcgettext);
|
||||||
|
#endif
|
||||||
+1259
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,60 @@
|
|||||||
|
/* Implementation of the dcngettext(3) function.
|
||||||
|
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "gettextP.h"
|
||||||
|
#ifdef _LIBC
|
||||||
|
# include <libintl.h>
|
||||||
|
#else
|
||||||
|
# include "libgnuintl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* @@ end of prolog @@ */
|
||||||
|
|
||||||
|
/* Names for the libintl functions are a problem. They must not clash
|
||||||
|
with existing names and they should follow ANSI C. But this source
|
||||||
|
code is also used in GNU C Library where the names have a __
|
||||||
|
prefix. So we have to make a difference here. */
|
||||||
|
#ifdef _LIBC
|
||||||
|
# define DCNGETTEXT __dcngettext
|
||||||
|
# define DCIGETTEXT __dcigettext
|
||||||
|
#else
|
||||||
|
# define DCNGETTEXT dcngettext__
|
||||||
|
# define DCIGETTEXT dcigettext__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
||||||
|
locale. */
|
||||||
|
char *
|
||||||
|
DCNGETTEXT (domainname, msgid1, msgid2, n, category)
|
||||||
|
const char *domainname;
|
||||||
|
const char *msgid1;
|
||||||
|
const char *msgid2;
|
||||||
|
unsigned long int n;
|
||||||
|
int category;
|
||||||
|
{
|
||||||
|
return DCIGETTEXT (domainname, msgid1, msgid2, 1, n, category);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
/* Alias for function name in GNU C Library. */
|
||||||
|
weak_alias (__dcngettext, dcngettext);
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
/* Implementation of the dgettext(3) function.
|
||||||
|
Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
|
#include "gettextP.h"
|
||||||
|
#ifdef _LIBC
|
||||||
|
# include <libintl.h>
|
||||||
|
#else
|
||||||
|
# include "libgnuintl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* @@ end of prolog @@ */
|
||||||
|
|
||||||
|
/* Names for the libintl functions are a problem. They must not clash
|
||||||
|
with existing names and they should follow ANSI C. But this source
|
||||||
|
code is also used in GNU C Library where the names have a __
|
||||||
|
prefix. So we have to make a difference here. */
|
||||||
|
#ifdef _LIBC
|
||||||
|
# define DGETTEXT __dgettext
|
||||||
|
# define DCGETTEXT __dcgettext
|
||||||
|
#else
|
||||||
|
# define DGETTEXT dgettext__
|
||||||
|
# define DCGETTEXT dcgettext__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Look up MSGID in the DOMAINNAME message catalog of the current
|
||||||
|
LC_MESSAGES locale. */
|
||||||
|
char *
|
||||||
|
DGETTEXT (domainname, msgid)
|
||||||
|
const char *domainname;
|
||||||
|
const char *msgid;
|
||||||
|
{
|
||||||
|
return DCGETTEXT (domainname, msgid, LC_MESSAGES);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
/* Alias for function name in GNU C Library. */
|
||||||
|
weak_alias (__dgettext, dgettext);
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/* Implementation of the dngettext(3) function.
|
||||||
|
Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
|
#include "gettextP.h"
|
||||||
|
#ifdef _LIBC
|
||||||
|
# include <libintl.h>
|
||||||
|
#else
|
||||||
|
# include "libgnuintl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* @@ end of prolog @@ */
|
||||||
|
|
||||||
|
/* Names for the libintl functions are a problem. They must not clash
|
||||||
|
with existing names and they should follow ANSI C. But this source
|
||||||
|
code is also used in GNU C Library where the names have a __
|
||||||
|
prefix. So we have to make a difference here. */
|
||||||
|
#ifdef _LIBC
|
||||||
|
# define DNGETTEXT __dngettext
|
||||||
|
# define DCNGETTEXT __dcngettext
|
||||||
|
#else
|
||||||
|
# define DNGETTEXT dngettext__
|
||||||
|
# define DCNGETTEXT dcngettext__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Look up MSGID in the DOMAINNAME message catalog of the current
|
||||||
|
LC_MESSAGES locale and skip message according to the plural form. */
|
||||||
|
char *
|
||||||
|
DNGETTEXT (domainname, msgid1, msgid2, n)
|
||||||
|
const char *domainname;
|
||||||
|
const char *msgid1;
|
||||||
|
const char *msgid2;
|
||||||
|
unsigned long int n;
|
||||||
|
{
|
||||||
|
return DCNGETTEXT (domainname, msgid1, msgid2, n, LC_MESSAGES);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
/* Alias for function name in GNU C Library. */
|
||||||
|
weak_alias (__dngettext, dngettext);
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,192 @@
|
|||||||
|
/* Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
Contributed by Ulrich Drepper <[email protected]>, 1995.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include "loadinfo.h"
|
||||||
|
|
||||||
|
/* On some strange systems still no definition of NULL is found. Sigh! */
|
||||||
|
#ifndef NULL
|
||||||
|
# if defined __STDC__ && __STDC__
|
||||||
|
# define NULL ((void *) 0)
|
||||||
|
# else
|
||||||
|
# define NULL 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* @@ end of prolog @@ */
|
||||||
|
|
||||||
|
char *
|
||||||
|
_nl_find_language (name)
|
||||||
|
const char *name;
|
||||||
|
{
|
||||||
|
while (name[0] != '\0' && name[0] != '_' && name[0] != '@'
|
||||||
|
&& name[0] != '+' && name[0] != ',')
|
||||||
|
++name;
|
||||||
|
|
||||||
|
return (char *) name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
_nl_explode_name (name, language, modifier, territory, codeset,
|
||||||
|
normalized_codeset, special, sponsor, revision)
|
||||||
|
char *name;
|
||||||
|
const char **language;
|
||||||
|
const char **modifier;
|
||||||
|
const char **territory;
|
||||||
|
const char **codeset;
|
||||||
|
const char **normalized_codeset;
|
||||||
|
const char **special;
|
||||||
|
const char **sponsor;
|
||||||
|
const char **revision;
|
||||||
|
{
|
||||||
|
enum { undecided, xpg, cen } syntax;
|
||||||
|
char *cp;
|
||||||
|
int mask;
|
||||||
|
|
||||||
|
*modifier = NULL;
|
||||||
|
*territory = NULL;
|
||||||
|
*codeset = NULL;
|
||||||
|
*normalized_codeset = NULL;
|
||||||
|
*special = NULL;
|
||||||
|
*sponsor = NULL;
|
||||||
|
*revision = NULL;
|
||||||
|
|
||||||
|
/* Now we determine the single parts of the locale name. First
|
||||||
|
look for the language. Termination symbols are `_' and `@' if
|
||||||
|
we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */
|
||||||
|
mask = 0;
|
||||||
|
syntax = undecided;
|
||||||
|
*language = cp = name;
|
||||||
|
cp = _nl_find_language (*language);
|
||||||
|
|
||||||
|
if (*language == cp)
|
||||||
|
/* This does not make sense: language has to be specified. Use
|
||||||
|
this entry as it is without exploding. Perhaps it is an alias. */
|
||||||
|
cp = strchr (*language, '\0');
|
||||||
|
else if (cp[0] == '_')
|
||||||
|
{
|
||||||
|
/* Next is the territory. */
|
||||||
|
cp[0] = '\0';
|
||||||
|
*territory = ++cp;
|
||||||
|
|
||||||
|
while (cp[0] != '\0' && cp[0] != '.' && cp[0] != '@'
|
||||||
|
&& cp[0] != '+' && cp[0] != ',' && cp[0] != '_')
|
||||||
|
++cp;
|
||||||
|
|
||||||
|
mask |= TERRITORY;
|
||||||
|
|
||||||
|
if (cp[0] == '.')
|
||||||
|
{
|
||||||
|
/* Next is the codeset. */
|
||||||
|
syntax = xpg;
|
||||||
|
cp[0] = '\0';
|
||||||
|
*codeset = ++cp;
|
||||||
|
|
||||||
|
while (cp[0] != '\0' && cp[0] != '@')
|
||||||
|
++cp;
|
||||||
|
|
||||||
|
mask |= XPG_CODESET;
|
||||||
|
|
||||||
|
if (*codeset != cp && (*codeset)[0] != '\0')
|
||||||
|
{
|
||||||
|
*normalized_codeset = _nl_normalize_codeset (*codeset,
|
||||||
|
cp - *codeset);
|
||||||
|
if (strcmp (*codeset, *normalized_codeset) == 0)
|
||||||
|
free ((char *) *normalized_codeset);
|
||||||
|
else
|
||||||
|
mask |= XPG_NORM_CODESET;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cp[0] == '@' || (syntax != xpg && cp[0] == '+'))
|
||||||
|
{
|
||||||
|
/* Next is the modifier. */
|
||||||
|
syntax = cp[0] == '@' ? xpg : cen;
|
||||||
|
cp[0] = '\0';
|
||||||
|
*modifier = ++cp;
|
||||||
|
|
||||||
|
while (syntax == cen && cp[0] != '\0' && cp[0] != '+'
|
||||||
|
&& cp[0] != ',' && cp[0] != '_')
|
||||||
|
++cp;
|
||||||
|
|
||||||
|
mask |= XPG_MODIFIER | CEN_AUDIENCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (syntax != xpg && (cp[0] == '+' || cp[0] == ',' || cp[0] == '_'))
|
||||||
|
{
|
||||||
|
syntax = cen;
|
||||||
|
|
||||||
|
if (cp[0] == '+')
|
||||||
|
{
|
||||||
|
/* Next is special application (CEN syntax). */
|
||||||
|
cp[0] = '\0';
|
||||||
|
*special = ++cp;
|
||||||
|
|
||||||
|
while (cp[0] != '\0' && cp[0] != ',' && cp[0] != '_')
|
||||||
|
++cp;
|
||||||
|
|
||||||
|
mask |= CEN_SPECIAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cp[0] == ',')
|
||||||
|
{
|
||||||
|
/* Next is sponsor (CEN syntax). */
|
||||||
|
cp[0] = '\0';
|
||||||
|
*sponsor = ++cp;
|
||||||
|
|
||||||
|
while (cp[0] != '\0' && cp[0] != '_')
|
||||||
|
++cp;
|
||||||
|
|
||||||
|
mask |= CEN_SPONSOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cp[0] == '_')
|
||||||
|
{
|
||||||
|
/* Next is revision (CEN syntax). */
|
||||||
|
cp[0] = '\0';
|
||||||
|
*revision = ++cp;
|
||||||
|
|
||||||
|
mask |= CEN_REVISION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* For CEN syntax values it might be important to have the
|
||||||
|
separator character in the file name, not for XPG syntax. */
|
||||||
|
if (syntax == xpg)
|
||||||
|
{
|
||||||
|
if (*territory != NULL && (*territory)[0] == '\0')
|
||||||
|
mask &= ~TERRITORY;
|
||||||
|
|
||||||
|
if (*codeset != NULL && (*codeset)[0] == '\0')
|
||||||
|
mask &= ~XPG_CODESET;
|
||||||
|
|
||||||
|
if (*modifier != NULL && (*modifier)[0] == '\0')
|
||||||
|
mask &= ~XPG_MODIFIER;
|
||||||
|
}
|
||||||
|
|
||||||
|
return mask;
|
||||||
|
}
|
||||||
@@ -0,0 +1,198 @@
|
|||||||
|
/* Handle list of needed message catalogs
|
||||||
|
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
Written by Ulrich Drepper <[email protected]>, 1995.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#if defined HAVE_UNISTD_H || defined _LIBC
|
||||||
|
# include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "gettextP.h"
|
||||||
|
#ifdef _LIBC
|
||||||
|
# include <libintl.h>
|
||||||
|
#else
|
||||||
|
# include "libgnuintl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* @@ end of prolog @@ */
|
||||||
|
/* List of already loaded domains. */
|
||||||
|
static struct loaded_l10nfile *_nl_loaded_domains;
|
||||||
|
|
||||||
|
|
||||||
|
/* Return a data structure describing the message catalog described by
|
||||||
|
the DOMAINNAME and CATEGORY parameters with respect to the currently
|
||||||
|
established bindings. */
|
||||||
|
struct loaded_l10nfile *
|
||||||
|
internal_function
|
||||||
|
_nl_find_domain (dirname, locale, domainname, domainbinding)
|
||||||
|
const char *dirname;
|
||||||
|
char *locale;
|
||||||
|
const char *domainname;
|
||||||
|
struct binding *domainbinding;
|
||||||
|
{
|
||||||
|
struct loaded_l10nfile *retval;
|
||||||
|
const char *language;
|
||||||
|
const char *modifier;
|
||||||
|
const char *territory;
|
||||||
|
const char *codeset;
|
||||||
|
const char *normalized_codeset;
|
||||||
|
const char *special;
|
||||||
|
const char *sponsor;
|
||||||
|
const char *revision;
|
||||||
|
const char *alias_value;
|
||||||
|
int mask;
|
||||||
|
|
||||||
|
/* LOCALE can consist of up to four recognized parts for the XPG syntax:
|
||||||
|
|
||||||
|
language[_territory[.codeset]][@modifier]
|
||||||
|
|
||||||
|
and six parts for the CEN syntax:
|
||||||
|
|
||||||
|
language[_territory][+audience][+special][,[sponsor][_revision]]
|
||||||
|
|
||||||
|
Beside the first part all of them are allowed to be missing. If
|
||||||
|
the full specified locale is not found, the less specific one are
|
||||||
|
looked for. The various parts will be stripped off according to
|
||||||
|
the following order:
|
||||||
|
(1) revision
|
||||||
|
(2) sponsor
|
||||||
|
(3) special
|
||||||
|
(4) codeset
|
||||||
|
(5) normalized codeset
|
||||||
|
(6) territory
|
||||||
|
(7) audience/modifier
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* If we have already tested for this locale entry there has to
|
||||||
|
be one data set in the list of loaded domains. */
|
||||||
|
retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname,
|
||||||
|
strlen (dirname) + 1, 0, locale, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, domainname, 0);
|
||||||
|
if (retval != NULL)
|
||||||
|
{
|
||||||
|
/* We know something about this locale. */
|
||||||
|
int cnt;
|
||||||
|
|
||||||
|
if (retval->decided == 0)
|
||||||
|
_nl_load_domain (retval, domainbinding);
|
||||||
|
|
||||||
|
if (retval->data != NULL)
|
||||||
|
return retval;
|
||||||
|
|
||||||
|
for (cnt = 0; retval->successor[cnt] != NULL; ++cnt)
|
||||||
|
{
|
||||||
|
if (retval->successor[cnt]->decided == 0)
|
||||||
|
_nl_load_domain (retval->successor[cnt], domainbinding);
|
||||||
|
|
||||||
|
if (retval->successor[cnt]->data != NULL)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return cnt >= 0 ? retval : NULL;
|
||||||
|
/* NOTREACHED */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* See whether the locale value is an alias. If yes its value
|
||||||
|
*overwrites* the alias name. No test for the original value is
|
||||||
|
done. */
|
||||||
|
alias_value = _nl_expand_alias (locale);
|
||||||
|
if (alias_value != NULL)
|
||||||
|
{
|
||||||
|
#if defined _LIBC || defined HAVE_STRDUP
|
||||||
|
locale = strdup (alias_value);
|
||||||
|
if (locale == NULL)
|
||||||
|
return NULL;
|
||||||
|
#else
|
||||||
|
size_t len = strlen (alias_value) + 1;
|
||||||
|
locale = (char *) malloc (len);
|
||||||
|
if (locale == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
memcpy (locale, alias_value, len);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now we determine the single parts of the locale name. First
|
||||||
|
look for the language. Termination symbols are `_' and `@' if
|
||||||
|
we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */
|
||||||
|
mask = _nl_explode_name (locale, &language, &modifier, &territory,
|
||||||
|
&codeset, &normalized_codeset, &special,
|
||||||
|
&sponsor, &revision);
|
||||||
|
|
||||||
|
/* Create all possible locale entries which might be interested in
|
||||||
|
generalization. */
|
||||||
|
retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname,
|
||||||
|
strlen (dirname) + 1, mask, language, territory,
|
||||||
|
codeset, normalized_codeset, modifier, special,
|
||||||
|
sponsor, revision, domainname, 1);
|
||||||
|
if (retval == NULL)
|
||||||
|
/* This means we are out of core. */
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (retval->decided == 0)
|
||||||
|
_nl_load_domain (retval, domainbinding);
|
||||||
|
if (retval->data == NULL)
|
||||||
|
{
|
||||||
|
int cnt;
|
||||||
|
for (cnt = 0; retval->successor[cnt] != NULL; ++cnt)
|
||||||
|
{
|
||||||
|
if (retval->successor[cnt]->decided == 0)
|
||||||
|
_nl_load_domain (retval->successor[cnt], domainbinding);
|
||||||
|
if (retval->successor[cnt]->data != NULL)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The room for an alias was dynamically allocated. Free it now. */
|
||||||
|
if (alias_value != NULL)
|
||||||
|
free (locale);
|
||||||
|
|
||||||
|
/* The space for normalized_codeset is dynamically allocated. Free it. */
|
||||||
|
if (mask & XPG_NORM_CODESET)
|
||||||
|
free ((void *) normalized_codeset);
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
static void __attribute__ ((unused))
|
||||||
|
free_mem (void)
|
||||||
|
{
|
||||||
|
struct loaded_l10nfile *runp = _nl_loaded_domains;
|
||||||
|
|
||||||
|
while (runp != NULL)
|
||||||
|
{
|
||||||
|
struct loaded_l10nfile *here = runp;
|
||||||
|
if (runp->data != NULL)
|
||||||
|
_nl_unload_domain ((struct loaded_domain *) runp->data);
|
||||||
|
runp = runp->next;
|
||||||
|
free ((char *) here->filename);
|
||||||
|
free (here);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
text_set_element (__libc_subfreeres, free_mem);
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
/* Implementation of gettext(3) function.
|
||||||
|
Copyright (C) 1995, 1997, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
# define __need_NULL
|
||||||
|
# include <stddef.h>
|
||||||
|
#else
|
||||||
|
# include <stdlib.h> /* Just for NULL. */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "gettextP.h"
|
||||||
|
#ifdef _LIBC
|
||||||
|
# include <libintl.h>
|
||||||
|
#else
|
||||||
|
# include "libgnuintl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* @@ end of prolog @@ */
|
||||||
|
|
||||||
|
/* Names for the libintl functions are a problem. They must not clash
|
||||||
|
with existing names and they should follow ANSI C. But this source
|
||||||
|
code is also used in GNU C Library where the names have a __
|
||||||
|
prefix. So we have to make a difference here. */
|
||||||
|
#ifdef _LIBC
|
||||||
|
# define GETTEXT __gettext
|
||||||
|
# define DCGETTEXT __dcgettext
|
||||||
|
#else
|
||||||
|
# define GETTEXT gettext__
|
||||||
|
# define DCGETTEXT dcgettext__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Look up MSGID in the current default message catalog for the current
|
||||||
|
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
||||||
|
text). */
|
||||||
|
char *
|
||||||
|
GETTEXT (msgid)
|
||||||
|
const char *msgid;
|
||||||
|
{
|
||||||
|
return DCGETTEXT (NULL, msgid, LC_MESSAGES);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
/* Alias for function name in GNU C Library. */
|
||||||
|
weak_alias (__gettext, gettext);
|
||||||
|
#endif
|
||||||
+102
@@ -0,0 +1,102 @@
|
|||||||
|
/* Description of GNU message catalog format: general file layout.
|
||||||
|
Copyright (C) 1995, 1997, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
#ifndef _GETTEXT_H
|
||||||
|
#define _GETTEXT_H 1
|
||||||
|
|
||||||
|
#if HAVE_LIMITS_H || _LIBC
|
||||||
|
# include <limits.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* @@ end of prolog @@ */
|
||||||
|
|
||||||
|
/* The magic number of the GNU message catalog format. */
|
||||||
|
#define _MAGIC 0x950412de
|
||||||
|
#define _MAGIC_SWAPPED 0xde120495
|
||||||
|
|
||||||
|
/* Revision number of the currently used .mo (binary) file format. */
|
||||||
|
#define MO_REVISION_NUMBER 0
|
||||||
|
|
||||||
|
/* The following contortions are an attempt to use the C preprocessor
|
||||||
|
to determine an unsigned integral type that is 32 bits wide. An
|
||||||
|
alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
|
||||||
|
as of version autoconf-2.13, the AC_CHECK_SIZEOF macro doesn't work
|
||||||
|
when cross-compiling. */
|
||||||
|
|
||||||
|
#if __STDC__
|
||||||
|
# define UINT_MAX_32_BITS 4294967295U
|
||||||
|
#else
|
||||||
|
# define UINT_MAX_32_BITS 0xFFFFFFFF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* If UINT_MAX isn't defined, assume it's a 32-bit type.
|
||||||
|
This should be valid for all systems GNU cares about because
|
||||||
|
that doesn't include 16-bit systems, and only modern systems
|
||||||
|
(that certainly have <limits.h>) have 64+-bit integral types. */
|
||||||
|
|
||||||
|
#ifndef UINT_MAX
|
||||||
|
# define UINT_MAX UINT_MAX_32_BITS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if UINT_MAX == UINT_MAX_32_BITS
|
||||||
|
typedef unsigned nls_uint32;
|
||||||
|
#else
|
||||||
|
# if USHRT_MAX == UINT_MAX_32_BITS
|
||||||
|
typedef unsigned short nls_uint32;
|
||||||
|
# else
|
||||||
|
# if ULONG_MAX == UINT_MAX_32_BITS
|
||||||
|
typedef unsigned long nls_uint32;
|
||||||
|
# else
|
||||||
|
/* The following line is intended to throw an error. Using #error is
|
||||||
|
not portable enough. */
|
||||||
|
"Cannot determine unsigned 32-bit data type."
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Header for binary .mo file format. */
|
||||||
|
struct mo_file_header
|
||||||
|
{
|
||||||
|
/* The magic number. */
|
||||||
|
nls_uint32 magic;
|
||||||
|
/* The revision number of the file format. */
|
||||||
|
nls_uint32 revision;
|
||||||
|
/* The number of strings pairs. */
|
||||||
|
nls_uint32 nstrings;
|
||||||
|
/* Offset of table with start offsets of original strings. */
|
||||||
|
nls_uint32 orig_tab_offset;
|
||||||
|
/* Offset of table with start offsets of translation strings. */
|
||||||
|
nls_uint32 trans_tab_offset;
|
||||||
|
/* Size of hashing table. */
|
||||||
|
nls_uint32 hash_tab_size;
|
||||||
|
/* Offset of first hashing entry. */
|
||||||
|
nls_uint32 hash_tab_offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct string_desc
|
||||||
|
{
|
||||||
|
/* Length of addressed string. */
|
||||||
|
nls_uint32 length;
|
||||||
|
/* Offset of string in file. */
|
||||||
|
nls_uint32 offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* @@ begin of epilog @@ */
|
||||||
|
|
||||||
|
#endif /* gettext.h */
|
||||||
+252
@@ -0,0 +1,252 @@
|
|||||||
|
/* Header describing internals of libintl library.
|
||||||
|
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
Written by Ulrich Drepper <[email protected]>, 1995.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
#ifndef _GETTEXTP_H
|
||||||
|
#define _GETTEXTP_H
|
||||||
|
|
||||||
|
#include <stddef.h> /* Get size_t. */
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
# include "../iconv/gconv_int.h"
|
||||||
|
#else
|
||||||
|
# if HAVE_ICONV
|
||||||
|
# include <iconv.h>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "loadinfo.h"
|
||||||
|
|
||||||
|
#include "gettext.h" /* Get nls_uint32. */
|
||||||
|
|
||||||
|
/* @@ end of prolog @@ */
|
||||||
|
|
||||||
|
#ifndef PARAMS
|
||||||
|
# if __STDC__
|
||||||
|
# define PARAMS(args) args
|
||||||
|
# else
|
||||||
|
# define PARAMS(args) ()
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef internal_function
|
||||||
|
# define internal_function
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Tell the compiler when a conditional or integer expression is
|
||||||
|
almost always true or almost always false. */
|
||||||
|
#ifndef HAVE_BUILTIN_EXPECT
|
||||||
|
# define __builtin_expect(expr, val) (expr)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef W
|
||||||
|
# define W(flag, data) ((flag) ? SWAP (data) : (data))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
# include <byteswap.h>
|
||||||
|
# define SWAP(i) bswap_32 (i)
|
||||||
|
#else
|
||||||
|
static inline nls_uint32
|
||||||
|
SWAP (i)
|
||||||
|
nls_uint32 i;
|
||||||
|
{
|
||||||
|
return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* This is the representation of the expressions to determine the
|
||||||
|
plural form. */
|
||||||
|
struct expression
|
||||||
|
{
|
||||||
|
int nargs; /* Number of arguments. */
|
||||||
|
enum operator
|
||||||
|
{
|
||||||
|
/* Without arguments: */
|
||||||
|
var, /* The variable "n". */
|
||||||
|
num, /* Decimal number. */
|
||||||
|
/* Unary operators: */
|
||||||
|
lnot, /* Logical NOT. */
|
||||||
|
/* Binary operators: */
|
||||||
|
mult, /* Multiplication. */
|
||||||
|
divide, /* Division. */
|
||||||
|
module, /* Module operation. */
|
||||||
|
plus, /* Addition. */
|
||||||
|
minus, /* Subtraction. */
|
||||||
|
less_than, /* Comparison. */
|
||||||
|
greater_than, /* Comparison. */
|
||||||
|
less_or_equal, /* Comparison. */
|
||||||
|
greater_or_equal, /* Comparison. */
|
||||||
|
equal, /* Comparision for equality. */
|
||||||
|
not_equal, /* Comparision for inequality. */
|
||||||
|
land, /* Logical AND. */
|
||||||
|
lor, /* Logical OR. */
|
||||||
|
/* Ternary operators: */
|
||||||
|
qmop /* Question mark operator. */
|
||||||
|
} operation;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
unsigned long int num; /* Number value for `num'. */
|
||||||
|
struct expression *args[3]; /* Up to three arguments. */
|
||||||
|
} val;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* This is the data structure to pass information to the parser and get
|
||||||
|
the result in a thread-safe way. */
|
||||||
|
struct parse_args
|
||||||
|
{
|
||||||
|
const char *cp;
|
||||||
|
struct expression *res;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* The representation of an opened message catalog. */
|
||||||
|
struct loaded_domain
|
||||||
|
{
|
||||||
|
const char *data;
|
||||||
|
int use_mmap;
|
||||||
|
size_t mmap_size;
|
||||||
|
int must_swap;
|
||||||
|
nls_uint32 nstrings;
|
||||||
|
struct string_desc *orig_tab;
|
||||||
|
struct string_desc *trans_tab;
|
||||||
|
nls_uint32 hash_size;
|
||||||
|
nls_uint32 *hash_tab;
|
||||||
|
int codeset_cntr;
|
||||||
|
#ifdef _LIBC
|
||||||
|
__gconv_t conv;
|
||||||
|
#else
|
||||||
|
# if HAVE_ICONV
|
||||||
|
iconv_t conv;
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
char **conv_tab;
|
||||||
|
|
||||||
|
struct expression *plural;
|
||||||
|
unsigned long int nplurals;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* We want to allocate a string at the end of the struct. But ISO C
|
||||||
|
doesn't allow zero sized arrays. */
|
||||||
|
#ifdef __GNUC__
|
||||||
|
# define ZERO 0
|
||||||
|
#else
|
||||||
|
# define ZERO 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* A set of settings bound to a message domain. Used to store settings
|
||||||
|
from bindtextdomain() and bind_textdomain_codeset(). */
|
||||||
|
struct binding
|
||||||
|
{
|
||||||
|
struct binding *next;
|
||||||
|
char *dirname;
|
||||||
|
int codeset_cntr; /* Incremented each time codeset changes. */
|
||||||
|
char *codeset;
|
||||||
|
char domainname[ZERO];
|
||||||
|
};
|
||||||
|
|
||||||
|
/* A counter which is incremented each time some previous translations
|
||||||
|
become invalid.
|
||||||
|
This variable is part of the external ABI of the GNU libintl. */
|
||||||
|
extern int _nl_msg_cat_cntr;
|
||||||
|
|
||||||
|
struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname,
|
||||||
|
char *__locale,
|
||||||
|
const char *__domainname,
|
||||||
|
struct binding *__domainbinding))
|
||||||
|
internal_function;
|
||||||
|
void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain,
|
||||||
|
struct binding *__domainbinding))
|
||||||
|
internal_function;
|
||||||
|
void _nl_unload_domain PARAMS ((struct loaded_domain *__domain))
|
||||||
|
internal_function;
|
||||||
|
const char *_nl_init_domain_conv PARAMS ((struct loaded_l10nfile *__domain_file,
|
||||||
|
struct loaded_domain *__domain,
|
||||||
|
struct binding *__domainbinding))
|
||||||
|
internal_function;
|
||||||
|
void _nl_free_domain_conv PARAMS ((struct loaded_domain *__domain))
|
||||||
|
internal_function;
|
||||||
|
|
||||||
|
char *_nl_find_msg PARAMS ((struct loaded_l10nfile *domain_file,
|
||||||
|
struct binding *domainbinding,
|
||||||
|
const char *msgid, size_t *lengthp))
|
||||||
|
internal_function;
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
extern char *__gettext PARAMS ((const char *__msgid));
|
||||||
|
extern char *__dgettext PARAMS ((const char *__domainname,
|
||||||
|
const char *__msgid));
|
||||||
|
extern char *__dcgettext PARAMS ((const char *__domainname,
|
||||||
|
const char *__msgid, int __category));
|
||||||
|
extern char *__ngettext PARAMS ((const char *__msgid1, const char *__msgid2,
|
||||||
|
unsigned long int __n));
|
||||||
|
extern char *__dngettext PARAMS ((const char *__domainname,
|
||||||
|
const char *__msgid1, const char *__msgid2,
|
||||||
|
unsigned long int n));
|
||||||
|
extern char *__dcngettext PARAMS ((const char *__domainname,
|
||||||
|
const char *__msgid1, const char *__msgid2,
|
||||||
|
unsigned long int __n, int __category));
|
||||||
|
extern char *__dcigettext PARAMS ((const char *__domainname,
|
||||||
|
const char *__msgid1, const char *__msgid2,
|
||||||
|
int __plural, unsigned long int __n,
|
||||||
|
int __category));
|
||||||
|
extern char *__textdomain PARAMS ((const char *__domainname));
|
||||||
|
extern char *__bindtextdomain PARAMS ((const char *__domainname,
|
||||||
|
const char *__dirname));
|
||||||
|
extern char *__bind_textdomain_codeset PARAMS ((const char *__domainname,
|
||||||
|
const char *__codeset));
|
||||||
|
#else
|
||||||
|
extern char *gettext__ PARAMS ((const char *__msgid));
|
||||||
|
extern char *dgettext__ PARAMS ((const char *__domainname,
|
||||||
|
const char *__msgid));
|
||||||
|
extern char *dcgettext__ PARAMS ((const char *__domainname,
|
||||||
|
const char *__msgid, int __category));
|
||||||
|
extern char *ngettext__ PARAMS ((const char *__msgid1, const char *__msgid2,
|
||||||
|
unsigned long int __n));
|
||||||
|
extern char *dngettext__ PARAMS ((const char *__domainname,
|
||||||
|
const char *__msgid1, const char *__msgid2,
|
||||||
|
unsigned long int __n));
|
||||||
|
extern char *dcngettext__ PARAMS ((const char *__domainname,
|
||||||
|
const char *__msgid1, const char *__msgid2,
|
||||||
|
unsigned long int __n, int __category));
|
||||||
|
extern char *dcigettext__ PARAMS ((const char *__domainname,
|
||||||
|
const char *__msgid1, const char *__msgid2,
|
||||||
|
int __plural, unsigned long int __n,
|
||||||
|
int __category));
|
||||||
|
extern char *textdomain__ PARAMS ((const char *__domainname));
|
||||||
|
extern char *bindtextdomain__ PARAMS ((const char *__domainname,
|
||||||
|
const char *__dirname));
|
||||||
|
extern char *bind_textdomain_codeset__ PARAMS ((const char *__domainname,
|
||||||
|
const char *__codeset));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
extern void __gettext_free_exp PARAMS ((struct expression *exp))
|
||||||
|
internal_function;
|
||||||
|
extern int __gettextparse PARAMS ((void *arg));
|
||||||
|
#else
|
||||||
|
extern void gettext_free_exp__ PARAMS ((struct expression *exp))
|
||||||
|
internal_function;
|
||||||
|
extern int gettextparse__ PARAMS ((void *arg));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* @@ begin of epilog @@ */
|
||||||
|
|
||||||
|
#endif /* gettextP.h */
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
/* Description of GNU message catalog format: string hashing function.
|
||||||
|
Copyright (C) 1995, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
/* @@ end of prolog @@ */
|
||||||
|
|
||||||
|
#ifndef PARAMS
|
||||||
|
# if __STDC__
|
||||||
|
# define PARAMS(Args) Args
|
||||||
|
# else
|
||||||
|
# define PARAMS(Args) ()
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* We assume to have `unsigned long int' value with at least 32 bits. */
|
||||||
|
#define HASHWORDBITS 32
|
||||||
|
|
||||||
|
|
||||||
|
/* Defines the so called `hashpjw' function by P.J. Weinberger
|
||||||
|
[see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
|
||||||
|
1986, 1987 Bell Telephone Laboratories, Inc.] */
|
||||||
|
static unsigned long int hash_string PARAMS ((const char *__str_param));
|
||||||
|
|
||||||
|
static inline unsigned long int
|
||||||
|
hash_string (str_param)
|
||||||
|
const char *str_param;
|
||||||
|
{
|
||||||
|
unsigned long int hval, g;
|
||||||
|
const char *str = str_param;
|
||||||
|
|
||||||
|
/* Compute the hash value for the given string. */
|
||||||
|
hval = 0;
|
||||||
|
while (*str != '\0')
|
||||||
|
{
|
||||||
|
hval <<= 4;
|
||||||
|
hval += (unsigned long int) *str++;
|
||||||
|
g = hval & ((unsigned long int) 0xf << (HASHWORDBITS - 4));
|
||||||
|
if (g != 0)
|
||||||
|
{
|
||||||
|
hval ^= g >> (HASHWORDBITS - 8);
|
||||||
|
hval ^= g;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hval;
|
||||||
|
}
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
/* intl-compat.c - Stub functions to call gettext functions from GNU gettext
|
||||||
|
Library.
|
||||||
|
Copyright (C) 1995, 2000, 2001 Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "libgnuintl.h"
|
||||||
|
#include "gettextP.h"
|
||||||
|
|
||||||
|
/* @@ end of prolog @@ */
|
||||||
|
|
||||||
|
/* This file redirects the gettext functions (without prefix or suffix) to
|
||||||
|
those defined in the included GNU gettext library (with "__" suffix).
|
||||||
|
It is compiled into libintl when the included GNU gettext library is
|
||||||
|
configured --with-included-gettext.
|
||||||
|
|
||||||
|
This redirection works also in the case that the system C library or
|
||||||
|
the system libintl library contain gettext/textdomain/... functions.
|
||||||
|
If it didn't, we would need to add preprocessor level redirections to
|
||||||
|
libgnuintl.h of the following form:
|
||||||
|
|
||||||
|
# define gettext gettext__
|
||||||
|
# define dgettext dgettext__
|
||||||
|
# define dcgettext dcgettext__
|
||||||
|
# define ngettext ngettext__
|
||||||
|
# define dngettext dngettext__
|
||||||
|
# define dcngettext dcngettext__
|
||||||
|
# define textdomain textdomain__
|
||||||
|
# define bindtextdomain bindtextdomain__
|
||||||
|
# define bind_textdomain_codeset bind_textdomain_codeset__
|
||||||
|
|
||||||
|
How does this redirection work? There are two cases.
|
||||||
|
A. When libintl.a is linked into an executable, it works because
|
||||||
|
functions defined in the executable always override functions in
|
||||||
|
the shared libraries.
|
||||||
|
B. When libintl.so is used, it works because
|
||||||
|
1. those systems defining gettext/textdomain/... in the C library
|
||||||
|
(namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer) are
|
||||||
|
ELF systems and define these symbols as weak, thus explicitly
|
||||||
|
letting other shared libraries override it.
|
||||||
|
2. those systems defining gettext/textdomain/... in a standalone
|
||||||
|
libintl.so library (namely, Solaris 2.3 and newer) have this
|
||||||
|
shared library in /usr/lib, and the linker will search /usr/lib
|
||||||
|
*after* the directory where the GNU gettext library is installed.
|
||||||
|
|
||||||
|
A third case, namely when libintl.a is linked into a shared library
|
||||||
|
whose name is not libintl.so, is not supported. In this case, on
|
||||||
|
Solaris, when -lintl precedes the linker option for the shared library
|
||||||
|
containing GNU gettext, the system's gettext would indeed override
|
||||||
|
the GNU gettext. Anyone doing this kind of stuff must be clever enough
|
||||||
|
to 1. compile libintl.a with -fPIC, 2. remove -lintl from his linker
|
||||||
|
command line. */
|
||||||
|
|
||||||
|
|
||||||
|
#undef gettext
|
||||||
|
#undef dgettext
|
||||||
|
#undef dcgettext
|
||||||
|
#undef ngettext
|
||||||
|
#undef dngettext
|
||||||
|
#undef dcngettext
|
||||||
|
#undef textdomain
|
||||||
|
#undef bindtextdomain
|
||||||
|
#undef bind_textdomain_codeset
|
||||||
|
|
||||||
|
|
||||||
|
char *
|
||||||
|
gettext (msgid)
|
||||||
|
const char *msgid;
|
||||||
|
{
|
||||||
|
return gettext__ (msgid);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char *
|
||||||
|
dgettext (domainname, msgid)
|
||||||
|
const char *domainname;
|
||||||
|
const char *msgid;
|
||||||
|
{
|
||||||
|
return dgettext__ (domainname, msgid);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char *
|
||||||
|
dcgettext (domainname, msgid, category)
|
||||||
|
const char *domainname;
|
||||||
|
const char *msgid;
|
||||||
|
int category;
|
||||||
|
{
|
||||||
|
return dcgettext__ (domainname, msgid, category);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char *
|
||||||
|
ngettext (msgid1, msgid2, n)
|
||||||
|
const char *msgid1;
|
||||||
|
const char *msgid2;
|
||||||
|
unsigned long int n;
|
||||||
|
{
|
||||||
|
return ngettext__ (msgid1, msgid2, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char *
|
||||||
|
dngettext (domainname, msgid1, msgid2, n)
|
||||||
|
const char *domainname;
|
||||||
|
const char *msgid1;
|
||||||
|
const char *msgid2;
|
||||||
|
unsigned long int n;
|
||||||
|
{
|
||||||
|
return dngettext__ (domainname, msgid1, msgid2, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char *
|
||||||
|
dcngettext (domainname, msgid1, msgid2, n, category)
|
||||||
|
const char *domainname;
|
||||||
|
const char *msgid1;
|
||||||
|
const char *msgid2;
|
||||||
|
unsigned long int n;
|
||||||
|
int category;
|
||||||
|
{
|
||||||
|
return dcngettext__ (domainname, msgid1, msgid2, n, category);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char *
|
||||||
|
textdomain (domainname)
|
||||||
|
const char *domainname;
|
||||||
|
{
|
||||||
|
return textdomain__ (domainname);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char *
|
||||||
|
bindtextdomain (domainname, dirname)
|
||||||
|
const char *domainname;
|
||||||
|
const char *dirname;
|
||||||
|
{
|
||||||
|
return bindtextdomain__ (domainname, dirname);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char *
|
||||||
|
bind_textdomain_codeset (domainname, codeset)
|
||||||
|
const char *domainname;
|
||||||
|
const char *codeset;
|
||||||
|
{
|
||||||
|
return bind_textdomain_codeset__ (domainname, codeset);
|
||||||
|
}
|
||||||
@@ -0,0 +1,405 @@
|
|||||||
|
/* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
Contributed by Ulrich Drepper <[email protected]>, 1995.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
/* Tell glibc's <string.h> to provide a prototype for stpcpy().
|
||||||
|
This must come before <config.h> because <config.h> may include
|
||||||
|
<features.h>, and once <features.h> has been included, it's too late. */
|
||||||
|
#ifndef _GNU_SOURCE
|
||||||
|
# define _GNU_SOURCE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#if !HAVE_STRCHR && !defined _LIBC
|
||||||
|
# ifndef strchr
|
||||||
|
# define strchr index
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined _LIBC || defined HAVE_ARGZ_H
|
||||||
|
# include <argz.h>
|
||||||
|
#endif
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "loadinfo.h"
|
||||||
|
|
||||||
|
/* On some strange systems still no definition of NULL is found. Sigh! */
|
||||||
|
#ifndef NULL
|
||||||
|
# if defined __STDC__ && __STDC__
|
||||||
|
# define NULL ((void *) 0)
|
||||||
|
# else
|
||||||
|
# define NULL 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* @@ end of prolog @@ */
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
/* Rename the non ANSI C functions. This is required by the standard
|
||||||
|
because some ANSI C functions will require linking with this object
|
||||||
|
file and the name space must not be polluted. */
|
||||||
|
# ifndef stpcpy
|
||||||
|
# define stpcpy(dest, src) __stpcpy(dest, src)
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# ifndef HAVE_STPCPY
|
||||||
|
static char *stpcpy PARAMS ((char *dest, const char *src));
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define function which are usually not available. */
|
||||||
|
|
||||||
|
#if !defined _LIBC && !defined HAVE___ARGZ_COUNT
|
||||||
|
/* Returns the number of strings in ARGZ. */
|
||||||
|
static size_t argz_count__ PARAMS ((const char *argz, size_t len));
|
||||||
|
|
||||||
|
static size_t
|
||||||
|
argz_count__ (argz, len)
|
||||||
|
const char *argz;
|
||||||
|
size_t len;
|
||||||
|
{
|
||||||
|
size_t count = 0;
|
||||||
|
while (len > 0)
|
||||||
|
{
|
||||||
|
size_t part_len = strlen (argz);
|
||||||
|
argz += part_len + 1;
|
||||||
|
len -= part_len + 1;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
# undef __argz_count
|
||||||
|
# define __argz_count(argz, len) argz_count__ (argz, len)
|
||||||
|
#endif /* !_LIBC && !HAVE___ARGZ_COUNT */
|
||||||
|
|
||||||
|
#if !defined _LIBC && !defined HAVE___ARGZ_STRINGIFY
|
||||||
|
/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's
|
||||||
|
except the last into the character SEP. */
|
||||||
|
static void argz_stringify__ PARAMS ((char *argz, size_t len, int sep));
|
||||||
|
|
||||||
|
static void
|
||||||
|
argz_stringify__ (argz, len, sep)
|
||||||
|
char *argz;
|
||||||
|
size_t len;
|
||||||
|
int sep;
|
||||||
|
{
|
||||||
|
while (len > 0)
|
||||||
|
{
|
||||||
|
size_t part_len = strlen (argz);
|
||||||
|
argz += part_len;
|
||||||
|
len -= part_len + 1;
|
||||||
|
if (len > 0)
|
||||||
|
*argz++ = sep;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# undef __argz_stringify
|
||||||
|
# define __argz_stringify(argz, len, sep) argz_stringify__ (argz, len, sep)
|
||||||
|
#endif /* !_LIBC && !HAVE___ARGZ_STRINGIFY */
|
||||||
|
|
||||||
|
#if !defined _LIBC && !defined HAVE___ARGZ_NEXT
|
||||||
|
static char *argz_next__ PARAMS ((char *argz, size_t argz_len,
|
||||||
|
const char *entry));
|
||||||
|
|
||||||
|
static char *
|
||||||
|
argz_next__ (argz, argz_len, entry)
|
||||||
|
char *argz;
|
||||||
|
size_t argz_len;
|
||||||
|
const char *entry;
|
||||||
|
{
|
||||||
|
if (entry)
|
||||||
|
{
|
||||||
|
if (entry < argz + argz_len)
|
||||||
|
entry = strchr (entry, '\0') + 1;
|
||||||
|
|
||||||
|
return entry >= argz + argz_len ? NULL : (char *) entry;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (argz_len > 0)
|
||||||
|
return argz;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
# undef __argz_next
|
||||||
|
# define __argz_next(argz, len, entry) argz_next__ (argz, len, entry)
|
||||||
|
#endif /* !_LIBC && !HAVE___ARGZ_NEXT */
|
||||||
|
|
||||||
|
|
||||||
|
/* Return number of bits set in X. */
|
||||||
|
static int pop PARAMS ((int x));
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
pop (x)
|
||||||
|
int x;
|
||||||
|
{
|
||||||
|
/* We assume that no more than 16 bits are used. */
|
||||||
|
x = ((x & ~0x5555) >> 1) + (x & 0x5555);
|
||||||
|
x = ((x & ~0x3333) >> 2) + (x & 0x3333);
|
||||||
|
x = ((x >> 4) + x) & 0x0f0f;
|
||||||
|
x = ((x >> 8) + x) & 0xff;
|
||||||
|
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct loaded_l10nfile *
|
||||||
|
_nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
|
||||||
|
territory, codeset, normalized_codeset, modifier, special,
|
||||||
|
sponsor, revision, filename, do_allocate)
|
||||||
|
struct loaded_l10nfile **l10nfile_list;
|
||||||
|
const char *dirlist;
|
||||||
|
size_t dirlist_len;
|
||||||
|
int mask;
|
||||||
|
const char *language;
|
||||||
|
const char *territory;
|
||||||
|
const char *codeset;
|
||||||
|
const char *normalized_codeset;
|
||||||
|
const char *modifier;
|
||||||
|
const char *special;
|
||||||
|
const char *sponsor;
|
||||||
|
const char *revision;
|
||||||
|
const char *filename;
|
||||||
|
int do_allocate;
|
||||||
|
{
|
||||||
|
char *abs_filename;
|
||||||
|
struct loaded_l10nfile *last = NULL;
|
||||||
|
struct loaded_l10nfile *retval;
|
||||||
|
char *cp;
|
||||||
|
size_t entries;
|
||||||
|
int cnt;
|
||||||
|
|
||||||
|
/* Allocate room for the full file name. */
|
||||||
|
abs_filename = (char *) malloc (dirlist_len
|
||||||
|
+ strlen (language)
|
||||||
|
+ ((mask & TERRITORY) != 0
|
||||||
|
? strlen (territory) + 1 : 0)
|
||||||
|
+ ((mask & XPG_CODESET) != 0
|
||||||
|
? strlen (codeset) + 1 : 0)
|
||||||
|
+ ((mask & XPG_NORM_CODESET) != 0
|
||||||
|
? strlen (normalized_codeset) + 1 : 0)
|
||||||
|
+ (((mask & XPG_MODIFIER) != 0
|
||||||
|
|| (mask & CEN_AUDIENCE) != 0)
|
||||||
|
? strlen (modifier) + 1 : 0)
|
||||||
|
+ ((mask & CEN_SPECIAL) != 0
|
||||||
|
? strlen (special) + 1 : 0)
|
||||||
|
+ (((mask & CEN_SPONSOR) != 0
|
||||||
|
|| (mask & CEN_REVISION) != 0)
|
||||||
|
? (1 + ((mask & CEN_SPONSOR) != 0
|
||||||
|
? strlen (sponsor) + 1 : 0)
|
||||||
|
+ ((mask & CEN_REVISION) != 0
|
||||||
|
? strlen (revision) + 1 : 0)) : 0)
|
||||||
|
+ 1 + strlen (filename) + 1);
|
||||||
|
|
||||||
|
if (abs_filename == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
retval = NULL;
|
||||||
|
last = NULL;
|
||||||
|
|
||||||
|
/* Construct file name. */
|
||||||
|
memcpy (abs_filename, dirlist, dirlist_len);
|
||||||
|
__argz_stringify (abs_filename, dirlist_len, PATH_SEPARATOR);
|
||||||
|
cp = abs_filename + (dirlist_len - 1);
|
||||||
|
*cp++ = '/';
|
||||||
|
cp = stpcpy (cp, language);
|
||||||
|
|
||||||
|
if ((mask & TERRITORY) != 0)
|
||||||
|
{
|
||||||
|
*cp++ = '_';
|
||||||
|
cp = stpcpy (cp, territory);
|
||||||
|
}
|
||||||
|
if ((mask & XPG_CODESET) != 0)
|
||||||
|
{
|
||||||
|
*cp++ = '.';
|
||||||
|
cp = stpcpy (cp, codeset);
|
||||||
|
}
|
||||||
|
if ((mask & XPG_NORM_CODESET) != 0)
|
||||||
|
{
|
||||||
|
*cp++ = '.';
|
||||||
|
cp = stpcpy (cp, normalized_codeset);
|
||||||
|
}
|
||||||
|
if ((mask & (XPG_MODIFIER | CEN_AUDIENCE)) != 0)
|
||||||
|
{
|
||||||
|
/* This component can be part of both syntaces but has different
|
||||||
|
leading characters. For CEN we use `+', else `@'. */
|
||||||
|
*cp++ = (mask & CEN_AUDIENCE) != 0 ? '+' : '@';
|
||||||
|
cp = stpcpy (cp, modifier);
|
||||||
|
}
|
||||||
|
if ((mask & CEN_SPECIAL) != 0)
|
||||||
|
{
|
||||||
|
*cp++ = '+';
|
||||||
|
cp = stpcpy (cp, special);
|
||||||
|
}
|
||||||
|
if ((mask & (CEN_SPONSOR | CEN_REVISION)) != 0)
|
||||||
|
{
|
||||||
|
*cp++ = ',';
|
||||||
|
if ((mask & CEN_SPONSOR) != 0)
|
||||||
|
cp = stpcpy (cp, sponsor);
|
||||||
|
if ((mask & CEN_REVISION) != 0)
|
||||||
|
{
|
||||||
|
*cp++ = '_';
|
||||||
|
cp = stpcpy (cp, revision);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*cp++ = '/';
|
||||||
|
stpcpy (cp, filename);
|
||||||
|
|
||||||
|
/* Look in list of already loaded domains whether it is already
|
||||||
|
available. */
|
||||||
|
last = NULL;
|
||||||
|
for (retval = *l10nfile_list; retval != NULL; retval = retval->next)
|
||||||
|
if (retval->filename != NULL)
|
||||||
|
{
|
||||||
|
int compare = strcmp (retval->filename, abs_filename);
|
||||||
|
if (compare == 0)
|
||||||
|
/* We found it! */
|
||||||
|
break;
|
||||||
|
if (compare < 0)
|
||||||
|
{
|
||||||
|
/* It's not in the list. */
|
||||||
|
retval = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
last = retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (retval != NULL || do_allocate == 0)
|
||||||
|
{
|
||||||
|
free (abs_filename);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
retval = (struct loaded_l10nfile *)
|
||||||
|
malloc (sizeof (*retval) + (__argz_count (dirlist, dirlist_len)
|
||||||
|
* (1 << pop (mask))
|
||||||
|
* sizeof (struct loaded_l10nfile *)));
|
||||||
|
if (retval == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
retval->filename = abs_filename;
|
||||||
|
retval->decided = (__argz_count (dirlist, dirlist_len) != 1
|
||||||
|
|| ((mask & XPG_CODESET) != 0
|
||||||
|
&& (mask & XPG_NORM_CODESET) != 0));
|
||||||
|
retval->data = NULL;
|
||||||
|
|
||||||
|
if (last == NULL)
|
||||||
|
{
|
||||||
|
retval->next = *l10nfile_list;
|
||||||
|
*l10nfile_list = retval;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
retval->next = last->next;
|
||||||
|
last->next = retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
entries = 0;
|
||||||
|
/* If the DIRLIST is a real list the RETVAL entry corresponds not to
|
||||||
|
a real file. So we have to use the DIRLIST separation mechanism
|
||||||
|
of the inner loop. */
|
||||||
|
cnt = __argz_count (dirlist, dirlist_len) == 1 ? mask - 1 : mask;
|
||||||
|
for (; cnt >= 0; --cnt)
|
||||||
|
if ((cnt & ~mask) == 0
|
||||||
|
&& ((cnt & CEN_SPECIFIC) == 0 || (cnt & XPG_SPECIFIC) == 0)
|
||||||
|
&& ((cnt & XPG_CODESET) == 0 || (cnt & XPG_NORM_CODESET) == 0))
|
||||||
|
{
|
||||||
|
/* Iterate over all elements of the DIRLIST. */
|
||||||
|
char *dir = NULL;
|
||||||
|
|
||||||
|
while ((dir = __argz_next ((char *) dirlist, dirlist_len, dir))
|
||||||
|
!= NULL)
|
||||||
|
retval->successor[entries++]
|
||||||
|
= _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1, cnt,
|
||||||
|
language, territory, codeset,
|
||||||
|
normalized_codeset, modifier, special,
|
||||||
|
sponsor, revision, filename, 1);
|
||||||
|
}
|
||||||
|
retval->successor[entries] = NULL;
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Normalize codeset name. There is no standard for the codeset
|
||||||
|
names. Normalization allows the user to use any of the common
|
||||||
|
names. The return value is dynamically allocated and has to be
|
||||||
|
freed by the caller. */
|
||||||
|
const char *
|
||||||
|
_nl_normalize_codeset (codeset, name_len)
|
||||||
|
const char *codeset;
|
||||||
|
size_t name_len;
|
||||||
|
{
|
||||||
|
int len = 0;
|
||||||
|
int only_digit = 1;
|
||||||
|
char *retval;
|
||||||
|
char *wp;
|
||||||
|
size_t cnt;
|
||||||
|
|
||||||
|
for (cnt = 0; cnt < name_len; ++cnt)
|
||||||
|
if (isalnum (codeset[cnt]))
|
||||||
|
{
|
||||||
|
++len;
|
||||||
|
|
||||||
|
if (isalpha (codeset[cnt]))
|
||||||
|
only_digit = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
retval = (char *) malloc ((only_digit ? 3 : 0) + len + 1);
|
||||||
|
|
||||||
|
if (retval != NULL)
|
||||||
|
{
|
||||||
|
if (only_digit)
|
||||||
|
wp = stpcpy (retval, "iso");
|
||||||
|
else
|
||||||
|
wp = retval;
|
||||||
|
|
||||||
|
for (cnt = 0; cnt < name_len; ++cnt)
|
||||||
|
if (isalpha (codeset[cnt]))
|
||||||
|
*wp++ = tolower (codeset[cnt]);
|
||||||
|
else if (isdigit (codeset[cnt]))
|
||||||
|
*wp++ = codeset[cnt];
|
||||||
|
|
||||||
|
*wp = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
return (const char *) retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* @@ begin of epilog @@ */
|
||||||
|
|
||||||
|
/* We don't want libintl.a to depend on any other library. So we
|
||||||
|
avoid the non-standard function stpcpy. In GNU C Library this
|
||||||
|
function is available, though. Also allow the symbol HAVE_STPCPY
|
||||||
|
to be defined. */
|
||||||
|
#if !_LIBC && !HAVE_STPCPY
|
||||||
|
static char *
|
||||||
|
stpcpy (dest, src)
|
||||||
|
char *dest;
|
||||||
|
const char *src;
|
||||||
|
{
|
||||||
|
while ((*dest++ = *src++) != '\0')
|
||||||
|
/* Do nothing. */ ;
|
||||||
|
return dest - 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
/* Convenience header for conditional use of GNU <libintl.h>.
|
||||||
|
Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
#ifndef _LIBGETTEXT_H
|
||||||
|
#define _LIBGETTEXT_H 1
|
||||||
|
|
||||||
|
/* NLS can be disabled through the configure --disable-nls option. */
|
||||||
|
#if ENABLE_NLS
|
||||||
|
|
||||||
|
/* Get declarations of GNU message catalog functions. */
|
||||||
|
# include <libintl.h>
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
# define gettext(Msgid) (Msgid)
|
||||||
|
# define dgettext(Domainname, Msgid) (Msgid)
|
||||||
|
# define dcgettext(Domainname, Msgid, Category) (Msgid)
|
||||||
|
# define ngettext(Msgid1, Msgid2, N) \
|
||||||
|
((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2))
|
||||||
|
# define dngettext(Domainname, Msgid1, Msgid2, N) \
|
||||||
|
((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2))
|
||||||
|
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
|
||||||
|
((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2))
|
||||||
|
# define textdomain(Domainname) ((char *) (Domainname))
|
||||||
|
# define bindtextdomain(Domainname, Dirname) ((char *) (Dirname))
|
||||||
|
# define bind_textdomain_codeset(Domainname, Codeset) ((char *) (Codeset))
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* For automatical extraction of messages sometimes no real
|
||||||
|
translation is needed. Instead the string itself is the result. */
|
||||||
|
#define gettext_noop(Str) (Str)
|
||||||
|
|
||||||
|
#endif /* _LIBGETTEXT_H */
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
/* Message catalogs for internationalization.
|
||||||
|
Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
#ifndef _LIBINTL_H
|
||||||
|
#define _LIBINTL_H 1
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
|
/* The LC_MESSAGES locale category is the category used by the functions
|
||||||
|
gettext() and dgettext(). It is specified in POSIX, but not in ANSI C.
|
||||||
|
On systems that don't define it, use an arbitrary value instead.
|
||||||
|
On Solaris, <locale.h> defines __LOCALE_H then includes <libintl.h> (i.e.
|
||||||
|
this file!) and then only defines LC_MESSAGES. To avoid a redefinition
|
||||||
|
warning, don't define LC_MESSAGES in this case. */
|
||||||
|
#if !defined LC_MESSAGES && !defined __LOCALE_H
|
||||||
|
# define LC_MESSAGES 1729
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* We define an additional symbol to signal that we use the GNU
|
||||||
|
implementation of gettext. */
|
||||||
|
#define __USE_GNU_GETTEXT 1
|
||||||
|
|
||||||
|
/* Resolve a platform specific conflict on DJGPP. GNU gettext takes
|
||||||
|
precedence over _conio_gettext. */
|
||||||
|
#ifdef __DJGPP__
|
||||||
|
# undef gettext
|
||||||
|
# define gettext gettext
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PARAMS
|
||||||
|
# if __STDC__ || defined __cplusplus
|
||||||
|
# define PARAMS(args) args
|
||||||
|
# else
|
||||||
|
# define PARAMS(args) ()
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Look up MSGID in the current default message catalog for the current
|
||||||
|
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
||||||
|
text). */
|
||||||
|
extern char *gettext PARAMS ((const char *__msgid));
|
||||||
|
|
||||||
|
/* Look up MSGID in the DOMAINNAME message catalog for the current
|
||||||
|
LC_MESSAGES locale. */
|
||||||
|
extern char *dgettext PARAMS ((const char *__domainname, const char *__msgid));
|
||||||
|
|
||||||
|
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
||||||
|
locale. */
|
||||||
|
extern char *dcgettext PARAMS ((const char *__domainname, const char *__msgid,
|
||||||
|
int __category));
|
||||||
|
|
||||||
|
|
||||||
|
/* Similar to `gettext' but select the plural form corresponding to the
|
||||||
|
number N. */
|
||||||
|
extern char *ngettext PARAMS ((const char *__msgid1, const char *__msgid2,
|
||||||
|
unsigned long int __n));
|
||||||
|
|
||||||
|
/* Similar to `dgettext' but select the plural form corresponding to the
|
||||||
|
number N. */
|
||||||
|
extern char *dngettext PARAMS ((const char *__domainname, const char *__msgid1,
|
||||||
|
const char *__msgid2, unsigned long int __n));
|
||||||
|
|
||||||
|
/* Similar to `dcgettext' but select the plural form corresponding to the
|
||||||
|
number N. */
|
||||||
|
extern char *dcngettext PARAMS ((const char *__domainname, const char *__msgid1,
|
||||||
|
const char *__msgid2, unsigned long int __n,
|
||||||
|
int __category));
|
||||||
|
|
||||||
|
|
||||||
|
/* Set the current default message catalog to DOMAINNAME.
|
||||||
|
If DOMAINNAME is null, return the current default.
|
||||||
|
If DOMAINNAME is "", reset to the default of "messages". */
|
||||||
|
extern char *textdomain PARAMS ((const char *__domainname));
|
||||||
|
|
||||||
|
/* Specify that the DOMAINNAME message catalog will be found
|
||||||
|
in DIRNAME rather than in the system locale data base. */
|
||||||
|
extern char *bindtextdomain PARAMS ((const char *__domainname,
|
||||||
|
const char *__dirname));
|
||||||
|
|
||||||
|
/* Specify the character encoding in which the messages from the
|
||||||
|
DOMAINNAME message catalog will be returned. */
|
||||||
|
extern char *bind_textdomain_codeset PARAMS ((const char *__domainname,
|
||||||
|
const char *__codeset));
|
||||||
|
|
||||||
|
|
||||||
|
/* Optimized version of the functions above. */
|
||||||
|
#if defined __OPTIMIZED
|
||||||
|
/* These are macros, but could also be inline functions. */
|
||||||
|
|
||||||
|
# define gettext(msgid) \
|
||||||
|
dgettext (NULL, msgid)
|
||||||
|
|
||||||
|
# define dgettext(domainname, msgid) \
|
||||||
|
dcgettext (domainname, msgid, LC_MESSAGES)
|
||||||
|
|
||||||
|
# define ngettext(msgid1, msgid2, n) \
|
||||||
|
dngettext (NULL, msgid1, msgid2, n)
|
||||||
|
|
||||||
|
# define dngettext(domainname, msgid1, msgid2, n) \
|
||||||
|
dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES)
|
||||||
|
|
||||||
|
#endif /* Optimizing. */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* libintl.h */
|
||||||
+109
@@ -0,0 +1,109 @@
|
|||||||
|
/* Copyright (C) 1996-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by Ulrich Drepper <[email protected]>, 1996.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
#ifndef _LOADINFO_H
|
||||||
|
#define _LOADINFO_H 1
|
||||||
|
|
||||||
|
#ifndef PARAMS
|
||||||
|
# if __STDC__
|
||||||
|
# define PARAMS(args) args
|
||||||
|
# else
|
||||||
|
# define PARAMS(args) ()
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef internal_function
|
||||||
|
# define internal_function
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Tell the compiler when a conditional or integer expression is
|
||||||
|
almost always true or almost always false. */
|
||||||
|
#ifndef HAVE_BUILTIN_EXPECT
|
||||||
|
# define __builtin_expect(expr, val) (expr)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Separator in PATH like lists of pathnames. */
|
||||||
|
#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
|
||||||
|
/* Win32, OS/2, DOS */
|
||||||
|
# define PATH_SEPARATOR ';'
|
||||||
|
#else
|
||||||
|
/* Unix */
|
||||||
|
# define PATH_SEPARATOR ':'
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Encoding of locale name parts. */
|
||||||
|
#define CEN_REVISION 1
|
||||||
|
#define CEN_SPONSOR 2
|
||||||
|
#define CEN_SPECIAL 4
|
||||||
|
#define XPG_NORM_CODESET 8
|
||||||
|
#define XPG_CODESET 16
|
||||||
|
#define TERRITORY 32
|
||||||
|
#define CEN_AUDIENCE 64
|
||||||
|
#define XPG_MODIFIER 128
|
||||||
|
|
||||||
|
#define CEN_SPECIFIC (CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE)
|
||||||
|
#define XPG_SPECIFIC (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER)
|
||||||
|
|
||||||
|
|
||||||
|
struct loaded_l10nfile
|
||||||
|
{
|
||||||
|
const char *filename;
|
||||||
|
int decided;
|
||||||
|
|
||||||
|
const void *data;
|
||||||
|
|
||||||
|
struct loaded_l10nfile *next;
|
||||||
|
struct loaded_l10nfile *successor[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Normalize codeset name. There is no standard for the codeset
|
||||||
|
names. Normalization allows the user to use any of the common
|
||||||
|
names. The return value is dynamically allocated and has to be
|
||||||
|
freed by the caller. */
|
||||||
|
extern const char *_nl_normalize_codeset PARAMS ((const char *codeset,
|
||||||
|
size_t name_len));
|
||||||
|
|
||||||
|
extern struct loaded_l10nfile *
|
||||||
|
_nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list,
|
||||||
|
const char *dirlist, size_t dirlist_len, int mask,
|
||||||
|
const char *language, const char *territory,
|
||||||
|
const char *codeset,
|
||||||
|
const char *normalized_codeset,
|
||||||
|
const char *modifier, const char *special,
|
||||||
|
const char *sponsor, const char *revision,
|
||||||
|
const char *filename, int do_allocate));
|
||||||
|
|
||||||
|
|
||||||
|
extern const char *_nl_expand_alias PARAMS ((const char *name));
|
||||||
|
|
||||||
|
/* normalized_codeset is dynamically allocated and has to be freed by
|
||||||
|
the caller. */
|
||||||
|
extern int _nl_explode_name PARAMS ((char *name, const char **language,
|
||||||
|
const char **modifier,
|
||||||
|
const char **territory,
|
||||||
|
const char **codeset,
|
||||||
|
const char **normalized_codeset,
|
||||||
|
const char **special,
|
||||||
|
const char **sponsor,
|
||||||
|
const char **revision));
|
||||||
|
|
||||||
|
extern char *_nl_find_language PARAMS ((const char *name));
|
||||||
|
|
||||||
|
#endif /* loadinfo.h */
|
||||||
@@ -0,0 +1,567 @@
|
|||||||
|
/* Load needed message catalogs.
|
||||||
|
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
/* Tell glibc's <string.h> to provide a prototype for mempcpy().
|
||||||
|
This must come before <config.h> because <config.h> may include
|
||||||
|
<features.h>, and once <features.h> has been included, it's too late. */
|
||||||
|
#ifndef _GNU_SOURCE
|
||||||
|
# define _GNU_SOURCE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
# define alloca __builtin_alloca
|
||||||
|
# define HAVE_ALLOCA 1
|
||||||
|
#else
|
||||||
|
# if defined HAVE_ALLOCA_H || defined _LIBC
|
||||||
|
# include <alloca.h>
|
||||||
|
# else
|
||||||
|
# ifdef _AIX
|
||||||
|
#pragma alloca
|
||||||
|
# else
|
||||||
|
# ifndef alloca
|
||||||
|
char *alloca ();
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#if defined HAVE_UNISTD_H || defined _LIBC
|
||||||
|
# include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
# include <langinfo.h>
|
||||||
|
# include <locale.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|
||||||
|
|| (defined _LIBC && defined _POSIX_MAPPED_FILES)
|
||||||
|
# include <sys/mman.h>
|
||||||
|
# undef HAVE_MMAP
|
||||||
|
# define HAVE_MMAP 1
|
||||||
|
#else
|
||||||
|
# undef HAVE_MMAP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "gettext.h"
|
||||||
|
#include "gettextP.h"
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
# include "../locale/localeinfo.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* @@ end of prolog @@ */
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
/* Rename the non ISO C functions. This is required by the standard
|
||||||
|
because some ISO C functions will require linking with this object
|
||||||
|
file and the name space must not be polluted. */
|
||||||
|
# define open __open
|
||||||
|
# define close __close
|
||||||
|
# define read __read
|
||||||
|
# define mmap __mmap
|
||||||
|
# define munmap __munmap
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Names for the libintl functions are a problem. They must not clash
|
||||||
|
with existing names and they should follow ANSI C. But this source
|
||||||
|
code is also used in GNU C Library where the names have a __
|
||||||
|
prefix. So we have to make a difference here. */
|
||||||
|
#ifdef _LIBC
|
||||||
|
# define PLURAL_PARSE __gettextparse
|
||||||
|
#else
|
||||||
|
# define PLURAL_PARSE gettextparse__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* For those losing systems which don't have `alloca' we have to add
|
||||||
|
some additional code emulating it. */
|
||||||
|
#ifdef HAVE_ALLOCA
|
||||||
|
# define freea(p) /* nothing */
|
||||||
|
#else
|
||||||
|
# define alloca(n) malloc (n)
|
||||||
|
# define freea(p) free (p)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* For systems that distinguish between text and binary I/O.
|
||||||
|
O_BINARY is usually declared in <fcntl.h>. */
|
||||||
|
#if !defined O_BINARY && defined _O_BINARY
|
||||||
|
/* For MSC-compatible compilers. */
|
||||||
|
# define O_BINARY _O_BINARY
|
||||||
|
# define O_TEXT _O_TEXT
|
||||||
|
#endif
|
||||||
|
#ifdef __BEOS__
|
||||||
|
/* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */
|
||||||
|
# undef O_BINARY
|
||||||
|
# undef O_TEXT
|
||||||
|
#endif
|
||||||
|
/* On reasonable systems, binary I/O is the default. */
|
||||||
|
#ifndef O_BINARY
|
||||||
|
# define O_BINARY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* We need a sign, whether a new catalog was loaded, which can be associated
|
||||||
|
with all translations. This is important if the translations are
|
||||||
|
cached by one of GCC's features. */
|
||||||
|
int _nl_msg_cat_cntr;
|
||||||
|
|
||||||
|
#if (defined __GNUC__ && !defined __APPLE_CC__) \
|
||||||
|
|| (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
|
||||||
|
|
||||||
|
/* These structs are the constant expression for the germanic plural
|
||||||
|
form determination. It represents the expression "n != 1". */
|
||||||
|
static const struct expression plvar =
|
||||||
|
{
|
||||||
|
.nargs = 0,
|
||||||
|
.operation = var,
|
||||||
|
};
|
||||||
|
static const struct expression plone =
|
||||||
|
{
|
||||||
|
.nargs = 0,
|
||||||
|
.operation = num,
|
||||||
|
.val =
|
||||||
|
{
|
||||||
|
.num = 1
|
||||||
|
}
|
||||||
|
};
|
||||||
|
static struct expression germanic_plural =
|
||||||
|
{
|
||||||
|
.nargs = 2,
|
||||||
|
.operation = not_equal,
|
||||||
|
.val =
|
||||||
|
{
|
||||||
|
.args =
|
||||||
|
{
|
||||||
|
[0] = (struct expression *) &plvar,
|
||||||
|
[1] = (struct expression *) &plone
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
# define INIT_GERMANIC_PLURAL()
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* For compilers without support for ISO C 99 struct/union initializers:
|
||||||
|
Initialization at run-time. */
|
||||||
|
|
||||||
|
static struct expression plvar;
|
||||||
|
static struct expression plone;
|
||||||
|
static struct expression germanic_plural;
|
||||||
|
|
||||||
|
static void
|
||||||
|
init_germanic_plural ()
|
||||||
|
{
|
||||||
|
if (plone.val.num == 0)
|
||||||
|
{
|
||||||
|
plvar.nargs = 0;
|
||||||
|
plvar.operation = var;
|
||||||
|
|
||||||
|
plone.nargs = 0;
|
||||||
|
plone.operation = num;
|
||||||
|
plone.val.num = 1;
|
||||||
|
|
||||||
|
germanic_plural.nargs = 2;
|
||||||
|
germanic_plural.operation = not_equal;
|
||||||
|
germanic_plural.val.args[0] = &plvar;
|
||||||
|
germanic_plural.val.args[1] = &plone;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# define INIT_GERMANIC_PLURAL() init_germanic_plural ()
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Initialize the codeset dependent parts of an opened message catalog.
|
||||||
|
Return the header entry. */
|
||||||
|
const char *
|
||||||
|
internal_function
|
||||||
|
_nl_init_domain_conv (domain_file, domain, domainbinding)
|
||||||
|
struct loaded_l10nfile *domain_file;
|
||||||
|
struct loaded_domain *domain;
|
||||||
|
struct binding *domainbinding;
|
||||||
|
{
|
||||||
|
/* Find out about the character set the file is encoded with.
|
||||||
|
This can be found (in textual form) in the entry "". If this
|
||||||
|
entry does not exist or if this does not contain the `charset='
|
||||||
|
information, we will assume the charset matches the one the
|
||||||
|
current locale and we don't have to perform any conversion. */
|
||||||
|
char *nullentry;
|
||||||
|
size_t nullentrylen;
|
||||||
|
|
||||||
|
/* Preinitialize fields, to avoid recursion during _nl_find_msg. */
|
||||||
|
domain->codeset_cntr =
|
||||||
|
(domainbinding != NULL ? domainbinding->codeset_cntr : 0);
|
||||||
|
#ifdef _LIBC
|
||||||
|
domain->conv = (__gconv_t) -1;
|
||||||
|
#else
|
||||||
|
# if HAVE_ICONV
|
||||||
|
domain->conv = (iconv_t) -1;
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
domain->conv_tab = NULL;
|
||||||
|
|
||||||
|
/* Get the header entry. */
|
||||||
|
nullentry = _nl_find_msg (domain_file, domainbinding, "", &nullentrylen);
|
||||||
|
|
||||||
|
if (nullentry != NULL)
|
||||||
|
{
|
||||||
|
#if defined _LIBC || HAVE_ICONV
|
||||||
|
const char *charsetstr;
|
||||||
|
|
||||||
|
charsetstr = strstr (nullentry, "charset=");
|
||||||
|
if (charsetstr != NULL)
|
||||||
|
{
|
||||||
|
size_t len;
|
||||||
|
char *charset;
|
||||||
|
const char *outcharset;
|
||||||
|
|
||||||
|
charsetstr += strlen ("charset=");
|
||||||
|
len = strcspn (charsetstr, " \t\n");
|
||||||
|
|
||||||
|
charset = (char *) alloca (len + 1);
|
||||||
|
# if defined _LIBC || HAVE_MEMPCPY
|
||||||
|
*((char *) mempcpy (charset, charsetstr, len)) = '\0';
|
||||||
|
# else
|
||||||
|
memcpy (charset, charsetstr, len);
|
||||||
|
charset[len] = '\0';
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* The output charset should normally be determined by the
|
||||||
|
locale. But sometimes the locale is not used or not correctly
|
||||||
|
set up, so we provide a possibility for the user to override
|
||||||
|
this. Moreover, the value specified through
|
||||||
|
bind_textdomain_codeset overrides both. */
|
||||||
|
if (domainbinding != NULL && domainbinding->codeset != NULL)
|
||||||
|
outcharset = domainbinding->codeset;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
outcharset = getenv ("OUTPUT_CHARSET");
|
||||||
|
if (outcharset == NULL || outcharset[0] == '\0')
|
||||||
|
{
|
||||||
|
# ifdef _LIBC
|
||||||
|
outcharset = (*_nl_current[LC_CTYPE])->values[_NL_ITEM_INDEX (CODESET)].string;
|
||||||
|
# else
|
||||||
|
# if HAVE_ICONV
|
||||||
|
extern const char *locale_charset (void);
|
||||||
|
outcharset = locale_charset ();
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# ifdef _LIBC
|
||||||
|
/* We always want to use transliteration. */
|
||||||
|
outcharset = norm_add_slashes (outcharset, "TRANSLIT");
|
||||||
|
charset = norm_add_slashes (charset, NULL);
|
||||||
|
if (__gconv_open (outcharset, charset, &domain->conv,
|
||||||
|
GCONV_AVOID_NOCONV)
|
||||||
|
!= __GCONV_OK)
|
||||||
|
domain->conv = (__gconv_t) -1;
|
||||||
|
# else
|
||||||
|
# if HAVE_ICONV
|
||||||
|
/* When using GNU libiconv, we want to use transliteration. */
|
||||||
|
# if _LIBICONV_VERSION >= 0x0105
|
||||||
|
len = strlen (outcharset);
|
||||||
|
{
|
||||||
|
char *tmp = (char *) alloca (len + 10 + 1);
|
||||||
|
memcpy (tmp, outcharset, len);
|
||||||
|
memcpy (tmp + len, "//TRANSLIT", 10 + 1);
|
||||||
|
outcharset = tmp;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
domain->conv = iconv_open (outcharset, charset);
|
||||||
|
# if _LIBICONV_VERSION >= 0x0105
|
||||||
|
freea (outcharset);
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
freea (charset);
|
||||||
|
}
|
||||||
|
#endif /* _LIBC || HAVE_ICONV */
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullentry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Frees the codeset dependent parts of an opened message catalog. */
|
||||||
|
void
|
||||||
|
internal_function
|
||||||
|
_nl_free_domain_conv (domain)
|
||||||
|
struct loaded_domain *domain;
|
||||||
|
{
|
||||||
|
if (domain->conv_tab != NULL && domain->conv_tab != (char **) -1)
|
||||||
|
free (domain->conv_tab);
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
if (domain->conv != (__gconv_t) -1)
|
||||||
|
__gconv_close (domain->conv);
|
||||||
|
#else
|
||||||
|
# if HAVE_ICONV
|
||||||
|
if (domain->conv != (iconv_t) -1)
|
||||||
|
iconv_close (domain->conv);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Load the message catalogs specified by FILENAME. If it is no valid
|
||||||
|
message catalog do nothing. */
|
||||||
|
void
|
||||||
|
internal_function
|
||||||
|
_nl_load_domain (domain_file, domainbinding)
|
||||||
|
struct loaded_l10nfile *domain_file;
|
||||||
|
struct binding *domainbinding;
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
size_t size;
|
||||||
|
#ifdef _LIBC
|
||||||
|
struct stat64 st;
|
||||||
|
#else
|
||||||
|
struct stat st;
|
||||||
|
#endif
|
||||||
|
struct mo_file_header *data = (struct mo_file_header *) -1;
|
||||||
|
int use_mmap = 0;
|
||||||
|
struct loaded_domain *domain;
|
||||||
|
const char *nullentry;
|
||||||
|
|
||||||
|
domain_file->decided = 1;
|
||||||
|
domain_file->data = NULL;
|
||||||
|
|
||||||
|
/* Note that it would be useless to store domainbinding in domain_file
|
||||||
|
because domainbinding might be == NULL now but != NULL later (after
|
||||||
|
a call to bind_textdomain_codeset). */
|
||||||
|
|
||||||
|
/* If the record does not represent a valid locale the FILENAME
|
||||||
|
might be NULL. This can happen when according to the given
|
||||||
|
specification the locale file name is different for XPG and CEN
|
||||||
|
syntax. */
|
||||||
|
if (domain_file->filename == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Try to open the addressed file. */
|
||||||
|
fd = open (domain_file->filename, O_RDONLY | O_BINARY);
|
||||||
|
if (fd == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* We must know about the size of the file. */
|
||||||
|
if (
|
||||||
|
#ifdef _LIBC
|
||||||
|
__builtin_expect (fstat64 (fd, &st) != 0, 0)
|
||||||
|
#else
|
||||||
|
__builtin_expect (fstat (fd, &st) != 0, 0)
|
||||||
|
#endif
|
||||||
|
|| __builtin_expect ((size = (size_t) st.st_size) != st.st_size, 0)
|
||||||
|
|| __builtin_expect (size < sizeof (struct mo_file_header), 0))
|
||||||
|
{
|
||||||
|
/* Something went wrong. */
|
||||||
|
close (fd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_MMAP
|
||||||
|
/* Now we are ready to load the file. If mmap() is available we try
|
||||||
|
this first. If not available or it failed we try to load it. */
|
||||||
|
data = (struct mo_file_header *) mmap (NULL, size, PROT_READ,
|
||||||
|
MAP_PRIVATE, fd, 0);
|
||||||
|
|
||||||
|
if (__builtin_expect (data != (struct mo_file_header *) -1, 1))
|
||||||
|
{
|
||||||
|
/* mmap() call was successful. */
|
||||||
|
close (fd);
|
||||||
|
use_mmap = 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* If the data is not yet available (i.e. mmap'ed) we try to load
|
||||||
|
it manually. */
|
||||||
|
if (data == (struct mo_file_header *) -1)
|
||||||
|
{
|
||||||
|
size_t to_read;
|
||||||
|
char *read_ptr;
|
||||||
|
|
||||||
|
data = (struct mo_file_header *) malloc (size);
|
||||||
|
if (data == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
to_read = size;
|
||||||
|
read_ptr = (char *) data;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
long int nb = (long int) read (fd, read_ptr, to_read);
|
||||||
|
if (nb <= 0)
|
||||||
|
{
|
||||||
|
#ifdef EINTR
|
||||||
|
if (nb == -1 && errno == EINTR)
|
||||||
|
continue;
|
||||||
|
#endif
|
||||||
|
close (fd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
read_ptr += nb;
|
||||||
|
to_read -= nb;
|
||||||
|
}
|
||||||
|
while (to_read > 0);
|
||||||
|
|
||||||
|
close (fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Using the magic number we can test whether it really is a message
|
||||||
|
catalog file. */
|
||||||
|
if (__builtin_expect (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED,
|
||||||
|
0))
|
||||||
|
{
|
||||||
|
/* The magic number is wrong: not a message catalog file. */
|
||||||
|
#ifdef HAVE_MMAP
|
||||||
|
if (use_mmap)
|
||||||
|
munmap ((caddr_t) data, size);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
free (data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
domain = (struct loaded_domain *) malloc (sizeof (struct loaded_domain));
|
||||||
|
if (domain == NULL)
|
||||||
|
return;
|
||||||
|
domain_file->data = domain;
|
||||||
|
|
||||||
|
domain->data = (char *) data;
|
||||||
|
domain->use_mmap = use_mmap;
|
||||||
|
domain->mmap_size = size;
|
||||||
|
domain->must_swap = data->magic != _MAGIC;
|
||||||
|
|
||||||
|
/* Fill in the information about the available tables. */
|
||||||
|
switch (W (domain->must_swap, data->revision))
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
domain->nstrings = W (domain->must_swap, data->nstrings);
|
||||||
|
domain->orig_tab = (struct string_desc *)
|
||||||
|
((char *) data + W (domain->must_swap, data->orig_tab_offset));
|
||||||
|
domain->trans_tab = (struct string_desc *)
|
||||||
|
((char *) data + W (domain->must_swap, data->trans_tab_offset));
|
||||||
|
domain->hash_size = W (domain->must_swap, data->hash_tab_size);
|
||||||
|
domain->hash_tab = (nls_uint32 *)
|
||||||
|
((char *) data + W (domain->must_swap, data->hash_tab_offset));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* This is an invalid revision. */
|
||||||
|
#ifdef HAVE_MMAP
|
||||||
|
if (use_mmap)
|
||||||
|
munmap ((caddr_t) data, size);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
free (data);
|
||||||
|
free (domain);
|
||||||
|
domain_file->data = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now initialize the character set converter from the character set
|
||||||
|
the file is encoded with (found in the header entry) to the domain's
|
||||||
|
specified character set or the locale's character set. */
|
||||||
|
nullentry = _nl_init_domain_conv (domain_file, domain, domainbinding);
|
||||||
|
|
||||||
|
/* Also look for a plural specification. */
|
||||||
|
if (nullentry != NULL)
|
||||||
|
{
|
||||||
|
const char *plural;
|
||||||
|
const char *nplurals;
|
||||||
|
|
||||||
|
plural = strstr (nullentry, "plural=");
|
||||||
|
nplurals = strstr (nullentry, "nplurals=");
|
||||||
|
if (plural == NULL || nplurals == NULL)
|
||||||
|
goto no_plural;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* First get the number. */
|
||||||
|
char *endp;
|
||||||
|
unsigned long int n;
|
||||||
|
struct parse_args args;
|
||||||
|
|
||||||
|
nplurals += 9;
|
||||||
|
while (*nplurals != '\0' && isspace (*nplurals))
|
||||||
|
++nplurals;
|
||||||
|
#if defined HAVE_STRTOUL || defined _LIBC
|
||||||
|
n = strtoul (nplurals, &endp, 10);
|
||||||
|
#else
|
||||||
|
for (endp = nplurals, n = 0; *endp >= '0' && *endp <= '9'; endp++)
|
||||||
|
n = n * 10 + (*endp - '0');
|
||||||
|
#endif
|
||||||
|
domain->nplurals = n;
|
||||||
|
if (nplurals == endp)
|
||||||
|
goto no_plural;
|
||||||
|
|
||||||
|
/* Due to the restrictions bison imposes onto the interface of the
|
||||||
|
scanner function we have to put the input string and the result
|
||||||
|
passed up from the parser into the same structure which address
|
||||||
|
is passed down to the parser. */
|
||||||
|
plural += 7;
|
||||||
|
args.cp = plural;
|
||||||
|
if (PLURAL_PARSE (&args) != 0)
|
||||||
|
goto no_plural;
|
||||||
|
domain->plural = args.res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* By default we are using the Germanic form: singular form only
|
||||||
|
for `one', the plural form otherwise. Yes, this is also what
|
||||||
|
English is using since English is a Germanic language. */
|
||||||
|
no_plural:
|
||||||
|
INIT_GERMANIC_PLURAL ();
|
||||||
|
domain->plural = &germanic_plural;
|
||||||
|
domain->nplurals = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
void
|
||||||
|
internal_function
|
||||||
|
_nl_unload_domain (domain)
|
||||||
|
struct loaded_domain *domain;
|
||||||
|
{
|
||||||
|
if (domain->plural != &germanic_plural)
|
||||||
|
__gettext_free_exp (domain->plural);
|
||||||
|
|
||||||
|
_nl_free_domain_conv (domain);
|
||||||
|
|
||||||
|
# ifdef _POSIX_MAPPED_FILES
|
||||||
|
if (domain->use_mmap)
|
||||||
|
munmap ((caddr_t) domain->data, domain->mmap_size);
|
||||||
|
else
|
||||||
|
# endif /* _POSIX_MAPPED_FILES */
|
||||||
|
free ((void *) domain->data);
|
||||||
|
|
||||||
|
free (domain);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,271 @@
|
|||||||
|
/* Determine a canonical name for the current locale's character encoding.
|
||||||
|
|
||||||
|
Copyright (C) 2000-2001 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
/* Written by Bruno Haible <[email protected]>. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_STDDEF_H
|
||||||
|
# include <stddef.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#if HAVE_STRING_H
|
||||||
|
# include <string.h>
|
||||||
|
#else
|
||||||
|
# include <strings.h>
|
||||||
|
#endif
|
||||||
|
#if HAVE_STDLIB_H
|
||||||
|
# include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined _WIN32 || defined __WIN32__
|
||||||
|
# undef WIN32 /* avoid warning on mingw32 */
|
||||||
|
# define WIN32
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
|
# if HAVE_LANGINFO_CODESET
|
||||||
|
# include <langinfo.h>
|
||||||
|
# else
|
||||||
|
# if HAVE_SETLOCALE
|
||||||
|
# include <locale.h>
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#else /* WIN32 */
|
||||||
|
# define WIN32_LEAN_AND_MEAN
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef DIRECTORY_SEPARATOR
|
||||||
|
# define DIRECTORY_SEPARATOR '/'
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ISSLASH
|
||||||
|
# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The following static variable is declared 'volatile' to avoid a
|
||||||
|
possible multithread problem in the function get_charset_aliases. If we
|
||||||
|
are running in a threaded environment, and if two threads initialize
|
||||||
|
'charset_aliases' simultaneously, both will produce the same value,
|
||||||
|
and everything will be ok if the two assignments to 'charset_aliases'
|
||||||
|
are atomic. But I don't know what will happen if the two assignments mix. */
|
||||||
|
#if __STDC__ != 1
|
||||||
|
# define volatile /* empty */
|
||||||
|
#endif
|
||||||
|
/* Pointer to the contents of the charset.alias file, if it has already been
|
||||||
|
read, else NULL. Its format is:
|
||||||
|
ALIAS_1 '\0' CANONICAL_1 '\0' ... ALIAS_n '\0' CANONICAL_n '\0' '\0' */
|
||||||
|
static const char * volatile charset_aliases;
|
||||||
|
|
||||||
|
/* Return a pointer to the contents of the charset.alias file. */
|
||||||
|
static const char *
|
||||||
|
get_charset_aliases ()
|
||||||
|
{
|
||||||
|
const char *cp;
|
||||||
|
|
||||||
|
cp = charset_aliases;
|
||||||
|
if (cp == NULL)
|
||||||
|
{
|
||||||
|
#ifndef WIN32
|
||||||
|
FILE *fp;
|
||||||
|
const char *dir = LIBDIR;
|
||||||
|
const char *base = "charset.alias";
|
||||||
|
char *file_name;
|
||||||
|
|
||||||
|
/* Concatenate dir and base into freshly allocated file_name. */
|
||||||
|
{
|
||||||
|
size_t dir_len = strlen (dir);
|
||||||
|
size_t base_len = strlen (base);
|
||||||
|
int add_slash = (dir_len > 0 && !ISSLASH (dir[dir_len - 1]));
|
||||||
|
file_name = (char *) malloc (dir_len + add_slash + base_len + 1);
|
||||||
|
if (file_name != NULL)
|
||||||
|
{
|
||||||
|
memcpy (file_name, dir, dir_len);
|
||||||
|
if (add_slash)
|
||||||
|
file_name[dir_len] = DIRECTORY_SEPARATOR;
|
||||||
|
memcpy (file_name + dir_len + add_slash, base, base_len + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_name == NULL || (fp = fopen (file_name, "r")) == NULL)
|
||||||
|
/* Out of memory or file not found, treat it as empty. */
|
||||||
|
cp = "";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Parse the file's contents. */
|
||||||
|
int c;
|
||||||
|
char buf1[50+1];
|
||||||
|
char buf2[50+1];
|
||||||
|
char *res_ptr = NULL;
|
||||||
|
size_t res_size = 0;
|
||||||
|
size_t l1, l2;
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
c = getc (fp);
|
||||||
|
if (c == EOF)
|
||||||
|
break;
|
||||||
|
if (c == '\n' || c == ' ' || c == '\t')
|
||||||
|
continue;
|
||||||
|
if (c == '#')
|
||||||
|
{
|
||||||
|
/* Skip comment, to end of line. */
|
||||||
|
do
|
||||||
|
c = getc (fp);
|
||||||
|
while (!(c == EOF || c == '\n'));
|
||||||
|
if (c == EOF)
|
||||||
|
break;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ungetc (c, fp);
|
||||||
|
if (fscanf(fp, "%50s %50s", buf1, buf2) < 2)
|
||||||
|
break;
|
||||||
|
l1 = strlen (buf1);
|
||||||
|
l2 = strlen (buf2);
|
||||||
|
if (res_size == 0)
|
||||||
|
{
|
||||||
|
res_size = l1 + 1 + l2 + 1;
|
||||||
|
res_ptr = malloc (res_size + 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
res_size += l1 + 1 + l2 + 1;
|
||||||
|
res_ptr = realloc (res_ptr, res_size + 1);
|
||||||
|
}
|
||||||
|
if (res_ptr == NULL)
|
||||||
|
{
|
||||||
|
/* Out of memory. */
|
||||||
|
res_size = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1);
|
||||||
|
strcpy (res_ptr + res_size - (l2 + 1), buf2);
|
||||||
|
}
|
||||||
|
fclose (fp);
|
||||||
|
if (res_size == 0)
|
||||||
|
cp = "";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*(res_ptr + res_size) = '\0';
|
||||||
|
cp = res_ptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_name != NULL)
|
||||||
|
free (file_name);
|
||||||
|
|
||||||
|
#else /* WIN32 */
|
||||||
|
|
||||||
|
/* To avoid the troubles of installing a separate file in the same
|
||||||
|
directory as the DLL and of retrieving the DLL's directory at
|
||||||
|
runtime, simply inline the aliases here. */
|
||||||
|
|
||||||
|
cp = "CP936" "\0" "GBK" "\0"
|
||||||
|
"CP1361" "\0" "JOHAB" "\0";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
charset_aliases = cp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return cp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Determine the current locale's character encoding, and canonicalize it
|
||||||
|
into one of the canonical names listed in config.charset.
|
||||||
|
The result must not be freed; it is statically allocated.
|
||||||
|
If the canonical name cannot be determined, the result is a non-canonical
|
||||||
|
name. */
|
||||||
|
|
||||||
|
#ifdef STATIC
|
||||||
|
STATIC
|
||||||
|
#endif
|
||||||
|
const char *
|
||||||
|
locale_charset ()
|
||||||
|
{
|
||||||
|
const char *codeset;
|
||||||
|
const char *aliases;
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
|
|
||||||
|
# if HAVE_LANGINFO_CODESET
|
||||||
|
|
||||||
|
/* Most systems support nl_langinfo (CODESET) nowadays. */
|
||||||
|
codeset = nl_langinfo (CODESET);
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
|
/* On old systems which lack it, use setlocale or getenv. */
|
||||||
|
const char *locale = NULL;
|
||||||
|
|
||||||
|
/* But most old systems don't have a complete set of locales. Some
|
||||||
|
(like SunOS 4 or DJGPP) have only the C locale. Therefore we don't
|
||||||
|
use setlocale here; it would return "C" when it doesn't support the
|
||||||
|
locale name the user has set. */
|
||||||
|
# if HAVE_SETLOCALE && 0
|
||||||
|
locale = setlocale (LC_CTYPE, NULL);
|
||||||
|
# endif
|
||||||
|
if (locale == NULL || locale[0] == '\0')
|
||||||
|
{
|
||||||
|
locale = getenv ("LC_ALL");
|
||||||
|
if (locale == NULL || locale[0] == '\0')
|
||||||
|
{
|
||||||
|
locale = getenv ("LC_CTYPE");
|
||||||
|
if (locale == NULL || locale[0] == '\0')
|
||||||
|
locale = getenv ("LANG");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* On some old systems, one used to set locale = "iso8859_1". On others,
|
||||||
|
you set it to "language_COUNTRY.charset". In any case, we resolve it
|
||||||
|
through the charset.alias file. */
|
||||||
|
codeset = locale;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#else /* WIN32 */
|
||||||
|
|
||||||
|
static char buf[2 + 10 + 1];
|
||||||
|
|
||||||
|
/* Win32 has a function returning the locale's codepage as a number. */
|
||||||
|
sprintf (buf, "CP%u", GetACP ());
|
||||||
|
codeset = buf;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (codeset == NULL)
|
||||||
|
/* The canonical name cannot be determined. */
|
||||||
|
codeset = "";
|
||||||
|
|
||||||
|
/* Resolve alias. */
|
||||||
|
for (aliases = get_charset_aliases ();
|
||||||
|
*aliases != '\0';
|
||||||
|
aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
|
||||||
|
if (strcmp (codeset, aliases) == 0
|
||||||
|
|| (aliases[0] == '*' && aliases[1] == '\0'))
|
||||||
|
{
|
||||||
|
codeset = aliases + strlen (aliases) + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return codeset;
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
# Locale name alias data base.
|
||||||
|
# Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU Library General Public License as published
|
||||||
|
# by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# Library General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Library General Public
|
||||||
|
# License along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
# USA.
|
||||||
|
|
||||||
|
# The format of this file is the same as for the corresponding file of
|
||||||
|
# the X Window System, which normally can be found in
|
||||||
|
# /usr/lib/X11/locale/locale.alias
|
||||||
|
# A single line contains two fields: an alias and a substitution value.
|
||||||
|
# All entries are case independent.
|
||||||
|
|
||||||
|
# Note: This file is far from being complete. If you have a value for
|
||||||
|
# your own site which you think might be useful for others too, share
|
||||||
|
# it with the rest of us. Send it using the `glibcbug' script to
|
||||||
|
# [email protected].
|
||||||
|
|
||||||
|
# Packages using this file:
|
||||||
|
|
||||||
|
bokmal no_NO.ISO-8859-1
|
||||||
|
bokmål no_NO.ISO-8859-1
|
||||||
|
catalan ca_ES.ISO-8859-1
|
||||||
|
croatian hr_HR.ISO-8859-2
|
||||||
|
czech cs_CZ.ISO-8859-2
|
||||||
|
danish da_DK.ISO-8859-1
|
||||||
|
dansk da_DK.ISO-8859-1
|
||||||
|
deutsch de_DE.ISO-8859-1
|
||||||
|
dutch nl_NL.ISO-8859-1
|
||||||
|
eesti et_EE.ISO-8859-1
|
||||||
|
estonian et_EE.ISO-8859-1
|
||||||
|
finnish fi_FI.ISO-8859-1
|
||||||
|
français fr_FR.ISO-8859-1
|
||||||
|
french fr_FR.ISO-8859-1
|
||||||
|
galego gl_ES.ISO-8859-1
|
||||||
|
galician gl_ES.ISO-8859-1
|
||||||
|
german de_DE.ISO-8859-1
|
||||||
|
greek el_GR.ISO-8859-7
|
||||||
|
hebrew he_IL.ISO-8859-8
|
||||||
|
hrvatski hr_HR.ISO-8859-2
|
||||||
|
hungarian hu_HU.ISO-8859-2
|
||||||
|
icelandic is_IS.ISO-8859-1
|
||||||
|
italian it_IT.ISO-8859-1
|
||||||
|
japanese ja_JP.eucJP
|
||||||
|
japanese.euc ja_JP.eucJP
|
||||||
|
ja_JP ja_JP.eucJP
|
||||||
|
ja_JP.ujis ja_JP.eucJP
|
||||||
|
japanese.sjis ja_JP.SJIS
|
||||||
|
korean ko_KR.eucKR
|
||||||
|
korean.euc ko_KR.eucKR
|
||||||
|
ko_KR ko_KR.eucKR
|
||||||
|
lithuanian lt_LT.ISO-8859-13
|
||||||
|
nb_NO no_NO.ISO-8859-1
|
||||||
|
nb_NO.ISO-8859-1 no_NO.ISO-8859-1
|
||||||
|
norwegian no_NO.ISO-8859-1
|
||||||
|
nynorsk nn_NO.ISO-8859-1
|
||||||
|
polish pl_PL.ISO-8859-2
|
||||||
|
portuguese pt_PT.ISO-8859-1
|
||||||
|
romanian ro_RO.ISO-8859-2
|
||||||
|
russian ru_RU.ISO-8859-5
|
||||||
|
slovak sk_SK.ISO-8859-2
|
||||||
|
slovene sl_SI.ISO-8859-2
|
||||||
|
slovenian sl_SI.ISO-8859-2
|
||||||
|
spanish es_ES.ISO-8859-1
|
||||||
|
swedish sv_SE.ISO-8859-1
|
||||||
|
thai th_TH.TIS-620
|
||||||
|
turkish tr_TR.ISO-8859-9
|
||||||
@@ -0,0 +1,404 @@
|
|||||||
|
/* Handle aliases for locale names.
|
||||||
|
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
/* Tell glibc's <string.h> to provide a prototype for mempcpy().
|
||||||
|
This must come before <config.h> because <config.h> may include
|
||||||
|
<features.h>, and once <features.h> has been included, it's too late. */
|
||||||
|
#ifndef _GNU_SOURCE
|
||||||
|
# define _GNU_SOURCE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
# define alloca __builtin_alloca
|
||||||
|
# define HAVE_ALLOCA 1
|
||||||
|
#else
|
||||||
|
# if defined HAVE_ALLOCA_H || defined _LIBC
|
||||||
|
# include <alloca.h>
|
||||||
|
# else
|
||||||
|
# ifdef _AIX
|
||||||
|
#pragma alloca
|
||||||
|
# else
|
||||||
|
# ifndef alloca
|
||||||
|
char *alloca ();
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#if !HAVE_STRCHR && !defined _LIBC
|
||||||
|
# ifndef strchr
|
||||||
|
# define strchr index
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "gettextP.h"
|
||||||
|
|
||||||
|
/* @@ end of prolog @@ */
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
/* Rename the non ANSI C functions. This is required by the standard
|
||||||
|
because some ANSI C functions will require linking with this object
|
||||||
|
file and the name space must not be polluted. */
|
||||||
|
# define strcasecmp __strcasecmp
|
||||||
|
|
||||||
|
# ifndef mempcpy
|
||||||
|
# define mempcpy __mempcpy
|
||||||
|
# endif
|
||||||
|
# define HAVE_MEMPCPY 1
|
||||||
|
|
||||||
|
/* We need locking here since we can be called from different places. */
|
||||||
|
# include <bits/libc-lock.h>
|
||||||
|
|
||||||
|
__libc_lock_define_initialized (static, lock);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef internal_function
|
||||||
|
# define internal_function
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* For those losing systems which don't have `alloca' we have to add
|
||||||
|
some additional code emulating it. */
|
||||||
|
#ifdef HAVE_ALLOCA
|
||||||
|
# define freea(p) /* nothing */
|
||||||
|
#else
|
||||||
|
# define alloca(n) malloc (n)
|
||||||
|
# define freea(p) free (p)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined _LIBC_REENTRANT || defined HAVE_FGETS_UNLOCKED
|
||||||
|
# undef fgets
|
||||||
|
# define fgets(buf, len, s) fgets_unlocked (buf, len, s)
|
||||||
|
#endif
|
||||||
|
#if defined _LIBC_REENTRANT || defined HAVE_FEOF_UNLOCKED
|
||||||
|
# undef feof
|
||||||
|
# define feof(s) feof_unlocked (s)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
struct alias_map
|
||||||
|
{
|
||||||
|
const char *alias;
|
||||||
|
const char *value;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static char *string_space;
|
||||||
|
static size_t string_space_act;
|
||||||
|
static size_t string_space_max;
|
||||||
|
static struct alias_map *map;
|
||||||
|
static size_t nmap;
|
||||||
|
static size_t maxmap;
|
||||||
|
|
||||||
|
|
||||||
|
/* Prototypes for local functions. */
|
||||||
|
static size_t read_alias_file PARAMS ((const char *fname, int fname_len))
|
||||||
|
internal_function;
|
||||||
|
static int extend_alias_table PARAMS ((void));
|
||||||
|
static int alias_compare PARAMS ((const struct alias_map *map1,
|
||||||
|
const struct alias_map *map2));
|
||||||
|
|
||||||
|
|
||||||
|
const char *
|
||||||
|
_nl_expand_alias (name)
|
||||||
|
const char *name;
|
||||||
|
{
|
||||||
|
static const char *locale_alias_path = LOCALE_ALIAS_PATH;
|
||||||
|
struct alias_map *retval;
|
||||||
|
const char *result = NULL;
|
||||||
|
size_t added;
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
__libc_lock_lock (lock);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
struct alias_map item;
|
||||||
|
|
||||||
|
item.alias = name;
|
||||||
|
|
||||||
|
if (nmap > 0)
|
||||||
|
retval = (struct alias_map *) bsearch (&item, map, nmap,
|
||||||
|
sizeof (struct alias_map),
|
||||||
|
(int (*) PARAMS ((const void *,
|
||||||
|
const void *))
|
||||||
|
) alias_compare);
|
||||||
|
else
|
||||||
|
retval = NULL;
|
||||||
|
|
||||||
|
/* We really found an alias. Return the value. */
|
||||||
|
if (retval != NULL)
|
||||||
|
{
|
||||||
|
result = retval->value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Perhaps we can find another alias file. */
|
||||||
|
added = 0;
|
||||||
|
while (added == 0 && locale_alias_path[0] != '\0')
|
||||||
|
{
|
||||||
|
const char *start;
|
||||||
|
|
||||||
|
while (locale_alias_path[0] == PATH_SEPARATOR)
|
||||||
|
++locale_alias_path;
|
||||||
|
start = locale_alias_path;
|
||||||
|
|
||||||
|
while (locale_alias_path[0] != '\0'
|
||||||
|
&& locale_alias_path[0] != PATH_SEPARATOR)
|
||||||
|
++locale_alias_path;
|
||||||
|
|
||||||
|
if (start < locale_alias_path)
|
||||||
|
added = read_alias_file (start, locale_alias_path - start);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (added != 0);
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
__libc_lock_unlock (lock);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static size_t
|
||||||
|
internal_function
|
||||||
|
read_alias_file (fname, fname_len)
|
||||||
|
const char *fname;
|
||||||
|
int fname_len;
|
||||||
|
{
|
||||||
|
FILE *fp;
|
||||||
|
char *full_fname;
|
||||||
|
size_t added;
|
||||||
|
static const char aliasfile[] = "/locale.alias";
|
||||||
|
|
||||||
|
full_fname = (char *) alloca (fname_len + sizeof aliasfile);
|
||||||
|
#ifdef HAVE_MEMPCPY
|
||||||
|
mempcpy (mempcpy (full_fname, fname, fname_len),
|
||||||
|
aliasfile, sizeof aliasfile);
|
||||||
|
#else
|
||||||
|
memcpy (full_fname, fname, fname_len);
|
||||||
|
memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
fp = fopen (full_fname, "r");
|
||||||
|
freea (full_fname);
|
||||||
|
if (fp == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
added = 0;
|
||||||
|
while (!feof (fp))
|
||||||
|
{
|
||||||
|
/* It is a reasonable approach to use a fix buffer here because
|
||||||
|
a) we are only interested in the first two fields
|
||||||
|
b) these fields must be usable as file names and so must not
|
||||||
|
be that long
|
||||||
|
*/
|
||||||
|
char buf[BUFSIZ];
|
||||||
|
char *alias;
|
||||||
|
char *value;
|
||||||
|
char *cp;
|
||||||
|
|
||||||
|
if (fgets (buf, sizeof buf, fp) == NULL)
|
||||||
|
/* EOF reached. */
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* Possibly not the whole line fits into the buffer. Ignore
|
||||||
|
the rest of the line. */
|
||||||
|
if (strchr (buf, '\n') == NULL)
|
||||||
|
{
|
||||||
|
char altbuf[BUFSIZ];
|
||||||
|
do
|
||||||
|
if (fgets (altbuf, sizeof altbuf, fp) == NULL)
|
||||||
|
/* Make sure the inner loop will be left. The outer loop
|
||||||
|
will exit at the `feof' test. */
|
||||||
|
break;
|
||||||
|
while (strchr (altbuf, '\n') == NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
cp = buf;
|
||||||
|
/* Ignore leading white space. */
|
||||||
|
while (isspace (cp[0]))
|
||||||
|
++cp;
|
||||||
|
|
||||||
|
/* A leading '#' signals a comment line. */
|
||||||
|
if (cp[0] != '\0' && cp[0] != '#')
|
||||||
|
{
|
||||||
|
alias = cp++;
|
||||||
|
while (cp[0] != '\0' && !isspace (cp[0]))
|
||||||
|
++cp;
|
||||||
|
/* Terminate alias name. */
|
||||||
|
if (cp[0] != '\0')
|
||||||
|
*cp++ = '\0';
|
||||||
|
|
||||||
|
/* Now look for the beginning of the value. */
|
||||||
|
while (isspace (cp[0]))
|
||||||
|
++cp;
|
||||||
|
|
||||||
|
if (cp[0] != '\0')
|
||||||
|
{
|
||||||
|
size_t alias_len;
|
||||||
|
size_t value_len;
|
||||||
|
|
||||||
|
value = cp++;
|
||||||
|
while (cp[0] != '\0' && !isspace (cp[0]))
|
||||||
|
++cp;
|
||||||
|
/* Terminate value. */
|
||||||
|
if (cp[0] == '\n')
|
||||||
|
{
|
||||||
|
/* This has to be done to make the following test
|
||||||
|
for the end of line possible. We are looking for
|
||||||
|
the terminating '\n' which do not overwrite here. */
|
||||||
|
*cp++ = '\0';
|
||||||
|
*cp = '\n';
|
||||||
|
}
|
||||||
|
else if (cp[0] != '\0')
|
||||||
|
*cp++ = '\0';
|
||||||
|
|
||||||
|
if (nmap >= maxmap)
|
||||||
|
if (__builtin_expect (extend_alias_table (), 0))
|
||||||
|
return added;
|
||||||
|
|
||||||
|
alias_len = strlen (alias) + 1;
|
||||||
|
value_len = strlen (value) + 1;
|
||||||
|
|
||||||
|
if (string_space_act + alias_len + value_len > string_space_max)
|
||||||
|
{
|
||||||
|
/* Increase size of memory pool. */
|
||||||
|
size_t new_size = (string_space_max
|
||||||
|
+ (alias_len + value_len > 1024
|
||||||
|
? alias_len + value_len : 1024));
|
||||||
|
char *new_pool = (char *) realloc (string_space, new_size);
|
||||||
|
if (new_pool == NULL)
|
||||||
|
return added;
|
||||||
|
|
||||||
|
if (__builtin_expect (string_space != new_pool, 0))
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < nmap; i++)
|
||||||
|
{
|
||||||
|
map[i].alias += new_pool - string_space;
|
||||||
|
map[i].value += new_pool - string_space;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string_space = new_pool;
|
||||||
|
string_space_max = new_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
map[nmap].alias = memcpy (&string_space[string_space_act],
|
||||||
|
alias, alias_len);
|
||||||
|
string_space_act += alias_len;
|
||||||
|
|
||||||
|
map[nmap].value = memcpy (&string_space[string_space_act],
|
||||||
|
value, value_len);
|
||||||
|
string_space_act += value_len;
|
||||||
|
|
||||||
|
++nmap;
|
||||||
|
++added;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Should we test for ferror()? I think we have to silently ignore
|
||||||
|
errors. --drepper */
|
||||||
|
fclose (fp);
|
||||||
|
|
||||||
|
if (added > 0)
|
||||||
|
qsort (map, nmap, sizeof (struct alias_map),
|
||||||
|
(int (*) PARAMS ((const void *, const void *))) alias_compare);
|
||||||
|
|
||||||
|
return added;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
extend_alias_table ()
|
||||||
|
{
|
||||||
|
size_t new_size;
|
||||||
|
struct alias_map *new_map;
|
||||||
|
|
||||||
|
new_size = maxmap == 0 ? 100 : 2 * maxmap;
|
||||||
|
new_map = (struct alias_map *) realloc (map, (new_size
|
||||||
|
* sizeof (struct alias_map)));
|
||||||
|
if (new_map == NULL)
|
||||||
|
/* Simply don't extend: we don't have any more core. */
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
map = new_map;
|
||||||
|
maxmap = new_size;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
static void __attribute__ ((unused))
|
||||||
|
free_mem (void)
|
||||||
|
{
|
||||||
|
if (string_space != NULL)
|
||||||
|
free (string_space);
|
||||||
|
if (map != NULL)
|
||||||
|
free (map);
|
||||||
|
}
|
||||||
|
text_set_element (__libc_subfreeres, free_mem);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
alias_compare (map1, map2)
|
||||||
|
const struct alias_map *map1;
|
||||||
|
const struct alias_map *map2;
|
||||||
|
{
|
||||||
|
#if defined _LIBC || defined HAVE_STRCASECMP
|
||||||
|
return strcasecmp (map1->alias, map2->alias);
|
||||||
|
#else
|
||||||
|
const unsigned char *p1 = (const unsigned char *) map1->alias;
|
||||||
|
const unsigned char *p2 = (const unsigned char *) map2->alias;
|
||||||
|
unsigned char c1, c2;
|
||||||
|
|
||||||
|
if (p1 == p2)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
/* I know this seems to be odd but the tolower() function in
|
||||||
|
some systems libc cannot handle nonalpha characters. */
|
||||||
|
c1 = isupper (*p1) ? tolower (*p1) : *p1;
|
||||||
|
c2 = isupper (*p2) ? tolower (*p2) : *p2;
|
||||||
|
if (c1 == '\0')
|
||||||
|
break;
|
||||||
|
++p1;
|
||||||
|
++p2;
|
||||||
|
}
|
||||||
|
while (c1 == c2);
|
||||||
|
|
||||||
|
return c1 - c2;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
/* Implementation of ngettext(3) function.
|
||||||
|
Copyright (C) 1995, 1997, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
# define __need_NULL
|
||||||
|
# include <stddef.h>
|
||||||
|
#else
|
||||||
|
# include <stdlib.h> /* Just for NULL. */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "gettextP.h"
|
||||||
|
#ifdef _LIBC
|
||||||
|
# include <libintl.h>
|
||||||
|
#else
|
||||||
|
# include "libgnuintl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
|
/* @@ end of prolog @@ */
|
||||||
|
|
||||||
|
/* Names for the libintl functions are a problem. They must not clash
|
||||||
|
with existing names and they should follow ANSI C. But this source
|
||||||
|
code is also used in GNU C Library where the names have a __
|
||||||
|
prefix. So we have to make a difference here. */
|
||||||
|
#ifdef _LIBC
|
||||||
|
# define NGETTEXT __ngettext
|
||||||
|
# define DCNGETTEXT __dcngettext
|
||||||
|
#else
|
||||||
|
# define NGETTEXT ngettext__
|
||||||
|
# define DCNGETTEXT dcngettext__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Look up MSGID in the current default message catalog for the current
|
||||||
|
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
||||||
|
text). */
|
||||||
|
char *
|
||||||
|
NGETTEXT (msgid1, msgid2, n)
|
||||||
|
const char *msgid1;
|
||||||
|
const char *msgid2;
|
||||||
|
unsigned long int n;
|
||||||
|
{
|
||||||
|
return DCNGETTEXT (NULL, msgid1, msgid2, n, LC_MESSAGES);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
/* Alias for function name in GNU C Library. */
|
||||||
|
weak_alias (__ngettext, ngettext);
|
||||||
|
#endif
|
||||||
@@ -1,6 +1,310 @@
|
|||||||
|
|
||||||
|
/* A Bison parser, made from plural.y
|
||||||
|
by GNU Bison version 1.28 */
|
||||||
|
|
||||||
|
#define YYBISON 1 /* Identify Bison output. */
|
||||||
|
|
||||||
|
#define yyparse __gettextparse
|
||||||
|
#define yylex __gettextlex
|
||||||
|
#define yyerror __gettexterror
|
||||||
|
#define yylval __gettextlval
|
||||||
|
#define yychar __gettextchar
|
||||||
|
#define yydebug __gettextdebug
|
||||||
|
#define yynerrs __gettextnerrs
|
||||||
|
#define EQUOP2 257
|
||||||
|
#define CMPOP2 258
|
||||||
|
#define ADDOP2 259
|
||||||
|
#define MULOP2 260
|
||||||
|
#define NUMBER 261
|
||||||
|
|
||||||
|
#line 1 "plural.y"
|
||||||
|
|
||||||
|
/* Expression parsing for plural form selection.
|
||||||
|
Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
/* The bison generated parser uses alloca. AIX 3 forces us to put this
|
||||||
|
declaration at the beginning of the file. The declaration in bison's
|
||||||
|
skeleton file comes too late. This must come before <config.h>
|
||||||
|
because <config.h> may include arbitrary system headers. */
|
||||||
|
#if defined _AIX && !defined __GNUC__
|
||||||
|
#pragma alloca
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "gettextP.h"
|
||||||
|
|
||||||
|
/* Names for the libintl functions are a problem. They must not clash
|
||||||
|
with existing names and they should follow ANSI C. But this source
|
||||||
|
code is also used in GNU C Library where the names have a __
|
||||||
|
prefix. So we have to make a difference here. */
|
||||||
|
#ifdef _LIBC
|
||||||
|
# define FREE_EXPRESSION __gettext_free_exp
|
||||||
|
#else
|
||||||
|
# define FREE_EXPRESSION gettext_free_exp__
|
||||||
|
# define __gettextparse gettextparse__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define YYLEX_PARAM &((struct parse_args *) arg)->cp
|
||||||
|
#define YYPARSE_PARAM arg
|
||||||
|
|
||||||
|
#line 53 "plural.y"
|
||||||
|
typedef union {
|
||||||
|
unsigned long int num;
|
||||||
|
enum operator op;
|
||||||
|
struct expression *exp;
|
||||||
|
} YYSTYPE;
|
||||||
|
#line 59 "plural.y"
|
||||||
|
|
||||||
|
/* Prototypes for local functions. */
|
||||||
|
static struct expression *new_exp PARAMS ((int nargs, enum operator op,
|
||||||
|
struct expression * const *args));
|
||||||
|
static inline struct expression *new_exp_0 PARAMS ((enum operator op));
|
||||||
|
static inline struct expression *new_exp_1 PARAMS ((enum operator op,
|
||||||
|
struct expression *right));
|
||||||
|
static struct expression *new_exp_2 PARAMS ((enum operator op,
|
||||||
|
struct expression *left,
|
||||||
|
struct expression *right));
|
||||||
|
static inline struct expression *new_exp_3 PARAMS ((enum operator op,
|
||||||
|
struct expression *bexp,
|
||||||
|
struct expression *tbranch,
|
||||||
|
struct expression *fbranch));
|
||||||
|
static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
|
||||||
|
static void yyerror PARAMS ((const char *str));
|
||||||
|
|
||||||
|
/* Allocation of expressions. */
|
||||||
|
|
||||||
|
static struct expression *
|
||||||
|
new_exp (nargs, op, args)
|
||||||
|
int nargs;
|
||||||
|
enum operator op;
|
||||||
|
struct expression * const *args;
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
struct expression *newp;
|
||||||
|
|
||||||
|
/* If any of the argument could not be malloc'ed, just return NULL. */
|
||||||
|
for (i = nargs - 1; i >= 0; i--)
|
||||||
|
if (args[i] == NULL)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
/* Allocate a new expression. */
|
||||||
|
newp = (struct expression *) malloc (sizeof (*newp));
|
||||||
|
if (newp != NULL)
|
||||||
|
{
|
||||||
|
newp->nargs = nargs;
|
||||||
|
newp->operation = op;
|
||||||
|
for (i = nargs - 1; i >= 0; i--)
|
||||||
|
newp->val.args[i] = args[i];
|
||||||
|
return newp;
|
||||||
|
}
|
||||||
|
|
||||||
|
fail:
|
||||||
|
for (i = nargs - 1; i >= 0; i--)
|
||||||
|
FREE_EXPRESSION (args[i]);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct expression *
|
||||||
|
new_exp_0 (op)
|
||||||
|
enum operator op;
|
||||||
|
{
|
||||||
|
return new_exp (0, op, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct expression *
|
||||||
|
new_exp_1 (op, right)
|
||||||
|
enum operator op;
|
||||||
|
struct expression *right;
|
||||||
|
{
|
||||||
|
struct expression *args[1];
|
||||||
|
|
||||||
|
args[0] = right;
|
||||||
|
return new_exp (1, op, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct expression *
|
||||||
|
new_exp_2 (op, left, right)
|
||||||
|
enum operator op;
|
||||||
|
struct expression *left;
|
||||||
|
struct expression *right;
|
||||||
|
{
|
||||||
|
struct expression *args[2];
|
||||||
|
|
||||||
|
args[0] = left;
|
||||||
|
args[1] = right;
|
||||||
|
return new_exp (2, op, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct expression *
|
||||||
|
new_exp_3 (op, bexp, tbranch, fbranch)
|
||||||
|
enum operator op;
|
||||||
|
struct expression *bexp;
|
||||||
|
struct expression *tbranch;
|
||||||
|
struct expression *fbranch;
|
||||||
|
{
|
||||||
|
struct expression *args[3];
|
||||||
|
|
||||||
|
args[0] = bexp;
|
||||||
|
args[1] = tbranch;
|
||||||
|
args[2] = fbranch;
|
||||||
|
return new_exp (3, op, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#ifndef __STDC__
|
||||||
|
#define const
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define YYFINAL 27
|
||||||
|
#define YYFLAG -32768
|
||||||
|
#define YYNTBASE 16
|
||||||
|
|
||||||
|
#define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 18)
|
||||||
|
|
||||||
|
static const char yytranslate[] = { 0,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 10, 2, 2, 2, 2, 5, 2, 14,
|
||||||
|
15, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 12, 2, 2,
|
||||||
|
2, 2, 3, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 13,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 4, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2, 1, 6, 7, 8, 9,
|
||||||
|
11
|
||||||
|
};
|
||||||
|
|
||||||
|
#if YYDEBUG != 0
|
||||||
|
static const short yyprhs[] = { 0,
|
||||||
|
0, 2, 8, 12, 16, 20, 24, 28, 32, 35,
|
||||||
|
37, 39
|
||||||
|
};
|
||||||
|
|
||||||
|
static const short yyrhs[] = { 17,
|
||||||
|
0, 17, 3, 17, 12, 17, 0, 17, 4, 17,
|
||||||
|
0, 17, 5, 17, 0, 17, 6, 17, 0, 17,
|
||||||
|
7, 17, 0, 17, 8, 17, 0, 17, 9, 17,
|
||||||
|
0, 10, 17, 0, 13, 0, 11, 0, 14, 17,
|
||||||
|
15, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if YYDEBUG != 0
|
||||||
|
static const short yyrline[] = { 0,
|
||||||
|
178, 186, 190, 194, 198, 202, 206, 210, 214, 218,
|
||||||
|
222, 227
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
|
||||||
|
|
||||||
|
static const char * const yytname[] = { "$","error","$undefined.","'?'","'|'",
|
||||||
|
"'&'","EQUOP2","CMPOP2","ADDOP2","MULOP2","'!'","NUMBER","':'","'n'","'('","')'",
|
||||||
|
"start","exp", NULL
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static const short yyr1[] = { 0,
|
||||||
|
16, 17, 17, 17, 17, 17, 17, 17, 17, 17,
|
||||||
|
17, 17
|
||||||
|
};
|
||||||
|
|
||||||
|
static const short yyr2[] = { 0,
|
||||||
|
1, 5, 3, 3, 3, 3, 3, 3, 2, 1,
|
||||||
|
1, 3
|
||||||
|
};
|
||||||
|
|
||||||
|
static const short yydefact[] = { 0,
|
||||||
|
0, 11, 10, 0, 1, 9, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 12, 0, 3, 4, 5, 6,
|
||||||
|
7, 8, 0, 2, 0, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
static const short yydefgoto[] = { 25,
|
||||||
|
5
|
||||||
|
};
|
||||||
|
|
||||||
|
static const short yypact[] = { -9,
|
||||||
|
-9,-32768,-32768, -9, 34,-32768, 11, -9, -9, -9,
|
||||||
|
-9, -9, -9, -9,-32768, 24, 39, 43, 16, 26,
|
||||||
|
-3,-32768, -9, 34, 21, 53,-32768
|
||||||
|
};
|
||||||
|
|
||||||
|
static const short yypgoto[] = {-32768,
|
||||||
|
-1
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define YYLAST 53
|
||||||
|
|
||||||
|
|
||||||
|
static const short yytable[] = { 6,
|
||||||
|
1, 2, 7, 3, 4, 14, 16, 17, 18, 19,
|
||||||
|
20, 21, 22, 8, 9, 10, 11, 12, 13, 14,
|
||||||
|
26, 24, 12, 13, 14, 15, 8, 9, 10, 11,
|
||||||
|
12, 13, 14, 13, 14, 23, 8, 9, 10, 11,
|
||||||
|
12, 13, 14, 10, 11, 12, 13, 14, 11, 12,
|
||||||
|
13, 14, 27
|
||||||
|
};
|
||||||
|
|
||||||
|
static const short yycheck[] = { 1,
|
||||||
|
10, 11, 4, 13, 14, 9, 8, 9, 10, 11,
|
||||||
|
12, 13, 14, 3, 4, 5, 6, 7, 8, 9,
|
||||||
|
0, 23, 7, 8, 9, 15, 3, 4, 5, 6,
|
||||||
|
7, 8, 9, 8, 9, 12, 3, 4, 5, 6,
|
||||||
|
7, 8, 9, 5, 6, 7, 8, 9, 6, 7,
|
||||||
|
8, 9, 0
|
||||||
|
};
|
||||||
|
#define YYPURE 1
|
||||||
|
|
||||||
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
|
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
|
||||||
#line 3 "bison.simple"
|
#line 3 "/home/haible/gnu/arch/linuxlibc6/share/bison.simple"
|
||||||
/* This file comes from bison-@bison_version@. */
|
/* This file comes from bison-1.28. */
|
||||||
|
|
||||||
/* Skeleton output parser for bison,
|
/* Skeleton output parser for bison,
|
||||||
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
|
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
|
||||||
@@ -17,7 +321,8 @@
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
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
|
/* As a special exception, when this file is copied by Bison into a
|
||||||
Bison output file, you may use that output file without restriction.
|
Bison output file, you may use that output file without restriction.
|
||||||
@@ -212,7 +517,7 @@ __yy_memcpy (char *to, char *from, unsigned int count)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#line 216 "bison.simple"
|
#line 217 "/home/haible/gnu/arch/linuxlibc6/share/bison.simple"
|
||||||
|
|
||||||
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
|
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
|
||||||
into yyparse. The argument should have type void *.
|
into yyparse. The argument should have type void *.
|
||||||
@@ -537,8 +842,87 @@ yyreduce:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
$ /* the action file gets copied in in place of this dollarsign */
|
|
||||||
#line 542 "bison.simple"
|
switch (yyn) {
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
#line 179 "plural.y"
|
||||||
|
{
|
||||||
|
if (yyvsp[0].exp == NULL)
|
||||||
|
YYABORT;
|
||||||
|
((struct parse_args *) arg)->res = yyvsp[0].exp;
|
||||||
|
;
|
||||||
|
break;}
|
||||||
|
case 2:
|
||||||
|
#line 187 "plural.y"
|
||||||
|
{
|
||||||
|
yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp);
|
||||||
|
;
|
||||||
|
break;}
|
||||||
|
case 3:
|
||||||
|
#line 191 "plural.y"
|
||||||
|
{
|
||||||
|
yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp);
|
||||||
|
;
|
||||||
|
break;}
|
||||||
|
case 4:
|
||||||
|
#line 195 "plural.y"
|
||||||
|
{
|
||||||
|
yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp);
|
||||||
|
;
|
||||||
|
break;}
|
||||||
|
case 5:
|
||||||
|
#line 199 "plural.y"
|
||||||
|
{
|
||||||
|
yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
|
||||||
|
;
|
||||||
|
break;}
|
||||||
|
case 6:
|
||||||
|
#line 203 "plural.y"
|
||||||
|
{
|
||||||
|
yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
|
||||||
|
;
|
||||||
|
break;}
|
||||||
|
case 7:
|
||||||
|
#line 207 "plural.y"
|
||||||
|
{
|
||||||
|
yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
|
||||||
|
;
|
||||||
|
break;}
|
||||||
|
case 8:
|
||||||
|
#line 211 "plural.y"
|
||||||
|
{
|
||||||
|
yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
|
||||||
|
;
|
||||||
|
break;}
|
||||||
|
case 9:
|
||||||
|
#line 215 "plural.y"
|
||||||
|
{
|
||||||
|
yyval.exp = new_exp_1 (lnot, yyvsp[0].exp);
|
||||||
|
;
|
||||||
|
break;}
|
||||||
|
case 10:
|
||||||
|
#line 219 "plural.y"
|
||||||
|
{
|
||||||
|
yyval.exp = new_exp_0 (var);
|
||||||
|
;
|
||||||
|
break;}
|
||||||
|
case 11:
|
||||||
|
#line 223 "plural.y"
|
||||||
|
{
|
||||||
|
if ((yyval.exp = new_exp_0 (num)) != NULL)
|
||||||
|
yyval.exp->val.num = yyvsp[0].num;
|
||||||
|
;
|
||||||
|
break;}
|
||||||
|
case 12:
|
||||||
|
#line 228 "plural.y"
|
||||||
|
{
|
||||||
|
yyval.exp = yyvsp[-1].exp;
|
||||||
|
;
|
||||||
|
break;}
|
||||||
|
}
|
||||||
|
/* the action file gets copied in in place of this dollarsign */
|
||||||
|
#line 543 "/home/haible/gnu/arch/linuxlibc6/share/bison.simple"
|
||||||
|
|
||||||
yyvsp -= yylen;
|
yyvsp -= yylen;
|
||||||
yyssp -= yylen;
|
yyssp -= yylen;
|
||||||
@@ -758,3 +1142,185 @@ yyerrhandle:
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#line 233 "plural.y"
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
internal_function
|
||||||
|
FREE_EXPRESSION (exp)
|
||||||
|
struct expression *exp;
|
||||||
|
{
|
||||||
|
if (exp == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Handle the recursive case. */
|
||||||
|
switch (exp->nargs)
|
||||||
|
{
|
||||||
|
case 3:
|
||||||
|
FREE_EXPRESSION (exp->val.args[2]);
|
||||||
|
/* FALLTHROUGH */
|
||||||
|
case 2:
|
||||||
|
FREE_EXPRESSION (exp->val.args[1]);
|
||||||
|
/* FALLTHROUGH */
|
||||||
|
case 1:
|
||||||
|
FREE_EXPRESSION (exp->val.args[0]);
|
||||||
|
/* FALLTHROUGH */
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
free (exp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
yylex (lval, pexp)
|
||||||
|
YYSTYPE *lval;
|
||||||
|
const char **pexp;
|
||||||
|
{
|
||||||
|
const char *exp = *pexp;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
if (exp[0] == '\0')
|
||||||
|
{
|
||||||
|
*pexp = exp;
|
||||||
|
return YYEOF;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exp[0] != ' ' && exp[0] != '\t')
|
||||||
|
break;
|
||||||
|
|
||||||
|
++exp;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = *exp++;
|
||||||
|
switch (result)
|
||||||
|
{
|
||||||
|
case '0': case '1': case '2': case '3': case '4':
|
||||||
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
|
{
|
||||||
|
unsigned long int n = result - '0';
|
||||||
|
while (exp[0] >= '0' && exp[0] <= '9')
|
||||||
|
{
|
||||||
|
n *= 10;
|
||||||
|
n += exp[0] - '0';
|
||||||
|
++exp;
|
||||||
|
}
|
||||||
|
lval->num = n;
|
||||||
|
result = NUMBER;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '=':
|
||||||
|
if (exp[0] == '=')
|
||||||
|
{
|
||||||
|
++exp;
|
||||||
|
lval->op = equal;
|
||||||
|
result = EQUOP2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
result = YYERRCODE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '!':
|
||||||
|
if (exp[0] == '=')
|
||||||
|
{
|
||||||
|
++exp;
|
||||||
|
lval->op = not_equal;
|
||||||
|
result = EQUOP2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '&':
|
||||||
|
case '|':
|
||||||
|
if (exp[0] == result)
|
||||||
|
++exp;
|
||||||
|
else
|
||||||
|
result = YYERRCODE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '<':
|
||||||
|
if (exp[0] == '=')
|
||||||
|
{
|
||||||
|
++exp;
|
||||||
|
lval->op = less_or_equal;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
lval->op = less_than;
|
||||||
|
result = CMPOP2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '>':
|
||||||
|
if (exp[0] == '=')
|
||||||
|
{
|
||||||
|
++exp;
|
||||||
|
lval->op = greater_or_equal;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
lval->op = greater_than;
|
||||||
|
result = CMPOP2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '*':
|
||||||
|
lval->op = mult;
|
||||||
|
result = MULOP2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '/':
|
||||||
|
lval->op = divide;
|
||||||
|
result = MULOP2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '%':
|
||||||
|
lval->op = module;
|
||||||
|
result = MULOP2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '+':
|
||||||
|
lval->op = plus;
|
||||||
|
result = ADDOP2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '-':
|
||||||
|
lval->op = minus;
|
||||||
|
result = ADDOP2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'n':
|
||||||
|
case '?':
|
||||||
|
case ':':
|
||||||
|
case '(':
|
||||||
|
case ')':
|
||||||
|
/* Nothing, just return the character. */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ';':
|
||||||
|
case '\n':
|
||||||
|
case '\0':
|
||||||
|
/* Be safe and let the user call this function again. */
|
||||||
|
--exp;
|
||||||
|
result = YYEOF;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
result = YYERRCODE;
|
||||||
|
#if YYDEBUG != 0
|
||||||
|
--exp;
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
*pexp = exp;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
yyerror (str)
|
||||||
|
const char *str;
|
||||||
|
{
|
||||||
|
/* Do nothing. We don't print error messages here. */
|
||||||
|
}
|
||||||
+413
@@ -0,0 +1,413 @@
|
|||||||
|
%{
|
||||||
|
/* Expression parsing for plural form selection.
|
||||||
|
Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
Written by Ulrich Drepper <[email protected]>, 2000.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
/* The bison generated parser uses alloca. AIX 3 forces us to put this
|
||||||
|
declaration at the beginning of the file. The declaration in bison's
|
||||||
|
skeleton file comes too late. This must come before <config.h>
|
||||||
|
because <config.h> may include arbitrary system headers. */
|
||||||
|
#if defined _AIX && !defined __GNUC__
|
||||||
|
#pragma alloca
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "gettextP.h"
|
||||||
|
|
||||||
|
/* Names for the libintl functions are a problem. They must not clash
|
||||||
|
with existing names and they should follow ANSI C. But this source
|
||||||
|
code is also used in GNU C Library where the names have a __
|
||||||
|
prefix. So we have to make a difference here. */
|
||||||
|
#ifdef _LIBC
|
||||||
|
# define FREE_EXPRESSION __gettext_free_exp
|
||||||
|
#else
|
||||||
|
# define FREE_EXPRESSION gettext_free_exp__
|
||||||
|
# define __gettextparse gettextparse__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define YYLEX_PARAM &((struct parse_args *) arg)->cp
|
||||||
|
#define YYPARSE_PARAM arg
|
||||||
|
%}
|
||||||
|
%pure_parser
|
||||||
|
%expect 10
|
||||||
|
|
||||||
|
%union {
|
||||||
|
unsigned long int num;
|
||||||
|
enum operator op;
|
||||||
|
struct expression *exp;
|
||||||
|
}
|
||||||
|
|
||||||
|
%{
|
||||||
|
/* Prototypes for local functions. */
|
||||||
|
static struct expression *new_exp PARAMS ((int nargs, enum operator op,
|
||||||
|
struct expression * const *args));
|
||||||
|
static inline struct expression *new_exp_0 PARAMS ((enum operator op));
|
||||||
|
static inline struct expression *new_exp_1 PARAMS ((enum operator op,
|
||||||
|
struct expression *right));
|
||||||
|
static struct expression *new_exp_2 PARAMS ((enum operator op,
|
||||||
|
struct expression *left,
|
||||||
|
struct expression *right));
|
||||||
|
static inline struct expression *new_exp_3 PARAMS ((enum operator op,
|
||||||
|
struct expression *bexp,
|
||||||
|
struct expression *tbranch,
|
||||||
|
struct expression *fbranch));
|
||||||
|
static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
|
||||||
|
static void yyerror PARAMS ((const char *str));
|
||||||
|
|
||||||
|
/* Allocation of expressions. */
|
||||||
|
|
||||||
|
static struct expression *
|
||||||
|
new_exp (nargs, op, args)
|
||||||
|
int nargs;
|
||||||
|
enum operator op;
|
||||||
|
struct expression * const *args;
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
struct expression *newp;
|
||||||
|
|
||||||
|
/* If any of the argument could not be malloc'ed, just return NULL. */
|
||||||
|
for (i = nargs - 1; i >= 0; i--)
|
||||||
|
if (args[i] == NULL)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
/* Allocate a new expression. */
|
||||||
|
newp = (struct expression *) malloc (sizeof (*newp));
|
||||||
|
if (newp != NULL)
|
||||||
|
{
|
||||||
|
newp->nargs = nargs;
|
||||||
|
newp->operation = op;
|
||||||
|
for (i = nargs - 1; i >= 0; i--)
|
||||||
|
newp->val.args[i] = args[i];
|
||||||
|
return newp;
|
||||||
|
}
|
||||||
|
|
||||||
|
fail:
|
||||||
|
for (i = nargs - 1; i >= 0; i--)
|
||||||
|
FREE_EXPRESSION (args[i]);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct expression *
|
||||||
|
new_exp_0 (op)
|
||||||
|
enum operator op;
|
||||||
|
{
|
||||||
|
return new_exp (0, op, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct expression *
|
||||||
|
new_exp_1 (op, right)
|
||||||
|
enum operator op;
|
||||||
|
struct expression *right;
|
||||||
|
{
|
||||||
|
struct expression *args[1];
|
||||||
|
|
||||||
|
args[0] = right;
|
||||||
|
return new_exp (1, op, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct expression *
|
||||||
|
new_exp_2 (op, left, right)
|
||||||
|
enum operator op;
|
||||||
|
struct expression *left;
|
||||||
|
struct expression *right;
|
||||||
|
{
|
||||||
|
struct expression *args[2];
|
||||||
|
|
||||||
|
args[0] = left;
|
||||||
|
args[1] = right;
|
||||||
|
return new_exp (2, op, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct expression *
|
||||||
|
new_exp_3 (op, bexp, tbranch, fbranch)
|
||||||
|
enum operator op;
|
||||||
|
struct expression *bexp;
|
||||||
|
struct expression *tbranch;
|
||||||
|
struct expression *fbranch;
|
||||||
|
{
|
||||||
|
struct expression *args[3];
|
||||||
|
|
||||||
|
args[0] = bexp;
|
||||||
|
args[1] = tbranch;
|
||||||
|
args[2] = fbranch;
|
||||||
|
return new_exp (3, op, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
%}
|
||||||
|
|
||||||
|
/* This declares that all operators have the same associativity and the
|
||||||
|
precedence order as in C. See [Harbison, Steele: C, A Reference Manual].
|
||||||
|
There is no unary minus and no bitwise operators.
|
||||||
|
Operators with the same syntactic behaviour have been merged into a single
|
||||||
|
token, to save space in the array generated by bison. */
|
||||||
|
%right '?' /* ? */
|
||||||
|
%left '|' /* || */
|
||||||
|
%left '&' /* && */
|
||||||
|
%left EQUOP2 /* == != */
|
||||||
|
%left CMPOP2 /* < > <= >= */
|
||||||
|
%left ADDOP2 /* + - */
|
||||||
|
%left MULOP2 /* * / % */
|
||||||
|
%right '!' /* ! */
|
||||||
|
|
||||||
|
%token <op> EQUOP2 CMPOP2 ADDOP2 MULOP2
|
||||||
|
%token <num> NUMBER
|
||||||
|
%type <exp> exp
|
||||||
|
|
||||||
|
%%
|
||||||
|
|
||||||
|
start: exp
|
||||||
|
{
|
||||||
|
if ($1 == NULL)
|
||||||
|
YYABORT;
|
||||||
|
((struct parse_args *) arg)->res = $1;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
exp: exp '?' exp ':' exp
|
||||||
|
{
|
||||||
|
$$ = new_exp_3 (qmop, $1, $3, $5);
|
||||||
|
}
|
||||||
|
| exp '|' exp
|
||||||
|
{
|
||||||
|
$$ = new_exp_2 (lor, $1, $3);
|
||||||
|
}
|
||||||
|
| exp '&' exp
|
||||||
|
{
|
||||||
|
$$ = new_exp_2 (land, $1, $3);
|
||||||
|
}
|
||||||
|
| exp EQUOP2 exp
|
||||||
|
{
|
||||||
|
$$ = new_exp_2 ($2, $1, $3);
|
||||||
|
}
|
||||||
|
| exp CMPOP2 exp
|
||||||
|
{
|
||||||
|
$$ = new_exp_2 ($2, $1, $3);
|
||||||
|
}
|
||||||
|
| exp ADDOP2 exp
|
||||||
|
{
|
||||||
|
$$ = new_exp_2 ($2, $1, $3);
|
||||||
|
}
|
||||||
|
| exp MULOP2 exp
|
||||||
|
{
|
||||||
|
$$ = new_exp_2 ($2, $1, $3);
|
||||||
|
}
|
||||||
|
| '!' exp
|
||||||
|
{
|
||||||
|
$$ = new_exp_1 (lnot, $2);
|
||||||
|
}
|
||||||
|
| 'n'
|
||||||
|
{
|
||||||
|
$$ = new_exp_0 (var);
|
||||||
|
}
|
||||||
|
| NUMBER
|
||||||
|
{
|
||||||
|
if (($$ = new_exp_0 (num)) != NULL)
|
||||||
|
$$->val.num = $1;
|
||||||
|
}
|
||||||
|
| '(' exp ')'
|
||||||
|
{
|
||||||
|
$$ = $2;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
%%
|
||||||
|
|
||||||
|
void
|
||||||
|
internal_function
|
||||||
|
FREE_EXPRESSION (exp)
|
||||||
|
struct expression *exp;
|
||||||
|
{
|
||||||
|
if (exp == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Handle the recursive case. */
|
||||||
|
switch (exp->nargs)
|
||||||
|
{
|
||||||
|
case 3:
|
||||||
|
FREE_EXPRESSION (exp->val.args[2]);
|
||||||
|
/* FALLTHROUGH */
|
||||||
|
case 2:
|
||||||
|
FREE_EXPRESSION (exp->val.args[1]);
|
||||||
|
/* FALLTHROUGH */
|
||||||
|
case 1:
|
||||||
|
FREE_EXPRESSION (exp->val.args[0]);
|
||||||
|
/* FALLTHROUGH */
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
free (exp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
yylex (lval, pexp)
|
||||||
|
YYSTYPE *lval;
|
||||||
|
const char **pexp;
|
||||||
|
{
|
||||||
|
const char *exp = *pexp;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
if (exp[0] == '\0')
|
||||||
|
{
|
||||||
|
*pexp = exp;
|
||||||
|
return YYEOF;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exp[0] != ' ' && exp[0] != '\t')
|
||||||
|
break;
|
||||||
|
|
||||||
|
++exp;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = *exp++;
|
||||||
|
switch (result)
|
||||||
|
{
|
||||||
|
case '0': case '1': case '2': case '3': case '4':
|
||||||
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
|
{
|
||||||
|
unsigned long int n = result - '0';
|
||||||
|
while (exp[0] >= '0' && exp[0] <= '9')
|
||||||
|
{
|
||||||
|
n *= 10;
|
||||||
|
n += exp[0] - '0';
|
||||||
|
++exp;
|
||||||
|
}
|
||||||
|
lval->num = n;
|
||||||
|
result = NUMBER;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '=':
|
||||||
|
if (exp[0] == '=')
|
||||||
|
{
|
||||||
|
++exp;
|
||||||
|
lval->op = equal;
|
||||||
|
result = EQUOP2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
result = YYERRCODE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '!':
|
||||||
|
if (exp[0] == '=')
|
||||||
|
{
|
||||||
|
++exp;
|
||||||
|
lval->op = not_equal;
|
||||||
|
result = EQUOP2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '&':
|
||||||
|
case '|':
|
||||||
|
if (exp[0] == result)
|
||||||
|
++exp;
|
||||||
|
else
|
||||||
|
result = YYERRCODE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '<':
|
||||||
|
if (exp[0] == '=')
|
||||||
|
{
|
||||||
|
++exp;
|
||||||
|
lval->op = less_or_equal;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
lval->op = less_than;
|
||||||
|
result = CMPOP2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '>':
|
||||||
|
if (exp[0] == '=')
|
||||||
|
{
|
||||||
|
++exp;
|
||||||
|
lval->op = greater_or_equal;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
lval->op = greater_than;
|
||||||
|
result = CMPOP2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '*':
|
||||||
|
lval->op = mult;
|
||||||
|
result = MULOP2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '/':
|
||||||
|
lval->op = divide;
|
||||||
|
result = MULOP2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '%':
|
||||||
|
lval->op = module;
|
||||||
|
result = MULOP2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '+':
|
||||||
|
lval->op = plus;
|
||||||
|
result = ADDOP2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '-':
|
||||||
|
lval->op = minus;
|
||||||
|
result = ADDOP2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'n':
|
||||||
|
case '?':
|
||||||
|
case ':':
|
||||||
|
case '(':
|
||||||
|
case ')':
|
||||||
|
/* Nothing, just return the character. */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ';':
|
||||||
|
case '\n':
|
||||||
|
case '\0':
|
||||||
|
/* Be safe and let the user call this function again. */
|
||||||
|
--exp;
|
||||||
|
result = YYEOF;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
result = YYERRCODE;
|
||||||
|
#if YYDEBUG != 0
|
||||||
|
--exp;
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
*pexp = exp;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
yyerror (str)
|
||||||
|
const char *str;
|
||||||
|
{
|
||||||
|
/* Do nothing. We don't print error messages here. */
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# Add this package to a list of references stored in a text file.
|
||||||
|
#
|
||||||
|
# Copyright (C) 2000 Free Software Foundation, Inc.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU Library General Public License as published
|
||||||
|
# by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# Library General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Library General Public
|
||||||
|
# License along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
# USA.
|
||||||
|
#
|
||||||
|
# Written by Bruno Haible <[email protected]>.
|
||||||
|
#
|
||||||
|
/^# Packages using this file: / {
|
||||||
|
s/# Packages using this file://
|
||||||
|
ta
|
||||||
|
:a
|
||||||
|
s/ @PACKAGE@ / @PACKAGE@ /
|
||||||
|
tb
|
||||||
|
s/ $/ @PACKAGE@ /
|
||||||
|
:b
|
||||||
|
s/^/# Packages using this file:/
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# Remove this package from a list of references stored in a text file.
|
||||||
|
#
|
||||||
|
# Copyright (C) 2000 Free Software Foundation, Inc.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU Library General Public License as published
|
||||||
|
# by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# Library General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Library General Public
|
||||||
|
# License along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
# USA.
|
||||||
|
#
|
||||||
|
# Written by Bruno Haible <[email protected]>.
|
||||||
|
#
|
||||||
|
/^# Packages using this file: / {
|
||||||
|
s/# Packages using this file://
|
||||||
|
s/ @PACKAGE@ / /
|
||||||
|
s/^/# Packages using this file:/
|
||||||
|
}
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
/* Implementation of the textdomain(3) function.
|
||||||
|
Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
# include <libintl.h>
|
||||||
|
#else
|
||||||
|
# include "libgnuintl.h"
|
||||||
|
#endif
|
||||||
|
#include "gettextP.h"
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
/* We have to handle multi-threaded applications. */
|
||||||
|
# include <bits/libc-lock.h>
|
||||||
|
#else
|
||||||
|
/* Provide dummy implementation if this is outside glibc. */
|
||||||
|
# define __libc_rwlock_define(CLASS, NAME)
|
||||||
|
# define __libc_rwlock_wrlock(NAME)
|
||||||
|
# define __libc_rwlock_unlock(NAME)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The internal variables in the standalone libintl.a must have different
|
||||||
|
names than the internal variables in GNU libc, otherwise programs
|
||||||
|
using libintl.a cannot be linked statically. */
|
||||||
|
#if !defined _LIBC
|
||||||
|
# define _nl_default_default_domain _nl_default_default_domain__
|
||||||
|
# define _nl_current_default_domain _nl_current_default_domain__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* @@ end of prolog @@ */
|
||||||
|
|
||||||
|
/* Name of the default text domain. */
|
||||||
|
extern const char _nl_default_default_domain[];
|
||||||
|
|
||||||
|
/* Default text domain in which entries for gettext(3) are to be found. */
|
||||||
|
extern const char *_nl_current_default_domain;
|
||||||
|
|
||||||
|
|
||||||
|
/* Names for the libintl functions are a problem. They must not clash
|
||||||
|
with existing names and they should follow ANSI C. But this source
|
||||||
|
code is also used in GNU C Library where the names have a __
|
||||||
|
prefix. So we have to make a difference here. */
|
||||||
|
#ifdef _LIBC
|
||||||
|
# define TEXTDOMAIN __textdomain
|
||||||
|
# ifndef strdup
|
||||||
|
# define strdup(str) __strdup (str)
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define TEXTDOMAIN textdomain__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Lock variable to protect the global data in the gettext implementation. */
|
||||||
|
__libc_rwlock_define (extern, _nl_state_lock)
|
||||||
|
|
||||||
|
/* Set the current default message catalog to DOMAINNAME.
|
||||||
|
If DOMAINNAME is null, return the current default.
|
||||||
|
If DOMAINNAME is "", reset to the default of "messages". */
|
||||||
|
char *
|
||||||
|
TEXTDOMAIN (domainname)
|
||||||
|
const char *domainname;
|
||||||
|
{
|
||||||
|
char *new_domain;
|
||||||
|
char *old_domain;
|
||||||
|
|
||||||
|
/* A NULL pointer requests the current setting. */
|
||||||
|
if (domainname == NULL)
|
||||||
|
return (char *) _nl_current_default_domain;
|
||||||
|
|
||||||
|
__libc_rwlock_wrlock (_nl_state_lock);
|
||||||
|
|
||||||
|
old_domain = (char *) _nl_current_default_domain;
|
||||||
|
|
||||||
|
/* If domain name is the null string set to default domain "messages". */
|
||||||
|
if (domainname[0] == '\0'
|
||||||
|
|| strcmp (domainname, _nl_default_default_domain) == 0)
|
||||||
|
{
|
||||||
|
_nl_current_default_domain = _nl_default_default_domain;
|
||||||
|
new_domain = (char *) _nl_current_default_domain;
|
||||||
|
}
|
||||||
|
else if (strcmp (domainname, old_domain) == 0)
|
||||||
|
/* This can happen and people will use it to signal that some
|
||||||
|
environment variable changed. */
|
||||||
|
new_domain = old_domain;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* If the following malloc fails `_nl_current_default_domain'
|
||||||
|
will be NULL. This value will be returned and so signals we
|
||||||
|
are out of core. */
|
||||||
|
#if defined _LIBC || defined HAVE_STRDUP
|
||||||
|
new_domain = strdup (domainname);
|
||||||
|
#else
|
||||||
|
size_t len = strlen (domainname) + 1;
|
||||||
|
new_domain = (char *) malloc (len);
|
||||||
|
if (new_domain != NULL)
|
||||||
|
memcpy (new_domain, domainname, len);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (new_domain != NULL)
|
||||||
|
_nl_current_default_domain = new_domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We use this possibility to signal a change of the loaded catalogs
|
||||||
|
since this is most likely the case and there is no other easy we
|
||||||
|
to do it. Do it only when the call was successful. */
|
||||||
|
if (new_domain != NULL)
|
||||||
|
{
|
||||||
|
++_nl_msg_cat_cntr;
|
||||||
|
|
||||||
|
if (old_domain != new_domain && old_domain != _nl_default_default_domain)
|
||||||
|
free (old_domain);
|
||||||
|
}
|
||||||
|
|
||||||
|
__libc_rwlock_unlock (_nl_state_lock);
|
||||||
|
|
||||||
|
return new_domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
/* Alias for function name in GNU C Library. */
|
||||||
|
weak_alias (__textdomain, textdomain);
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
*_.c
|
||||||
|
.deps
|
||||||
|
Makefile
|
||||||
|
ansi2knr
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
|
|
||||||
|
AUTOMAKE_OPTIONS = ansi2knr
|
||||||
|
|
||||||
|
noinst_LIBRARIES = libbison.a
|
||||||
|
|
||||||
|
INCLUDES = -I.. -I$(srcdir) -I../intl
|
||||||
|
|
||||||
|
# Heck, we are still using an old version of Automake which does not
|
||||||
|
# understand LIBOBJ additions using $objext...
|
||||||
|
|
||||||
|
EXTRA_DIST = malloc.c realloc.c
|
||||||
|
|
||||||
|
libbison_a_SOURCES = \
|
||||||
|
getopt.h getopt.c getopt1.c \
|
||||||
|
quote.h quote.c quotearg.h quotearg.c \
|
||||||
|
xalloc.h xmalloc.c xstrdup.c
|
||||||
|
|
||||||
|
libbison_a_LIBADD = @LIBOBJS@ @ALLOCA@
|
||||||
|
libbison_a_DEPENDENCIES = $(libbison_a_LIBADD)
|
||||||
+400
@@ -0,0 +1,400 @@
|
|||||||
|
# Makefile.in generated by automake 1.5a from Makefile.am.
|
||||||
|
# @configure_input@
|
||||||
|
|
||||||
|
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||||
|
# Free Software Foundation, Inc.
|
||||||
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
# with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
@SET_MAKE@
|
||||||
|
|
||||||
|
SHELL = @SHELL@
|
||||||
|
|
||||||
|
srcdir = @srcdir@
|
||||||
|
top_srcdir = @top_srcdir@
|
||||||
|
VPATH = @srcdir@
|
||||||
|
prefix = @prefix@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
|
||||||
|
bindir = @bindir@
|
||||||
|
sbindir = @sbindir@
|
||||||
|
libexecdir = @libexecdir@
|
||||||
|
datadir = @datadir@
|
||||||
|
sysconfdir = @sysconfdir@
|
||||||
|
sharedstatedir = @sharedstatedir@
|
||||||
|
localstatedir = @localstatedir@
|
||||||
|
libdir = @libdir@
|
||||||
|
infodir = @infodir@
|
||||||
|
mandir = @mandir@
|
||||||
|
includedir = @includedir@
|
||||||
|
oldincludedir = /usr/include
|
||||||
|
pkgdatadir = $(datadir)/@PACKAGE@
|
||||||
|
pkglibdir = $(libdir)/@PACKAGE@
|
||||||
|
pkgincludedir = $(includedir)/@PACKAGE@
|
||||||
|
top_builddir = ..
|
||||||
|
|
||||||
|
ACLOCAL = @ACLOCAL@
|
||||||
|
AUTOCONF = @AUTOCONF@
|
||||||
|
AUTOMAKE = @AUTOMAKE@
|
||||||
|
AUTOHEADER = @AUTOHEADER@
|
||||||
|
|
||||||
|
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
|
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||||
|
INSTALL_HEADER = $(INSTALL_DATA)
|
||||||
|
transform = @program_transform_name@
|
||||||
|
NORMAL_INSTALL = :
|
||||||
|
PRE_INSTALL = :
|
||||||
|
POST_INSTALL = :
|
||||||
|
NORMAL_UNINSTALL = :
|
||||||
|
PRE_UNINSTALL = :
|
||||||
|
POST_UNINSTALL = :
|
||||||
|
host_alias = @host_alias@
|
||||||
|
host_triplet = @host@
|
||||||
|
|
||||||
|
EXEEXT = @EXEEXT@
|
||||||
|
OBJEXT = @OBJEXT@
|
||||||
|
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||||
|
AMTAR = @AMTAR@
|
||||||
|
AUTOM4TE = @AUTOM4TE@
|
||||||
|
AWK = @AWK@
|
||||||
|
BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
|
||||||
|
CATALOGS = @CATALOGS@
|
||||||
|
CATOBJEXT = @CATOBJEXT@
|
||||||
|
CC = @CC@
|
||||||
|
CPP = @CPP@
|
||||||
|
DATADIRNAME = @DATADIRNAME@
|
||||||
|
DEPDIR = @DEPDIR@
|
||||||
|
GCC = @GCC@
|
||||||
|
GENCAT = @GENCAT@
|
||||||
|
GLIBC21 = @GLIBC21@
|
||||||
|
GMOFILES = @GMOFILES@
|
||||||
|
GMSGFMT = @GMSGFMT@
|
||||||
|
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||||
|
INSTOBJEXT = @INSTOBJEXT@
|
||||||
|
INTLBISON = @INTLBISON@
|
||||||
|
INTLLIBS = @INTLLIBS@
|
||||||
|
INTLOBJS = @INTLOBJS@
|
||||||
|
INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
|
||||||
|
LIB = @LIB@
|
||||||
|
LIBICONV = @LIBICONV@
|
||||||
|
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||||
|
MSGFMT = @MSGFMT@
|
||||||
|
PACKAGE = @PACKAGE@
|
||||||
|
POFILES = @POFILES@
|
||||||
|
POSUB = @POSUB@
|
||||||
|
RANLIB = @RANLIB@
|
||||||
|
U = @U@
|
||||||
|
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||||
|
USE_NLS = @USE_NLS@
|
||||||
|
VERSION = @VERSION@
|
||||||
|
WARNING_CFLAGS = @WARNING_CFLAGS@
|
||||||
|
am__include = @am__include@
|
||||||
|
am__quote = @am__quote@
|
||||||
|
install_sh = @install_sh@
|
||||||
|
|
||||||
|
AUTOMAKE_OPTIONS = ansi2knr
|
||||||
|
|
||||||
|
noinst_LIBRARIES = libbison.a
|
||||||
|
|
||||||
|
INCLUDES = -I.. -I$(srcdir) -I../intl
|
||||||
|
|
||||||
|
|
||||||
|
# Heck, we are still using an old version of Automake which does not
|
||||||
|
# understand LIBOBJ additions using $objext...
|
||||||
|
EXTRA_DIST = malloc.c realloc.c
|
||||||
|
|
||||||
|
libbison_a_SOURCES = \
|
||||||
|
getopt.h getopt.c getopt1.c \
|
||||||
|
quote.h quote.c quotearg.h quotearg.c \
|
||||||
|
xalloc.h xmalloc.c xstrdup.c
|
||||||
|
|
||||||
|
|
||||||
|
libbison_a_LIBADD = @LIBOBJS@ @ALLOCA@
|
||||||
|
libbison_a_DEPENDENCIES = $(libbison_a_LIBADD)
|
||||||
|
subdir = lib
|
||||||
|
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
|
||||||
|
CONFIG_HEADER = $(top_builddir)/config.h
|
||||||
|
CONFIG_CLEAN_FILES =
|
||||||
|
LIBRARIES = $(noinst_LIBRARIES)
|
||||||
|
|
||||||
|
libbison_a_AR = $(AR) cru
|
||||||
|
am_libbison_a_OBJECTS = getopt$U.$(OBJEXT) getopt1$U.$(OBJEXT) \
|
||||||
|
quote$U.$(OBJEXT) quotearg$U.$(OBJEXT) xmalloc$U.$(OBJEXT) \
|
||||||
|
xstrdup$U.$(OBJEXT)
|
||||||
|
libbison_a_OBJECTS = $(am_libbison_a_OBJECTS)
|
||||||
|
|
||||||
|
DEFS = @DEFS@
|
||||||
|
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||||
|
CPPFLAGS = @CPPFLAGS@
|
||||||
|
LDFLAGS = @LDFLAGS@
|
||||||
|
LIBS = @LIBS@
|
||||||
|
depcomp = $(SHELL) $(top_srcdir)/config/depcomp
|
||||||
|
@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/alloca.Po $(DEPDIR)/error.Po \
|
||||||
|
@AMDEP_TRUE@ $(DEPDIR)/getopt$U.Po $(DEPDIR)/getopt1$U.Po \
|
||||||
|
@AMDEP_TRUE@ $(DEPDIR)/malloc.Po $(DEPDIR)/memchr.Po \
|
||||||
|
@AMDEP_TRUE@ $(DEPDIR)/obstack.Po $(DEPDIR)/quote$U.Po \
|
||||||
|
@AMDEP_TRUE@ $(DEPDIR)/quotearg$U.Po $(DEPDIR)/realloc.Po \
|
||||||
|
@AMDEP_TRUE@ $(DEPDIR)/stpcpy.Po $(DEPDIR)/strndup.Po \
|
||||||
|
@AMDEP_TRUE@ $(DEPDIR)/strnlen.Po $(DEPDIR)/strspn.Po \
|
||||||
|
@AMDEP_TRUE@ $(DEPDIR)/xmalloc$U.Po $(DEPDIR)/xstrdup$U.Po
|
||||||
|
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||||
|
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||||
|
CCLD = $(CC)
|
||||||
|
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||||
|
CFLAGS = @CFLAGS@
|
||||||
|
DIST_SOURCES = $(libbison_a_SOURCES)
|
||||||
|
DIST_COMMON = Makefile.am Makefile.in alloca.c ansi2knr.1 ansi2knr.c \
|
||||||
|
error.c error.h malloc.c memchr.c obstack.c obstack.h realloc.c \
|
||||||
|
stpcpy.c strndup.c strnlen.c strspn.c
|
||||||
|
SOURCES = $(libbison_a_SOURCES)
|
||||||
|
|
||||||
|
all: all-am
|
||||||
|
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .c .o .obj
|
||||||
|
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||||
|
cd $(top_srcdir) && \
|
||||||
|
$(AUTOMAKE) --gnu lib/Makefile
|
||||||
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
|
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
|
||||||
|
|
||||||
|
AR = ar
|
||||||
|
|
||||||
|
clean-noinstLIBRARIES:
|
||||||
|
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
|
||||||
|
libbison.a: $(libbison_a_OBJECTS) $(libbison_a_DEPENDENCIES)
|
||||||
|
-rm -f libbison.a
|
||||||
|
$(libbison_a_AR) libbison.a $(libbison_a_OBJECTS) $(libbison_a_LIBADD)
|
||||||
|
$(RANLIB) libbison.a
|
||||||
|
|
||||||
|
mostlyclean-compile:
|
||||||
|
-rm -f *.$(OBJEXT) core *.core
|
||||||
|
|
||||||
|
distclean-compile:
|
||||||
|
-rm -f *.tab.c
|
||||||
|
|
||||||
|
ANSI2KNR = @ANSI2KNR@
|
||||||
|
ansi2knr: ansi2knr.$(OBJEXT)
|
||||||
|
$(LINK) ansi2knr.$(OBJEXT) $(LIBS)
|
||||||
|
ansi2knr.$(OBJEXT): $(CONFIG_HEADER)
|
||||||
|
|
||||||
|
clean-krextra:
|
||||||
|
-rm -f ansi2knr
|
||||||
|
|
||||||
|
mostlyclean-kr:
|
||||||
|
-test "$U" = "" || rm -f *_.c
|
||||||
|
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/alloca.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/error.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt$U.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt1$U.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/malloc.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/memchr.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/obstack.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/quote$U.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/quotearg$U.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/realloc.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/stpcpy.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strndup.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strnlen.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strspn.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/xmalloc$U.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/xstrdup$U.Po@am__quote@
|
||||||
|
|
||||||
|
distclean-depend:
|
||||||
|
-rm -rf $(DEPDIR)
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
$(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
|
||||||
|
|
||||||
|
.c.obj:
|
||||||
|
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
$(COMPILE) -c `cygpath -w $<`
|
||||||
|
CCDEPMODE = @CCDEPMODE@
|
||||||
|
alloca_.c: alloca.c $(ANSI2KNR)
|
||||||
|
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/alloca.c; then echo $(srcdir)/alloca.c; else echo alloca.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > alloca_.c || rm -f alloca_.c
|
||||||
|
error_.c: error.c $(ANSI2KNR)
|
||||||
|
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/error.c; then echo $(srcdir)/error.c; else echo error.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > error_.c || rm -f error_.c
|
||||||
|
getopt_.c: getopt.c $(ANSI2KNR)
|
||||||
|
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getopt.c; then echo $(srcdir)/getopt.c; else echo getopt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getopt_.c || rm -f getopt_.c
|
||||||
|
getopt1_.c: getopt1.c $(ANSI2KNR)
|
||||||
|
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getopt1.c; then echo $(srcdir)/getopt1.c; else echo getopt1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getopt1_.c || rm -f getopt1_.c
|
||||||
|
malloc_.c: malloc.c $(ANSI2KNR)
|
||||||
|
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/malloc.c; then echo $(srcdir)/malloc.c; else echo malloc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > malloc_.c || rm -f malloc_.c
|
||||||
|
memchr_.c: memchr.c $(ANSI2KNR)
|
||||||
|
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/memchr.c; then echo $(srcdir)/memchr.c; else echo memchr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > memchr_.c || rm -f memchr_.c
|
||||||
|
obstack_.c: obstack.c $(ANSI2KNR)
|
||||||
|
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/obstack.c; then echo $(srcdir)/obstack.c; else echo obstack.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > obstack_.c || rm -f obstack_.c
|
||||||
|
quote_.c: quote.c $(ANSI2KNR)
|
||||||
|
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/quote.c; then echo $(srcdir)/quote.c; else echo quote.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > quote_.c || rm -f quote_.c
|
||||||
|
quotearg_.c: quotearg.c $(ANSI2KNR)
|
||||||
|
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/quotearg.c; then echo $(srcdir)/quotearg.c; else echo quotearg.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > quotearg_.c || rm -f quotearg_.c
|
||||||
|
realloc_.c: realloc.c $(ANSI2KNR)
|
||||||
|
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/realloc.c; then echo $(srcdir)/realloc.c; else echo realloc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > realloc_.c || rm -f realloc_.c
|
||||||
|
stpcpy_.c: stpcpy.c $(ANSI2KNR)
|
||||||
|
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/stpcpy.c; then echo $(srcdir)/stpcpy.c; else echo stpcpy.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > stpcpy_.c || rm -f stpcpy_.c
|
||||||
|
strndup_.c: strndup.c $(ANSI2KNR)
|
||||||
|
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strndup.c; then echo $(srcdir)/strndup.c; else echo strndup.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strndup_.c || rm -f strndup_.c
|
||||||
|
strnlen_.c: strnlen.c $(ANSI2KNR)
|
||||||
|
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strnlen.c; then echo $(srcdir)/strnlen.c; else echo strnlen.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strnlen_.c || rm -f strnlen_.c
|
||||||
|
strspn_.c: strspn.c $(ANSI2KNR)
|
||||||
|
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strspn.c; then echo $(srcdir)/strspn.c; else echo strspn.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strspn_.c || rm -f strspn_.c
|
||||||
|
xmalloc_.c: xmalloc.c $(ANSI2KNR)
|
||||||
|
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xmalloc.c; then echo $(srcdir)/xmalloc.c; else echo xmalloc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > xmalloc_.c || rm -f xmalloc_.c
|
||||||
|
xstrdup_.c: xstrdup.c $(ANSI2KNR)
|
||||||
|
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xstrdup.c; then echo $(srcdir)/xstrdup.c; else echo xstrdup.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > xstrdup_.c || rm -f xstrdup_.c
|
||||||
|
alloca_.$(OBJEXT) error_.$(OBJEXT) getopt_.$(OBJEXT) getopt1_.$(OBJEXT) \
|
||||||
|
malloc_.$(OBJEXT) memchr_.$(OBJEXT) obstack_.$(OBJEXT) quote_.$(OBJEXT) \
|
||||||
|
quotearg_.$(OBJEXT) realloc_.$(OBJEXT) stpcpy_.$(OBJEXT) \
|
||||||
|
strndup_.$(OBJEXT) strnlen_.$(OBJEXT) strspn_.$(OBJEXT) \
|
||||||
|
xmalloc_.$(OBJEXT) xstrdup_.$(OBJEXT) : $(ANSI2KNR)
|
||||||
|
uninstall-info-am:
|
||||||
|
|
||||||
|
tags: TAGS
|
||||||
|
|
||||||
|
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||||
|
list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
|
||||||
|
unique=`for i in $$list; do \
|
||||||
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
|
done | \
|
||||||
|
$(AWK) ' { files[$$0] = 1; } \
|
||||||
|
END { for (i in files) print i; }'`; \
|
||||||
|
mkid -fID $$unique $(LISP)
|
||||||
|
|
||||||
|
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||||
|
$(TAGS_FILES) $(LISP)
|
||||||
|
tags=; \
|
||||||
|
here=`pwd`; \
|
||||||
|
list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
|
||||||
|
unique=`for i in $$list; do \
|
||||||
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
|
done | \
|
||||||
|
$(AWK) ' { files[$$0] = 1; } \
|
||||||
|
END { for (i in files) print i; }'`; \
|
||||||
|
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||||
|
|| etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
|
||||||
|
|
||||||
|
GTAGS:
|
||||||
|
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||||
|
&& cd $(top_srcdir) \
|
||||||
|
&& gtags -i $(GTAGS_ARGS) $$here
|
||||||
|
|
||||||
|
distclean-tags:
|
||||||
|
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
|
||||||
|
|
||||||
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
|
||||||
|
top_distdir = ..
|
||||||
|
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
|
||||||
|
|
||||||
|
distdir: $(DISTFILES)
|
||||||
|
@for file in $(DISTFILES); do \
|
||||||
|
if test -f $$file; then d=.; else d=$(srcdir); fi; \
|
||||||
|
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||||
|
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||||
|
$(mkinstalldirs) "$(distdir)/$$dir"; \
|
||||||
|
fi; \
|
||||||
|
if test -d $$d/$$file; then \
|
||||||
|
cp -pR $$d/$$file $(distdir) \
|
||||||
|
|| exit 1; \
|
||||||
|
else \
|
||||||
|
test -f $(distdir)/$$file \
|
||||||
|
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||||
|
|| exit 1; \
|
||||||
|
fi; \
|
||||||
|
done
|
||||||
|
check-am: all-am
|
||||||
|
check: check-am
|
||||||
|
all-am: Makefile $(ANSI2KNR) $(LIBRARIES)
|
||||||
|
|
||||||
|
installdirs:
|
||||||
|
|
||||||
|
install: install-am
|
||||||
|
install-exec: install-exec-am
|
||||||
|
install-data: install-data-am
|
||||||
|
uninstall: uninstall-am
|
||||||
|
|
||||||
|
install-am: all-am
|
||||||
|
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||||
|
|
||||||
|
installcheck: installcheck-am
|
||||||
|
install-strip:
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||||
|
`test -z '$(STRIP)' || \
|
||||||
|
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||||
|
mostlyclean-generic:
|
||||||
|
|
||||||
|
clean-generic:
|
||||||
|
|
||||||
|
distclean-generic:
|
||||||
|
-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
|
||||||
|
|
||||||
|
maintainer-clean-generic:
|
||||||
|
@echo "This command is intended for maintainers to use"
|
||||||
|
@echo "it deletes files that may require special tools to rebuild."
|
||||||
|
clean: clean-am
|
||||||
|
|
||||||
|
clean-am: clean-generic clean-krextra clean-noinstLIBRARIES \
|
||||||
|
mostlyclean-am
|
||||||
|
|
||||||
|
distclean: distclean-am
|
||||||
|
|
||||||
|
distclean-am: clean-am distclean-compile distclean-depend \
|
||||||
|
distclean-generic distclean-tags
|
||||||
|
|
||||||
|
dvi: dvi-am
|
||||||
|
|
||||||
|
dvi-am:
|
||||||
|
|
||||||
|
info: info-am
|
||||||
|
|
||||||
|
info-am:
|
||||||
|
|
||||||
|
install-data-am:
|
||||||
|
|
||||||
|
install-exec-am:
|
||||||
|
|
||||||
|
install-info: install-info-am
|
||||||
|
|
||||||
|
install-man:
|
||||||
|
|
||||||
|
installcheck-am:
|
||||||
|
|
||||||
|
maintainer-clean: maintainer-clean-am
|
||||||
|
|
||||||
|
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||||
|
|
||||||
|
mostlyclean: mostlyclean-am
|
||||||
|
|
||||||
|
mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr
|
||||||
|
|
||||||
|
uninstall-am: uninstall-info-am
|
||||||
|
|
||||||
|
.PHONY: GTAGS all all-am check check-am clean clean-generic \
|
||||||
|
clean-krextra clean-noinstLIBRARIES distclean distclean-compile \
|
||||||
|
distclean-depend distclean-generic distclean-tags distdir dvi \
|
||||||
|
dvi-am info info-am install install-am install-data \
|
||||||
|
install-data-am install-exec install-exec-am install-info \
|
||||||
|
install-info-am install-man install-strip installcheck \
|
||||||
|
installcheck-am installdirs maintainer-clean \
|
||||||
|
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||||
|
mostlyclean-generic mostlyclean-kr tags uninstall uninstall-am \
|
||||||
|
uninstall-info-am
|
||||||
|
|
||||||
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||||
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
|
.NOEXPORT:
|
||||||
+504
@@ -0,0 +1,504 @@
|
|||||||
|
/* alloca.c -- allocate automatically reclaimed memory
|
||||||
|
(Mostly) portable public-domain implementation -- D A Gwyn
|
||||||
|
|
||||||
|
This implementation of the PWB library alloca function,
|
||||||
|
which is used to allocate space off the run-time stack so
|
||||||
|
that it is automatically reclaimed upon procedure exit,
|
||||||
|
was inspired by discussions with J. Q. Johnson of Cornell.
|
||||||
|
J.Otto Tennant <[email protected]> contributed the Cray support.
|
||||||
|
|
||||||
|
There are some preprocessor constants that can
|
||||||
|
be defined when compiling for your specific system, for
|
||||||
|
improved efficiency; however, the defaults should be okay.
|
||||||
|
|
||||||
|
The general concept of this implementation is to keep
|
||||||
|
track of all alloca-allocated blocks, and reclaim any
|
||||||
|
that are found to be deeper in the stack than the current
|
||||||
|
invocation. This heuristic does not reclaim storage as
|
||||||
|
soon as it becomes invalid, but it will do so eventually.
|
||||||
|
|
||||||
|
As a special case, alloca(0) reclaims storage without
|
||||||
|
allocating any. It is a good idea to use alloca(0) in
|
||||||
|
your main control loop, etc. to force garbage collection. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_STRING_H
|
||||||
|
# include <string.h>
|
||||||
|
#endif
|
||||||
|
#if HAVE_STDLIB_H
|
||||||
|
# include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef emacs
|
||||||
|
# include "blockinput.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* If compiling with GCC 2, this file's not needed. */
|
||||||
|
#if !defined (__GNUC__) || __GNUC__ < 2
|
||||||
|
|
||||||
|
/* If someone has defined alloca as a macro,
|
||||||
|
there must be some other way alloca is supposed to work. */
|
||||||
|
# ifndef alloca
|
||||||
|
|
||||||
|
# ifdef emacs
|
||||||
|
# ifdef static
|
||||||
|
/* actually, only want this if static is defined as ""
|
||||||
|
-- this is for usg, in which emacs must undefine static
|
||||||
|
in order to make unexec workable
|
||||||
|
*/
|
||||||
|
# ifndef STACK_DIRECTION
|
||||||
|
you
|
||||||
|
lose
|
||||||
|
-- must know STACK_DIRECTION at compile-time
|
||||||
|
# endif /* STACK_DIRECTION undefined */
|
||||||
|
# endif /* static */
|
||||||
|
# endif /* emacs */
|
||||||
|
|
||||||
|
/* If your stack is a linked list of frames, you have to
|
||||||
|
provide an "address metric" ADDRESS_FUNCTION macro. */
|
||||||
|
|
||||||
|
# if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||||
|
long i00afunc ();
|
||||||
|
# define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
|
||||||
|
# else
|
||||||
|
# define ADDRESS_FUNCTION(arg) &(arg)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if __STDC__
|
||||||
|
typedef void *pointer;
|
||||||
|
# else
|
||||||
|
typedef char *pointer;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifndef NULL
|
||||||
|
# define NULL 0
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Different portions of Emacs need to call different versions of
|
||||||
|
malloc. The Emacs executable needs alloca to call xmalloc, because
|
||||||
|
ordinary malloc isn't protected from input signals. On the other
|
||||||
|
hand, the utilities in lib-src need alloca to call malloc; some of
|
||||||
|
them are very simple, and don't have an xmalloc routine.
|
||||||
|
|
||||||
|
Non-Emacs programs expect this to call xmalloc.
|
||||||
|
|
||||||
|
Callers below should use malloc. */
|
||||||
|
|
||||||
|
# ifndef emacs
|
||||||
|
# undef malloc
|
||||||
|
# define malloc xmalloc
|
||||||
|
# endif
|
||||||
|
extern pointer malloc ();
|
||||||
|
|
||||||
|
/* Define STACK_DIRECTION if you know the direction of stack
|
||||||
|
growth for your system; otherwise it will be automatically
|
||||||
|
deduced at run-time.
|
||||||
|
|
||||||
|
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||||
|
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||||
|
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||||
|
|
||||||
|
# ifndef STACK_DIRECTION
|
||||||
|
# define STACK_DIRECTION 0 /* Direction unknown. */
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if STACK_DIRECTION != 0
|
||||||
|
|
||||||
|
# define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
|
||||||
|
|
||||||
|
# else /* STACK_DIRECTION == 0; need run-time code. */
|
||||||
|
|
||||||
|
static int stack_dir; /* 1 or -1 once known. */
|
||||||
|
# define STACK_DIR stack_dir
|
||||||
|
|
||||||
|
static void
|
||||||
|
find_stack_direction ()
|
||||||
|
{
|
||||||
|
static char *addr = NULL; /* Address of first `dummy', once known. */
|
||||||
|
auto char dummy; /* To get stack address. */
|
||||||
|
|
||||||
|
if (addr == NULL)
|
||||||
|
{ /* Initial entry. */
|
||||||
|
addr = ADDRESS_FUNCTION (dummy);
|
||||||
|
|
||||||
|
find_stack_direction (); /* Recurse once. */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Second entry. */
|
||||||
|
if (ADDRESS_FUNCTION (dummy) > addr)
|
||||||
|
stack_dir = 1; /* Stack grew upward. */
|
||||||
|
else
|
||||||
|
stack_dir = -1; /* Stack grew downward. */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# endif /* STACK_DIRECTION == 0 */
|
||||||
|
|
||||||
|
/* An "alloca header" is used to:
|
||||||
|
(a) chain together all alloca'ed blocks;
|
||||||
|
(b) keep track of stack depth.
|
||||||
|
|
||||||
|
It is very important that sizeof(header) agree with malloc
|
||||||
|
alignment chunk size. The following default should work okay. */
|
||||||
|
|
||||||
|
# ifndef ALIGN_SIZE
|
||||||
|
# define ALIGN_SIZE sizeof(double)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
typedef union hdr
|
||||||
|
{
|
||||||
|
char align[ALIGN_SIZE]; /* To force sizeof(header). */
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
union hdr *next; /* For chaining headers. */
|
||||||
|
char *deep; /* For stack depth measure. */
|
||||||
|
} h;
|
||||||
|
} header;
|
||||||
|
|
||||||
|
static header *last_alloca_header = NULL; /* -> last alloca header. */
|
||||||
|
|
||||||
|
/* Return a pointer to at least SIZE bytes of storage,
|
||||||
|
which will be automatically reclaimed upon exit from
|
||||||
|
the procedure that called alloca. Originally, this space
|
||||||
|
was supposed to be taken from the current stack frame of the
|
||||||
|
caller, but that method cannot be made to work for some
|
||||||
|
implementations of C, for example under Gould's UTX/32. */
|
||||||
|
|
||||||
|
pointer
|
||||||
|
alloca (size_t size)
|
||||||
|
{
|
||||||
|
auto char probe; /* Probes stack depth: */
|
||||||
|
register char *depth = ADDRESS_FUNCTION (probe);
|
||||||
|
|
||||||
|
# if STACK_DIRECTION == 0
|
||||||
|
if (STACK_DIR == 0) /* Unknown growth direction. */
|
||||||
|
find_stack_direction ();
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Reclaim garbage, defined as all alloca'd storage that
|
||||||
|
was allocated from deeper in the stack than currently. */
|
||||||
|
|
||||||
|
{
|
||||||
|
register header *hp; /* Traverses linked list. */
|
||||||
|
|
||||||
|
# ifdef emacs
|
||||||
|
BLOCK_INPUT;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
for (hp = last_alloca_header; hp != NULL;)
|
||||||
|
if ((STACK_DIR > 0 && hp->h.deep > depth)
|
||||||
|
|| (STACK_DIR < 0 && hp->h.deep < depth))
|
||||||
|
{
|
||||||
|
register header *np = hp->h.next;
|
||||||
|
|
||||||
|
free ((pointer) hp); /* Collect garbage. */
|
||||||
|
|
||||||
|
hp = np; /* -> next header. */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break; /* Rest are not deeper. */
|
||||||
|
|
||||||
|
last_alloca_header = hp; /* -> last valid storage. */
|
||||||
|
|
||||||
|
# ifdef emacs
|
||||||
|
UNBLOCK_INPUT;
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if (size == 0)
|
||||||
|
return NULL; /* No allocation required. */
|
||||||
|
|
||||||
|
/* Allocate combined header + user data storage. */
|
||||||
|
|
||||||
|
{
|
||||||
|
register pointer new = malloc (sizeof (header) + size);
|
||||||
|
/* Address of header. */
|
||||||
|
|
||||||
|
if (new == 0)
|
||||||
|
abort();
|
||||||
|
|
||||||
|
((header *) new)->h.next = last_alloca_header;
|
||||||
|
((header *) new)->h.deep = depth;
|
||||||
|
|
||||||
|
last_alloca_header = (header *) new;
|
||||||
|
|
||||||
|
/* User storage begins just after header. */
|
||||||
|
|
||||||
|
return (pointer) ((char *) new + sizeof (header));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||||
|
|
||||||
|
# ifdef DEBUG_I00AFUNC
|
||||||
|
# include <stdio.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifndef CRAY_STACK
|
||||||
|
# define CRAY_STACK
|
||||||
|
# ifndef CRAY2
|
||||||
|
/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
|
||||||
|
struct stack_control_header
|
||||||
|
{
|
||||||
|
long shgrow:32; /* Number of times stack has grown. */
|
||||||
|
long shaseg:32; /* Size of increments to stack. */
|
||||||
|
long shhwm:32; /* High water mark of stack. */
|
||||||
|
long shsize:32; /* Current size of stack (all segments). */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* The stack segment linkage control information occurs at
|
||||||
|
the high-address end of a stack segment. (The stack
|
||||||
|
grows from low addresses to high addresses.) The initial
|
||||||
|
part of the stack segment linkage control information is
|
||||||
|
0200 (octal) words. This provides for register storage
|
||||||
|
for the routine which overflows the stack. */
|
||||||
|
|
||||||
|
struct stack_segment_linkage
|
||||||
|
{
|
||||||
|
long ss[0200]; /* 0200 overflow words. */
|
||||||
|
long sssize:32; /* Number of words in this segment. */
|
||||||
|
long ssbase:32; /* Offset to stack base. */
|
||||||
|
long:32;
|
||||||
|
long sspseg:32; /* Offset to linkage control of previous
|
||||||
|
segment of stack. */
|
||||||
|
long:32;
|
||||||
|
long sstcpt:32; /* Pointer to task common address block. */
|
||||||
|
long sscsnm; /* Private control structure number for
|
||||||
|
microtasking. */
|
||||||
|
long ssusr1; /* Reserved for user. */
|
||||||
|
long ssusr2; /* Reserved for user. */
|
||||||
|
long sstpid; /* Process ID for pid based multi-tasking. */
|
||||||
|
long ssgvup; /* Pointer to multitasking thread giveup. */
|
||||||
|
long sscray[7]; /* Reserved for Cray Research. */
|
||||||
|
long ssa0;
|
||||||
|
long ssa1;
|
||||||
|
long ssa2;
|
||||||
|
long ssa3;
|
||||||
|
long ssa4;
|
||||||
|
long ssa5;
|
||||||
|
long ssa6;
|
||||||
|
long ssa7;
|
||||||
|
long sss0;
|
||||||
|
long sss1;
|
||||||
|
long sss2;
|
||||||
|
long sss3;
|
||||||
|
long sss4;
|
||||||
|
long sss5;
|
||||||
|
long sss6;
|
||||||
|
long sss7;
|
||||||
|
};
|
||||||
|
|
||||||
|
# else /* CRAY2 */
|
||||||
|
/* The following structure defines the vector of words
|
||||||
|
returned by the STKSTAT library routine. */
|
||||||
|
struct stk_stat
|
||||||
|
{
|
||||||
|
long now; /* Current total stack size. */
|
||||||
|
long maxc; /* Amount of contiguous space which would
|
||||||
|
be required to satisfy the maximum
|
||||||
|
stack demand to date. */
|
||||||
|
long high_water; /* Stack high-water mark. */
|
||||||
|
long overflows; /* Number of stack overflow ($STKOFEN) calls. */
|
||||||
|
long hits; /* Number of internal buffer hits. */
|
||||||
|
long extends; /* Number of block extensions. */
|
||||||
|
long stko_mallocs; /* Block allocations by $STKOFEN. */
|
||||||
|
long underflows; /* Number of stack underflow calls ($STKRETN). */
|
||||||
|
long stko_free; /* Number of deallocations by $STKRETN. */
|
||||||
|
long stkm_free; /* Number of deallocations by $STKMRET. */
|
||||||
|
long segments; /* Current number of stack segments. */
|
||||||
|
long maxs; /* Maximum number of stack segments so far. */
|
||||||
|
long pad_size; /* Stack pad size. */
|
||||||
|
long current_address; /* Current stack segment address. */
|
||||||
|
long current_size; /* Current stack segment size. This
|
||||||
|
number is actually corrupted by STKSTAT to
|
||||||
|
include the fifteen word trailer area. */
|
||||||
|
long initial_address; /* Address of initial segment. */
|
||||||
|
long initial_size; /* Size of initial segment. */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* The following structure describes the data structure which trails
|
||||||
|
any stack segment. I think that the description in 'asdef' is
|
||||||
|
out of date. I only describe the parts that I am sure about. */
|
||||||
|
|
||||||
|
struct stk_trailer
|
||||||
|
{
|
||||||
|
long this_address; /* Address of this block. */
|
||||||
|
long this_size; /* Size of this block (does not include
|
||||||
|
this trailer). */
|
||||||
|
long unknown2;
|
||||||
|
long unknown3;
|
||||||
|
long link; /* Address of trailer block of previous
|
||||||
|
segment. */
|
||||||
|
long unknown5;
|
||||||
|
long unknown6;
|
||||||
|
long unknown7;
|
||||||
|
long unknown8;
|
||||||
|
long unknown9;
|
||||||
|
long unknown10;
|
||||||
|
long unknown11;
|
||||||
|
long unknown12;
|
||||||
|
long unknown13;
|
||||||
|
long unknown14;
|
||||||
|
};
|
||||||
|
|
||||||
|
# endif /* CRAY2 */
|
||||||
|
# endif /* not CRAY_STACK */
|
||||||
|
|
||||||
|
# ifdef CRAY2
|
||||||
|
/* Determine a "stack measure" for an arbitrary ADDRESS.
|
||||||
|
I doubt that "lint" will like this much. */
|
||||||
|
|
||||||
|
static long
|
||||||
|
i00afunc (long *address)
|
||||||
|
{
|
||||||
|
struct stk_stat status;
|
||||||
|
struct stk_trailer *trailer;
|
||||||
|
long *block, size;
|
||||||
|
long result = 0;
|
||||||
|
|
||||||
|
/* We want to iterate through all of the segments. The first
|
||||||
|
step is to get the stack status structure. We could do this
|
||||||
|
more quickly and more directly, perhaps, by referencing the
|
||||||
|
$LM00 common block, but I know that this works. */
|
||||||
|
|
||||||
|
STKSTAT (&status);
|
||||||
|
|
||||||
|
/* Set up the iteration. */
|
||||||
|
|
||||||
|
trailer = (struct stk_trailer *) (status.current_address
|
||||||
|
+ status.current_size
|
||||||
|
- 15);
|
||||||
|
|
||||||
|
/* There must be at least one stack segment. Therefore it is
|
||||||
|
a fatal error if "trailer" is null. */
|
||||||
|
|
||||||
|
if (trailer == 0)
|
||||||
|
abort ();
|
||||||
|
|
||||||
|
/* Discard segments that do not contain our argument address. */
|
||||||
|
|
||||||
|
while (trailer != 0)
|
||||||
|
{
|
||||||
|
block = (long *) trailer->this_address;
|
||||||
|
size = trailer->this_size;
|
||||||
|
if (block == 0 || size == 0)
|
||||||
|
abort ();
|
||||||
|
trailer = (struct stk_trailer *) trailer->link;
|
||||||
|
if ((block <= address) && (address < (block + size)))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the result to the offset in this segment and add the sizes
|
||||||
|
of all predecessor segments. */
|
||||||
|
|
||||||
|
result = address - block;
|
||||||
|
|
||||||
|
if (trailer == 0)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (trailer->this_size <= 0)
|
||||||
|
abort ();
|
||||||
|
result += trailer->this_size;
|
||||||
|
trailer = (struct stk_trailer *) trailer->link;
|
||||||
|
}
|
||||||
|
while (trailer != 0);
|
||||||
|
|
||||||
|
/* We are done. Note that if you present a bogus address (one
|
||||||
|
not in any segment), you will get a different number back, formed
|
||||||
|
from subtracting the address of the first block. This is probably
|
||||||
|
not what you want. */
|
||||||
|
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
|
||||||
|
# else /* not CRAY2 */
|
||||||
|
/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
|
||||||
|
Determine the number of the cell within the stack,
|
||||||
|
given the address of the cell. The purpose of this
|
||||||
|
routine is to linearize, in some sense, stack addresses
|
||||||
|
for alloca. */
|
||||||
|
|
||||||
|
static long
|
||||||
|
i00afunc (long address)
|
||||||
|
{
|
||||||
|
long stkl = 0;
|
||||||
|
|
||||||
|
long size, pseg, this_segment, stack;
|
||||||
|
long result = 0;
|
||||||
|
|
||||||
|
struct stack_segment_linkage *ssptr;
|
||||||
|
|
||||||
|
/* Register B67 contains the address of the end of the
|
||||||
|
current stack segment. If you (as a subprogram) store
|
||||||
|
your registers on the stack and find that you are past
|
||||||
|
the contents of B67, you have overflowed the segment.
|
||||||
|
|
||||||
|
B67 also points to the stack segment linkage control
|
||||||
|
area, which is what we are really interested in. */
|
||||||
|
|
||||||
|
stkl = CRAY_STACKSEG_END ();
|
||||||
|
ssptr = (struct stack_segment_linkage *) stkl;
|
||||||
|
|
||||||
|
/* If one subtracts 'size' from the end of the segment,
|
||||||
|
one has the address of the first word of the segment.
|
||||||
|
|
||||||
|
If this is not the first segment, 'pseg' will be
|
||||||
|
nonzero. */
|
||||||
|
|
||||||
|
pseg = ssptr->sspseg;
|
||||||
|
size = ssptr->sssize;
|
||||||
|
|
||||||
|
this_segment = stkl - size;
|
||||||
|
|
||||||
|
/* It is possible that calling this routine itself caused
|
||||||
|
a stack overflow. Discard stack segments which do not
|
||||||
|
contain the target address. */
|
||||||
|
|
||||||
|
while (!(this_segment <= address && address <= stkl))
|
||||||
|
{
|
||||||
|
# ifdef DEBUG_I00AFUNC
|
||||||
|
fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
|
||||||
|
# endif
|
||||||
|
if (pseg == 0)
|
||||||
|
break;
|
||||||
|
stkl = stkl - pseg;
|
||||||
|
ssptr = (struct stack_segment_linkage *) stkl;
|
||||||
|
size = ssptr->sssize;
|
||||||
|
pseg = ssptr->sspseg;
|
||||||
|
this_segment = stkl - size;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = address - this_segment;
|
||||||
|
|
||||||
|
/* If you subtract pseg from the current end of the stack,
|
||||||
|
you get the address of the previous stack segment's end.
|
||||||
|
This seems a little convoluted to me, but I'll bet you save
|
||||||
|
a cycle somewhere. */
|
||||||
|
|
||||||
|
while (pseg != 0)
|
||||||
|
{
|
||||||
|
# ifdef DEBUG_I00AFUNC
|
||||||
|
fprintf (stderr, "%011o %011o\n", pseg, size);
|
||||||
|
# endif
|
||||||
|
stkl = stkl - pseg;
|
||||||
|
ssptr = (struct stack_segment_linkage *) stkl;
|
||||||
|
size = ssptr->sssize;
|
||||||
|
pseg = ssptr->sspseg;
|
||||||
|
result += size;
|
||||||
|
}
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
|
||||||
|
# endif /* not CRAY2 */
|
||||||
|
# endif /* CRAY */
|
||||||
|
|
||||||
|
# endif /* no alloca */
|
||||||
|
#endif /* not GCC version 2 */
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
.TH ANSI2KNR 1 "19 Jan 1996"
|
||||||
|
.SH NAME
|
||||||
|
ansi2knr \- convert ANSI C to Kernighan & Ritchie C
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.I ansi2knr
|
||||||
|
[--varargs] input_file [output_file]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
If no output_file is supplied, output goes to stdout.
|
||||||
|
.br
|
||||||
|
There are no error messages.
|
||||||
|
.sp
|
||||||
|
.I ansi2knr
|
||||||
|
recognizes function definitions by seeing a non-keyword identifier at the left
|
||||||
|
margin, followed by a left parenthesis, with a right parenthesis as the last
|
||||||
|
character on the line, and with a left brace as the first token on the
|
||||||
|
following line (ignoring possible intervening comments). It will recognize a
|
||||||
|
multi-line header provided that no intervening line ends with a left or right
|
||||||
|
brace or a semicolon. These algorithms ignore whitespace and comments, except
|
||||||
|
that the function name must be the first thing on the line.
|
||||||
|
.sp
|
||||||
|
The following constructs will confuse it:
|
||||||
|
.br
|
||||||
|
- Any other construct that starts at the left margin and follows the
|
||||||
|
above syntax (such as a macro or function call).
|
||||||
|
.br
|
||||||
|
- Some macros that tinker with the syntax of the function header.
|
||||||
|
.sp
|
||||||
|
The --varargs switch is obsolete, and is recognized only for
|
||||||
|
backwards compatibility. The present version of
|
||||||
|
.I ansi2knr
|
||||||
|
will always attempt to convert a ... argument to va_alist and va_dcl.
|
||||||
|
.SH AUTHOR
|
||||||
|
L. Peter Deutsch <[email protected]> wrote the original ansi2knr and
|
||||||
|
continues to maintain the current version; most of the code in the current
|
||||||
|
version is his work. ansi2knr also includes contributions by Francois
|
||||||
|
Pinard <[email protected]> and Jim Avera <[email protected]>.
|
||||||
+739
@@ -0,0 +1,739 @@
|
|||||||
|
/* Copyright (C) 1989, 2000 Aladdin Enterprises. All rights reserved. */
|
||||||
|
|
||||||
|
/*$Id$*/
|
||||||
|
/* Convert ANSI C function definitions to K&R ("traditional C") syntax */
|
||||||
|
|
||||||
|
/*
|
||||||
|
ansi2knr is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY. No author or distributor accepts responsibility to anyone for the
|
||||||
|
consequences of using it or for whether it serves any particular purpose or
|
||||||
|
works at all, unless he says so in writing. Refer to the GNU General Public
|
||||||
|
License (the "GPL") for full details.
|
||||||
|
|
||||||
|
Everyone is granted permission to copy, modify and redistribute ansi2knr,
|
||||||
|
but only under the conditions described in the GPL. A copy of this license
|
||||||
|
is supposed to have been given to you along with ansi2knr so you can know
|
||||||
|
your rights and responsibilities. It should be in a file named COPYLEFT,
|
||||||
|
or, if there is no file named COPYLEFT, a file named COPYING. Among other
|
||||||
|
things, the copyright notice and this notice must be preserved on all
|
||||||
|
copies.
|
||||||
|
|
||||||
|
We explicitly state here what we believe is already implied by the GPL: if
|
||||||
|
the ansi2knr program is distributed as a separate set of sources and a
|
||||||
|
separate executable file which are aggregated on a storage medium together
|
||||||
|
with another program, this in itself does not bring the other program under
|
||||||
|
the GPL, nor does the mere fact that such a program or the procedures for
|
||||||
|
constructing it invoke the ansi2knr executable bring any other part of the
|
||||||
|
program under the GPL.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Usage:
|
||||||
|
ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]
|
||||||
|
* --filename provides the file name for the #line directive in the output,
|
||||||
|
* overriding input_file (if present).
|
||||||
|
* If no input_file is supplied, input is read from stdin.
|
||||||
|
* If no output_file is supplied, output goes to stdout.
|
||||||
|
* There are no error messages.
|
||||||
|
*
|
||||||
|
* ansi2knr recognizes function definitions by seeing a non-keyword
|
||||||
|
* identifier at the left margin, followed by a left parenthesis, with a
|
||||||
|
* right parenthesis as the last character on the line, and with a left
|
||||||
|
* brace as the first token on the following line (ignoring possible
|
||||||
|
* intervening comments and/or preprocessor directives), except that a line
|
||||||
|
* consisting of only
|
||||||
|
* identifier1(identifier2)
|
||||||
|
* will not be considered a function definition unless identifier2 is
|
||||||
|
* the word "void", and a line consisting of
|
||||||
|
* identifier1(identifier2, <<arbitrary>>)
|
||||||
|
* will not be considered a function definition.
|
||||||
|
* ansi2knr will recognize a multi-line header provided that no intervening
|
||||||
|
* line ends with a left or right brace or a semicolon. These algorithms
|
||||||
|
* ignore whitespace, comments, and preprocessor directives, except that
|
||||||
|
* the function name must be the first thing on the line. The following
|
||||||
|
* constructs will confuse it:
|
||||||
|
* - Any other construct that starts at the left margin and
|
||||||
|
* follows the above syntax (such as a macro or function call).
|
||||||
|
* - Some macros that tinker with the syntax of function headers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The original and principal author of ansi2knr is L. Peter Deutsch
|
||||||
|
* <[email protected]>. Other authors are noted in the change history
|
||||||
|
* that follows (in reverse chronological order):
|
||||||
|
|
||||||
|
lpd 2000-04-12 backs out Eggert's changes because of bugs:
|
||||||
|
- concatlits didn't declare the type of its bufend argument;
|
||||||
|
- concatlits didn't't recognize when it was inside a comment;
|
||||||
|
- scanstring could scan backward past the beginning of the string; when
|
||||||
|
- the check for \ + newline in scanstring was unnecessary.
|
||||||
|
|
||||||
|
2000-03-05 Paul Eggert <[email protected]>
|
||||||
|
|
||||||
|
Add support for concatenated string literals.
|
||||||
|
* ansi2knr.c (concatlits): New decl.
|
||||||
|
(main): Invoke concatlits to concatenate string literals.
|
||||||
|
(scanstring): Handle backslash-newline correctly. Work with
|
||||||
|
character constants. Fix bug when scanning backwards through
|
||||||
|
backslash-quote. Check for unterminated strings.
|
||||||
|
(convert1): Parse character constants, too.
|
||||||
|
(appendline, concatlits): New functions.
|
||||||
|
* ansi2knr.1: Document this.
|
||||||
|
|
||||||
|
lpd 1999-08-17 added code to allow preprocessor directives
|
||||||
|
wherever comments are allowed
|
||||||
|
lpd 1999-04-12 added minor fixes from Pavel Roskin
|
||||||
|
<[email protected]> for clean compilation with
|
||||||
|
gcc -W -Wall
|
||||||
|
lpd 1999-03-22 added hack to recognize lines consisting of
|
||||||
|
identifier1(identifier2, xxx) as *not* being procedures
|
||||||
|
lpd 1999-02-03 made indentation of preprocessor commands consistent
|
||||||
|
lpd 1999-01-28 fixed two bugs: a '/' in an argument list caused an
|
||||||
|
endless loop; quoted strings within an argument list
|
||||||
|
confused the parser
|
||||||
|
lpd 1999-01-24 added a check for write errors on the output,
|
||||||
|
suggested by Jim Meyering <[email protected]>
|
||||||
|
lpd 1998-11-09 added further hack to recognize identifier(void)
|
||||||
|
as being a procedure
|
||||||
|
lpd 1998-10-23 added hack to recognize lines consisting of
|
||||||
|
identifier1(identifier2) as *not* being procedures
|
||||||
|
lpd 1997-12-08 made input_file optional; only closes input and/or
|
||||||
|
output file if not stdin or stdout respectively; prints
|
||||||
|
usage message on stderr rather than stdout; adds
|
||||||
|
--filename switch (changes suggested by
|
||||||
|
<[email protected]>)
|
||||||
|
lpd 1996-01-21 added code to cope with not HAVE_CONFIG_H and with
|
||||||
|
compilers that don't understand void, as suggested by
|
||||||
|
Tom Lane
|
||||||
|
lpd 1996-01-15 changed to require that the first non-comment token
|
||||||
|
on the line following a function header be a left brace,
|
||||||
|
to reduce sensitivity to macros, as suggested by Tom Lane
|
||||||
|
<[email protected]>
|
||||||
|
lpd 1995-06-22 removed #ifndefs whose sole purpose was to define
|
||||||
|
undefined preprocessor symbols as 0; changed all #ifdefs
|
||||||
|
for configuration symbols to #ifs
|
||||||
|
lpd 1995-04-05 changed copyright notice to make it clear that
|
||||||
|
including ansi2knr in a program does not bring the entire
|
||||||
|
program under the GPL
|
||||||
|
lpd 1994-12-18 added conditionals for systems where ctype macros
|
||||||
|
don't handle 8-bit characters properly, suggested by
|
||||||
|
Francois Pinard <[email protected]>;
|
||||||
|
removed --varargs switch (this is now the default)
|
||||||
|
lpd 1994-10-10 removed CONFIG_BROKETS conditional
|
||||||
|
lpd 1994-07-16 added some conditionals to help GNU `configure',
|
||||||
|
suggested by Francois Pinard <[email protected]>;
|
||||||
|
properly erase prototype args in function parameters,
|
||||||
|
contributed by Jim Avera <[email protected]>;
|
||||||
|
correct error in writeblanks (it shouldn't erase EOLs)
|
||||||
|
lpd 1989-xx-xx original version
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Most of the conditionals here are to make ansi2knr work with */
|
||||||
|
/* or without the GNU configure machinery. */
|
||||||
|
|
||||||
|
#if HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#if HAVE_CONFIG_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
For properly autoconfiguring ansi2knr, use AC_CONFIG_HEADER(config.h).
|
||||||
|
This will define HAVE_CONFIG_H and so, activate the following lines.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# if STDC_HEADERS || HAVE_STRING_H
|
||||||
|
# include <string.h>
|
||||||
|
# else
|
||||||
|
# include <strings.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#else /* not HAVE_CONFIG_H */
|
||||||
|
|
||||||
|
/* Otherwise do it the hard way */
|
||||||
|
|
||||||
|
# ifdef BSD
|
||||||
|
# include <strings.h>
|
||||||
|
# else
|
||||||
|
# ifdef VMS
|
||||||
|
extern int strlen(), strncmp();
|
||||||
|
# else
|
||||||
|
# include <string.h>
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif /* not HAVE_CONFIG_H */
|
||||||
|
|
||||||
|
#if STDC_HEADERS
|
||||||
|
# include <stdlib.h>
|
||||||
|
#else
|
||||||
|
/*
|
||||||
|
malloc and free should be declared in stdlib.h,
|
||||||
|
but if you've got a K&R compiler, they probably aren't.
|
||||||
|
*/
|
||||||
|
# ifdef MSDOS
|
||||||
|
# include <malloc.h>
|
||||||
|
# else
|
||||||
|
# ifdef VMS
|
||||||
|
extern char *malloc();
|
||||||
|
extern void free();
|
||||||
|
# else
|
||||||
|
extern char *malloc();
|
||||||
|
extern int free();
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define NULL (for *very* old compilers). */
|
||||||
|
#ifndef NULL
|
||||||
|
# define NULL (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The ctype macros don't always handle 8-bit characters correctly.
|
||||||
|
* Compensate for this here.
|
||||||
|
*/
|
||||||
|
#ifdef isascii
|
||||||
|
# undef HAVE_ISASCII /* just in case */
|
||||||
|
# define HAVE_ISASCII 1
|
||||||
|
#else
|
||||||
|
#endif
|
||||||
|
#if STDC_HEADERS || !HAVE_ISASCII
|
||||||
|
# define is_ascii(c) 1
|
||||||
|
#else
|
||||||
|
# define is_ascii(c) isascii(c)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define is_space(c) (is_ascii(c) && isspace(c))
|
||||||
|
#define is_alpha(c) (is_ascii(c) && isalpha(c))
|
||||||
|
#define is_alnum(c) (is_ascii(c) && isalnum(c))
|
||||||
|
|
||||||
|
/* Scanning macros */
|
||||||
|
#define isidchar(ch) (is_alnum(ch) || (ch) == '_')
|
||||||
|
#define isidfirstchar(ch) (is_alpha(ch) || (ch) == '_')
|
||||||
|
|
||||||
|
/* Forward references */
|
||||||
|
char *ppdirforward();
|
||||||
|
char *ppdirbackward();
|
||||||
|
char *skipspace();
|
||||||
|
char *scanstring();
|
||||||
|
int writeblanks();
|
||||||
|
int test1();
|
||||||
|
int convert1();
|
||||||
|
|
||||||
|
/* The main program */
|
||||||
|
int
|
||||||
|
main(argc, argv)
|
||||||
|
int argc;
|
||||||
|
char *argv[];
|
||||||
|
{ FILE *in = stdin;
|
||||||
|
FILE *out = stdout;
|
||||||
|
char *filename = 0;
|
||||||
|
char *program_name = argv[0];
|
||||||
|
char *output_name = 0;
|
||||||
|
#define bufsize 5000 /* arbitrary size */
|
||||||
|
char *buf;
|
||||||
|
char *line;
|
||||||
|
char *more;
|
||||||
|
char *usage =
|
||||||
|
"Usage: ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]\n";
|
||||||
|
/*
|
||||||
|
* In previous versions, ansi2knr recognized a --varargs switch.
|
||||||
|
* If this switch was supplied, ansi2knr would attempt to convert
|
||||||
|
* a ... argument to va_alist and va_dcl; if this switch was not
|
||||||
|
* supplied, ansi2knr would simply drop any such arguments.
|
||||||
|
* Now, ansi2knr always does this conversion, and we only
|
||||||
|
* check for this switch for backward compatibility.
|
||||||
|
*/
|
||||||
|
int convert_varargs = 1;
|
||||||
|
int output_error;
|
||||||
|
|
||||||
|
while ( argc > 1 && argv[1][0] == '-' ) {
|
||||||
|
if ( !strcmp(argv[1], "--varargs") ) {
|
||||||
|
convert_varargs = 1;
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( !strcmp(argv[1], "--filename") && argc > 2 ) {
|
||||||
|
filename = argv[2];
|
||||||
|
argc -= 2;
|
||||||
|
argv += 2;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
fprintf(stderr, "%s: Unrecognized switch: %s\n", program_name,
|
||||||
|
argv[1]);
|
||||||
|
fprintf(stderr, usage);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
switch ( argc )
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
fprintf(stderr, usage);
|
||||||
|
exit(0);
|
||||||
|
case 3:
|
||||||
|
output_name = argv[2];
|
||||||
|
out = fopen(output_name, "w");
|
||||||
|
if ( out == NULL ) {
|
||||||
|
fprintf(stderr, "%s: Cannot open output file %s\n",
|
||||||
|
program_name, output_name);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
/* falls through */
|
||||||
|
case 2:
|
||||||
|
in = fopen(argv[1], "r");
|
||||||
|
if ( in == NULL ) {
|
||||||
|
fprintf(stderr, "%s: Cannot open input file %s\n",
|
||||||
|
program_name, argv[1]);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if ( filename == 0 )
|
||||||
|
filename = argv[1];
|
||||||
|
/* falls through */
|
||||||
|
case 1:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ( filename )
|
||||||
|
fprintf(out, "#line 1 \"%s\"\n", filename);
|
||||||
|
buf = malloc(bufsize);
|
||||||
|
if ( buf == NULL )
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Unable to allocate read buffer!\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
line = buf;
|
||||||
|
while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL )
|
||||||
|
{
|
||||||
|
test: line += strlen(line);
|
||||||
|
switch ( test1(buf) )
|
||||||
|
{
|
||||||
|
case 2: /* a function header */
|
||||||
|
convert1(buf, out, 1, convert_varargs);
|
||||||
|
break;
|
||||||
|
case 1: /* a function */
|
||||||
|
/* Check for a { at the start of the next line. */
|
||||||
|
more = ++line;
|
||||||
|
f: if ( line >= buf + (bufsize - 1) ) /* overflow check */
|
||||||
|
goto wl;
|
||||||
|
if ( fgets(line, (unsigned)(buf + bufsize - line), in) == NULL )
|
||||||
|
goto wl;
|
||||||
|
switch ( *skipspace(ppdirforward(more), 1) )
|
||||||
|
{
|
||||||
|
case '{':
|
||||||
|
/* Definitely a function header. */
|
||||||
|
convert1(buf, out, 0, convert_varargs);
|
||||||
|
fputs(more, out);
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
/* The next line was blank or a comment: */
|
||||||
|
/* keep scanning for a non-comment. */
|
||||||
|
line += strlen(line);
|
||||||
|
goto f;
|
||||||
|
default:
|
||||||
|
/* buf isn't a function header, but */
|
||||||
|
/* more might be. */
|
||||||
|
fputs(buf, out);
|
||||||
|
strcpy(buf, more);
|
||||||
|
line = buf;
|
||||||
|
goto test;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case -1: /* maybe the start of a function */
|
||||||
|
if ( line != buf + (bufsize - 1) ) /* overflow check */
|
||||||
|
continue;
|
||||||
|
/* falls through */
|
||||||
|
default: /* not a function */
|
||||||
|
wl: fputs(buf, out);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
line = buf;
|
||||||
|
}
|
||||||
|
if ( line != buf )
|
||||||
|
fputs(buf, out);
|
||||||
|
free(buf);
|
||||||
|
if ( output_name ) {
|
||||||
|
output_error = ferror(out);
|
||||||
|
output_error |= fclose(out);
|
||||||
|
} else { /* out == stdout */
|
||||||
|
fflush(out);
|
||||||
|
output_error = ferror(out);
|
||||||
|
}
|
||||||
|
if ( output_error ) {
|
||||||
|
fprintf(stderr, "%s: error writing to %s\n", program_name,
|
||||||
|
(output_name ? output_name : "stdout"));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if ( in != stdin )
|
||||||
|
fclose(in);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Skip forward or backward over one or more preprocessor directives.
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
ppdirforward(p)
|
||||||
|
char *p;
|
||||||
|
{
|
||||||
|
for (; *p == '#'; ++p) {
|
||||||
|
for (; *p != '\r' && *p != '\n'; ++p)
|
||||||
|
if (*p == 0)
|
||||||
|
return p;
|
||||||
|
if (*p == '\r' && p[1] == '\n')
|
||||||
|
++p;
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
char *
|
||||||
|
ppdirbackward(p, limit)
|
||||||
|
char *p;
|
||||||
|
char *limit;
|
||||||
|
{
|
||||||
|
char *np = p;
|
||||||
|
|
||||||
|
for (;; p = --np) {
|
||||||
|
if (*np == '\n' && np[-1] == '\r')
|
||||||
|
--np;
|
||||||
|
for (; np > limit && np[-1] != '\r' && np[-1] != '\n'; --np)
|
||||||
|
if (np[-1] == 0)
|
||||||
|
return np;
|
||||||
|
if (*np != '#')
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Skip over whitespace, comments, and preprocessor directives,
|
||||||
|
* in either direction.
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
skipspace(p, dir)
|
||||||
|
char *p;
|
||||||
|
int dir; /* 1 for forward, -1 for backward */
|
||||||
|
{
|
||||||
|
for ( ; ; ) {
|
||||||
|
while ( is_space(*p) )
|
||||||
|
p += dir;
|
||||||
|
if ( !(*p == '/' && p[dir] == '*') )
|
||||||
|
break;
|
||||||
|
p += dir; p += dir;
|
||||||
|
while ( !(*p == '*' && p[dir] == '/') ) {
|
||||||
|
if ( *p == 0 )
|
||||||
|
return p; /* multi-line comment?? */
|
||||||
|
p += dir;
|
||||||
|
}
|
||||||
|
p += dir; p += dir;
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Scan over a quoted string, in either direction. */
|
||||||
|
char *
|
||||||
|
scanstring(p, dir)
|
||||||
|
char *p;
|
||||||
|
int dir;
|
||||||
|
{
|
||||||
|
for (p += dir; ; p += dir)
|
||||||
|
if (*p == '"' && p[-dir] != '\\')
|
||||||
|
return p + dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write blanks over part of a string.
|
||||||
|
* Don't overwrite end-of-line characters.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
writeblanks(start, end)
|
||||||
|
char *start;
|
||||||
|
char *end;
|
||||||
|
{ char *p;
|
||||||
|
for ( p = start; p < end; p++ )
|
||||||
|
if ( *p != '\r' && *p != '\n' )
|
||||||
|
*p = ' ';
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test whether the string in buf is a function definition.
|
||||||
|
* The string may contain and/or end with a newline.
|
||||||
|
* Return as follows:
|
||||||
|
* 0 - definitely not a function definition;
|
||||||
|
* 1 - definitely a function definition;
|
||||||
|
* 2 - definitely a function prototype (NOT USED);
|
||||||
|
* -1 - may be the beginning of a function definition,
|
||||||
|
* append another line and look again.
|
||||||
|
* The reason we don't attempt to convert function prototypes is that
|
||||||
|
* Ghostscript's declaration-generating macros look too much like
|
||||||
|
* prototypes, and confuse the algorithms.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
test1(buf)
|
||||||
|
char *buf;
|
||||||
|
{ char *p = buf;
|
||||||
|
char *bend;
|
||||||
|
char *endfn;
|
||||||
|
int contin;
|
||||||
|
|
||||||
|
if ( !isidfirstchar(*p) )
|
||||||
|
return 0; /* no name at left margin */
|
||||||
|
bend = skipspace(ppdirbackward(buf + strlen(buf) - 1, buf), -1);
|
||||||
|
switch ( *bend )
|
||||||
|
{
|
||||||
|
case ';': contin = 0 /*2*/; break;
|
||||||
|
case ')': contin = 1; break;
|
||||||
|
case '{': return 0; /* not a function */
|
||||||
|
case '}': return 0; /* not a function */
|
||||||
|
default: contin = -1;
|
||||||
|
}
|
||||||
|
while ( isidchar(*p) )
|
||||||
|
p++;
|
||||||
|
endfn = p;
|
||||||
|
p = skipspace(p, 1);
|
||||||
|
if ( *p++ != '(' )
|
||||||
|
return 0; /* not a function */
|
||||||
|
p = skipspace(p, 1);
|
||||||
|
if ( *p == ')' )
|
||||||
|
return 0; /* no parameters */
|
||||||
|
/* Check that the apparent function name isn't a keyword. */
|
||||||
|
/* We only need to check for keywords that could be followed */
|
||||||
|
/* by a left parenthesis (which, unfortunately, is most of them). */
|
||||||
|
{ static char *words[] =
|
||||||
|
{ "asm", "auto", "case", "char", "const", "double",
|
||||||
|
"extern", "float", "for", "if", "int", "long",
|
||||||
|
"register", "return", "short", "signed", "sizeof",
|
||||||
|
"static", "switch", "typedef", "unsigned",
|
||||||
|
"void", "volatile", "while", 0
|
||||||
|
};
|
||||||
|
char **key = words;
|
||||||
|
char *kp;
|
||||||
|
unsigned len = endfn - buf;
|
||||||
|
|
||||||
|
while ( (kp = *key) != 0 )
|
||||||
|
{ if ( strlen(kp) == len && !strncmp(kp, buf, len) )
|
||||||
|
return 0; /* name is a keyword */
|
||||||
|
key++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
char *id = p;
|
||||||
|
int len;
|
||||||
|
/*
|
||||||
|
* Check for identifier1(identifier2) and not
|
||||||
|
* identifier1(void), or identifier1(identifier2, xxxx).
|
||||||
|
*/
|
||||||
|
|
||||||
|
while ( isidchar(*p) )
|
||||||
|
p++;
|
||||||
|
len = p - id;
|
||||||
|
p = skipspace(p, 1);
|
||||||
|
if (*p == ',' ||
|
||||||
|
(*p == ')' && (len != 4 || strncmp(id, "void", 4)))
|
||||||
|
)
|
||||||
|
return 0; /* not a function */
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* If the last significant character was a ), we need to count
|
||||||
|
* parentheses, because it might be part of a formal parameter
|
||||||
|
* that is a procedure.
|
||||||
|
*/
|
||||||
|
if (contin > 0) {
|
||||||
|
int level = 0;
|
||||||
|
|
||||||
|
for (p = skipspace(buf, 1); *p; p = skipspace(p + 1, 1))
|
||||||
|
level += (*p == '(' ? 1 : *p == ')' ? -1 : 0);
|
||||||
|
if (level > 0)
|
||||||
|
contin = -1;
|
||||||
|
}
|
||||||
|
return contin;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Convert a recognized function definition or header to K&R syntax. */
|
||||||
|
int
|
||||||
|
convert1(buf, out, header, convert_varargs)
|
||||||
|
char *buf;
|
||||||
|
FILE *out;
|
||||||
|
int header; /* Boolean */
|
||||||
|
int convert_varargs; /* Boolean */
|
||||||
|
{ char *endfn;
|
||||||
|
char *p;
|
||||||
|
/*
|
||||||
|
* The breaks table contains pointers to the beginning and end
|
||||||
|
* of each argument.
|
||||||
|
*/
|
||||||
|
char **breaks;
|
||||||
|
unsigned num_breaks = 2; /* for testing */
|
||||||
|
char **btop;
|
||||||
|
char **bp;
|
||||||
|
char **ap;
|
||||||
|
char *vararg = 0;
|
||||||
|
|
||||||
|
/* Pre-ANSI implementations don't agree on whether strchr */
|
||||||
|
/* is called strchr or index, so we open-code it here. */
|
||||||
|
for ( endfn = buf; *(endfn++) != '('; )
|
||||||
|
;
|
||||||
|
top: p = endfn;
|
||||||
|
breaks = (char **)malloc(sizeof(char *) * num_breaks * 2);
|
||||||
|
if ( breaks == NULL )
|
||||||
|
{ /* Couldn't allocate break table, give up */
|
||||||
|
fprintf(stderr, "Unable to allocate break table!\n");
|
||||||
|
fputs(buf, out);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
btop = breaks + num_breaks * 2 - 2;
|
||||||
|
bp = breaks;
|
||||||
|
/* Parse the argument list */
|
||||||
|
do
|
||||||
|
{ int level = 0;
|
||||||
|
char *lp = NULL;
|
||||||
|
char *rp = NULL;
|
||||||
|
char *end = NULL;
|
||||||
|
|
||||||
|
if ( bp >= btop )
|
||||||
|
{ /* Filled up break table. */
|
||||||
|
/* Allocate a bigger one and start over. */
|
||||||
|
free((char *)breaks);
|
||||||
|
num_breaks <<= 1;
|
||||||
|
goto top;
|
||||||
|
}
|
||||||
|
*bp++ = p;
|
||||||
|
/* Find the end of the argument */
|
||||||
|
for ( ; end == NULL; p++ )
|
||||||
|
{ switch(*p)
|
||||||
|
{
|
||||||
|
case ',':
|
||||||
|
if ( !level ) end = p;
|
||||||
|
break;
|
||||||
|
case '(':
|
||||||
|
if ( !level ) lp = p;
|
||||||
|
level++;
|
||||||
|
break;
|
||||||
|
case ')':
|
||||||
|
if ( --level < 0 ) end = p;
|
||||||
|
else rp = p;
|
||||||
|
break;
|
||||||
|
case '/':
|
||||||
|
if (p[1] == '*')
|
||||||
|
p = skipspace(p, 1) - 1;
|
||||||
|
break;
|
||||||
|
case '"':
|
||||||
|
p = scanstring(p, 1) - 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Erase any embedded prototype parameters. */
|
||||||
|
if ( lp && rp )
|
||||||
|
writeblanks(lp + 1, rp);
|
||||||
|
p--; /* back up over terminator */
|
||||||
|
/* Find the name being declared. */
|
||||||
|
/* This is complicated because of procedure and */
|
||||||
|
/* array modifiers. */
|
||||||
|
for ( ; ; )
|
||||||
|
{ p = skipspace(p - 1, -1);
|
||||||
|
switch ( *p )
|
||||||
|
{
|
||||||
|
case ']': /* skip array dimension(s) */
|
||||||
|
case ')': /* skip procedure args OR name */
|
||||||
|
{ int level = 1;
|
||||||
|
while ( level )
|
||||||
|
switch ( *--p )
|
||||||
|
{
|
||||||
|
case ']': case ')':
|
||||||
|
level++;
|
||||||
|
break;
|
||||||
|
case '[': case '(':
|
||||||
|
level--;
|
||||||
|
break;
|
||||||
|
case '/':
|
||||||
|
if (p > buf && p[-1] == '*')
|
||||||
|
p = skipspace(p, -1) + 1;
|
||||||
|
break;
|
||||||
|
case '"':
|
||||||
|
p = scanstring(p, -1) + 1;
|
||||||
|
break;
|
||||||
|
default: ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( *p == '(' && *skipspace(p + 1, 1) == '*' )
|
||||||
|
{ /* We found the name being declared */
|
||||||
|
while ( !isidfirstchar(*p) )
|
||||||
|
p = skipspace(p, 1) + 1;
|
||||||
|
goto found;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
goto found;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
found: if ( *p == '.' && p[-1] == '.' && p[-2] == '.' )
|
||||||
|
{ if ( convert_varargs )
|
||||||
|
{ *bp++ = "va_alist";
|
||||||
|
vararg = p-2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ p++;
|
||||||
|
if ( bp == breaks + 1 ) /* sole argument */
|
||||||
|
writeblanks(breaks[0], p);
|
||||||
|
else
|
||||||
|
writeblanks(bp[-1] - 1, p);
|
||||||
|
bp--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ while ( isidchar(*p) ) p--;
|
||||||
|
*bp++ = p+1;
|
||||||
|
}
|
||||||
|
p = end;
|
||||||
|
}
|
||||||
|
while ( *p++ == ',' );
|
||||||
|
*bp = p;
|
||||||
|
/* Make a special check for 'void' arglist */
|
||||||
|
if ( bp == breaks+2 )
|
||||||
|
{ p = skipspace(breaks[0], 1);
|
||||||
|
if ( !strncmp(p, "void", 4) )
|
||||||
|
{ p = skipspace(p+4, 1);
|
||||||
|
if ( p == breaks[2] - 1 )
|
||||||
|
{ bp = breaks; /* yup, pretend arglist is empty */
|
||||||
|
writeblanks(breaks[0], p + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Put out the function name and left parenthesis. */
|
||||||
|
p = buf;
|
||||||
|
while ( p != endfn ) putc(*p, out), p++;
|
||||||
|
/* Put out the declaration. */
|
||||||
|
if ( header )
|
||||||
|
{ fputs(");", out);
|
||||||
|
for ( p = breaks[0]; *p; p++ )
|
||||||
|
if ( *p == '\r' || *p == '\n' )
|
||||||
|
putc(*p, out);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ for ( ap = breaks+1; ap < bp; ap += 2 )
|
||||||
|
{ p = *ap;
|
||||||
|
while ( isidchar(*p) )
|
||||||
|
putc(*p, out), p++;
|
||||||
|
if ( ap < bp - 1 )
|
||||||
|
fputs(", ", out);
|
||||||
|
}
|
||||||
|
fputs(") ", out);
|
||||||
|
/* Put out the argument declarations */
|
||||||
|
for ( ap = breaks+2; ap <= bp; ap += 2 )
|
||||||
|
(*ap)[-1] = ';';
|
||||||
|
if ( vararg != 0 )
|
||||||
|
{ *vararg = 0;
|
||||||
|
fputs(breaks[0], out); /* any prior args */
|
||||||
|
fputs("va_dcl", out); /* the final arg */
|
||||||
|
fputs(bp[0], out);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fputs(breaks[0], out);
|
||||||
|
}
|
||||||
|
free((char *)breaks);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
+400
@@ -0,0 +1,400 @@
|
|||||||
|
/* Error handler for noninteractive utilities
|
||||||
|
Copyright (C) 1990-1998, 2000, 2001 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library. Its master source is NOT part of
|
||||||
|
the C library, however. The master source lives in /gd/gnu/lib.
|
||||||
|
|
||||||
|
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. */
|
||||||
|
|
||||||
|
/* Written by David MacKenzie <[email protected]>. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#if HAVE_LIBINTL_H
|
||||||
|
# include <libintl.h>
|
||||||
|
#endif
|
||||||
|
#ifdef _LIBC
|
||||||
|
# include <wchar.h>
|
||||||
|
# define mbsrtowcs __mbsrtowcs
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC
|
||||||
|
# if __STDC__
|
||||||
|
# include <stdarg.h>
|
||||||
|
# define VA_START(args, lastarg) va_start(args, lastarg)
|
||||||
|
# else
|
||||||
|
# include <varargs.h>
|
||||||
|
# define VA_START(args, lastarg) va_start(args)
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define va_alist a1, a2, a3, a4, a5, a6, a7, a8
|
||||||
|
# define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if STDC_HEADERS || _LIBC
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <string.h>
|
||||||
|
#else
|
||||||
|
void exit ();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "error.h"
|
||||||
|
|
||||||
|
#ifndef _
|
||||||
|
# define _(String) String
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* If NULL, error will flush stdout, then print on stderr the program
|
||||||
|
name, a colon and a space. Otherwise, error will call this
|
||||||
|
function without parameters instead. */
|
||||||
|
void (*error_print_progname) (
|
||||||
|
#if __STDC__ - 0
|
||||||
|
void
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
|
||||||
|
/* This variable is incremented each time `error' is called. */
|
||||||
|
unsigned int error_message_count;
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
/* In the GNU C library, there is a predefined variable for this. */
|
||||||
|
|
||||||
|
# define program_name program_invocation_name
|
||||||
|
# include <errno.h>
|
||||||
|
|
||||||
|
/* In GNU libc we want do not want to use the common name `error' directly.
|
||||||
|
Instead make it a weak alias. */
|
||||||
|
extern void __error (int status, int errnum, const char *message, ...)
|
||||||
|
__attribute__ ((__format__ (__printf__, 3, 4)));
|
||||||
|
extern void __error_at_line (int status, int errnum, const char *file_name,
|
||||||
|
unsigned int line_number, const char *message,
|
||||||
|
...)
|
||||||
|
__attribute__ ((__format__ (__printf__, 5, 6)));;
|
||||||
|
# define error __error
|
||||||
|
# define error_at_line __error_at_line
|
||||||
|
|
||||||
|
# ifdef USE_IN_LIBIO
|
||||||
|
# include <libio/iolibio.h>
|
||||||
|
# define fflush(s) _IO_fflush (s)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#else /* not _LIBC */
|
||||||
|
|
||||||
|
# if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P
|
||||||
|
# ifndef HAVE_DECL_STRERROR_R
|
||||||
|
"this configure-time declaration test was not run"
|
||||||
|
# endif
|
||||||
|
char *strerror_r ();
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* The calling program should define program_name and set it to the
|
||||||
|
name of the executing program. */
|
||||||
|
extern char *program_name;
|
||||||
|
|
||||||
|
# if HAVE_STRERROR_R || defined strerror_r
|
||||||
|
# define __strerror_r strerror_r
|
||||||
|
# else
|
||||||
|
# if HAVE_STRERROR
|
||||||
|
# ifndef HAVE_DECL_STRERROR
|
||||||
|
"this configure-time declaration test was not run"
|
||||||
|
# endif
|
||||||
|
# if !HAVE_DECL_STRERROR
|
||||||
|
char *strerror ();
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
static char *
|
||||||
|
private_strerror (int errnum)
|
||||||
|
{
|
||||||
|
extern char *sys_errlist[];
|
||||||
|
extern int sys_nerr;
|
||||||
|
|
||||||
|
if (errnum > 0 && errnum <= sys_nerr)
|
||||||
|
return _(sys_errlist[errnum]);
|
||||||
|
return _("Unknown system error");
|
||||||
|
}
|
||||||
|
# define strerror private_strerror
|
||||||
|
# endif /* HAVE_STRERROR */
|
||||||
|
# endif /* HAVE_STRERROR_R || defined strerror_r */
|
||||||
|
#endif /* not _LIBC */
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_errno_message (int errnum)
|
||||||
|
{
|
||||||
|
char const *s;
|
||||||
|
|
||||||
|
#if defined HAVE_STRERROR_R || _LIBC
|
||||||
|
char errbuf[1024];
|
||||||
|
# if STRERROR_R_CHAR_P || _LIBC
|
||||||
|
s = __strerror_r (errnum, errbuf, sizeof errbuf);
|
||||||
|
# else
|
||||||
|
if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0)
|
||||||
|
s = errbuf;
|
||||||
|
else
|
||||||
|
s = 0;
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
s = strerror (errnum);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !_LIBC
|
||||||
|
if (! s)
|
||||||
|
s = _("Unknown system error");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if _LIBC && USE_IN_LIBIO
|
||||||
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
|
{
|
||||||
|
__fwprintf (stderr, L": %s", s);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
fprintf (stderr, ": %s", s);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef VA_START
|
||||||
|
static void
|
||||||
|
error_tail (int status, int errnum, const char *message, va_list args)
|
||||||
|
{
|
||||||
|
# if HAVE_VPRINTF || _LIBC
|
||||||
|
# if _LIBC && USE_IN_LIBIO
|
||||||
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
|
{
|
||||||
|
# define ALLOCA_LIMIT 2000
|
||||||
|
size_t len = strlen (message) + 1;
|
||||||
|
wchar_t *wmessage = NULL;
|
||||||
|
mbstate_t st;
|
||||||
|
size_t res;
|
||||||
|
const char *tmp;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (len < ALLOCA_LIMIT)
|
||||||
|
wmessage = (wchar_t *) alloca (len * sizeof (wchar_t));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (wmessage != NULL && len / 2 < ALLOCA_LIMIT)
|
||||||
|
wmessage = NULL;
|
||||||
|
|
||||||
|
wmessage = (wchar_t *) realloc (wmessage,
|
||||||
|
len * sizeof (wchar_t));
|
||||||
|
|
||||||
|
if (wmessage == NULL)
|
||||||
|
{
|
||||||
|
fputws_unlocked (L"out of memory\n", stderr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
memset (&st, '\0', sizeof (st));
|
||||||
|
tmp =message;
|
||||||
|
}
|
||||||
|
while ((res = mbsrtowcs (wmessage, &tmp, len, &st)) == len);
|
||||||
|
|
||||||
|
if (res == (size_t) -1)
|
||||||
|
/* The string cannot be converted. */
|
||||||
|
wmessage = (wchar_t *) L"???";
|
||||||
|
|
||||||
|
__vfwprintf (stderr, wmessage, args);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
# endif
|
||||||
|
vfprintf (stderr, message, args);
|
||||||
|
# else
|
||||||
|
_doprnt (message, args, stderr);
|
||||||
|
# endif
|
||||||
|
va_end (args);
|
||||||
|
|
||||||
|
++error_message_count;
|
||||||
|
if (errnum)
|
||||||
|
print_errno_message (errnum);
|
||||||
|
# if _LIBC && USE_IN_LIBIO
|
||||||
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
|
putwc (L'\n', stderr);
|
||||||
|
else
|
||||||
|
# endif
|
||||||
|
putc ('\n', stderr);
|
||||||
|
fflush (stderr);
|
||||||
|
if (status)
|
||||||
|
exit (status);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Print the program name and error message MESSAGE, which is a printf-style
|
||||||
|
format string with optional args.
|
||||||
|
If ERRNUM is nonzero, print its corresponding system error message.
|
||||||
|
Exit with status STATUS if it is nonzero. */
|
||||||
|
/* VARARGS */
|
||||||
|
void
|
||||||
|
#if defined VA_START && __STDC__
|
||||||
|
error (int status, int errnum, const char *message, ...)
|
||||||
|
#else
|
||||||
|
error (status, errnum, message, va_alist)
|
||||||
|
int status;
|
||||||
|
int errnum;
|
||||||
|
char *message;
|
||||||
|
va_dcl
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#ifdef VA_START
|
||||||
|
va_list args;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
fflush (stdout);
|
||||||
|
#ifdef _LIBC
|
||||||
|
# ifdef USE_IN_LIBIO
|
||||||
|
_IO_flockfile (stderr);
|
||||||
|
# else
|
||||||
|
__flockfile (stderr);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
if (error_print_progname)
|
||||||
|
(*error_print_progname) ();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#if _LIBC && USE_IN_LIBIO
|
||||||
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
|
__fwprintf (stderr, L"%s: ", program_name);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
fprintf (stderr, "%s: ", program_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef VA_START
|
||||||
|
VA_START (args, message);
|
||||||
|
error_tail (status, errnum, message, args);
|
||||||
|
#else
|
||||||
|
fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||||
|
|
||||||
|
++error_message_count;
|
||||||
|
if (errnum)
|
||||||
|
print_errno_message (errnum);
|
||||||
|
putc ('\n', stderr);
|
||||||
|
fflush (stderr);
|
||||||
|
if (status)
|
||||||
|
exit (status);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
# ifdef USE_IN_LIBIO
|
||||||
|
_IO_funlockfile (stderr);
|
||||||
|
# else
|
||||||
|
__funlockfile (stderr);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sometimes we want to have at most one error per line. This
|
||||||
|
variable controls whether this mode is selected or not. */
|
||||||
|
int error_one_per_line;
|
||||||
|
|
||||||
|
void
|
||||||
|
#if defined VA_START && __STDC__
|
||||||
|
error_at_line (int status, int errnum, const char *file_name,
|
||||||
|
unsigned int line_number, const char *message, ...)
|
||||||
|
#else
|
||||||
|
error_at_line (status, errnum, file_name, line_number, message, va_alist)
|
||||||
|
int status;
|
||||||
|
int errnum;
|
||||||
|
const char *file_name;
|
||||||
|
unsigned int line_number;
|
||||||
|
char *message;
|
||||||
|
va_dcl
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#ifdef VA_START
|
||||||
|
va_list args;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (error_one_per_line)
|
||||||
|
{
|
||||||
|
static const char *old_file_name;
|
||||||
|
static unsigned int old_line_number;
|
||||||
|
|
||||||
|
if (old_line_number == line_number
|
||||||
|
&& (file_name == old_file_name
|
||||||
|
|| strcmp (old_file_name, file_name) == 0))
|
||||||
|
/* Simply return and print nothing. */
|
||||||
|
return;
|
||||||
|
|
||||||
|
old_file_name = file_name;
|
||||||
|
old_line_number = line_number;
|
||||||
|
}
|
||||||
|
|
||||||
|
fflush (stdout);
|
||||||
|
#ifdef _LIBC
|
||||||
|
# ifdef USE_IN_LIBIO
|
||||||
|
_IO_flockfile (stderr);
|
||||||
|
# else
|
||||||
|
__flockfile (stderr);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
if (error_print_progname)
|
||||||
|
(*error_print_progname) ();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#if _LIBC && USE_IN_LIBIO
|
||||||
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
|
__fwprintf (stderr, L"%s: ", program_name);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
fprintf (stderr, "%s:", program_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_name != NULL)
|
||||||
|
{
|
||||||
|
#if _LIBC && USE_IN_LIBIO
|
||||||
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
|
__fwprintf (stderr, L"%s:%d: ", file_name, line_number);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
fprintf (stderr, "%s:%d: ", file_name, line_number);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef VA_START
|
||||||
|
VA_START (args, message);
|
||||||
|
error_tail (status, errnum, message, args);
|
||||||
|
#else
|
||||||
|
fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||||
|
|
||||||
|
++error_message_count;
|
||||||
|
if (errnum)
|
||||||
|
print_errno_message (errnum);
|
||||||
|
putc ('\n', stderr);
|
||||||
|
fflush (stderr);
|
||||||
|
if (status)
|
||||||
|
exit (status);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
# ifdef USE_IN_LIBIO
|
||||||
|
_IO_funlockfile (stderr);
|
||||||
|
# else
|
||||||
|
__funlockfile (stderr);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
/* Make the weak alias. */
|
||||||
|
# undef error
|
||||||
|
# undef error_at_line
|
||||||
|
weak_alias (__error, error)
|
||||||
|
weak_alias (__error_at_line, error_at_line)
|
||||||
|
#endif
|
||||||
+78
@@ -0,0 +1,78 @@
|
|||||||
|
/* Declaration for error-reporting function
|
||||||
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
|
||||||
|
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
||||||
|
Bugs can be reported to [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,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
USA. */
|
||||||
|
|
||||||
|
#ifndef _ERROR_H
|
||||||
|
#define _ERROR_H 1
|
||||||
|
|
||||||
|
#ifndef __attribute__
|
||||||
|
/* This feature is available in gcc versions 2.5 and later. */
|
||||||
|
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
|
||||||
|
# define __attribute__(Spec) /* empty */
|
||||||
|
# endif
|
||||||
|
/* The __-protected variants of `format' and `printf' attributes
|
||||||
|
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
|
||||||
|
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
|
||||||
|
# define __format__ format
|
||||||
|
# define __printf__ printf
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (__STDC__) && __STDC__
|
||||||
|
|
||||||
|
/* Print a message with `fprintf (stderr, FORMAT, ...)';
|
||||||
|
if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
|
||||||
|
If STATUS is nonzero, terminate the program with `exit (STATUS)'. */
|
||||||
|
|
||||||
|
extern void error (int status, int errnum, const char *format, ...)
|
||||||
|
__attribute__ ((__format__ (__printf__, 3, 4)));
|
||||||
|
|
||||||
|
extern void error_at_line (int status, int errnum, const char *fname,
|
||||||
|
unsigned int lineno, const char *format, ...)
|
||||||
|
__attribute__ ((__format__ (__printf__, 5, 6)));
|
||||||
|
|
||||||
|
/* If NULL, error will flush stdout, then print on stderr the program
|
||||||
|
name, a colon and a space. Otherwise, error will call this
|
||||||
|
function without parameters instead. */
|
||||||
|
extern void (*error_print_progname) (void);
|
||||||
|
|
||||||
|
#else
|
||||||
|
void error ();
|
||||||
|
void error_at_line ();
|
||||||
|
extern void (*error_print_progname) ();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* This variable is incremented each time `error' is called. */
|
||||||
|
extern unsigned int error_message_count;
|
||||||
|
|
||||||
|
/* Sometimes we want to have at most one error per line. This
|
||||||
|
variable controls whether this mode is selected or not. */
|
||||||
|
extern int error_one_per_line;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* error.h */
|
||||||
+1068
File diff suppressed because it is too large
Load Diff
+180
@@ -0,0 +1,180 @@
|
|||||||
|
/* Declarations for getopt.
|
||||||
|
Copyright (C) 1989-1994, 1996-1999, 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. */
|
||||||
|
|
||||||
|
#ifndef _GETOPT_H
|
||||||
|
|
||||||
|
#ifndef __need_getopt
|
||||||
|
# define _GETOPT_H 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* If __GNU_LIBRARY__ is not already defined, either we are being used
|
||||||
|
standalone, or this is the first header included in the source file.
|
||||||
|
If we are being used with glibc, we need to include <features.h>, but
|
||||||
|
that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
|
||||||
|
not defined, include <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
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* For communication from `getopt' to the caller.
|
||||||
|
When `getopt' finds an option that takes an argument,
|
||||||
|
the argument value is returned here.
|
||||||
|
Also, when `ordering' is RETURN_IN_ORDER,
|
||||||
|
each non-option ARGV-element is returned here. */
|
||||||
|
|
||||||
|
extern char *optarg;
|
||||||
|
|
||||||
|
/* Index in ARGV of the next element to be scanned.
|
||||||
|
This is used for communication to and from the caller
|
||||||
|
and for communication between successive calls to `getopt'.
|
||||||
|
|
||||||
|
On entry to `getopt', zero means this is the first call; initialize.
|
||||||
|
|
||||||
|
When `getopt' returns -1, this is the index of the first of the
|
||||||
|
non-option elements that the caller should itself scan.
|
||||||
|
|
||||||
|
Otherwise, `optind' communicates from one call to the next
|
||||||
|
how much of ARGV has been scanned so far. */
|
||||||
|
|
||||||
|
extern int optind;
|
||||||
|
|
||||||
|
/* Callers store zero here to inhibit the error message `getopt' prints
|
||||||
|
for unrecognized options. */
|
||||||
|
|
||||||
|
extern int opterr;
|
||||||
|
|
||||||
|
/* Set to an option character which was unrecognized. */
|
||||||
|
|
||||||
|
extern int optopt;
|
||||||
|
|
||||||
|
#ifndef __need_getopt
|
||||||
|
/* Describe the long-named options requested by the application.
|
||||||
|
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
|
||||||
|
of `struct option' terminated by an element containing a name which is
|
||||||
|
zero.
|
||||||
|
|
||||||
|
The field `has_arg' is:
|
||||||
|
no_argument (or 0) if the option does not take an argument,
|
||||||
|
required_argument (or 1) if the option requires an argument,
|
||||||
|
optional_argument (or 2) if the option takes an optional argument.
|
||||||
|
|
||||||
|
If the field `flag' is not NULL, it points to a variable that is set
|
||||||
|
to the value given in the field `val' when the option is found, but
|
||||||
|
left unchanged if the option is not found.
|
||||||
|
|
||||||
|
To have a long-named option do something other than set an `int' to
|
||||||
|
a compiled-in constant, such as set a value from `optarg', set the
|
||||||
|
option's `flag' field to zero and its `val' field to a nonzero
|
||||||
|
value (the equivalent single-letter option character, if there is
|
||||||
|
one). For long options that have a zero `flag' field, `getopt'
|
||||||
|
returns the contents of the `val' field. */
|
||||||
|
|
||||||
|
struct option
|
||||||
|
{
|
||||||
|
# if (defined __STDC__ && __STDC__) || defined __cplusplus
|
||||||
|
const char *name;
|
||||||
|
# else
|
||||||
|
char *name;
|
||||||
|
# endif
|
||||||
|
/* has_arg can't be an enum because some compilers complain about
|
||||||
|
type mismatches in all the code that assumes it is an int. */
|
||||||
|
int has_arg;
|
||||||
|
int *flag;
|
||||||
|
int val;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Names for the values of the `has_arg' field of `struct option'. */
|
||||||
|
|
||||||
|
# define no_argument 0
|
||||||
|
# define required_argument 1
|
||||||
|
# define optional_argument 2
|
||||||
|
#endif /* need getopt */
|
||||||
|
|
||||||
|
|
||||||
|
/* Get definitions and prototypes for functions to process the
|
||||||
|
arguments in ARGV (ARGC of them, minus the program name) for
|
||||||
|
options given in OPTS.
|
||||||
|
|
||||||
|
Return the option character from OPTS just read. Return -1 when
|
||||||
|
there are no more options. For unrecognized options, or options
|
||||||
|
missing arguments, `optopt' is set to the option letter, and '?' is
|
||||||
|
returned.
|
||||||
|
|
||||||
|
The OPTS string is a list of characters which are recognized option
|
||||||
|
letters, optionally followed by colons, specifying that that letter
|
||||||
|
takes an argument, to be placed in `optarg'.
|
||||||
|
|
||||||
|
If a letter in OPTS is followed by two colons, its argument is
|
||||||
|
optional. This behavior is specific to the GNU `getopt'.
|
||||||
|
|
||||||
|
The argument `--' causes premature termination of argument
|
||||||
|
scanning, explicitly telling `getopt' that there are no more
|
||||||
|
options.
|
||||||
|
|
||||||
|
If OPTS begins with `--', then non-option arguments are treated as
|
||||||
|
arguments to the option '\0'. This behavior is specific to the GNU
|
||||||
|
`getopt'. */
|
||||||
|
|
||||||
|
#if (defined __STDC__ && __STDC__) || defined __cplusplus
|
||||||
|
# ifdef __GNU_LIBRARY__
|
||||||
|
/* Many other libraries have conflicting prototypes for getopt, with
|
||||||
|
differences in the consts, in stdlib.h. To avoid compilation
|
||||||
|
errors, only prototype getopt for the GNU C library. */
|
||||||
|
extern int getopt (int __argc, char *const *__argv, const char *__shortopts);
|
||||||
|
# else /* not __GNU_LIBRARY__ */
|
||||||
|
extern int getopt ();
|
||||||
|
# endif /* __GNU_LIBRARY__ */
|
||||||
|
|
||||||
|
# ifndef __need_getopt
|
||||||
|
extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts,
|
||||||
|
const struct option *__longopts, int *__longind);
|
||||||
|
extern int getopt_long_only (int __argc, char *const *__argv,
|
||||||
|
const char *__shortopts,
|
||||||
|
const struct option *__longopts, int *__longind);
|
||||||
|
|
||||||
|
/* Internal only. Users should not call this directly. */
|
||||||
|
extern int _getopt_internal (int __argc, char *const *__argv,
|
||||||
|
const char *__shortopts,
|
||||||
|
const struct option *__longopts, int *__longind,
|
||||||
|
int __long_only);
|
||||||
|
# endif
|
||||||
|
#else /* not __STDC__ */
|
||||||
|
extern int getopt ();
|
||||||
|
# ifndef __need_getopt
|
||||||
|
extern int getopt_long ();
|
||||||
|
extern int getopt_long_only ();
|
||||||
|
|
||||||
|
extern int _getopt_internal ();
|
||||||
|
# endif
|
||||||
|
#endif /* __STDC__ */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Make sure we later can get all the definitions and declarations. */
|
||||||
|
#undef __need_getopt
|
||||||
|
|
||||||
|
#endif /* getopt.h */
|
||||||
+188
@@ -0,0 +1,188 @@
|
|||||||
|
/* getopt_long and getopt_long_only entry points for GNU getopt.
|
||||||
|
Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
|
||||||
|
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. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "getopt.h"
|
||||||
|
|
||||||
|
#if !defined __STDC__ || !__STDC__
|
||||||
|
/* This is a separate conditional since some stdc systems
|
||||||
|
reject `defined (const)'. */
|
||||||
|
#ifndef const
|
||||||
|
#define const
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/* Comment out all this code if we are using the GNU C Library, and are not
|
||||||
|
actually compiling the library itself. This code is part of the GNU C
|
||||||
|
Library, but also included in many other GNU distributions. Compiling
|
||||||
|
and linking in this code is a waste when using the GNU C library
|
||||||
|
(especially if it is a shared library). Rather than having every GNU
|
||||||
|
program understand `configure --with-gnu-libc' and omit the object files,
|
||||||
|
it is simpler to just do this in the source for each such file. */
|
||||||
|
|
||||||
|
#define GETOPT_INTERFACE_VERSION 2
|
||||||
|
#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
|
||||||
|
#include <gnu-versions.h>
|
||||||
|
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
|
||||||
|
#define ELIDE_CODE
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ELIDE_CODE
|
||||||
|
|
||||||
|
|
||||||
|
/* This needs to come after some library #include
|
||||||
|
to get __GNU_LIBRARY__ defined. */
|
||||||
|
#ifdef __GNU_LIBRARY__
|
||||||
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef NULL
|
||||||
|
#define NULL 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int
|
||||||
|
getopt_long (argc, argv, options, long_options, opt_index)
|
||||||
|
int argc;
|
||||||
|
char *const *argv;
|
||||||
|
const char *options;
|
||||||
|
const struct option *long_options;
|
||||||
|
int *opt_index;
|
||||||
|
{
|
||||||
|
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
|
||||||
|
If an option that starts with '-' (not '--') doesn't match a long option,
|
||||||
|
but does match a short option, it is parsed as a short option
|
||||||
|
instead. */
|
||||||
|
|
||||||
|
int
|
||||||
|
getopt_long_only (argc, argv, options, long_options, opt_index)
|
||||||
|
int argc;
|
||||||
|
char *const *argv;
|
||||||
|
const char *options;
|
||||||
|
const struct option *long_options;
|
||||||
|
int *opt_index;
|
||||||
|
{
|
||||||
|
return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* Not ELIDE_CODE. */
|
||||||
|
|
||||||
|
#ifdef TEST
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (argc, argv)
|
||||||
|
int argc;
|
||||||
|
char **argv;
|
||||||
|
{
|
||||||
|
int c;
|
||||||
|
int digit_optind = 0;
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
int this_option_optind = optind ? optind : 1;
|
||||||
|
int option_index = 0;
|
||||||
|
static struct option long_options[] =
|
||||||
|
{
|
||||||
|
{"add", 1, 0, 0},
|
||||||
|
{"append", 0, 0, 0},
|
||||||
|
{"delete", 1, 0, 0},
|
||||||
|
{"verbose", 0, 0, 0},
|
||||||
|
{"create", 0, 0, 0},
|
||||||
|
{"file", 1, 0, 0},
|
||||||
|
{0, 0, 0, 0}
|
||||||
|
};
|
||||||
|
|
||||||
|
c = getopt_long (argc, argv, "abc:d:0123456789",
|
||||||
|
long_options, &option_index);
|
||||||
|
if (c == -1)
|
||||||
|
break;
|
||||||
|
|
||||||
|
switch (c)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
printf ("option %s", long_options[option_index].name);
|
||||||
|
if (optarg)
|
||||||
|
printf (" with arg %s", optarg);
|
||||||
|
printf ("\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '0':
|
||||||
|
case '1':
|
||||||
|
case '2':
|
||||||
|
case '3':
|
||||||
|
case '4':
|
||||||
|
case '5':
|
||||||
|
case '6':
|
||||||
|
case '7':
|
||||||
|
case '8':
|
||||||
|
case '9':
|
||||||
|
if (digit_optind != 0 && digit_optind != this_option_optind)
|
||||||
|
printf ("digits occur in two different argv-elements.\n");
|
||||||
|
digit_optind = this_option_optind;
|
||||||
|
printf ("option %c\n", c);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'a':
|
||||||
|
printf ("option a\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'b':
|
||||||
|
printf ("option b\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'c':
|
||||||
|
printf ("option c with value `%s'\n", optarg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'd':
|
||||||
|
printf ("option d with value `%s'\n", optarg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '?':
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
printf ("?? getopt returned character code 0%o ??\n", c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (optind < argc)
|
||||||
|
{
|
||||||
|
printf ("non-option ARGV-elements: ");
|
||||||
|
while (optind < argc)
|
||||||
|
printf ("%s ", argv[optind++]);
|
||||||
|
printf ("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
exit (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* TEST */
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/* Work around bug on some systems where malloc (0) fails.
|
||||||
|
Copyright (C) 1997, 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. */
|
||||||
|
|
||||||
|
/* written by Jim Meyering */
|
||||||
|
|
||||||
|
#if HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
#undef malloc
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
char *malloc ();
|
||||||
|
|
||||||
|
/* Allocate an N-byte block of memory from the heap.
|
||||||
|
If N is zero, allocate a 1-byte block. */
|
||||||
|
|
||||||
|
char *
|
||||||
|
rpl_malloc (size_t n)
|
||||||
|
{
|
||||||
|
if (n == 0)
|
||||||
|
n = 1;
|
||||||
|
return malloc (n);
|
||||||
|
}
|
||||||
+216
@@ -0,0 +1,216 @@
|
|||||||
|
/* 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]).
|
||||||
|
|
||||||
|
NOTE: The canonical source of this file is maintained with 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,
|
||||||
|
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
|
||||||
|
|
||||||
|
#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 HAVE_STDLIB_H || defined _LIBC
|
||||||
|
# include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 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>
|
||||||
|
#if HAVE_BP_SYM_H || defined _LIBC
|
||||||
|
# include <bp-sym.h>
|
||||||
|
#else
|
||||||
|
# define BP_SYM(sym) sym
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef memchr
|
||||||
|
#undef __memchr
|
||||||
|
|
||||||
|
/* Search no more than N bytes of S for C. */
|
||||||
|
__ptr_t
|
||||||
|
__memchr (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 first 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 > 0 && ((unsigned long int) char_ptr
|
||||||
|
& (sizeof (longword) - 1)) != 0;
|
||||||
|
--n, ++char_ptr)
|
||||||
|
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 - 1);
|
||||||
|
|
||||||
|
if (cp[0] == c)
|
||||||
|
return (__ptr_t) cp;
|
||||||
|
if (cp[1] == c)
|
||||||
|
return (__ptr_t) &cp[1];
|
||||||
|
if (cp[2] == c)
|
||||||
|
return (__ptr_t) &cp[2];
|
||||||
|
if (cp[3] == c)
|
||||||
|
return (__ptr_t) &cp[3];
|
||||||
|
#if LONG_MAX > 2147483647
|
||||||
|
if (cp[4] == c)
|
||||||
|
return (__ptr_t) &cp[4];
|
||||||
|
if (cp[5] == c)
|
||||||
|
return (__ptr_t) &cp[5];
|
||||||
|
if (cp[6] == c)
|
||||||
|
return (__ptr_t) &cp[6];
|
||||||
|
if (cp[7] == c)
|
||||||
|
return (__ptr_t) &cp[7];
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
n -= sizeof (longword);
|
||||||
|
}
|
||||||
|
|
||||||
|
char_ptr = (const unsigned char *) longword_ptr;
|
||||||
|
|
||||||
|
while (n-- > 0)
|
||||||
|
{
|
||||||
|
if (*char_ptr == c)
|
||||||
|
return (__ptr_t) char_ptr;
|
||||||
|
else
|
||||||
|
++char_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#ifdef weak_alias
|
||||||
|
weak_alias (__memchr, BP_SYM (memchr))
|
||||||
|
#endif
|
||||||
+623
@@ -0,0 +1,623 @@
|
|||||||
|
/* obstack.c - subroutines used implicitly by object stack macros
|
||||||
|
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
|
||||||
|
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
|
||||||
|
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. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "obstack.h"
|
||||||
|
|
||||||
|
/* NOTE BEFORE MODIFYING THIS FILE: This version number must be
|
||||||
|
incremented whenever callers compiled using an old obstack.h can no
|
||||||
|
longer properly call the functions in this obstack.c. */
|
||||||
|
#define OBSTACK_INTERFACE_VERSION 1
|
||||||
|
|
||||||
|
/* Comment out all this code if we are using the GNU C Library, and are not
|
||||||
|
actually compiling the library itself, and the installed library
|
||||||
|
supports the same library interface we do. This code is part of the GNU
|
||||||
|
C Library, but also included in many other GNU distributions. Compiling
|
||||||
|
and linking in this code is a waste when using the GNU C library
|
||||||
|
(especially if it is a shared library). Rather than having every GNU
|
||||||
|
program understand `configure --with-gnu-libc' and omit the object
|
||||||
|
files, it is simpler to just do this in the source for each such file. */
|
||||||
|
|
||||||
|
#include <stdio.h> /* Random thing to get __GNU_LIBRARY__. */
|
||||||
|
#if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
|
||||||
|
# include <gnu-versions.h>
|
||||||
|
# if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION
|
||||||
|
# define ELIDE_CODE
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined _LIBC && defined USE_IN_LIBIO
|
||||||
|
# include <wchar.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ELIDE_CODE
|
||||||
|
|
||||||
|
|
||||||
|
# if defined __STDC__ && __STDC__
|
||||||
|
# define POINTER void *
|
||||||
|
# else
|
||||||
|
# define POINTER char *
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Determine default alignment. */
|
||||||
|
struct fooalign {char x; double d;};
|
||||||
|
# define DEFAULT_ALIGNMENT \
|
||||||
|
((PTR_INT_TYPE) ((char *) &((struct fooalign *) 0)->d - (char *) 0))
|
||||||
|
/* 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
|
||||||
|
DEFAULT_ROUNDING. So we prepare for it to do that. */
|
||||||
|
union fooround {long x; double d;};
|
||||||
|
# define DEFAULT_ROUNDING (sizeof (union fooround))
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
in such a case, redefine COPYING_UNIT to `long' (if that works)
|
||||||
|
or `char' as a last resort. */
|
||||||
|
# ifndef COPYING_UNIT
|
||||||
|
# define COPYING_UNIT int
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
/* The functions allocating more room by calling `obstack_chunk_alloc'
|
||||||
|
jump to the handler pointed to by `obstack_alloc_failed_handler'.
|
||||||
|
This can be set to a user defined function which should either
|
||||||
|
abort gracefully or use longjump - but shouldn't return. This
|
||||||
|
variable by default points to the internal function
|
||||||
|
`print_and_abort'. */
|
||||||
|
# if defined __STDC__ && __STDC__
|
||||||
|
static void print_and_abort (void);
|
||||||
|
void (*obstack_alloc_failed_handler) (void) = print_and_abort;
|
||||||
|
# else
|
||||||
|
static void print_and_abort ();
|
||||||
|
void (*obstack_alloc_failed_handler) () = print_and_abort;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Exit value used when `print_and_abort' is used. */
|
||||||
|
# if defined __GNU_LIBRARY__ || defined HAVE_STDLIB_H
|
||||||
|
# include <stdlib.h>
|
||||||
|
# endif
|
||||||
|
# ifndef EXIT_FAILURE
|
||||||
|
# define EXIT_FAILURE 1
|
||||||
|
# endif
|
||||||
|
int obstack_exit_failure = EXIT_FAILURE;
|
||||||
|
|
||||||
|
/* The non-GNU-C macros copy the obstack into this global variable
|
||||||
|
to avoid multiple evaluation. */
|
||||||
|
|
||||||
|
struct obstack *_obstack;
|
||||||
|
|
||||||
|
/* Define a macro that either calls functions with the traditional malloc/free
|
||||||
|
calling interface, or calls functions with the mmalloc/mfree interface
|
||||||
|
(that adds an extra first argument), based on the state of use_extra_arg.
|
||||||
|
For free, do not use ?:, since some compilers, like the MIPS compilers,
|
||||||
|
do not allow (expr) ? void : void. */
|
||||||
|
|
||||||
|
# if defined __STDC__ && __STDC__
|
||||||
|
# define CALL_CHUNKFUN(h, size) \
|
||||||
|
(((h) -> use_extra_arg) \
|
||||||
|
? (*(h)->chunkfun) ((h)->extra_arg, (size)) \
|
||||||
|
: (*(struct _obstack_chunk *(*) (long)) (h)->chunkfun) ((size)))
|
||||||
|
|
||||||
|
# define CALL_FREEFUN(h, old_chunk) \
|
||||||
|
do { \
|
||||||
|
if ((h) -> use_extra_arg) \
|
||||||
|
(*(h)->freefun) ((h)->extra_arg, (old_chunk)); \
|
||||||
|
else \
|
||||||
|
(*(void (*) (void *)) (h)->freefun) ((old_chunk)); \
|
||||||
|
} while (0)
|
||||||
|
# else
|
||||||
|
# define CALL_CHUNKFUN(h, size) \
|
||||||
|
(((h) -> use_extra_arg) \
|
||||||
|
? (*(h)->chunkfun) ((h)->extra_arg, (size)) \
|
||||||
|
: (*(struct _obstack_chunk *(*) ()) (h)->chunkfun) ((size)))
|
||||||
|
|
||||||
|
# define CALL_FREEFUN(h, old_chunk) \
|
||||||
|
do { \
|
||||||
|
if ((h) -> use_extra_arg) \
|
||||||
|
(*(h)->freefun) ((h)->extra_arg, (old_chunk)); \
|
||||||
|
else \
|
||||||
|
(*(void (*) ()) (h)->freefun) ((old_chunk)); \
|
||||||
|
} while (0)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Initialize an obstack H for use. Specify chunk size SIZE (0 means default).
|
||||||
|
Objects start on multiples of ALIGNMENT (0 means use default).
|
||||||
|
CHUNKFUN is the function to use to allocate chunks,
|
||||||
|
and FREEFUN the function to free them.
|
||||||
|
|
||||||
|
Return nonzero if successful, calls obstack_alloc_failed_handler if
|
||||||
|
allocation fails. */
|
||||||
|
|
||||||
|
int
|
||||||
|
_obstack_begin (h, size, alignment, chunkfun, freefun)
|
||||||
|
struct obstack *h;
|
||||||
|
int size;
|
||||||
|
int alignment;
|
||||||
|
# if defined __STDC__ && __STDC__
|
||||||
|
POINTER (*chunkfun) (long);
|
||||||
|
void (*freefun) (void *);
|
||||||
|
# else
|
||||||
|
POINTER (*chunkfun) ();
|
||||||
|
void (*freefun) ();
|
||||||
|
# endif
|
||||||
|
{
|
||||||
|
register struct _obstack_chunk *chunk; /* points to new chunk */
|
||||||
|
|
||||||
|
if (alignment == 0)
|
||||||
|
alignment = (int) DEFAULT_ALIGNMENT;
|
||||||
|
if (size == 0)
|
||||||
|
/* Default size is what GNU malloc can fit in a 4096-byte block. */
|
||||||
|
{
|
||||||
|
/* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc.
|
||||||
|
Use the values for range checking, because if range checking is off,
|
||||||
|
the extra bytes won't be missed terribly, but if range checking is on
|
||||||
|
and we used a larger request, a whole extra 4096 bytes would be
|
||||||
|
allocated.
|
||||||
|
|
||||||
|
These number are irrelevant to the new GNU malloc. I suspect it is
|
||||||
|
less sensitive to the size of the request. */
|
||||||
|
int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1))
|
||||||
|
+ 4 + DEFAULT_ROUNDING - 1)
|
||||||
|
& ~(DEFAULT_ROUNDING - 1));
|
||||||
|
size = 4096 - extra;
|
||||||
|
}
|
||||||
|
|
||||||
|
# if defined __STDC__ && __STDC__
|
||||||
|
h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun;
|
||||||
|
h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
|
||||||
|
# else
|
||||||
|
h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
|
||||||
|
h->freefun = freefun;
|
||||||
|
# endif
|
||||||
|
h->chunk_size = size;
|
||||||
|
h->alignment_mask = alignment - 1;
|
||||||
|
h->use_extra_arg = 0;
|
||||||
|
|
||||||
|
chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size);
|
||||||
|
if (!chunk)
|
||||||
|
(*obstack_alloc_failed_handler) ();
|
||||||
|
h->next_free = h->object_base = chunk->contents;
|
||||||
|
h->chunk_limit = chunk->limit
|
||||||
|
= (char *) chunk + h->chunk_size;
|
||||||
|
chunk->prev = 0;
|
||||||
|
/* The initial chunk now contains no empty object. */
|
||||||
|
h->maybe_empty_object = 0;
|
||||||
|
h->alloc_failed = 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
_obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg)
|
||||||
|
struct obstack *h;
|
||||||
|
int size;
|
||||||
|
int alignment;
|
||||||
|
# if defined __STDC__ && __STDC__
|
||||||
|
POINTER (*chunkfun) (POINTER, long);
|
||||||
|
void (*freefun) (POINTER, POINTER);
|
||||||
|
# else
|
||||||
|
POINTER (*chunkfun) ();
|
||||||
|
void (*freefun) ();
|
||||||
|
# endif
|
||||||
|
POINTER arg;
|
||||||
|
{
|
||||||
|
register struct _obstack_chunk *chunk; /* points to new chunk */
|
||||||
|
|
||||||
|
if (alignment == 0)
|
||||||
|
alignment = (int) DEFAULT_ALIGNMENT;
|
||||||
|
if (size == 0)
|
||||||
|
/* Default size is what GNU malloc can fit in a 4096-byte block. */
|
||||||
|
{
|
||||||
|
/* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc.
|
||||||
|
Use the values for range checking, because if range checking is off,
|
||||||
|
the extra bytes won't be missed terribly, but if range checking is on
|
||||||
|
and we used a larger request, a whole extra 4096 bytes would be
|
||||||
|
allocated.
|
||||||
|
|
||||||
|
These number are irrelevant to the new GNU malloc. I suspect it is
|
||||||
|
less sensitive to the size of the request. */
|
||||||
|
int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1))
|
||||||
|
+ 4 + DEFAULT_ROUNDING - 1)
|
||||||
|
& ~(DEFAULT_ROUNDING - 1));
|
||||||
|
size = 4096 - extra;
|
||||||
|
}
|
||||||
|
|
||||||
|
# if defined __STDC__ && __STDC__
|
||||||
|
h->chunkfun = (struct _obstack_chunk * (*)(void *,long)) chunkfun;
|
||||||
|
h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
|
||||||
|
# else
|
||||||
|
h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
|
||||||
|
h->freefun = freefun;
|
||||||
|
# endif
|
||||||
|
h->chunk_size = size;
|
||||||
|
h->alignment_mask = alignment - 1;
|
||||||
|
h->extra_arg = arg;
|
||||||
|
h->use_extra_arg = 1;
|
||||||
|
|
||||||
|
chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size);
|
||||||
|
if (!chunk)
|
||||||
|
(*obstack_alloc_failed_handler) ();
|
||||||
|
h->next_free = h->object_base = chunk->contents;
|
||||||
|
h->chunk_limit = chunk->limit
|
||||||
|
= (char *) chunk + h->chunk_size;
|
||||||
|
chunk->prev = 0;
|
||||||
|
/* The initial chunk now contains no empty object. */
|
||||||
|
h->maybe_empty_object = 0;
|
||||||
|
h->alloc_failed = 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Allocate a new current chunk for the obstack *H
|
||||||
|
on the assumption that LENGTH bytes need to be added
|
||||||
|
to the current object, or a new object of length LENGTH allocated.
|
||||||
|
Copies any partial object from the end of the old chunk
|
||||||
|
to the beginning of the new one. */
|
||||||
|
|
||||||
|
void
|
||||||
|
_obstack_newchunk (h, length)
|
||||||
|
struct obstack *h;
|
||||||
|
int length;
|
||||||
|
{
|
||||||
|
register struct _obstack_chunk *old_chunk = h->chunk;
|
||||||
|
register struct _obstack_chunk *new_chunk;
|
||||||
|
register long new_size;
|
||||||
|
register long obj_size = h->next_free - h->object_base;
|
||||||
|
register long i;
|
||||||
|
long already;
|
||||||
|
char *object_base;
|
||||||
|
|
||||||
|
/* Compute size for new chunk. */
|
||||||
|
new_size = (obj_size + length) + (obj_size >> 3) + h->alignment_mask + 100;
|
||||||
|
if (new_size < h->chunk_size)
|
||||||
|
new_size = h->chunk_size;
|
||||||
|
|
||||||
|
/* Allocate and initialize the new chunk. */
|
||||||
|
new_chunk = CALL_CHUNKFUN (h, new_size);
|
||||||
|
if (!new_chunk)
|
||||||
|
(*obstack_alloc_failed_handler) ();
|
||||||
|
h->chunk = new_chunk;
|
||||||
|
new_chunk->prev = old_chunk;
|
||||||
|
new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size;
|
||||||
|
|
||||||
|
/* Compute an aligned object_base in the new chunk */
|
||||||
|
object_base =
|
||||||
|
__INT_TO_PTR ((__PTR_TO_INT (new_chunk->contents) + h->alignment_mask)
|
||||||
|
& ~ (h->alignment_mask));
|
||||||
|
|
||||||
|
/* Move the existing object to the new chunk.
|
||||||
|
Word at a time is fast and is safe if the object
|
||||||
|
is sufficiently aligned. */
|
||||||
|
if (h->alignment_mask + 1 >= DEFAULT_ALIGNMENT)
|
||||||
|
{
|
||||||
|
for (i = obj_size / sizeof (COPYING_UNIT) - 1;
|
||||||
|
i >= 0; i--)
|
||||||
|
((COPYING_UNIT *)object_base)[i]
|
||||||
|
= ((COPYING_UNIT *)h->object_base)[i];
|
||||||
|
/* We used to copy the odd few remaining bytes as one extra COPYING_UNIT,
|
||||||
|
but that can cross a page boundary on a machine
|
||||||
|
which does not do strict alignment for COPYING_UNITS. */
|
||||||
|
already = obj_size / sizeof (COPYING_UNIT) * sizeof (COPYING_UNIT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
already = 0;
|
||||||
|
/* Copy remaining bytes one by one. */
|
||||||
|
for (i = already; i < obj_size; i++)
|
||||||
|
object_base[i] = h->object_base[i];
|
||||||
|
|
||||||
|
/* If the object just copied was the only data in OLD_CHUNK,
|
||||||
|
free that chunk and remove it from the chain.
|
||||||
|
But not if that chunk might contain an empty object. */
|
||||||
|
if (h->object_base == old_chunk->contents && ! h->maybe_empty_object)
|
||||||
|
{
|
||||||
|
new_chunk->prev = old_chunk->prev;
|
||||||
|
CALL_FREEFUN (h, old_chunk);
|
||||||
|
}
|
||||||
|
|
||||||
|
h->object_base = object_base;
|
||||||
|
h->next_free = h->object_base + obj_size;
|
||||||
|
/* The new chunk certainly contains no empty object yet. */
|
||||||
|
h->maybe_empty_object = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return nonzero if object OBJ has been allocated from obstack H.
|
||||||
|
This is here for debugging.
|
||||||
|
If you use it in a program, you are probably losing. */
|
||||||
|
|
||||||
|
# if defined __STDC__ && __STDC__
|
||||||
|
/* Suppress -Wmissing-prototypes warning. We don't want to declare this in
|
||||||
|
obstack.h because it is just for debugging. */
|
||||||
|
int _obstack_allocated_p (struct obstack *h, POINTER obj);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
int
|
||||||
|
_obstack_allocated_p (h, obj)
|
||||||
|
struct obstack *h;
|
||||||
|
POINTER obj;
|
||||||
|
{
|
||||||
|
register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
|
||||||
|
register struct _obstack_chunk *plp; /* point to previous chunk if any */
|
||||||
|
|
||||||
|
lp = (h)->chunk;
|
||||||
|
/* We use >= rather than > since the object cannot be exactly at
|
||||||
|
the beginning of the chunk but might be an empty object exactly
|
||||||
|
at the end of an adjacent chunk. */
|
||||||
|
while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj))
|
||||||
|
{
|
||||||
|
plp = lp->prev;
|
||||||
|
lp = plp;
|
||||||
|
}
|
||||||
|
return lp != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Free objects in obstack H, including OBJ and everything allocate
|
||||||
|
more recently than OBJ. If OBJ is zero, free everything in H. */
|
||||||
|
|
||||||
|
# undef obstack_free
|
||||||
|
|
||||||
|
/* This function has two names with identical definitions.
|
||||||
|
This is the first one, called from non-ANSI code. */
|
||||||
|
|
||||||
|
void
|
||||||
|
_obstack_free (h, obj)
|
||||||
|
struct obstack *h;
|
||||||
|
POINTER obj;
|
||||||
|
{
|
||||||
|
register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
|
||||||
|
register struct _obstack_chunk *plp; /* point to previous chunk if any */
|
||||||
|
|
||||||
|
lp = h->chunk;
|
||||||
|
/* We use >= because there cannot be an object at the beginning of a chunk.
|
||||||
|
But there can be an empty object at that address
|
||||||
|
at the end of another chunk. */
|
||||||
|
while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj))
|
||||||
|
{
|
||||||
|
plp = lp->prev;
|
||||||
|
CALL_FREEFUN (h, lp);
|
||||||
|
lp = plp;
|
||||||
|
/* If we switch chunks, we can't tell whether the new current
|
||||||
|
chunk contains an empty object, so assume that it may. */
|
||||||
|
h->maybe_empty_object = 1;
|
||||||
|
}
|
||||||
|
if (lp)
|
||||||
|
{
|
||||||
|
h->object_base = h->next_free = (char *) (obj);
|
||||||
|
h->chunk_limit = lp->limit;
|
||||||
|
h->chunk = lp;
|
||||||
|
}
|
||||||
|
else if (obj != 0)
|
||||||
|
/* obj is not in any of the chunks! */
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This function is used from ANSI code. */
|
||||||
|
|
||||||
|
void
|
||||||
|
obstack_free (h, obj)
|
||||||
|
struct obstack *h;
|
||||||
|
POINTER obj;
|
||||||
|
{
|
||||||
|
register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
|
||||||
|
register struct _obstack_chunk *plp; /* point to previous chunk if any */
|
||||||
|
|
||||||
|
lp = h->chunk;
|
||||||
|
/* We use >= because there cannot be an object at the beginning of a chunk.
|
||||||
|
But there can be an empty object at that address
|
||||||
|
at the end of another chunk. */
|
||||||
|
while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj))
|
||||||
|
{
|
||||||
|
plp = lp->prev;
|
||||||
|
CALL_FREEFUN (h, lp);
|
||||||
|
lp = plp;
|
||||||
|
/* If we switch chunks, we can't tell whether the new current
|
||||||
|
chunk contains an empty object, so assume that it may. */
|
||||||
|
h->maybe_empty_object = 1;
|
||||||
|
}
|
||||||
|
if (lp)
|
||||||
|
{
|
||||||
|
h->object_base = h->next_free = (char *) (obj);
|
||||||
|
h->chunk_limit = lp->limit;
|
||||||
|
h->chunk = lp;
|
||||||
|
}
|
||||||
|
else if (obj != 0)
|
||||||
|
/* obj is not in any of the chunks! */
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
_obstack_memory_used (h)
|
||||||
|
struct obstack *h;
|
||||||
|
{
|
||||||
|
register struct _obstack_chunk* lp;
|
||||||
|
register int nbytes = 0;
|
||||||
|
|
||||||
|
for (lp = h->chunk; lp != 0; lp = lp->prev)
|
||||||
|
{
|
||||||
|
nbytes += lp->limit - (char *) lp;
|
||||||
|
}
|
||||||
|
return nbytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Define the error handler. */
|
||||||
|
# ifndef _
|
||||||
|
# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
|
||||||
|
# include <libintl.h>
|
||||||
|
# ifndef _
|
||||||
|
# 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
|
||||||
|
|
||||||
|
static void
|
||||||
|
__attribute__ ((noreturn))
|
||||||
|
print_and_abort ()
|
||||||
|
{
|
||||||
|
/* Don't change any of these strings. Yes, it would be possible to add
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
# if 0
|
||||||
|
/* These are now turned off because the applications do not use it
|
||||||
|
and it uses bcopy via obstack_grow, which causes trouble on sysV. */
|
||||||
|
|
||||||
|
/* Now define the functional versions of the obstack macros.
|
||||||
|
Define them to simply use the corresponding macros to do the job. */
|
||||||
|
|
||||||
|
# if defined __STDC__ && __STDC__
|
||||||
|
/* These function definitions do not work with non-ANSI preprocessors;
|
||||||
|
they won't pass through the macro names in parentheses. */
|
||||||
|
|
||||||
|
/* The function names appear in parentheses in order to prevent
|
||||||
|
the macro-definitions of the names from being expanded there. */
|
||||||
|
|
||||||
|
POINTER (obstack_base) (obstack)
|
||||||
|
struct obstack *obstack;
|
||||||
|
{
|
||||||
|
return obstack_base (obstack);
|
||||||
|
}
|
||||||
|
|
||||||
|
POINTER (obstack_next_free) (obstack)
|
||||||
|
struct obstack *obstack;
|
||||||
|
{
|
||||||
|
return obstack_next_free (obstack);
|
||||||
|
}
|
||||||
|
|
||||||
|
int (obstack_object_size) (obstack)
|
||||||
|
struct obstack *obstack;
|
||||||
|
{
|
||||||
|
return obstack_object_size (obstack);
|
||||||
|
}
|
||||||
|
|
||||||
|
int (obstack_room) (obstack)
|
||||||
|
struct obstack *obstack;
|
||||||
|
{
|
||||||
|
return obstack_room (obstack);
|
||||||
|
}
|
||||||
|
|
||||||
|
int (obstack_make_room) (obstack, length)
|
||||||
|
struct obstack *obstack;
|
||||||
|
int length;
|
||||||
|
{
|
||||||
|
return obstack_make_room (obstack, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
void (obstack_grow) (obstack, data, length)
|
||||||
|
struct obstack *obstack;
|
||||||
|
const POINTER data;
|
||||||
|
int length;
|
||||||
|
{
|
||||||
|
obstack_grow (obstack, data, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
void (obstack_grow0) (obstack, data, length)
|
||||||
|
struct obstack *obstack;
|
||||||
|
const POINTER data;
|
||||||
|
int length;
|
||||||
|
{
|
||||||
|
obstack_grow0 (obstack, data, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
void (obstack_1grow) (obstack, character)
|
||||||
|
struct obstack *obstack;
|
||||||
|
int character;
|
||||||
|
{
|
||||||
|
obstack_1grow (obstack, character);
|
||||||
|
}
|
||||||
|
|
||||||
|
void (obstack_blank) (obstack, length)
|
||||||
|
struct obstack *obstack;
|
||||||
|
int length;
|
||||||
|
{
|
||||||
|
obstack_blank (obstack, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
void (obstack_1grow_fast) (obstack, character)
|
||||||
|
struct obstack *obstack;
|
||||||
|
int character;
|
||||||
|
{
|
||||||
|
obstack_1grow_fast (obstack, character);
|
||||||
|
}
|
||||||
|
|
||||||
|
void (obstack_blank_fast) (obstack, length)
|
||||||
|
struct obstack *obstack;
|
||||||
|
int length;
|
||||||
|
{
|
||||||
|
obstack_blank_fast (obstack, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
POINTER (obstack_finish) (obstack)
|
||||||
|
struct obstack *obstack;
|
||||||
|
{
|
||||||
|
return obstack_finish (obstack);
|
||||||
|
}
|
||||||
|
|
||||||
|
POINTER (obstack_alloc) (obstack, length)
|
||||||
|
struct obstack *obstack;
|
||||||
|
int length;
|
||||||
|
{
|
||||||
|
return obstack_alloc (obstack, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
POINTER (obstack_copy) (obstack, address, length)
|
||||||
|
struct obstack *obstack;
|
||||||
|
const POINTER address;
|
||||||
|
int length;
|
||||||
|
{
|
||||||
|
return obstack_copy (obstack, address, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
POINTER (obstack_copy0) (obstack, address, length)
|
||||||
|
struct obstack *obstack;
|
||||||
|
const POINTER address;
|
||||||
|
int length;
|
||||||
|
{
|
||||||
|
return obstack_copy0 (obstack, address, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
# endif /* __STDC__ */
|
||||||
|
|
||||||
|
# endif /* 0 */
|
||||||
|
|
||||||
|
#endif /* !ELIDE_CODE */
|
||||||
+609
@@ -0,0 +1,609 @@
|
|||||||
|
/* obstack.h - object stack macros
|
||||||
|
Copyright (C) 1988,89,90,91,92,93,94,96,97,98,99 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of the GNU C Library. Its master source is NOT part of
|
||||||
|
the C library, however. The master source lives in /gd/gnu/lib.
|
||||||
|
|
||||||
|
NOTE: The canonical source of this file is maintained with 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,
|
||||||
|
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. */
|
||||||
|
|
||||||
|
/* Summary:
|
||||||
|
|
||||||
|
All the apparent functions defined here are macros. The idea
|
||||||
|
is that you would use these pre-tested macros to solve a
|
||||||
|
very specific set of problems, and they would run fast.
|
||||||
|
Caution: no side-effects in arguments please!! They may be
|
||||||
|
evaluated MANY times!!
|
||||||
|
|
||||||
|
These macros operate a stack of objects. Each object starts life
|
||||||
|
small, and may grow to maturity. (Consider building a word syllable
|
||||||
|
by syllable.) An object can move while it is growing. Once it has
|
||||||
|
been "finished" it never changes address again. So the "top of the
|
||||||
|
stack" is typically an immature growing object, while the rest of the
|
||||||
|
stack is of mature, fixed size and fixed address objects.
|
||||||
|
|
||||||
|
These routines grab large chunks of memory, using a function you
|
||||||
|
supply, called `obstack_chunk_alloc'. On occasion, they free chunks,
|
||||||
|
by calling `obstack_chunk_free'. You must define them and declare
|
||||||
|
them before using any obstack macros.
|
||||||
|
|
||||||
|
Each independent stack is represented by a `struct obstack'.
|
||||||
|
Each of the obstack macros expects a pointer to such a structure
|
||||||
|
as the first argument.
|
||||||
|
|
||||||
|
One motivation for this package is the problem of growing char strings
|
||||||
|
in symbol tables. Unless you are "fascist pig with a read-only mind"
|
||||||
|
--Gosper's immortal quote from HAKMEM item 154, out of context--you
|
||||||
|
would not like to put any arbitrary upper limit on the length of your
|
||||||
|
symbols.
|
||||||
|
|
||||||
|
In practice this often means you will build many short symbols and a
|
||||||
|
few long symbols. At the time you are reading a symbol you don't know
|
||||||
|
how long it is. One traditional method is to read a symbol into a
|
||||||
|
buffer, realloc()ating the buffer every time you try to read a symbol
|
||||||
|
that is longer than the buffer. This is beaut, but you still will
|
||||||
|
want to copy the symbol from the buffer to a more permanent
|
||||||
|
symbol-table entry say about half the time.
|
||||||
|
|
||||||
|
With obstacks, you can work differently. Use one obstack for all symbol
|
||||||
|
names. As you read a symbol, grow the name in the obstack gradually.
|
||||||
|
When the name is complete, finalize it. Then, if the symbol exists already,
|
||||||
|
free the newly read name.
|
||||||
|
|
||||||
|
The way we do this is to take a large chunk, allocating memory from
|
||||||
|
low addresses. When you want to build a symbol in the chunk you just
|
||||||
|
add chars above the current "high water mark" in the chunk. When you
|
||||||
|
have finished adding chars, because you got to the end of the symbol,
|
||||||
|
you know how long the chars are, and you can create a new object.
|
||||||
|
Mostly the chars will not burst over the highest address of the chunk,
|
||||||
|
because you would typically expect a chunk to be (say) 100 times as
|
||||||
|
long as an average object.
|
||||||
|
|
||||||
|
In case that isn't clear, when we have enough chars to make up
|
||||||
|
the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed)
|
||||||
|
so we just point to it where it lies. No moving of chars is
|
||||||
|
needed and this is the second win: potentially long strings need
|
||||||
|
never be explicitly shuffled. Once an object is formed, it does not
|
||||||
|
change its address during its lifetime.
|
||||||
|
|
||||||
|
When the chars burst over a chunk boundary, we allocate a larger
|
||||||
|
chunk, and then copy the partly formed object from the end of the old
|
||||||
|
chunk to the beginning of the new larger chunk. We then carry on
|
||||||
|
accreting characters to the end of the object as we normally would.
|
||||||
|
|
||||||
|
A special macro is provided to add a single char at a time to a
|
||||||
|
growing object. This allows the use of register variables, which
|
||||||
|
break the ordinary 'growth' macro.
|
||||||
|
|
||||||
|
Summary:
|
||||||
|
We allocate large chunks.
|
||||||
|
We carve out one object at a time from the current chunk.
|
||||||
|
Once carved, an object never moves.
|
||||||
|
We are free to append data of any size to the currently
|
||||||
|
growing object.
|
||||||
|
Exactly one object is growing in an obstack at any one time.
|
||||||
|
You can run one obstack per control block.
|
||||||
|
You may have as many control blocks as you dare.
|
||||||
|
Because of the way we do it, you can `unwind' an obstack
|
||||||
|
back to a previous state. (You may remove objects much
|
||||||
|
as you would with a stack.)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Don't do the contents of this file more than once. */
|
||||||
|
|
||||||
|
#ifndef _OBSTACK_H
|
||||||
|
#define _OBSTACK_H 1
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* We use subtraction of (char *) 0 instead of casting to int
|
||||||
|
because on word-addressable machines a simple cast to int
|
||||||
|
may ignore the byte-within-word field of the pointer. */
|
||||||
|
|
||||||
|
#ifndef __PTR_TO_INT
|
||||||
|
# define __PTR_TO_INT(P) ((P) - (char *) 0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __INT_TO_PTR
|
||||||
|
# define __INT_TO_PTR(P) ((P) + (char *) 0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* We need the type of the resulting object. If __PTRDIFF_TYPE__ is
|
||||||
|
defined, as with GNU C, use that; that way we don't pollute the
|
||||||
|
namespace with <stddef.h>'s symbols. Otherwise, if <stddef.h> is
|
||||||
|
available, include it and use ptrdiff_t. In traditional C, long is
|
||||||
|
the best that we can do. */
|
||||||
|
|
||||||
|
#ifdef __PTRDIFF_TYPE__
|
||||||
|
# define PTR_INT_TYPE __PTRDIFF_TYPE__
|
||||||
|
#else
|
||||||
|
# ifdef HAVE_STDDEF_H
|
||||||
|
# include <stddef.h>
|
||||||
|
# define PTR_INT_TYPE ptrdiff_t
|
||||||
|
# else
|
||||||
|
# define PTR_INT_TYPE long
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined _LIBC || defined HAVE_STRING_H
|
||||||
|
# include <string.h>
|
||||||
|
# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N))
|
||||||
|
#else
|
||||||
|
# ifdef memcpy
|
||||||
|
# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N))
|
||||||
|
# else
|
||||||
|
# define _obstack_memcpy(To, From, N) bcopy ((From), (To), (N))
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct _obstack_chunk /* Lives at front of each chunk. */
|
||||||
|
{
|
||||||
|
char *limit; /* 1 past end of this chunk */
|
||||||
|
struct _obstack_chunk *prev; /* address of prior chunk or NULL */
|
||||||
|
char contents[4]; /* objects begin here */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct obstack /* control current object in current chunk */
|
||||||
|
{
|
||||||
|
long chunk_size; /* preferred size to allocate chunks in */
|
||||||
|
struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */
|
||||||
|
char *object_base; /* address of object we are building */
|
||||||
|
char *next_free; /* where to add next char to current object */
|
||||||
|
char *chunk_limit; /* address of char after current chunk */
|
||||||
|
PTR_INT_TYPE temp; /* Temporary for some macros. */
|
||||||
|
int alignment_mask; /* Mask of alignment for each object. */
|
||||||
|
#if defined __STDC__ && __STDC__
|
||||||
|
/* These prototypes vary based on `use_extra_arg', and we use
|
||||||
|
casts to the prototypeless function type in all assignments,
|
||||||
|
but having prototypes here quiets -Wstrict-prototypes. */
|
||||||
|
struct _obstack_chunk *(*chunkfun) (void *, long);
|
||||||
|
void (*freefun) (void *, struct _obstack_chunk *);
|
||||||
|
void *extra_arg; /* first arg for chunk alloc/dealloc funcs */
|
||||||
|
#else
|
||||||
|
struct _obstack_chunk *(*chunkfun) (); /* User's fcn to allocate a chunk. */
|
||||||
|
void (*freefun) (); /* User's function to free a chunk. */
|
||||||
|
char *extra_arg; /* first arg for chunk alloc/dealloc funcs */
|
||||||
|
#endif
|
||||||
|
unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */
|
||||||
|
unsigned maybe_empty_object:1;/* There is a possibility that the current
|
||||||
|
chunk contains a zero-length object. This
|
||||||
|
prevents freeing the chunk if we allocate
|
||||||
|
a bigger chunk to replace it. */
|
||||||
|
unsigned alloc_failed:1; /* No longer used, as we now call the failed
|
||||||
|
handler on error, but retained for binary
|
||||||
|
compatibility. */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Declare the external functions we use; they are in obstack.c. */
|
||||||
|
|
||||||
|
#if defined __STDC__ && __STDC__
|
||||||
|
extern void _obstack_newchunk (struct obstack *, int);
|
||||||
|
extern void _obstack_free (struct obstack *, void *);
|
||||||
|
extern int _obstack_begin (struct obstack *, int, int,
|
||||||
|
void *(*) (long), void (*) (void *));
|
||||||
|
extern int _obstack_begin_1 (struct obstack *, int, int,
|
||||||
|
void *(*) (void *, long),
|
||||||
|
void (*) (void *, void *), void *);
|
||||||
|
extern int _obstack_memory_used (struct obstack *);
|
||||||
|
#else
|
||||||
|
extern void _obstack_newchunk ();
|
||||||
|
extern void _obstack_free ();
|
||||||
|
extern int _obstack_begin ();
|
||||||
|
extern int _obstack_begin_1 ();
|
||||||
|
extern int _obstack_memory_used ();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined __STDC__ && __STDC__
|
||||||
|
|
||||||
|
/* Do the function-declarations after the structs
|
||||||
|
but before defining the macros. */
|
||||||
|
|
||||||
|
void obstack_init (struct obstack *obstack);
|
||||||
|
|
||||||
|
void * obstack_alloc (struct obstack *obstack, int size);
|
||||||
|
|
||||||
|
void * obstack_copy (struct obstack *obstack, const void *address, int size);
|
||||||
|
void * obstack_copy0 (struct obstack *obstack, const void *address, int size);
|
||||||
|
|
||||||
|
void obstack_free (struct obstack *obstack, void *block);
|
||||||
|
|
||||||
|
void obstack_blank (struct obstack *obstack, int size);
|
||||||
|
|
||||||
|
void obstack_grow (struct obstack *obstack, const void *data, int size);
|
||||||
|
void obstack_grow0 (struct obstack *obstack, const void *data, int size);
|
||||||
|
|
||||||
|
void obstack_1grow (struct obstack *obstack, int data_char);
|
||||||
|
void obstack_ptr_grow (struct obstack *obstack, const void *data);
|
||||||
|
void obstack_int_grow (struct obstack *obstack, int data);
|
||||||
|
|
||||||
|
void * obstack_finish (struct obstack *obstack);
|
||||||
|
|
||||||
|
int obstack_object_size (struct obstack *obstack);
|
||||||
|
|
||||||
|
int obstack_room (struct obstack *obstack);
|
||||||
|
void obstack_make_room (struct obstack *obstack, int size);
|
||||||
|
void obstack_1grow_fast (struct obstack *obstack, int data_char);
|
||||||
|
void obstack_ptr_grow_fast (struct obstack *obstack, const void *data);
|
||||||
|
void obstack_int_grow_fast (struct obstack *obstack, int data);
|
||||||
|
void obstack_blank_fast (struct obstack *obstack, int size);
|
||||||
|
|
||||||
|
void * obstack_base (struct obstack *obstack);
|
||||||
|
void * obstack_next_free (struct obstack *obstack);
|
||||||
|
int obstack_alignment_mask (struct obstack *obstack);
|
||||||
|
int obstack_chunk_size (struct obstack *obstack);
|
||||||
|
int obstack_memory_used (struct obstack *obstack);
|
||||||
|
|
||||||
|
#endif /* __STDC__ */
|
||||||
|
|
||||||
|
/* Non-ANSI C cannot really support alternative functions for these macros,
|
||||||
|
so we do not declare them. */
|
||||||
|
|
||||||
|
/* Error handler called when `obstack_chunk_alloc' failed to allocate
|
||||||
|
more memory. This can be set to a user defined function which
|
||||||
|
should either abort gracefully or use longjump - but shouldn't
|
||||||
|
return. The default action is to print a message and abort. */
|
||||||
|
#if defined __STDC__ && __STDC__
|
||||||
|
extern void (*obstack_alloc_failed_handler) (void);
|
||||||
|
#else
|
||||||
|
extern void (*obstack_alloc_failed_handler) ();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Exit value used when `print_and_abort' is used. */
|
||||||
|
extern int obstack_exit_failure;
|
||||||
|
|
||||||
|
/* Pointer to beginning of object being allocated or to be allocated next.
|
||||||
|
Note that this might not be the final address of the object
|
||||||
|
because a new chunk might be needed to hold the final size. */
|
||||||
|
|
||||||
|
#define obstack_base(h) ((h)->object_base)
|
||||||
|
|
||||||
|
/* Size for allocating ordinary chunks. */
|
||||||
|
|
||||||
|
#define obstack_chunk_size(h) ((h)->chunk_size)
|
||||||
|
|
||||||
|
/* Pointer to next byte not yet allocated in current chunk. */
|
||||||
|
|
||||||
|
#define obstack_next_free(h) ((h)->next_free)
|
||||||
|
|
||||||
|
/* Mask specifying low bits that should be clear in address of an object. */
|
||||||
|
|
||||||
|
#define obstack_alignment_mask(h) ((h)->alignment_mask)
|
||||||
|
|
||||||
|
/* To prevent prototype warnings provide complete argument list in
|
||||||
|
standard C version. */
|
||||||
|
#if defined __STDC__ && __STDC__
|
||||||
|
|
||||||
|
# define obstack_init(h) \
|
||||||
|
_obstack_begin ((h), 0, 0, \
|
||||||
|
(void *(*) (long)) obstack_chunk_alloc, \
|
||||||
|
(void (*) (void *)) obstack_chunk_free)
|
||||||
|
|
||||||
|
# define obstack_begin(h, size) \
|
||||||
|
_obstack_begin ((h), (size), 0, \
|
||||||
|
(void *(*) (long)) obstack_chunk_alloc, \
|
||||||
|
(void (*) (void *)) obstack_chunk_free)
|
||||||
|
|
||||||
|
# define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
|
||||||
|
_obstack_begin ((h), (size), (alignment), \
|
||||||
|
(void *(*) (long)) (chunkfun), \
|
||||||
|
(void (*) (void *)) (freefun))
|
||||||
|
|
||||||
|
# define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
|
||||||
|
_obstack_begin_1 ((h), (size), (alignment), \
|
||||||
|
(void *(*) (void *, long)) (chunkfun), \
|
||||||
|
(void (*) (void *, void *)) (freefun), (arg))
|
||||||
|
|
||||||
|
# define obstack_chunkfun(h, newchunkfun) \
|
||||||
|
((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun))
|
||||||
|
|
||||||
|
# define obstack_freefun(h, newfreefun) \
|
||||||
|
((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun))
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
# define obstack_init(h) \
|
||||||
|
_obstack_begin ((h), 0, 0, \
|
||||||
|
(void *(*) ()) obstack_chunk_alloc, \
|
||||||
|
(void (*) ()) obstack_chunk_free)
|
||||||
|
|
||||||
|
# define obstack_begin(h, size) \
|
||||||
|
_obstack_begin ((h), (size), 0, \
|
||||||
|
(void *(*) ()) obstack_chunk_alloc, \
|
||||||
|
(void (*) ()) obstack_chunk_free)
|
||||||
|
|
||||||
|
# define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
|
||||||
|
_obstack_begin ((h), (size), (alignment), \
|
||||||
|
(void *(*) ()) (chunkfun), \
|
||||||
|
(void (*) ()) (freefun))
|
||||||
|
|
||||||
|
# define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
|
||||||
|
_obstack_begin_1 ((h), (size), (alignment), \
|
||||||
|
(void *(*) ()) (chunkfun), \
|
||||||
|
(void (*) ()) (freefun), (arg))
|
||||||
|
|
||||||
|
# define obstack_chunkfun(h, newchunkfun) \
|
||||||
|
((h) -> chunkfun = (struct _obstack_chunk *(*)()) (newchunkfun))
|
||||||
|
|
||||||
|
# define obstack_freefun(h, newfreefun) \
|
||||||
|
((h) -> freefun = (void (*)()) (newfreefun))
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = achar)
|
||||||
|
|
||||||
|
#define obstack_blank_fast(h,n) ((h)->next_free += (n))
|
||||||
|
|
||||||
|
#define obstack_memory_used(h) _obstack_memory_used (h)
|
||||||
|
|
||||||
|
#if defined __GNUC__ && defined __STDC__ && __STDC__
|
||||||
|
/* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and
|
||||||
|
does not implement __extension__. But that compiler doesn't define
|
||||||
|
__GNUC_MINOR__. */
|
||||||
|
# if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__)
|
||||||
|
# define __extension__
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* For GNU C, if not -traditional,
|
||||||
|
we can define these macros to compute all args only once
|
||||||
|
without using a global variable.
|
||||||
|
Also, we can avoid using the `temp' slot, to make faster code. */
|
||||||
|
|
||||||
|
# define obstack_object_size(OBSTACK) \
|
||||||
|
__extension__ \
|
||||||
|
({ struct obstack *__o = (OBSTACK); \
|
||||||
|
(unsigned) (__o->next_free - __o->object_base); })
|
||||||
|
|
||||||
|
# define obstack_room(OBSTACK) \
|
||||||
|
__extension__ \
|
||||||
|
({ struct obstack *__o = (OBSTACK); \
|
||||||
|
(unsigned) (__o->chunk_limit - __o->next_free); })
|
||||||
|
|
||||||
|
# define obstack_make_room(OBSTACK,length) \
|
||||||
|
__extension__ \
|
||||||
|
({ struct obstack *__o = (OBSTACK); \
|
||||||
|
int __len = (length); \
|
||||||
|
if (__o->chunk_limit - __o->next_free < __len) \
|
||||||
|
_obstack_newchunk (__o, __len); \
|
||||||
|
(void) 0; })
|
||||||
|
|
||||||
|
# define obstack_empty_p(OBSTACK) \
|
||||||
|
__extension__ \
|
||||||
|
({ struct obstack *__o = (OBSTACK); \
|
||||||
|
(__o->chunk->prev == 0 && __o->next_free - __o->chunk->contents == 0); })
|
||||||
|
|
||||||
|
# define obstack_grow(OBSTACK,where,length) \
|
||||||
|
__extension__ \
|
||||||
|
({ struct obstack *__o = (OBSTACK); \
|
||||||
|
int __len = (length); \
|
||||||
|
if (__o->next_free + __len > __o->chunk_limit) \
|
||||||
|
_obstack_newchunk (__o, __len); \
|
||||||
|
_obstack_memcpy (__o->next_free, (where), __len); \
|
||||||
|
__o->next_free += __len; \
|
||||||
|
(void) 0; })
|
||||||
|
|
||||||
|
# define obstack_grow0(OBSTACK,where,length) \
|
||||||
|
__extension__ \
|
||||||
|
({ struct obstack *__o = (OBSTACK); \
|
||||||
|
int __len = (length); \
|
||||||
|
if (__o->next_free + __len + 1 > __o->chunk_limit) \
|
||||||
|
_obstack_newchunk (__o, __len + 1); \
|
||||||
|
_obstack_memcpy (__o->next_free, (where), __len); \
|
||||||
|
__o->next_free += __len; \
|
||||||
|
*(__o->next_free)++ = 0; \
|
||||||
|
(void) 0; })
|
||||||
|
|
||||||
|
# define obstack_1grow(OBSTACK,datum) \
|
||||||
|
__extension__ \
|
||||||
|
({ struct obstack *__o = (OBSTACK); \
|
||||||
|
if (__o->next_free + 1 > __o->chunk_limit) \
|
||||||
|
_obstack_newchunk (__o, 1); \
|
||||||
|
*(__o->next_free)++ = (datum); \
|
||||||
|
(void) 0; })
|
||||||
|
|
||||||
|
/* These assume that the obstack alignment is good enough for pointers
|
||||||
|
or ints, and that the data added so far to the current object
|
||||||
|
shares that much alignment. */
|
||||||
|
|
||||||
|
# define obstack_ptr_grow(OBSTACK,datum) \
|
||||||
|
__extension__ \
|
||||||
|
({ struct obstack *__o = (OBSTACK); \
|
||||||
|
if (__o->next_free + sizeof (void *) > __o->chunk_limit) \
|
||||||
|
_obstack_newchunk (__o, sizeof (void *)); \
|
||||||
|
*((void **)__o->next_free)++ = (datum); \
|
||||||
|
(void) 0; })
|
||||||
|
|
||||||
|
# define obstack_int_grow(OBSTACK,datum) \
|
||||||
|
__extension__ \
|
||||||
|
({ struct obstack *__o = (OBSTACK); \
|
||||||
|
if (__o->next_free + sizeof (int) > __o->chunk_limit) \
|
||||||
|
_obstack_newchunk (__o, sizeof (int)); \
|
||||||
|
*((int *)__o->next_free)++ = (datum); \
|
||||||
|
(void) 0; })
|
||||||
|
|
||||||
|
# define obstack_ptr_grow_fast(h,aptr) \
|
||||||
|
(*((void **) (h)->next_free)++ = (aptr))
|
||||||
|
|
||||||
|
# define obstack_int_grow_fast(h,aint) \
|
||||||
|
(*((int *) (h)->next_free)++ = (aint))
|
||||||
|
|
||||||
|
# define obstack_blank(OBSTACK,length) \
|
||||||
|
__extension__ \
|
||||||
|
({ struct obstack *__o = (OBSTACK); \
|
||||||
|
int __len = (length); \
|
||||||
|
if (__o->chunk_limit - __o->next_free < __len) \
|
||||||
|
_obstack_newchunk (__o, __len); \
|
||||||
|
__o->next_free += __len; \
|
||||||
|
(void) 0; })
|
||||||
|
|
||||||
|
# define obstack_alloc(OBSTACK,length) \
|
||||||
|
__extension__ \
|
||||||
|
({ struct obstack *__h = (OBSTACK); \
|
||||||
|
obstack_blank (__h, (length)); \
|
||||||
|
obstack_finish (__h); })
|
||||||
|
|
||||||
|
# define obstack_copy(OBSTACK,where,length) \
|
||||||
|
__extension__ \
|
||||||
|
({ struct obstack *__h = (OBSTACK); \
|
||||||
|
obstack_grow (__h, (where), (length)); \
|
||||||
|
obstack_finish (__h); })
|
||||||
|
|
||||||
|
# define obstack_copy0(OBSTACK,where,length) \
|
||||||
|
__extension__ \
|
||||||
|
({ struct obstack *__h = (OBSTACK); \
|
||||||
|
obstack_grow0 (__h, (where), (length)); \
|
||||||
|
obstack_finish (__h); })
|
||||||
|
|
||||||
|
/* The local variable is named __o1 to avoid a name conflict
|
||||||
|
when obstack_blank is called. */
|
||||||
|
# define obstack_finish(OBSTACK) \
|
||||||
|
__extension__ \
|
||||||
|
({ struct obstack *__o1 = (OBSTACK); \
|
||||||
|
void *value; \
|
||||||
|
value = (void *) __o1->object_base; \
|
||||||
|
if (__o1->next_free == value) \
|
||||||
|
__o1->maybe_empty_object = 1; \
|
||||||
|
__o1->next_free \
|
||||||
|
= __INT_TO_PTR ((__PTR_TO_INT (__o1->next_free)+__o1->alignment_mask)\
|
||||||
|
& ~ (__o1->alignment_mask)); \
|
||||||
|
if (__o1->next_free - (char *)__o1->chunk \
|
||||||
|
> __o1->chunk_limit - (char *)__o1->chunk) \
|
||||||
|
__o1->next_free = __o1->chunk_limit; \
|
||||||
|
__o1->object_base = __o1->next_free; \
|
||||||
|
value; })
|
||||||
|
|
||||||
|
# define obstack_free(OBSTACK, OBJ) \
|
||||||
|
__extension__ \
|
||||||
|
({ struct obstack *__o = (OBSTACK); \
|
||||||
|
void *__obj = (OBJ); \
|
||||||
|
if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \
|
||||||
|
__o->next_free = __o->object_base = (char *)__obj; \
|
||||||
|
else (obstack_free) (__o, __obj); })
|
||||||
|
|
||||||
|
#else /* not __GNUC__ or not __STDC__ */
|
||||||
|
|
||||||
|
# define obstack_object_size(h) \
|
||||||
|
(unsigned) ((h)->next_free - (h)->object_base)
|
||||||
|
|
||||||
|
# define obstack_room(h) \
|
||||||
|
(unsigned) ((h)->chunk_limit - (h)->next_free)
|
||||||
|
|
||||||
|
# define obstack_empty_p(h) \
|
||||||
|
((h)->chunk->prev == 0 && (h)->next_free - (h)->chunk->contents == 0)
|
||||||
|
|
||||||
|
/* Note that the call to _obstack_newchunk is enclosed in (..., 0)
|
||||||
|
so that we can avoid having void expressions
|
||||||
|
in the arms of the conditional expression.
|
||||||
|
Casting the third operand to void was tried before,
|
||||||
|
but some compilers won't accept it. */
|
||||||
|
|
||||||
|
# define obstack_make_room(h,length) \
|
||||||
|
( (h)->temp = (length), \
|
||||||
|
(((h)->next_free + (h)->temp > (h)->chunk_limit) \
|
||||||
|
? (_obstack_newchunk ((h), (h)->temp), 0) : 0))
|
||||||
|
|
||||||
|
# define obstack_grow(h,where,length) \
|
||||||
|
( (h)->temp = (length), \
|
||||||
|
(((h)->next_free + (h)->temp > (h)->chunk_limit) \
|
||||||
|
? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \
|
||||||
|
_obstack_memcpy ((h)->next_free, (where), (h)->temp), \
|
||||||
|
(h)->next_free += (h)->temp)
|
||||||
|
|
||||||
|
# define obstack_grow0(h,where,length) \
|
||||||
|
( (h)->temp = (length), \
|
||||||
|
(((h)->next_free + (h)->temp + 1 > (h)->chunk_limit) \
|
||||||
|
? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0), \
|
||||||
|
_obstack_memcpy ((h)->next_free, (where), (h)->temp), \
|
||||||
|
(h)->next_free += (h)->temp, \
|
||||||
|
*((h)->next_free)++ = 0)
|
||||||
|
|
||||||
|
# define obstack_1grow(h,datum) \
|
||||||
|
( (((h)->next_free + 1 > (h)->chunk_limit) \
|
||||||
|
? (_obstack_newchunk ((h), 1), 0) : 0), \
|
||||||
|
(*((h)->next_free)++ = (datum)))
|
||||||
|
|
||||||
|
# define obstack_ptr_grow(h,datum) \
|
||||||
|
( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \
|
||||||
|
? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \
|
||||||
|
(*((const char **) (((h)->next_free+=sizeof(char *))-sizeof(char *))) = (datum)))
|
||||||
|
|
||||||
|
# define obstack_int_grow(h,datum) \
|
||||||
|
( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \
|
||||||
|
? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \
|
||||||
|
(*((int *) (((h)->next_free+=sizeof(int))-sizeof(int))) = (datum)))
|
||||||
|
|
||||||
|
# define obstack_ptr_grow_fast(h,aptr) \
|
||||||
|
(*((const char **) (h)->next_free)++ = (aptr))
|
||||||
|
|
||||||
|
# define obstack_int_grow_fast(h,aint) \
|
||||||
|
(*((int *) (h)->next_free)++ = (aint))
|
||||||
|
|
||||||
|
# define obstack_blank(h,length) \
|
||||||
|
( (h)->temp = (length), \
|
||||||
|
(((h)->chunk_limit - (h)->next_free < (h)->temp) \
|
||||||
|
? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \
|
||||||
|
((h)->next_free += (h)->temp))
|
||||||
|
|
||||||
|
# define obstack_alloc(h,length) \
|
||||||
|
(obstack_blank ((h), (length)), obstack_finish ((h)))
|
||||||
|
|
||||||
|
# define obstack_copy(h,where,length) \
|
||||||
|
(obstack_grow ((h), (where), (length)), obstack_finish ((h)))
|
||||||
|
|
||||||
|
# define obstack_copy0(h,where,length) \
|
||||||
|
(obstack_grow0 ((h), (where), (length)), obstack_finish ((h)))
|
||||||
|
|
||||||
|
# define obstack_finish(h) \
|
||||||
|
( ((h)->next_free == (h)->object_base \
|
||||||
|
? (((h)->maybe_empty_object = 1), 0) \
|
||||||
|
: 0), \
|
||||||
|
(h)->temp = __PTR_TO_INT ((h)->object_base), \
|
||||||
|
(h)->next_free \
|
||||||
|
= __INT_TO_PTR ((__PTR_TO_INT ((h)->next_free)+(h)->alignment_mask) \
|
||||||
|
& ~ ((h)->alignment_mask)), \
|
||||||
|
(((h)->next_free - (char *) (h)->chunk \
|
||||||
|
> (h)->chunk_limit - (char *) (h)->chunk) \
|
||||||
|
? ((h)->next_free = (h)->chunk_limit) : 0), \
|
||||||
|
(h)->object_base = (h)->next_free, \
|
||||||
|
__INT_TO_PTR ((h)->temp))
|
||||||
|
|
||||||
|
# if defined __STDC__ && __STDC__
|
||||||
|
# define obstack_free(h,obj) \
|
||||||
|
( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \
|
||||||
|
(((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
|
||||||
|
? (int) ((h)->next_free = (h)->object_base \
|
||||||
|
= (h)->temp + (char *) (h)->chunk) \
|
||||||
|
: (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0)))
|
||||||
|
# else
|
||||||
|
# define obstack_free(h,obj) \
|
||||||
|
( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \
|
||||||
|
(((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
|
||||||
|
? (int) ((h)->next_free = (h)->object_base \
|
||||||
|
= (h)->temp + (char *) (h)->chunk) \
|
||||||
|
: (_obstack_free ((h), (h)->temp + (char *) (h)->chunk), 0)))
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif /* not __GNUC__ or not __STDC__ */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* C++ */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* obstack.h */
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
/* Written by Paul Eggert <[email protected]> */
|
||||||
|
|
||||||
|
#if HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_STDDEF_H
|
||||||
|
# include <stddef.h> /* For the definition of size_t on windows w/MSVC. */
|
||||||
|
#endif
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <quotearg.h>
|
||||||
|
#include <quote.h>
|
||||||
|
|
||||||
|
/* Return an unambiguous printable representated, allocated in slot N,
|
||||||
|
for NAME, suitable for diagnostics. */
|
||||||
|
char const *
|
||||||
|
quote_n (int n, char const *name)
|
||||||
|
{
|
||||||
|
return quotearg_n_style (n, locale_quoting_style, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return an unambiguous printable representation of NAME, suitable
|
||||||
|
for diagnostics. */
|
||||||
|
char const *
|
||||||
|
quote (char const *name)
|
||||||
|
{
|
||||||
|
return quote_n (0, name);
|
||||||
|
}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
/* prototypes for quote.c */
|
||||||
|
|
||||||
|
#ifndef PARAMS
|
||||||
|
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||||
|
# define PARAMS(Args) Args
|
||||||
|
# else
|
||||||
|
# define PARAMS(Args) ()
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
char const *quote_n PARAMS ((int n, char const *name));
|
||||||
|
char const *quote PARAMS ((char const *name));
|
||||||
+622
@@ -0,0 +1,622 @@
|
|||||||
|
/* quotearg.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]> */
|
||||||
|
|
||||||
|
#if HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_STDDEF_H
|
||||||
|
# include <stddef.h> /* For the definition of size_t on windows w/MSVC. */
|
||||||
|
#endif
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <quotearg.h>
|
||||||
|
#include <xalloc.h>
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#if ENABLE_NLS
|
||||||
|
# include <libintl.h>
|
||||||
|
# define _(text) gettext (text)
|
||||||
|
#else
|
||||||
|
# define _(text) text
|
||||||
|
#endif
|
||||||
|
#define N_(text) text
|
||||||
|
|
||||||
|
#if HAVE_LIMITS_H
|
||||||
|
# include <limits.h>
|
||||||
|
#endif
|
||||||
|
#ifndef CHAR_BIT
|
||||||
|
# define CHAR_BIT 8
|
||||||
|
#endif
|
||||||
|
#ifndef UCHAR_MAX
|
||||||
|
# define UCHAR_MAX ((unsigned char) -1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_C_BACKSLASH_A
|
||||||
|
# define ALERT_CHAR '\a'
|
||||||
|
#else
|
||||||
|
# define ALERT_CHAR '\7'
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_STDLIB_H
|
||||||
|
# include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_STRING_H
|
||||||
|
# include <string.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_WCHAR_H
|
||||||
|
|
||||||
|
/* BSD/OS 4.1 wchar.h requires FILE and struct tm to be declared. */
|
||||||
|
# include <stdio.h>
|
||||||
|
# include <time.h>
|
||||||
|
|
||||||
|
# include <wchar.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !HAVE_MBRTOWC
|
||||||
|
/* Disable multibyte processing entirely. Since MB_CUR_MAX is 1, the
|
||||||
|
other macros are defined only for documentation and to satisfy C
|
||||||
|
syntax. */
|
||||||
|
# undef MB_CUR_MAX
|
||||||
|
# define MB_CUR_MAX 1
|
||||||
|
# define mbrtowc(pwc, s, n, ps) ((*(pwc) = *(s)) != 0)
|
||||||
|
# define iswprint(wc) ISPRINT ((unsigned char) (wc))
|
||||||
|
# undef HAVE_MBSINIT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined mbsinit && !HAVE_MBSINIT
|
||||||
|
# define mbsinit(ps) 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef iswprint
|
||||||
|
# if HAVE_WCTYPE_H
|
||||||
|
# include <wctype.h>
|
||||||
|
# endif
|
||||||
|
# if !defined iswprint && !HAVE_ISWPRINT
|
||||||
|
# define iswprint(wc) 1
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define INT_BITS (sizeof (int) * CHAR_BIT)
|
||||||
|
|
||||||
|
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
|
||||||
|
# define IN_CTYPE_DOMAIN(c) 1
|
||||||
|
#else
|
||||||
|
# define IN_CTYPE_DOMAIN(c) isascii(c)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Undefine to protect against the definition in wctype.h of solaris2.6. */
|
||||||
|
#undef ISPRINT
|
||||||
|
#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c))
|
||||||
|
|
||||||
|
struct quoting_options
|
||||||
|
{
|
||||||
|
/* Basic quoting style. */
|
||||||
|
enum quoting_style style;
|
||||||
|
|
||||||
|
/* Quote the characters indicated by this bit vector even if the
|
||||||
|
quoting style would not normally require them to be quoted. */
|
||||||
|
int quote_these_too[(UCHAR_MAX / INT_BITS) + 1];
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Names of quoting styles. */
|
||||||
|
char const *const quoting_style_args[] =
|
||||||
|
{
|
||||||
|
"literal",
|
||||||
|
"shell",
|
||||||
|
"shell-always",
|
||||||
|
"c",
|
||||||
|
"escape",
|
||||||
|
"locale",
|
||||||
|
"clocale",
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Correspondences to quoting style names. */
|
||||||
|
enum quoting_style const quoting_style_vals[] =
|
||||||
|
{
|
||||||
|
literal_quoting_style,
|
||||||
|
shell_quoting_style,
|
||||||
|
shell_always_quoting_style,
|
||||||
|
c_quoting_style,
|
||||||
|
escape_quoting_style,
|
||||||
|
locale_quoting_style,
|
||||||
|
clocale_quoting_style
|
||||||
|
};
|
||||||
|
|
||||||
|
/* The default quoting options. */
|
||||||
|
static struct quoting_options default_quoting_options;
|
||||||
|
|
||||||
|
/* Allocate a new set of quoting options, with contents initially identical
|
||||||
|
to O if O is not null, or to the default if O is null.
|
||||||
|
It is the caller's responsibility to free the result. */
|
||||||
|
struct quoting_options *
|
||||||
|
clone_quoting_options (struct quoting_options *o)
|
||||||
|
{
|
||||||
|
struct quoting_options *p
|
||||||
|
= (struct quoting_options *) xmalloc (sizeof (struct quoting_options));
|
||||||
|
*p = *(o ? o : &default_quoting_options);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the value of O's quoting style. If O is null, use the default. */
|
||||||
|
enum quoting_style
|
||||||
|
get_quoting_style (struct quoting_options *o)
|
||||||
|
{
|
||||||
|
return (o ? o : &default_quoting_options)->style;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* In O (or in the default if O is null),
|
||||||
|
set the value of the quoting style to S. */
|
||||||
|
void
|
||||||
|
set_quoting_style (struct quoting_options *o, enum quoting_style s)
|
||||||
|
{
|
||||||
|
(o ? o : &default_quoting_options)->style = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* In O (or in the default if O is null),
|
||||||
|
set the value of the quoting options for character C to I.
|
||||||
|
Return the old value. Currently, the only values defined for I are
|
||||||
|
0 (the default) and 1 (which means to quote the character even if
|
||||||
|
it would not otherwise be quoted). */
|
||||||
|
int
|
||||||
|
set_char_quoting (struct quoting_options *o, char c, int i)
|
||||||
|
{
|
||||||
|
unsigned char uc = c;
|
||||||
|
int *p = (o ? o : &default_quoting_options)->quote_these_too + uc / INT_BITS;
|
||||||
|
int shift = uc % INT_BITS;
|
||||||
|
int r = (*p >> shift) & 1;
|
||||||
|
*p ^= ((i & 1) ^ r) << shift;
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* MSGID approximates a quotation mark. Return its translation if it
|
||||||
|
has one; otherwise, return either it or "\"", depending on S. */
|
||||||
|
static char const *
|
||||||
|
gettext_quote (char const *msgid, enum quoting_style s)
|
||||||
|
{
|
||||||
|
char const *translation = _(msgid);
|
||||||
|
if (translation == msgid && s == clocale_quoting_style)
|
||||||
|
translation = "\"";
|
||||||
|
return translation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of
|
||||||
|
argument ARG (of size ARGSIZE), using QUOTING_STYLE and the
|
||||||
|
non-quoting-style part of O to control quoting.
|
||||||
|
Terminate the output with a null character, and return the written
|
||||||
|
size of the output, not counting the terminating null.
|
||||||
|
If BUFFERSIZE is too small to store the output string, return the
|
||||||
|
value that would have been returned had BUFFERSIZE been large enough.
|
||||||
|
If ARGSIZE is -1, use the string length of the argument for ARGSIZE.
|
||||||
|
|
||||||
|
This function acts like quotearg_buffer (BUFFER, BUFFERSIZE, ARG,
|
||||||
|
ARGSIZE, O), except it uses QUOTING_STYLE instead of the quoting
|
||||||
|
style specified by O, and O may not be null. */
|
||||||
|
|
||||||
|
static size_t
|
||||||
|
quotearg_buffer_restyled (char *buffer, size_t buffersize,
|
||||||
|
char const *arg, size_t argsize,
|
||||||
|
enum quoting_style quoting_style,
|
||||||
|
struct quoting_options const *o)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
size_t len = 0;
|
||||||
|
char const *quote_string = 0;
|
||||||
|
size_t quote_string_len = 0;
|
||||||
|
int backslash_escapes = 0;
|
||||||
|
int unibyte_locale = MB_CUR_MAX == 1;
|
||||||
|
|
||||||
|
#define STORE(c) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
if (len < buffersize) \
|
||||||
|
buffer[len] = (c); \
|
||||||
|
len++; \
|
||||||
|
} \
|
||||||
|
while (0)
|
||||||
|
|
||||||
|
switch (quoting_style)
|
||||||
|
{
|
||||||
|
case c_quoting_style:
|
||||||
|
STORE ('"');
|
||||||
|
backslash_escapes = 1;
|
||||||
|
quote_string = "\"";
|
||||||
|
quote_string_len = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case escape_quoting_style:
|
||||||
|
backslash_escapes = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case locale_quoting_style:
|
||||||
|
case clocale_quoting_style:
|
||||||
|
{
|
||||||
|
/* Get translations for open and closing quotation marks.
|
||||||
|
|
||||||
|
The message catalog should translate "`" to a left
|
||||||
|
quotation mark suitable for the locale, and similarly for
|
||||||
|
"'". If the catalog has no translation,
|
||||||
|
locale_quoting_style quotes `like this', and
|
||||||
|
clocale_quoting_style quotes "like this".
|
||||||
|
|
||||||
|
For example, an American English Unicode locale should
|
||||||
|
translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and
|
||||||
|
should translate "'" to U+201D (RIGHT DOUBLE QUOTATION
|
||||||
|
MARK). A British English Unicode locale should instead
|
||||||
|
translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and
|
||||||
|
U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. */
|
||||||
|
|
||||||
|
char const *left = gettext_quote (N_("`"), quoting_style);
|
||||||
|
char const *right = gettext_quote (N_("'"), quoting_style);
|
||||||
|
for (quote_string = left; *quote_string; quote_string++)
|
||||||
|
STORE (*quote_string);
|
||||||
|
backslash_escapes = 1;
|
||||||
|
quote_string = right;
|
||||||
|
quote_string_len = strlen (quote_string);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case shell_always_quoting_style:
|
||||||
|
STORE ('\'');
|
||||||
|
quote_string = "'";
|
||||||
|
quote_string_len = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; ! (argsize == (size_t) -1 ? arg[i] == '\0' : i == argsize); i++)
|
||||||
|
{
|
||||||
|
unsigned char c;
|
||||||
|
unsigned char esc;
|
||||||
|
|
||||||
|
if (backslash_escapes
|
||||||
|
&& quote_string_len
|
||||||
|
&& i + quote_string_len <= argsize
|
||||||
|
&& memcmp (arg + i, quote_string, quote_string_len) == 0)
|
||||||
|
STORE ('\\');
|
||||||
|
|
||||||
|
c = arg[i];
|
||||||
|
switch (c)
|
||||||
|
{
|
||||||
|
case '?':
|
||||||
|
switch (quoting_style)
|
||||||
|
{
|
||||||
|
case shell_quoting_style:
|
||||||
|
goto use_shell_always_quoting_style;
|
||||||
|
|
||||||
|
case c_quoting_style:
|
||||||
|
if (i + 2 < argsize && arg[i + 1] == '?')
|
||||||
|
switch (arg[i + 2])
|
||||||
|
{
|
||||||
|
case '!': case '\'':
|
||||||
|
case '(': case ')': case '-': case '/':
|
||||||
|
case '<': case '=': case '>':
|
||||||
|
/* Escape the second '?' in what would otherwise be
|
||||||
|
a trigraph. */
|
||||||
|
i += 2;
|
||||||
|
c = arg[i + 2];
|
||||||
|
STORE ('?');
|
||||||
|
STORE ('\\');
|
||||||
|
STORE ('?');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ALERT_CHAR: esc = 'a'; goto c_escape;
|
||||||
|
case '\b': esc = 'b'; goto c_escape;
|
||||||
|
case '\f': esc = 'f'; goto c_escape;
|
||||||
|
case '\n': esc = 'n'; goto c_and_shell_escape;
|
||||||
|
case '\r': esc = 'r'; goto c_and_shell_escape;
|
||||||
|
case '\t': esc = 't'; goto c_and_shell_escape;
|
||||||
|
case '\v': esc = 'v'; goto c_escape;
|
||||||
|
case '\\': esc = c; goto c_and_shell_escape;
|
||||||
|
|
||||||
|
c_and_shell_escape:
|
||||||
|
if (quoting_style == shell_quoting_style)
|
||||||
|
goto use_shell_always_quoting_style;
|
||||||
|
c_escape:
|
||||||
|
if (backslash_escapes)
|
||||||
|
{
|
||||||
|
c = esc;
|
||||||
|
goto store_escape;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '#': case '~':
|
||||||
|
if (i != 0)
|
||||||
|
break;
|
||||||
|
/* Fall through. */
|
||||||
|
case ' ':
|
||||||
|
case '!': /* special in bash */
|
||||||
|
case '"': case '$': case '&':
|
||||||
|
case '(': case ')': case '*': case ';':
|
||||||
|
case '<': case '>': case '[':
|
||||||
|
case '^': /* special in old /bin/sh, e.g. SunOS 4.1.4 */
|
||||||
|
case '`': case '|':
|
||||||
|
/* A shell special character. In theory, '$' and '`' could
|
||||||
|
be the first bytes of multibyte characters, which means
|
||||||
|
we should check them with mbrtowc, but in practice this
|
||||||
|
doesn't happen so it's not worth worrying about. */
|
||||||
|
if (quoting_style == shell_quoting_style)
|
||||||
|
goto use_shell_always_quoting_style;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '\'':
|
||||||
|
switch (quoting_style)
|
||||||
|
{
|
||||||
|
case shell_quoting_style:
|
||||||
|
goto use_shell_always_quoting_style;
|
||||||
|
|
||||||
|
case shell_always_quoting_style:
|
||||||
|
STORE ('\'');
|
||||||
|
STORE ('\\');
|
||||||
|
STORE ('\'');
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '%': case '+': case ',': case '-': case '.': case '/':
|
||||||
|
case '0': case '1': case '2': case '3': case '4': case '5':
|
||||||
|
case '6': case '7': case '8': case '9': case ':': case '=':
|
||||||
|
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
||||||
|
case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
|
||||||
|
case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
|
||||||
|
case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
|
||||||
|
case 'Y': case 'Z': case ']': case '_': case 'a': case 'b':
|
||||||
|
case 'c': case 'd': case 'e': case 'f': case 'g': case 'h':
|
||||||
|
case 'i': case 'j': case 'k': case 'l': case 'm': case 'n':
|
||||||
|
case 'o': case 'p': case 'q': case 'r': case 's': case 't':
|
||||||
|
case 'u': case 'v': case 'w': case 'x': case 'y': case 'z':
|
||||||
|
case '{': case '}':
|
||||||
|
/* These characters don't cause problems, no matter what the
|
||||||
|
quoting style is. They cannot start multibyte sequences. */
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
/* If we have a multibyte sequence, copy it until we reach
|
||||||
|
its end, find an error, or come back to the initial shift
|
||||||
|
state. For C-like styles, if the sequence has
|
||||||
|
unprintable characters, escape the whole sequence, since
|
||||||
|
we can't easily escape single characters within it. */
|
||||||
|
{
|
||||||
|
/* Length of multibyte sequence found so far. */
|
||||||
|
size_t m;
|
||||||
|
|
||||||
|
int printable;
|
||||||
|
|
||||||
|
if (unibyte_locale)
|
||||||
|
{
|
||||||
|
m = 1;
|
||||||
|
printable = ISPRINT (c);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mbstate_t mbstate;
|
||||||
|
memset (&mbstate, 0, sizeof mbstate);
|
||||||
|
|
||||||
|
m = 0;
|
||||||
|
printable = 1;
|
||||||
|
if (argsize == (size_t) -1)
|
||||||
|
argsize = strlen (arg);
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
wchar_t w;
|
||||||
|
size_t bytes = mbrtowc (&w, &arg[i + m],
|
||||||
|
argsize - (i + m), &mbstate);
|
||||||
|
if (bytes == 0)
|
||||||
|
break;
|
||||||
|
else if (bytes == (size_t) -1)
|
||||||
|
{
|
||||||
|
printable = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (bytes == (size_t) -2)
|
||||||
|
{
|
||||||
|
printable = 0;
|
||||||
|
while (i + m < argsize && arg[i + m])
|
||||||
|
m++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (! iswprint (w))
|
||||||
|
printable = 0;
|
||||||
|
m += bytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (! mbsinit (&mbstate));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (1 < m || (backslash_escapes && ! printable))
|
||||||
|
{
|
||||||
|
/* Output a multibyte sequence, or an escaped
|
||||||
|
unprintable unibyte character. */
|
||||||
|
size_t ilim = i + m;
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
if (backslash_escapes && ! printable)
|
||||||
|
{
|
||||||
|
STORE ('\\');
|
||||||
|
STORE ('0' + (c >> 6));
|
||||||
|
STORE ('0' + ((c >> 3) & 7));
|
||||||
|
c = '0' + (c & 7);
|
||||||
|
}
|
||||||
|
if (ilim <= i + 1)
|
||||||
|
break;
|
||||||
|
STORE (c);
|
||||||
|
c = arg[++i];
|
||||||
|
}
|
||||||
|
|
||||||
|
goto store_c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! (backslash_escapes
|
||||||
|
&& o->quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS))))
|
||||||
|
goto store_c;
|
||||||
|
|
||||||
|
store_escape:
|
||||||
|
STORE ('\\');
|
||||||
|
|
||||||
|
store_c:
|
||||||
|
STORE (c);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (quote_string)
|
||||||
|
for (; *quote_string; quote_string++)
|
||||||
|
STORE (*quote_string);
|
||||||
|
|
||||||
|
if (len < buffersize)
|
||||||
|
buffer[len] = '\0';
|
||||||
|
return len;
|
||||||
|
|
||||||
|
use_shell_always_quoting_style:
|
||||||
|
return quotearg_buffer_restyled (buffer, buffersize, arg, argsize,
|
||||||
|
shell_always_quoting_style, o);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of
|
||||||
|
argument ARG (of size ARGSIZE), using O to control quoting.
|
||||||
|
If O is null, use the default.
|
||||||
|
Terminate the output with a null character, and return the written
|
||||||
|
size of the output, not counting the terminating null.
|
||||||
|
If BUFFERSIZE is too small to store the output string, return the
|
||||||
|
value that would have been returned had BUFFERSIZE been large enough.
|
||||||
|
If ARGSIZE is -1, use the string length of the argument for ARGSIZE. */
|
||||||
|
size_t
|
||||||
|
quotearg_buffer (char *buffer, size_t buffersize,
|
||||||
|
char const *arg, size_t argsize,
|
||||||
|
struct quoting_options const *o)
|
||||||
|
{
|
||||||
|
struct quoting_options const *p = o ? o : &default_quoting_options;
|
||||||
|
return quotearg_buffer_restyled (buffer, buffersize, arg, argsize,
|
||||||
|
p->style, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Use storage slot N to return a quoted version of the string ARG.
|
||||||
|
OPTIONS specifies the quoting options.
|
||||||
|
The returned value points to static storage that can be
|
||||||
|
reused by the next call to this function with the same value of N.
|
||||||
|
N must be nonnegative. N is deliberately declared with type "int"
|
||||||
|
to allow for future extensions (using negative values). */
|
||||||
|
static char *
|
||||||
|
quotearg_n_options (int n, char const *arg,
|
||||||
|
struct quoting_options const *options)
|
||||||
|
{
|
||||||
|
/* Preallocate a slot 0 buffer, so that the caller can always quote
|
||||||
|
one small component of a "memory exhausted" message in slot 0. */
|
||||||
|
static char slot0[256];
|
||||||
|
static unsigned int nslots = 1;
|
||||||
|
struct slotvec
|
||||||
|
{
|
||||||
|
size_t size;
|
||||||
|
char *val;
|
||||||
|
};
|
||||||
|
static struct slotvec slotvec0 = {sizeof slot0, slot0};
|
||||||
|
static struct slotvec *slotvec = &slotvec0;
|
||||||
|
|
||||||
|
if (nslots <= n)
|
||||||
|
{
|
||||||
|
int n1 = n + 1;
|
||||||
|
size_t s = n1 * sizeof (struct slotvec);
|
||||||
|
if (! (0 < n1 && n1 == s / sizeof (struct slotvec)))
|
||||||
|
abort ();
|
||||||
|
if (slotvec == &slotvec0)
|
||||||
|
{
|
||||||
|
slotvec = (struct slotvec *) xmalloc (sizeof (struct slotvec));
|
||||||
|
*slotvec = slotvec0;
|
||||||
|
}
|
||||||
|
slotvec = (struct slotvec *) xrealloc (slotvec, s);
|
||||||
|
memset (slotvec + nslots, 0, (n1 - nslots) * sizeof (struct slotvec));
|
||||||
|
nslots = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
size_t size = slotvec[n].size;
|
||||||
|
char *val = slotvec[n].val;
|
||||||
|
size_t qsize = quotearg_buffer (val, size, arg, (size_t) -1, options);
|
||||||
|
|
||||||
|
if (size <= qsize)
|
||||||
|
{
|
||||||
|
slotvec[n].size = size = qsize + 1;
|
||||||
|
slotvec[n].val = val = xrealloc (val == slot0 ? 0 : val, size);
|
||||||
|
quotearg_buffer (val, size, arg, (size_t) -1, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
quotearg_n (unsigned int n, char const *arg)
|
||||||
|
{
|
||||||
|
return quotearg_n_options (n, arg, &default_quoting_options);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
quotearg (char const *arg)
|
||||||
|
{
|
||||||
|
return quotearg_n (0, arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
quotearg_n_style (unsigned int n, enum quoting_style s, char const *arg)
|
||||||
|
{
|
||||||
|
struct quoting_options o;
|
||||||
|
o.style = s;
|
||||||
|
memset (o.quote_these_too, 0, sizeof o.quote_these_too);
|
||||||
|
return quotearg_n_options (n, arg, &o);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
quotearg_style (enum quoting_style s, char const *arg)
|
||||||
|
{
|
||||||
|
return quotearg_n_style (0, s, arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
quotearg_char (char const *arg, char ch)
|
||||||
|
{
|
||||||
|
struct quoting_options options;
|
||||||
|
options = default_quoting_options;
|
||||||
|
set_char_quoting (&options, ch, 1);
|
||||||
|
return quotearg_n_options (0, arg, &options);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
quotearg_colon (char const *arg)
|
||||||
|
{
|
||||||
|
return quotearg_char (arg, ':');
|
||||||
|
}
|
||||||
+110
@@ -0,0 +1,110 @@
|
|||||||
|
/* quotearg.h - quote arguments for output
|
||||||
|
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
/* Written by Paul Eggert <[email protected]> */
|
||||||
|
|
||||||
|
/* Basic quoting styles. */
|
||||||
|
enum quoting_style
|
||||||
|
{
|
||||||
|
literal_quoting_style, /* --quoting-style=literal */
|
||||||
|
shell_quoting_style, /* --quoting-style=shell */
|
||||||
|
shell_always_quoting_style, /* --quoting-style=shell-always */
|
||||||
|
c_quoting_style, /* --quoting-style=c */
|
||||||
|
escape_quoting_style, /* --quoting-style=escape */
|
||||||
|
locale_quoting_style, /* --quoting-style=locale */
|
||||||
|
clocale_quoting_style /* --quoting-style=clocale */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* For now, --quoting-style=literal is the default, but this may change. */
|
||||||
|
#ifndef DEFAULT_QUOTING_STYLE
|
||||||
|
# define DEFAULT_QUOTING_STYLE literal_quoting_style
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Names of quoting styles and their corresponding values. */
|
||||||
|
extern char const *const quoting_style_args[];
|
||||||
|
extern enum quoting_style const quoting_style_vals[];
|
||||||
|
|
||||||
|
struct quoting_options;
|
||||||
|
|
||||||
|
#ifndef PARAMS
|
||||||
|
# if defined PROTOTYPES || defined __STDC__
|
||||||
|
# define PARAMS(Args) Args
|
||||||
|
# else
|
||||||
|
# define PARAMS(Args) ()
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The functions listed below set and use a hidden variable
|
||||||
|
that contains the default quoting style options. */
|
||||||
|
|
||||||
|
/* Allocate a new set of quoting options, with contents initially identical
|
||||||
|
to O if O is not null, or to the default if O is null.
|
||||||
|
It is the caller's responsibility to free the result. */
|
||||||
|
struct quoting_options *clone_quoting_options
|
||||||
|
PARAMS ((struct quoting_options *o));
|
||||||
|
|
||||||
|
/* Get the value of O's quoting style. If O is null, use the default. */
|
||||||
|
enum quoting_style get_quoting_style PARAMS ((struct quoting_options *o));
|
||||||
|
|
||||||
|
/* In O (or in the default if O is null),
|
||||||
|
set the value of the quoting style to S. */
|
||||||
|
void set_quoting_style PARAMS ((struct quoting_options *o,
|
||||||
|
enum quoting_style s));
|
||||||
|
|
||||||
|
/* In O (or in the default if O is null),
|
||||||
|
set the value of the quoting options for character C to I.
|
||||||
|
Return the old value. Currently, the only values defined for I are
|
||||||
|
0 (the default) and 1 (which means to quote the character even if
|
||||||
|
it would not otherwise be quoted). */
|
||||||
|
int set_char_quoting PARAMS ((struct quoting_options *o, char c, int i));
|
||||||
|
|
||||||
|
/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of
|
||||||
|
argument ARG (of size ARGSIZE), using O to control quoting.
|
||||||
|
If O is null, use the default.
|
||||||
|
Terminate the output with a null character, and return the written
|
||||||
|
size of the output, not counting the terminating null.
|
||||||
|
If BUFFERSIZE is too small to store the output string, return the
|
||||||
|
value that would have been returned had BUFFERSIZE been large enough.
|
||||||
|
If ARGSIZE is -1, use the string length of the argument for ARGSIZE. */
|
||||||
|
size_t quotearg_buffer PARAMS ((char *buffer, size_t buffersize,
|
||||||
|
char const *arg, size_t argsize,
|
||||||
|
struct quoting_options const *o));
|
||||||
|
|
||||||
|
/* Use storage slot N to return a quoted version of the string ARG.
|
||||||
|
Use the default quoting options.
|
||||||
|
The returned value points to static storage that can be
|
||||||
|
reused by the next call to this function with the same value of N.
|
||||||
|
N must be nonnegative. */
|
||||||
|
char *quotearg_n PARAMS ((unsigned int n, char const *arg));
|
||||||
|
|
||||||
|
/* Equivalent to quotearg_n (0, ARG). */
|
||||||
|
char *quotearg PARAMS ((char const *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
|
||||||
|
options to specify the quoting method. */
|
||||||
|
char *quotearg_n_style PARAMS ((unsigned int n, enum quoting_style s,
|
||||||
|
char const *arg));
|
||||||
|
|
||||||
|
/* Equivalent to quotearg_n_style (0, S, ARG). */
|
||||||
|
char *quotearg_style PARAMS ((enum quoting_style s, char const *arg));
|
||||||
|
|
||||||
|
/* Like quotearg (ARG), except also quote any instances of CH. */
|
||||||
|
char *quotearg_char PARAMS ((char const *arg, char ch));
|
||||||
|
|
||||||
|
/* Equivalent to quotearg_char (ARG, ':'). */
|
||||||
|
char *quotearg_colon PARAMS ((char const *arg));
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/* Work around bug on some systems where realloc (NULL, 0) fails.
|
||||||
|
Copyright (C) 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 Jim Meyering */
|
||||||
|
|
||||||
|
#if HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
#undef realloc
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
char *malloc ();
|
||||||
|
char *realloc ();
|
||||||
|
|
||||||
|
/* Change the size of an allocated block of memory P to N bytes,
|
||||||
|
with error checking. If N is zero, change it to 1. If P is NULL,
|
||||||
|
use malloc. */
|
||||||
|
|
||||||
|
char *
|
||||||
|
rpl_realloc (p, n)
|
||||||
|
char *p;
|
||||||
|
size_t n;
|
||||||
|
{
|
||||||
|
if (n == 0)
|
||||||
|
n = 1;
|
||||||
|
if (p == 0)
|
||||||
|
return malloc (n);
|
||||||
|
return realloc (p, n);
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
/* stpcpy.c -- copy a string and return pointer to end of new string
|
||||||
|
Copyright (C) 1992, 1995, 1997, 1998 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
NOTE: The canonical source of this file is maintained with 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,
|
||||||
|
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 <string.h>
|
||||||
|
|
||||||
|
#undef __stpcpy
|
||||||
|
#undef stpcpy
|
||||||
|
|
||||||
|
#ifndef weak_alias
|
||||||
|
# define __stpcpy stpcpy
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */
|
||||||
|
char *
|
||||||
|
__stpcpy (char *dest, const char *src)
|
||||||
|
{
|
||||||
|
register char *d = dest;
|
||||||
|
register const char *s = src;
|
||||||
|
|
||||||
|
do
|
||||||
|
*d++ = *s;
|
||||||
|
while (*s++ != '\0');
|
||||||
|
|
||||||
|
return d - 1;
|
||||||
|
}
|
||||||
|
#ifdef weak_alias
|
||||||
|
weak_alias (__stpcpy, stpcpy)
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
/* Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
NOTE: The canonical source of this file is maintained with 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,
|
||||||
|
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 <stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#if defined _LIBC || defined STDC_HEADERS
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <string.h>
|
||||||
|
#else
|
||||||
|
char *malloc ();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_DECL_STRNLEN
|
||||||
|
"this configure-time declaration test was not run"
|
||||||
|
#endif
|
||||||
|
#if !HAVE_DECL_STRNLEN
|
||||||
|
size_t strnlen ();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef __strndup
|
||||||
|
#undef strndup
|
||||||
|
|
||||||
|
#ifndef weak_alias
|
||||||
|
# define __strndup strndup
|
||||||
|
#endif
|
||||||
|
|
||||||
|
char *
|
||||||
|
__strndup (const char *s, size_t n)
|
||||||
|
{
|
||||||
|
size_t len = strnlen (s, n);
|
||||||
|
char *new = malloc (len + 1);
|
||||||
|
|
||||||
|
if (new == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
new[len] = '\0';
|
||||||
|
return (char *) memcpy (new, s, len);
|
||||||
|
}
|
||||||
|
#ifdef weak_alias
|
||||||
|
weak_alias (__strndup, strndup)
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/* Find the length of STRING, but scan at most MAXLEN characters.
|
||||||
|
Copyright (C) 1996, 1997, 1998, 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 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. */
|
||||||
|
|
||||||
|
#if HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_STRING_H
|
||||||
|
# if !STDC_HEADERS && HAVE_MEMORY_H
|
||||||
|
# include <memory.h>
|
||||||
|
# endif
|
||||||
|
# include <string.h>
|
||||||
|
#else
|
||||||
|
# include <strings.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_DECL_MEMCHR
|
||||||
|
"this configure-time declaration test was not run"
|
||||||
|
#endif
|
||||||
|
#if !HAVE_DECL_MEMCHR
|
||||||
|
char *memchr ();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef __strnlen
|
||||||
|
#undef strnlen
|
||||||
|
|
||||||
|
#ifndef weak_alias
|
||||||
|
# define __strnlen strnlen
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Find the length of STRING, but scan at most MAXLEN characters.
|
||||||
|
If no '\0' terminator is found in that many characters, return MAXLEN. */
|
||||||
|
|
||||||
|
size_t
|
||||||
|
__strnlen (const char *string, size_t maxlen)
|
||||||
|
{
|
||||||
|
const char *end = memchr (string, '\0', maxlen);
|
||||||
|
return end ? (size_t) (end - string) : maxlen;
|
||||||
|
}
|
||||||
|
#ifdef weak_alias
|
||||||
|
weak_alias (__strnlen, strnlen)
|
||||||
|
#endif
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user