mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-08 01:37:30 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d6817e7f1 | ||
|
|
94e6810a2a | ||
|
|
795c206389 | ||
|
|
dbae8e9065 | ||
|
|
bcdef75be8 | ||
|
|
caa3dbfbb1 | ||
|
|
d53439f246 | ||
|
|
730800a96d | ||
|
|
f02d3f4518 | ||
|
|
2ea99fe17a | ||
|
|
5274f1a708 | ||
|
|
e10ca10084 | ||
|
|
1599932c2e | ||
|
|
7542aa7499 | ||
|
|
da773a0cfc | ||
|
|
118761e11e | ||
|
|
923c47893a | ||
|
|
748c255306 | ||
|
|
07f5120ee3 | ||
|
|
3ef239bfc8 | ||
|
|
7c77b1a71e | ||
|
|
12b0eae9e2 | ||
|
|
97d0337e4f | ||
|
|
5aa7d604a4 | ||
|
|
409a631bed | ||
|
|
85106b82e9 | ||
|
|
e03a8a995c | ||
|
|
659833a066 | ||
|
|
617b26f41d | ||
|
|
c8e7db984c | ||
|
|
0ee65254ee | ||
|
|
9760fdcb37 | ||
|
|
fb6976e46d | ||
|
|
c8c629b3fc | ||
|
|
e96dd60412 | ||
|
|
2fe4117113 | ||
|
|
5b3a5f1e13 | ||
|
|
e0bdaedca1 | ||
|
|
283b860c58 | ||
|
|
06473e08a5 | ||
|
|
1d06a3166c | ||
|
|
d9a2bb2ec0 | ||
|
|
120a6ede44 | ||
|
|
5cba3a99c2 | ||
|
|
3c47fb91e8 | ||
|
|
a9f706812d | ||
|
|
54d27d7902 | ||
|
|
612f2b87d2 | ||
|
|
8a622d0668 | ||
|
|
edcb5813db | ||
|
|
cede952f6a | ||
|
|
f96696e2a1 | ||
|
|
b75ffba9bb | ||
|
|
b6d4004fd9 | ||
|
|
92dd5e611b | ||
|
|
bcdf9b3d4c | ||
|
|
aba1396f11 | ||
|
|
f499aa1f33 | ||
|
|
668ade05c6 | ||
|
|
6adb33006b | ||
|
|
c43792602e | ||
|
|
e953dba0d7 | ||
|
|
7f8b2a6533 | ||
|
|
f4b857f393 | ||
|
|
06a242169c | ||
|
|
e39dcad91a | ||
|
|
e0867ffcf1 | ||
|
|
270a907bad | ||
|
|
7457b8a7ed | ||
|
|
b4f73cc4f9 | ||
|
|
620f64043e | ||
|
|
cef7c9cc8f | ||
|
|
ddf0fac996 | ||
|
|
48da8216f9 | ||
|
|
d5b1a4f811 | ||
|
|
d3bea66937 | ||
|
|
b9e8bddb3a | ||
|
|
343b413cf8 | ||
|
|
b34300b070 | ||
|
|
32d3a0afd7 | ||
|
|
1718f1bd33 | ||
|
|
889988763f | ||
|
|
8154dbb7a2 | ||
|
|
8ac087a232 | ||
|
|
2a8d55ff1d | ||
|
|
9c3b0c752e | ||
|
|
26715ba4f6 | ||
|
|
a0a857b9c8 | ||
|
|
a643a467e3 | ||
|
|
3573a92c1a | ||
|
|
99ddd9e453 | ||
|
|
8885f79909 | ||
|
|
2a6ae3b7db | ||
|
|
7bccaefc41 | ||
|
|
8b8fcff81b | ||
|
|
6729e0e9bf | ||
|
|
cd4954b7b5 | ||
|
|
aef0ea1beb | ||
|
|
8544cc1532 | ||
|
|
949e6dbaae | ||
|
|
1bd55792e3 | ||
|
|
c8f5565bf3 | ||
|
|
f3a60dd1a6 | ||
|
|
988a86db72 | ||
|
|
79bb884eec | ||
|
|
d77ff9607e | ||
|
|
04ed2b520f | ||
|
|
68976a35ce | ||
|
|
06923253c3 | ||
|
|
2872bce78a | ||
|
|
bbe42d7673 | ||
|
|
fe7a2440ca | ||
|
|
61eb6fb4b6 | ||
|
|
16d61c974c | ||
|
|
5b32b3c4df | ||
|
|
1229705743 | ||
|
|
a4e5289335 | ||
|
|
494d2d0d5a | ||
|
|
3c9c83640f | ||
|
|
a6e3c5c803 | ||
|
|
aae9a035c5 | ||
|
|
131f125fdd | ||
|
|
f30a9f1c86 | ||
|
|
f8964007f8 | ||
|
|
42e478c7aa | ||
|
|
58a52f93bc | ||
|
|
ea48f89d26 | ||
|
|
6e6bd72e0d | ||
|
|
94c14ad4f6 | ||
|
|
2f010abe51 | ||
|
|
27242a7a46 | ||
|
|
2cdb9f1bf9 | ||
|
|
90f6005f58 | ||
|
|
7918fe45b4 | ||
|
|
61071e6b7b | ||
|
|
0cf6de6fcb | ||
|
|
2139ba0922 | ||
|
|
355150ebde | ||
|
|
9363bfad7e | ||
|
|
d994d0b47d | ||
|
|
d09d38ad6e | ||
|
|
7ad4b465ca | ||
|
|
f57fe2a8df | ||
|
|
88750086cc | ||
|
|
d62c336cf2 | ||
|
|
43658a3564 | ||
|
|
65ae7c5df2 | ||
|
|
d404480b88 | ||
|
|
a1bc7d3791 | ||
|
|
822c150636 | ||
|
|
e58fbab4d1 | ||
|
|
4928259fa9 | ||
|
|
ea0de609a6 | ||
|
|
5745f86187 | ||
|
|
99e854f60d | ||
|
|
7d88c35ffd | ||
|
|
810f3a5711 | ||
|
|
adff1e1c74 | ||
|
|
b6c9805cc8 | ||
|
|
f0bb6ff3db | ||
|
|
8d4656dcf6 | ||
|
|
c12dc3851b | ||
|
|
b2cc18212f | ||
|
|
cb8181dd4e | ||
|
|
5634d3a8f7 | ||
|
|
62a6c3bfcc | ||
|
|
5eb451ff18 | ||
|
|
245205fbd0 | ||
|
|
9d9d39a0de | ||
|
|
0e17eea049 | ||
|
|
cc891daade | ||
|
|
00e71a8c7e | ||
|
|
2f0b13c352 | ||
|
|
01d0e7ec15 | ||
|
|
08ce0598c5 | ||
|
|
d88701e3e6 | ||
|
|
87e1cd308f | ||
|
|
35efe18b1a | ||
|
|
d1db2071fc | ||
|
|
98a9106b6a | ||
|
|
ac80c9d00e | ||
|
|
0a0942b193 | ||
|
|
adf31e9b04 | ||
|
|
15d74e343b | ||
|
|
165a97c90f | ||
|
|
d716e02a98 | ||
|
|
01505de0b1 | ||
|
|
3dc95db8b7 | ||
|
|
0b5759f7bf | ||
|
|
83f102fd9f | ||
|
|
86ca867930 | ||
|
|
160fe54bab | ||
|
|
f3d1ae176f | ||
|
|
393cbe0ac3 | ||
|
|
b5660126d0 | ||
|
|
0c69739feb | ||
|
|
0bf5fc14be | ||
|
|
8141c7761c | ||
|
|
398b1011dc | ||
|
|
c8740575c4 | ||
|
|
2f04af4402 | ||
|
|
79330dc592 | ||
|
|
efddda3d6d | ||
|
|
0ecd2f0876 | ||
|
|
ca59cb7cf9 | ||
|
|
d36ddb5a9f | ||
|
|
ae3edadca6 | ||
|
|
0010418ea7 | ||
|
|
da977f8251 | ||
|
|
e228b16885 | ||
|
|
97b3c97f59 | ||
|
|
92facba86f | ||
|
|
a2fecc2d79 | ||
|
|
09e6133e84 | ||
|
|
b17fd60310 | ||
|
|
782462a4ca | ||
|
|
4042334882 | ||
|
|
1a209b0875 | ||
|
|
bc383c2eab | ||
|
|
d809d046df | ||
|
|
1c3c40a339 | ||
|
|
fda570aadc | ||
|
|
088450efce | ||
|
|
80f1212660 | ||
|
|
856e382c8b | ||
|
|
af4b22ceb5 | ||
|
|
003bb8c2b4 | ||
|
|
22aac3652e | ||
|
|
eeeb95595f | ||
|
|
39225a22b8 | ||
|
|
9354703d9d | ||
|
|
15ee6955c5 | ||
|
|
08fead5bb9 | ||
|
|
51c5cac572 | ||
|
|
1e0ee7b1b5 | ||
|
|
7d7b1ae9b5 | ||
|
|
5b1a3cd8a2 | ||
|
|
68a43a14a3 | ||
|
|
2b9f535589 | ||
|
|
5f4fe6255e | ||
|
|
68caa64328 | ||
|
|
46a7b0cf61 | ||
|
|
a3010a9b8f | ||
|
|
ce4bf31268 | ||
|
|
6b2a074330 | ||
|
|
05077c9a02 | ||
|
|
577210441b | ||
|
|
e991374db6 | ||
|
|
f1e23ebb35 | ||
|
|
9c5b4a6c25 | ||
|
|
b4d5aa5c50 | ||
|
|
f79e39cf56 | ||
|
|
316a03ca17 | ||
|
|
42bd356be8 | ||
|
|
a6738260af | ||
|
|
31b5286ac9 | ||
|
|
d95f691e3f | ||
|
|
a7403576e1 | ||
|
|
c63843eb29 | ||
|
|
c6c7380d88 | ||
|
|
800e8af417 | ||
|
|
9d43b9ecf5 | ||
|
|
57472aa318 | ||
|
|
ea2a3bddb8 | ||
|
|
8188c50c28 | ||
|
|
be5908b06c | ||
|
|
0c78c87f34 | ||
|
|
cd5f8608e2 | ||
|
|
c8e453c060 | ||
|
|
a2065b8743 | ||
|
|
66535c240e | ||
|
|
83e6dbcf19 | ||
|
|
9c8ad6614f | ||
|
|
642ab24df1 | ||
|
|
03baef7a3d | ||
|
|
2d88841282 | ||
|
|
6b3440829b | ||
|
|
6f4df4e16c | ||
|
|
6a6b5a6108 | ||
|
|
ecac9a7e9e | ||
|
|
787ce372b9 | ||
|
|
23fd95d972 | ||
|
|
e0a228f55d | ||
|
|
c5c53dbe2a | ||
|
|
a97fc9703c | ||
|
|
3930d70fba | ||
|
|
3b7435fc51 | ||
|
|
b90d80b588 | ||
|
|
bc7e0b5512 | ||
|
|
547b25fd13 | ||
|
|
0558bc5b1c | ||
|
|
bff90c71c1 | ||
|
|
7c3763d056 | ||
|
|
7c655ad471 | ||
|
|
442773abb3 | ||
|
|
e9ec537aba | ||
|
|
8ffc0e192f | ||
|
|
6f9c7bcf21 | ||
|
|
1f9464e345 | ||
|
|
80ac68cc59 | ||
|
|
0c6be86747 | ||
|
|
d5fee0cb0c | ||
|
|
7ce7a73095 | ||
|
|
7ff5e156c2 | ||
|
|
15ba6402bd | ||
|
|
9981d06217 | ||
|
|
cdedece154 | ||
|
|
8d7d6ce2c3 | ||
|
|
4c73289238 | ||
|
|
b8aa2339d3 | ||
|
|
8802148fcd | ||
|
|
922ec7c75d | ||
|
|
8ff2ad53f2 | ||
|
|
ab57683ea0 | ||
|
|
a8609b1ba7 | ||
|
|
2310414868 | ||
|
|
8b5411b938 | ||
|
|
9616e7fdb2 | ||
|
|
90bd4539c7 | ||
|
|
d1eea3de9c | ||
|
|
6f6c4ec7c7 | ||
|
|
91107d7bbb | ||
|
|
5fa8b2087f | ||
|
|
bb685a402f | ||
|
|
6ecd17100e | ||
|
|
2505f6b400 | ||
|
|
3735282e8b | ||
|
|
3ab9cc2f5d | ||
|
|
8e0e7cd4ba | ||
|
|
46bb7e0031 | ||
|
|
a146a16475 | ||
|
|
d9f47fafea | ||
|
|
2f512dbd18 | ||
|
|
db73f90953 | ||
|
|
0857bdbcde | ||
|
|
d5412f3952 | ||
|
|
82a8d372e5 | ||
|
|
28c5d0f045 | ||
|
|
cd18533a10 | ||
|
|
aae381de66 | ||
|
|
e2b1161ea6 | ||
|
|
a9fcfb133c | ||
|
|
77a9678496 | ||
|
|
38b3e061a7 | ||
|
|
27c4648010 | ||
|
|
e7084cecd0 | ||
|
|
6d944dd399 | ||
|
|
299bd20df4 | ||
|
|
05b13da525 | ||
|
|
ab2564053f | ||
|
|
83059ae3de | ||
|
|
ca1fdf8a55 | ||
|
|
e389c31315 | ||
|
|
90613d2282 | ||
|
|
a0c2defe8e | ||
|
|
7d983e5faf | ||
|
|
1c12a65f82 | ||
|
|
98861da887 | ||
|
|
0b2b1ff379 | ||
|
|
98ebd1c28b | ||
|
|
28b321b5e9 | ||
|
|
20219b1e24 | ||
|
|
313a3602bb | ||
|
|
46bc04ecdf | ||
|
|
15cadf0c42 | ||
|
|
7a68b02482 | ||
|
|
8439b0691d | ||
|
|
a44b57424b | ||
|
|
5921ac0de3 | ||
|
|
6aa69e70a2 | ||
|
|
51a8449782 | ||
|
|
e3b86cb645 | ||
|
|
71139b307d | ||
|
|
c456da514c | ||
|
|
1b32da412d | ||
|
|
7df1601239 | ||
|
|
a306665717 | ||
|
|
a4113ee734 | ||
|
|
0bbc3c3a4c | ||
|
|
8774cc2dfa | ||
|
|
63669c6a64 | ||
|
|
b6b4b27988 | ||
|
|
6697e72433 | ||
|
|
b5a0fd24a1 | ||
|
|
a4946ca375 | ||
|
|
8f0eb8cd04 | ||
|
|
4a2e3c4a20 | ||
|
|
dd95705ceb | ||
|
|
292d9deb18 | ||
|
|
b68e5f2ec9 | ||
|
|
3e4235b29a | ||
|
|
3ea5f3343b | ||
|
|
46acc391f0 | ||
|
|
2833e8467c | ||
|
|
40c5f9afbc | ||
|
|
8cfa80d082 | ||
|
|
743fa79afe | ||
|
|
07a08288a1 | ||
|
|
acf08a9015 | ||
|
|
508b9eff57 | ||
|
|
db63c9e291 | ||
|
|
b9d158c458 | ||
|
|
8ca013f2ae | ||
|
|
6a59c7fcd3 | ||
|
|
00e90f2ff3 | ||
|
|
15daf99288 | ||
|
|
be1b9927e5 | ||
|
|
513e598d1e | ||
|
|
444d3a6150 | ||
|
|
04252a9618 | ||
|
|
94d06d34e0 | ||
|
|
04db776e71 | ||
|
|
16c5edd86f | ||
|
|
229d207a58 | ||
|
|
8b7b813ebc | ||
|
|
9d6c7626da | ||
|
|
cddd25661f | ||
|
|
53f976cf83 | ||
|
|
aecccb16e9 | ||
|
|
7bd5199c54 | ||
|
|
fe7bf6e4e7 | ||
|
|
dcc8dd3d49 | ||
|
|
8e8be5365d | ||
|
|
671a10afcd | ||
|
|
52ba15e99d | ||
|
|
6ddca71cdb | ||
|
|
cb46dbb6eb | ||
|
|
ede90c86fa | ||
|
|
12ebcb3a21 | ||
|
|
2eef6d482f | ||
|
|
11318ff8ef | ||
|
|
d8bfdb4f91 | ||
|
|
e114080ef4 | ||
|
|
665247cfb6 | ||
|
|
0a2438b057 | ||
|
|
cd88ac738b | ||
|
|
b8a5daf59c | ||
|
|
fe72f742eb | ||
|
|
12430d1da1 | ||
|
|
37a929e5dd | ||
|
|
86fa2d3937 | ||
|
|
48f688a261 | ||
|
|
f47a9c8af3 | ||
|
|
14d0c9d9a3 | ||
|
|
cefbdccb98 | ||
|
|
68a82f14a2 | ||
|
|
e305585605 | ||
|
|
6578efea09 | ||
|
|
d036b10062 | ||
|
|
f6f6d88ad3 | ||
|
|
dac7d61612 | ||
|
|
21b04ff2a6 | ||
|
|
d43e889854 | ||
|
|
6d3d668887 | ||
|
|
e5a24250d2 | ||
|
|
b0ef26f058 | ||
|
|
6176cf5216 | ||
|
|
06ffcf8710 | ||
|
|
c6daefec0d | ||
|
|
773ee5d7e7 | ||
|
|
042b883899 | ||
|
|
bcea892ffa | ||
|
|
9869854d47 | ||
|
|
3b01fd8973 | ||
|
|
9151e980df | ||
|
|
1288783667 | ||
|
|
c1507e1e40 | ||
|
|
260aee10fe | ||
|
|
51f1739983 | ||
|
|
cc2580f5a4 | ||
|
|
3edf26b509 | ||
|
|
3e845aaea4 | ||
|
|
5aa0158452 | ||
|
|
8b2dcb33b7 | ||
|
|
f9763d86a0 | ||
|
|
35e8129ff9 | ||
|
|
6829710dce | ||
|
|
72c5a9cd8a | ||
|
|
cc065b3351 | ||
|
|
150d339231 | ||
|
|
a5c0adc9fe | ||
|
|
0dd3010501 | ||
|
|
d966015b52 | ||
|
|
1fd542fd38 | ||
|
|
1d54bf97e0 | ||
|
|
9e420659ad | ||
|
|
8acc47a7a9 | ||
|
|
91ac18bc66 | ||
|
|
7baa36c885 | ||
|
|
b99e34196b | ||
|
|
66c94331bc | ||
|
|
5970cfb56c | ||
|
|
9d76c72e80 | ||
|
|
2db42e1db1 | ||
|
|
07f95b3a79 | ||
|
|
7f29ed5798 | ||
|
|
cf5ba0feec | ||
|
|
e8285d6bba | ||
|
|
51ca3418ba | ||
|
|
b04238698f | ||
|
|
ed6d751cd9 | ||
|
|
7270b4223d | ||
|
|
6608f07322 | ||
|
|
5e9b1634c6 | ||
|
|
88e3aa7af6 | ||
|
|
6b9790f631 | ||
|
|
9d0f7ba3b5 | ||
|
|
1121df7c45 | ||
|
|
d26c7a41ff | ||
|
|
cee660a123 | ||
|
|
ccc8755196 | ||
|
|
eba550de9d | ||
|
|
b91c077710 | ||
|
|
39ad453266 | ||
|
|
b42f0b0d43 | ||
|
|
777a707c17 | ||
|
|
81b38907c1 | ||
|
|
284eaf34cc | ||
|
|
a8013517f5 | ||
|
|
8b9b916ce9 | ||
|
|
2272eb57a4 | ||
|
|
a3e676f64b | ||
|
|
0bf51b81bd | ||
|
|
ff51415423 | ||
|
|
86f123ba2e | ||
|
|
53cfce6bc5 | ||
|
|
1267f38f63 | ||
|
|
176a426b2e | ||
|
|
8535164f21 | ||
|
|
e366f5dbd8 | ||
|
|
5f52b45708 | ||
|
|
aa96e0e756 | ||
|
|
6abc327855 | ||
|
|
32495f256c | ||
|
|
23258ef145 | ||
|
|
488f6a706d | ||
|
|
1f06429edb | ||
|
|
0abd719d2d | ||
|
|
4935636521 | ||
|
|
c4d84aa333 | ||
|
|
bd32363e2f | ||
|
|
4c6e58ac59 | ||
|
|
665d38629b | ||
|
|
bb5e06b14e | ||
|
|
14de816ecf | ||
|
|
3b81b97c40 | ||
|
|
cb2124be7c | ||
|
|
dcd4e0a2ec | ||
|
|
fd884e2bea | ||
|
|
2c95fc2d55 | ||
|
|
5319d84400 | ||
|
|
4a2f0316e1 | ||
|
|
86469a0dfb | ||
|
|
180f91bac8 | ||
|
|
1e5e93a63d | ||
|
|
3ff94ed265 | ||
|
|
26f1840e57 | ||
|
|
e8d58effa6 | ||
|
|
ad882c44c9 | ||
|
|
031784c687 | ||
|
|
441c583a2c | ||
|
|
6aadae975c | ||
|
|
1f8c828c08 | ||
|
|
f8d533d79d | ||
|
|
22aee18f0b | ||
|
|
1cb07caf63 | ||
|
|
4526dd2078 | ||
|
|
3783576806 | ||
|
|
32e9ea6c64 | ||
|
|
53d349a3a6 | ||
|
|
5bf45bb13f | ||
|
|
0ca5bf08b5 | ||
|
|
8ad5009b22 | ||
|
|
2077f62d08 | ||
|
|
98e8a7ba08 | ||
|
|
866a609208 | ||
|
|
d26afcf366 | ||
|
|
c049dda279 | ||
|
|
0943dc82dd | ||
|
|
fef8e31f7c | ||
|
|
4972fac567 | ||
|
|
13ca332184 | ||
|
|
860e2e97ee | ||
|
|
ec4bb876a3 | ||
|
|
c1048eac9f | ||
|
|
615f110d4e | ||
|
|
a33fd65b12 | ||
|
|
f4425aece6 | ||
|
|
82a9fc746e | ||
|
|
ab0404ffa3 | ||
|
|
1ff67b38b3 | ||
|
|
c4c1d7dba8 | ||
|
|
ed77632f2d | ||
|
|
9aba9071b6 | ||
|
|
95407d3202 | ||
|
|
caccd36c4f | ||
|
|
55cdbf3a6d | ||
|
|
e40e7a669a | ||
|
|
ece15242e7 | ||
|
|
f174bbc711 | ||
|
|
ea089d09ae | ||
|
|
d299bdc5d9 | ||
|
|
539114339c | ||
|
|
d7523c883b | ||
|
|
0d59ff42d4 | ||
|
|
094873c6d2 | ||
|
|
fc3a59c85f | ||
|
|
83721f0142 | ||
|
|
e9111e53f6 | ||
|
|
3d95bf927c | ||
|
|
5746250af8 | ||
|
|
7ef1f9f8cb | ||
|
|
14b6678d2b | ||
|
|
aca369774c | ||
|
|
93cb481634 | ||
|
|
edb0118d96 | ||
|
|
33b66a224b | ||
|
|
58749ec3a4 | ||
|
|
7309a6ed21 | ||
|
|
96a9eba020 | ||
|
|
0d139d3c27 | ||
|
|
22b1b4547f | ||
|
|
d9692f7896 | ||
|
|
a1b21e0c4c | ||
|
|
0efc5cb783 | ||
|
|
e19be6171f | ||
|
|
1ea87faeb1 | ||
|
|
99d36a7557 | ||
|
|
449b53e34a | ||
|
|
fd7ff95fde | ||
|
|
859e7b79bd | ||
|
|
ede07e3a84 | ||
|
|
c330a4f9ce | ||
|
|
7eebc64347 | ||
|
|
cd9b5d01e3 | ||
|
|
f03933bcec | ||
|
|
c0b8ac1142 | ||
|
|
8bbe180991 | ||
|
|
c815a20aee | ||
|
|
06c98b477b | ||
|
|
1696a2c4e2 | ||
|
|
f2121e4bcf | ||
|
|
74932e621f | ||
|
|
448dbd72cd | ||
|
|
ddee00da0e | ||
|
|
dc82c80981 | ||
|
|
6ac7a08bc8 | ||
|
|
2c91e54d5a | ||
|
|
62c9234520 | ||
|
|
2a02754b52 | ||
|
|
55b5cb89bf | ||
|
|
eb60184fdb | ||
|
|
43b1d2acd1 | ||
|
|
f18fade888 | ||
|
|
47c2644e1d | ||
|
|
2f4b9948d5 | ||
|
|
22c3da8f9c | ||
|
|
7ce2b21354 | ||
|
|
4674123cca | ||
|
|
c2b73faade | ||
|
|
1a36eb5574 | ||
|
|
deb652deed | ||
|
|
a38bfb424e | ||
|
|
5a78516686 | ||
|
|
b7f0e6bd1c | ||
|
|
5f153ca929 | ||
|
|
6aa6a6ab87 | ||
|
|
44b5298506 | ||
|
|
a79e857ccd | ||
|
|
31cd8e0b75 | ||
|
|
580a4701ba | ||
|
|
ce1bbf3712 | ||
|
|
ae64c5cec3 | ||
|
|
1769e3fcdc | ||
|
|
2131b019c7 | ||
|
|
fe6e7058ee | ||
|
|
cb0a09808f | ||
|
|
23f8fe7d47 | ||
|
|
9904415f88 | ||
|
|
8019a1cfe2 | ||
|
|
ce8c6a04b6 | ||
|
|
b0bffb022a | ||
|
|
465ef7c649 | ||
|
|
16344cc34e | ||
|
|
cbedeea53c | ||
|
|
ac1446fe1d | ||
|
|
f5790b0a7c | ||
|
|
7de51385c2 | ||
|
|
7c356f9a24 | ||
|
|
b8b8d8fff9 | ||
|
|
871f6dbde1 | ||
|
|
ab1adb8745 | ||
|
|
535f43789f | ||
|
|
9504838d7e | ||
|
|
833de5e0d2 | ||
|
|
bf7662a241 | ||
|
|
a0ab80ab80 | ||
|
|
87530cf819 | ||
|
|
34cfada447 | ||
|
|
f9626c7c90 | ||
|
|
a3836896ca | ||
|
|
6120b8dc5a | ||
|
|
b7285dde4e | ||
|
|
6c08b99aac | ||
|
|
33ffb64091 | ||
|
|
98e5d33bb8 | ||
|
|
8e70e61bfa | ||
|
|
afb8248e91 | ||
|
|
793bc648bf | ||
|
|
5219d6c096 | ||
|
|
e6f6749965 | ||
|
|
013072f880 | ||
|
|
b2e578256e | ||
|
|
5b20d4c067 | ||
|
|
53f8b2d28b | ||
|
|
dadf411b8d | ||
|
|
2e2d1d356c | ||
|
|
dd5afef1eb | ||
|
|
ce6c5801b3 | ||
|
|
6c41675b0f | ||
|
|
bde9576660 | ||
|
|
ec7286bc55 | ||
|
|
7dfff1a835 | ||
|
|
8f1eb93e0a | ||
|
|
4ce7a79870 | ||
|
|
847fd9d595 | ||
|
|
7a05e1a726 | ||
|
|
d0ed5b984c | ||
|
|
c7b5155fdc | ||
|
|
300b5c0955 | ||
|
|
65f01545a8 | ||
|
|
3acaa30c1c | ||
|
|
7e1957044d | ||
|
|
0544cdca3a | ||
|
|
a95ff8e6e3 | ||
|
|
0aaafceafc | ||
|
|
2af5118d35 | ||
|
|
f1e8815c26 | ||
|
|
4cfbd67b08 | ||
|
|
1f2f2571e4 | ||
|
|
8fa606756a | ||
|
|
26a12ba990 | ||
|
|
a7bbee9d22 | ||
|
|
6536287267 | ||
|
|
0c3d2275ff | ||
|
|
317e1a4636 | ||
|
|
db8647203c | ||
|
|
0a8722a0ac | ||
|
|
e8baeb304a | ||
|
|
8f30e5f619 | ||
|
|
8df03e2814 | ||
|
|
0b22425be1 | ||
|
|
9ffb4f2592 | ||
|
|
ca7c5978d9 | ||
|
|
c79f749ff8 | ||
|
|
1e2b854bba | ||
|
|
e5898af98c | ||
|
|
3c0d0b351e | ||
|
|
3a878be7a1 | ||
|
|
d454f8bb3a | ||
|
|
ddc039d0f5 | ||
|
|
645a94cd5e | ||
|
|
43c3d4495a | ||
|
|
daecaa729c | ||
|
|
770c39fed6 | ||
|
|
bbda8d9678 | ||
|
|
a1dbb4ab16 | ||
|
|
edfd6d0988 | ||
|
|
7d819fc0cf | ||
|
|
5c0dfdbdbe | ||
|
|
3a86163f19 | ||
|
|
904e3e4a41 | ||
|
|
0101ed3196 | ||
|
|
4c24fa7e70 | ||
|
|
3ca76cffa0 | ||
|
|
831473d76e | ||
|
|
e68095972e | ||
|
|
98220d2a82 | ||
|
|
aee570302f | ||
|
|
990c27a23a | ||
|
|
5e3ab6f514 | ||
|
|
6d14a5c60b | ||
|
|
6ec98d5d74 | ||
|
|
fa41fe8646 | ||
|
|
f50277f003 | ||
|
|
bf60b6178f | ||
|
|
b178addf5c | ||
|
|
a41ee123df | ||
|
|
4afe145a10 | ||
|
|
aac95a6672 | ||
|
|
aa06ff957b | ||
|
|
415d5cbb75 | ||
|
|
f8a6ab9ae7 | ||
|
|
fa9f75e3eb | ||
|
|
38f8fee99d | ||
|
|
ab32202968 | ||
|
|
32c1b0fd2e | ||
|
|
687ce0d838 | ||
|
|
ff713a1e86 | ||
|
|
d4fa619d49 | ||
|
|
ed01060897 | ||
|
|
9a307e4550 | ||
|
|
a6ec8d37e6 | ||
|
|
b9355b9a11 | ||
|
|
ce82f6261a | ||
|
|
db508778ad | ||
|
|
0f398e4d4a | ||
|
|
62dc854bb0 | ||
|
|
b1f3a91569 | ||
|
|
1788410a56 | ||
|
|
6e1878b0fc | ||
|
|
350777932a | ||
|
|
e92382460e | ||
|
|
e92233bffc | ||
|
|
734b77d130 | ||
|
|
4fb4c6d4b3 | ||
|
|
e1876cba4d | ||
|
|
ca15b22212 | ||
|
|
e56fb1639b | ||
|
|
7f98b04296 | ||
|
|
a4248dd584 | ||
|
|
62395159a9 | ||
|
|
87ad1fdb3b | ||
|
|
b9d68b8e9d | ||
|
|
461e105069 | ||
|
|
4b8f435b2a | ||
|
|
9a171d03e8 | ||
|
|
6823fb1fe7 | ||
|
|
8b7a1d5440 | ||
|
|
4036c14edc | ||
|
|
2720dc3c05 | ||
|
|
2ac2b22c9b | ||
|
|
f68b7c5f3e | ||
|
|
1808802279 | ||
|
|
597c0d5d4e | ||
|
|
0cbbac3c12 | ||
|
|
0195cc8364 | ||
|
|
25534467c7 | ||
|
|
5a8b199454 | ||
|
|
e69e9be289 | ||
|
|
5560c7a686 | ||
|
|
dda970500e | ||
|
|
3edcf21dda | ||
|
|
7d220af292 | ||
|
|
afb022b7ec | ||
|
|
ec89317ff2 | ||
|
|
48cba31e58 | ||
|
|
aaa2d1f2e0 | ||
|
|
eb08cb956b | ||
|
|
878f78a6d6 | ||
|
|
6203a250f7 | ||
|
|
0ab9d11225 | ||
|
|
0d1ce8b710 | ||
|
|
5d0ac50c8b | ||
|
|
d63edeba21 | ||
|
|
c9bc54abc3 | ||
|
|
7603d13733 | ||
|
|
9b391a83c2 | ||
|
|
7f428de370 | ||
|
|
84b948a15f | ||
|
|
21cc717bac | ||
|
|
e941df5d1a | ||
|
|
a767522485 | ||
|
|
8c8b49ed20 | ||
|
|
54ad4c578c | ||
|
|
6ca17a6e35 | ||
|
|
7ab86afd32 | ||
|
|
4fc3baefd2 | ||
|
|
d379d735fb | ||
|
|
f7bd38413e | ||
|
|
9bde60d148 | ||
|
|
8e6a16984a | ||
|
|
8582e4e9e5 | ||
|
|
83ccb3e511 | ||
|
|
7c197409ae | ||
|
|
8559f372fd | ||
|
|
5076b907e1 | ||
|
|
a1432aa89a | ||
|
|
3cb2be5fc0 | ||
|
|
3dd7bc06d9 | ||
|
|
a2d83ca4a4 | ||
|
|
543077d915 | ||
|
|
2f0cd79621 | ||
|
|
431c1f1d31 | ||
|
|
7c2fef7020 | ||
|
|
cc121adc54 | ||
|
|
c54f216ecd | ||
|
|
97e03e1573 | ||
|
|
831dfbd011 | ||
|
|
08e96fd4e5 | ||
|
|
69ce6a99a4 | ||
|
|
dc7f04163a | ||
|
|
4af1b42bc0 | ||
|
|
f01745896f | ||
|
|
3ac1646ef2 | ||
|
|
59a45acca6 | ||
|
|
2f6ffb545e | ||
|
|
427019cc76 | ||
|
|
adee5f9451 | ||
|
|
9f69163453 | ||
|
|
f347f25987 | ||
|
|
a3e6298de3 | ||
|
|
47e4a02a64 | ||
|
|
e321ed9346 | ||
|
|
3af1ccef0b | ||
|
|
57f3c395b8 | ||
|
|
ae07e93028 | ||
|
|
cef0a461f9 | ||
|
|
211d712c59 | ||
|
|
66d88ba07b | ||
|
|
8a0c756c58 | ||
|
|
9063a96dfa | ||
|
|
df9dc889e0 | ||
|
|
c6f1e68e75 | ||
|
|
1d4793e5e8 | ||
|
|
76cfd48f72 | ||
|
|
9311e05119 | ||
|
|
2f307b2a53 | ||
|
|
7bdacc44a2 | ||
|
|
6b0ac4420c | ||
|
|
ae1a702501 | ||
|
|
b14f6cf79f | ||
|
|
9a83837391 | ||
|
|
87932e1e59 | ||
|
|
b22a776018 | ||
|
|
6792e51a65 | ||
|
|
e322abdd63 | ||
|
|
b76eb3ae40 | ||
|
|
3d89072c7e | ||
|
|
73b159e056 | ||
|
|
b3fd2faac0 | ||
|
|
a5f7a383bf | ||
|
|
bc7bc41e6f | ||
|
|
9c133dd23e | ||
|
|
e99c98a8f7 | ||
|
|
5cb454a8ad | ||
|
|
b04acdadf4 | ||
|
|
29ea3da2f8 | ||
|
|
403350e41d | ||
|
|
2ce4b47657 | ||
|
|
e72d606c36 | ||
|
|
f85c818fe8 | ||
|
|
0aeded1d2b | ||
|
|
76b9acc165 | ||
|
|
08c69a5aac | ||
|
|
49d8ec248c | ||
|
|
65a205a7db | ||
|
|
09dba8cf28 | ||
|
|
a8f7a57e97 | ||
|
|
fe81186629 | ||
|
|
bd1a88fab6 | ||
|
|
6b8397b9f7 | ||
|
|
abe6f2a233 | ||
|
|
05fd3d04f3 | ||
|
|
1ca88c9276 | ||
|
|
e1e02af55b | ||
|
|
ee44180fc6 | ||
|
|
a05e74cd29 | ||
|
|
ae090a31a5 | ||
|
|
9a9cf9eec6 | ||
|
|
df38ce3727 | ||
|
|
49f0b12a96 | ||
|
|
85fa03aab3 | ||
|
|
30b526bf78 | ||
|
|
e9bb88d51e | ||
|
|
bda81affd2 | ||
|
|
04999445d7 | ||
|
|
5514a3e582 | ||
|
|
84d3bfc0ea | ||
|
|
a22cd5ba2d | ||
|
|
3458373ed6 | ||
|
|
9912d5fc5d | ||
|
|
ed942af693 | ||
|
|
7cf14fb1e1 | ||
|
|
8488a5a475 | ||
|
|
57d2cec170 | ||
|
|
c20deee43d | ||
|
|
b498ec567c | ||
|
|
ed7ce6c111 | ||
|
|
e320de1e2e | ||
|
|
3b09117535 | ||
|
|
ebe7376243 | ||
|
|
0d69607ebd | ||
|
|
9e7c0d67d0 | ||
|
|
87fa59a1f1 | ||
|
|
dc474647e9 | ||
|
|
e8f3e3ffa0 | ||
|
|
6729156450 | ||
|
|
2c9f5d8a91 | ||
|
|
9c3b983a35 | ||
|
|
c8315794f1 | ||
|
|
431c793e0c | ||
|
|
2f8284ca0a | ||
|
|
f6c98834ea | ||
|
|
1c057aaf67 | ||
|
|
59fda95761 | ||
|
|
d4aa7982cf | ||
|
|
ca1bcd9ac3 | ||
|
|
ba1d89b386 | ||
|
|
e5c08b815f | ||
|
|
25058db066 | ||
|
|
33730ca2b9 | ||
|
|
0ca4f69d31 | ||
|
|
265c69ac98 | ||
|
|
f3e59b9793 | ||
|
|
a0492dc8f4 | ||
|
|
825198e7f7 | ||
|
|
0222aed97b | ||
|
|
529761f0f7 | ||
|
|
d9149f023d | ||
|
|
5e6a0cf6c0 | ||
|
|
806f578365 | ||
|
|
4ae3af8a3c | ||
|
|
b2b5e1e979 | ||
|
|
365f3e43cb | ||
|
|
8e52216b2e | ||
|
|
ee012b03c1 | ||
|
|
43617d0d50 | ||
|
|
0858fb4b73 | ||
|
|
92e1241ca9 | ||
|
|
6c118a143a | ||
|
|
4b389679c4 | ||
|
|
7dd8ded152 | ||
|
|
8e18d716f8 | ||
|
|
be45657eea | ||
|
|
b9288f3515 | ||
|
|
1a451a98ba | ||
|
|
2816eafc06 | ||
|
|
ed2bff2a7f | ||
|
|
dcda91c1a1 | ||
|
|
e51ce799af | ||
|
|
f0c0b88fdd | ||
|
|
47419f899f | ||
|
|
1524fa7287 | ||
|
|
a16b64b7aa | ||
|
|
eb42e4a847 | ||
|
|
67d9cd6975 | ||
|
|
8a4b6a79b7 | ||
|
|
8a13c8788e | ||
|
|
3778705036 | ||
|
|
0f12a9ca33 | ||
|
|
8442ce9d9f | ||
|
|
ff219f1f21 | ||
|
|
1fc2a27fa5 | ||
|
|
9a40810c85 | ||
|
|
a06a627394 | ||
|
|
26e30dc606 | ||
|
|
8e5e7efc5b | ||
|
|
c40b915e55 | ||
|
|
99e72c9ae5 | ||
|
|
4d2343d7af | ||
|
|
8022bb9b40 | ||
|
|
cc01431199 | ||
|
|
7920d4fc7e | ||
|
|
1e56cac358 | ||
|
|
ac7ed464b5 | ||
|
|
880e7d8ce7 | ||
|
|
b4bd4d4f30 | ||
|
|
a919c54de1 | ||
|
|
13dbb1553c | ||
|
|
e2a5cf3fcb | ||
|
|
b29bcc8618 | ||
|
|
dce6ba9e0f | ||
|
|
d578e05f96 | ||
|
|
3709eb6ab2 | ||
|
|
424679e9fb | ||
|
|
afba31f440 | ||
|
|
a74e56fe05 | ||
|
|
aadc3fea32 | ||
|
|
40ad451d02 | ||
|
|
9590c5173c | ||
|
|
64a857c52e | ||
|
|
f5f4a5cf37 | ||
|
|
dbe0db638e | ||
|
|
143df7de6b | ||
|
|
052d5fc85d | ||
|
|
c51651dee2 | ||
|
|
57c7f0ab5c | ||
|
|
1c23d93135 | ||
|
|
43d0919298 | ||
|
|
72c7872e7f | ||
|
|
9f6ff716c1 | ||
|
|
856c9fa57b | ||
|
|
c464d42445 | ||
|
|
8b90094a53 | ||
|
|
e1d33db97f | ||
|
|
022bef6ca7 | ||
|
|
a98c093d44 | ||
|
|
33f839f31d | ||
|
|
7155e1311f | ||
|
|
7ea3d57462 | ||
|
|
2807e1742f | ||
|
|
fb8c063249 | ||
|
|
ae24aa4b8e | ||
|
|
ef1b6c0b68 | ||
|
|
fb234adcf7 | ||
|
|
8020c7e56e | ||
|
|
4024d1f938 | ||
|
|
7c749c1897 | ||
|
|
cf8c1ef7b4 | ||
|
|
0adf145a9f | ||
|
|
58a5b6bfda | ||
|
|
2f6b0bc7d6 | ||
|
|
f4b832d277 | ||
|
|
c55f8b96c9 | ||
|
|
39fcedd78c | ||
|
|
75687f2f11 | ||
|
|
5f8a57efec | ||
|
|
b8b0a6ac27 | ||
|
|
5c2d995f0b | ||
|
|
4fb28d67b6 | ||
|
|
8a21e6bcbe | ||
|
|
3686d84a68 | ||
|
|
ce98c73f82 | ||
|
|
6bd64164d5 | ||
|
|
74efc41fc3 | ||
|
|
657ce39a28 | ||
|
|
97a29e07c9 | ||
|
|
bc033a67db | ||
|
|
515e8c2c0e | ||
|
|
63a566c65a | ||
|
|
14ea586525 | ||
|
|
727ef4b94f | ||
|
|
dd969337a0 | ||
|
|
aef2b692c1 | ||
|
|
035cf39d34 | ||
|
|
4adfb80edc | ||
|
|
491a2f5219 | ||
|
|
913578add9 | ||
|
|
64349569de | ||
|
|
18f2ffeead | ||
|
|
cc4b274a58 | ||
|
|
4214a056a1 | ||
|
|
4cb97fa3b9 | ||
|
|
1dcef1e4ea | ||
|
|
5b0b5b6ed5 | ||
|
|
5704fcb29d | ||
|
|
38933514e1 | ||
|
|
d863d52a5d | ||
|
|
db9da7b423 | ||
|
|
d032a8e6f6 | ||
|
|
f09884ad54 | ||
|
|
26f3ec7c03 | ||
|
|
4345f8a0b5 | ||
|
|
180cce6f63 | ||
|
|
131acf55f7 | ||
|
|
02c1e81a54 | ||
|
|
d28ef151e0 | ||
|
|
f4eff912d9 | ||
|
|
35cc422378 | ||
|
|
ff4cc2c6e2 | ||
|
|
51a29e57f8 | ||
|
|
b197b8d104 | ||
|
|
84eaf5e1c8 | ||
|
|
558cce8323 | ||
|
|
3bfee898db | ||
|
|
0c509e5cf8 | ||
|
|
ae9de3ed37 | ||
|
|
79f5dcf7d6 | ||
|
|
b26e4a97c9 | ||
|
|
936923a3b6 | ||
|
|
2c96b5856f | ||
|
|
cd9f1f828e | ||
|
|
883e3395f0 | ||
|
|
92a6f2c344 | ||
|
|
ef72a765bf | ||
|
|
737b6f8b13 | ||
|
|
678613b9d8 | ||
|
|
f9f46598a9 | ||
|
|
9b405fa636 | ||
|
|
db8bb9f23c | ||
|
|
b11d1eb440 | ||
|
|
5d1040309c | ||
|
|
3fa179752a | ||
|
|
1066633281 | ||
|
|
70ea4df4af | ||
|
|
9b81440b76 | ||
|
|
f22f8adedd | ||
|
|
0ba80e7943 | ||
|
|
2f4035c833 | ||
|
|
36c4708a84 | ||
|
|
068be1721f | ||
|
|
c8ef634f1b | ||
|
|
437ea23723 | ||
|
|
6a1f79bf8d | ||
|
|
216e81db96 | ||
|
|
a7b9d5590b | ||
|
|
3cb1db985e | ||
|
|
8460372395 | ||
|
|
f026dae4f2 | ||
|
|
6dd36a0df6 | ||
|
|
7b7f46aa2d | ||
|
|
363a8b69c9 | ||
|
|
751d155b96 | ||
|
|
ff3774d1ee | ||
|
|
89aa330637 | ||
|
|
9fff2f7bbe | ||
|
|
480d2b5624 | ||
|
|
8e29c1e9ee | ||
|
|
d95a4e2c19 | ||
|
|
836e8af6ff | ||
|
|
7c8dc40fe3 | ||
|
|
126e776bb1 | ||
|
|
b847333273 | ||
|
|
9f456af68b | ||
|
|
9b17045bdd | ||
|
|
94737d086f | ||
|
|
15515da8a2 | ||
|
|
1ec143228a | ||
|
|
9a1f3b48a9 | ||
|
|
ecd484ac21 | ||
|
|
9789e43af1 | ||
|
|
1b35f3bcfc | ||
|
|
27018c0ff0 | ||
|
|
3c03232b35 | ||
|
|
8e4a4d2d60 | ||
|
|
8b95f1005f | ||
|
|
6ebc57505c | ||
|
|
bd1ac39821 | ||
|
|
49cc65cdae | ||
|
|
7a3c3e85ad | ||
|
|
543d76185d | ||
|
|
71028d46cf | ||
|
|
7decb9dae5 | ||
|
|
c1626365f9 | ||
|
|
552ee2a247 | ||
|
|
055709538c | ||
|
|
250aded265 | ||
|
|
42486196ad | ||
|
|
fe94f59427 | ||
|
|
75b47ad142 | ||
|
|
38472b48d7 | ||
|
|
b74a38968a | ||
|
|
e5f4a7541d | ||
|
|
990e2612cc | ||
|
|
a702dc02f9 | ||
|
|
2258453ba3 | ||
|
|
84ed9d387f | ||
|
|
91c6db000f | ||
|
|
2b615c3ba4 | ||
|
|
d46f919bc1 | ||
|
|
49c3d762ee | ||
|
|
686380b824 | ||
|
|
52b711521f | ||
|
|
935347ee42 | ||
|
|
6adebbf162 | ||
|
|
c08d1ad74c | ||
|
|
2c93a6ac2d | ||
|
|
6a42e63dee | ||
|
|
41d93ca3fd | ||
|
|
ab38ad27a5 | ||
|
|
56986a4ab8 | ||
|
|
8b34428167 | ||
|
|
b49f07a92d | ||
|
|
2605bd4b30 | ||
|
|
1d062f3f6e | ||
|
|
66d7578c36 | ||
|
|
648648ff1b | ||
|
|
d9f641aa34 | ||
|
|
e3fdc42dfa | ||
|
|
df6f8ba35a | ||
|
|
a1cc1fddd8 | ||
|
|
886ad91adf | ||
|
|
08978fc3f4 | ||
|
|
86a884e538 | ||
|
|
d9763dd63a | ||
|
|
5476706142 | ||
|
|
a9b9c68b8a | ||
|
|
46c3d99a9c | ||
|
|
3705cd3f6d | ||
|
|
63de1783fa | ||
|
|
b99a07a935 | ||
|
|
e7bb6187eb | ||
|
|
9c462b0d01 | ||
|
|
c247b8081e | ||
|
|
7b03b7571b | ||
|
|
288d96229e | ||
|
|
67122717a4 | ||
|
|
74de59dff1 | ||
|
|
80f4a863f9 | ||
|
|
fa58a95035 | ||
|
|
734708319f | ||
|
|
1f14640b3e | ||
|
|
03b5cb6775 | ||
|
|
e7ef5041d5 | ||
|
|
8e40864770 | ||
|
|
c07cf5c2a5 | ||
|
|
b4d9b70c6e | ||
|
|
ad1cb8205b | ||
|
|
8d8f148d98 | ||
|
|
34feef0d6b | ||
|
|
3f9f54dcca | ||
|
|
99639f5812 | ||
|
|
4bffed7769 | ||
|
|
949d0d7002 | ||
|
|
bfb066ee96 | ||
|
|
71355c7917 | ||
|
|
f8cb29d636 | ||
|
|
ce75d26996 | ||
|
|
31a74b4aec | ||
|
|
896faf0b34 | ||
|
|
77111db912 | ||
|
|
3c01151a08 | ||
|
|
286d420740 | ||
|
|
90e15c04c9 | ||
|
|
8b99a7385d | ||
|
|
e6e19800dc | ||
|
|
0c5e2d2439 | ||
|
|
3898513fbd | ||
|
|
8dce85c2f2 | ||
|
|
6687828100 | ||
|
|
222fe23275 | ||
|
|
f4299a90e2 | ||
|
|
29cd309944 | ||
|
|
0fd809a770 | ||
|
|
7ff5198c53 | ||
|
|
16344800b2 | ||
|
|
f70e998794 | ||
|
|
94cfe03da5 | ||
|
|
bb9a36cad1 | ||
|
|
c45f699830 | ||
|
|
bef4389b5d | ||
|
|
8a8741a1fe | ||
|
|
80d8e554d3 | ||
|
|
8a33c1cace | ||
|
|
f43b57190c | ||
|
|
f1397d5339 | ||
|
|
e858d27888 | ||
|
|
7f66d5e99a | ||
|
|
9190271cef | ||
|
|
2afc5d6924 | ||
|
|
2b88417b8c | ||
|
|
8d030236d6 | ||
|
|
088c7a6044 | ||
|
|
ce4c65a60d | ||
|
|
d30044c969 | ||
|
|
3ee263e348 | ||
|
|
5a67b295e6 | ||
|
|
35f82bcd6b | ||
|
|
9ed2694ce0 | ||
|
|
540471fc09 | ||
|
|
f289014922 | ||
|
|
c0273c47d7 | ||
|
|
1436374c40 | ||
|
|
cc196f5b54 | ||
|
|
ef64e8336f | ||
|
|
534b0f7e06 | ||
|
|
06cdf297a8 | ||
|
|
b91a66699c | ||
|
|
7cd6ccc0ec | ||
|
|
7c4daf11c0 | ||
|
|
dc613f099c | ||
|
|
ac39c13b1c | ||
|
|
feee0f5a08 | ||
|
|
15b5b127da | ||
|
|
0d559f17cd | ||
|
|
6cacbd75e7 | ||
|
|
4f3eaaa854 | ||
|
|
d2da63f629 | ||
|
|
3d741d71c6 | ||
|
|
6f5fc0be54 | ||
|
|
18f7a8ca61 | ||
|
|
559d611a86 | ||
|
|
6083eb1030 | ||
|
|
ee111cf9c8 | ||
|
|
a25ccbec2e | ||
|
|
9950eaecd7 | ||
|
|
a3ef7170b1 | ||
|
|
8c1f1f15c5 | ||
|
|
09f96051dd | ||
|
|
66be507ac3 | ||
|
|
983e41b7be | ||
|
|
506eec88b4 | ||
|
|
062713a58d | ||
|
|
199b95c8d6 | ||
|
|
f1f5a325c1 | ||
|
|
a4a8f6719b | ||
|
|
e39fbeae16 | ||
|
|
2d6842b103 | ||
|
|
3eded520ef | ||
|
|
2cbd22b9c8 | ||
|
|
4af0eeded6 | ||
|
|
e184ed1ed3 | ||
|
|
2ea46ef6cc | ||
|
|
6affe84ee7 | ||
|
|
4312c5f9e0 | ||
|
|
d5a1d55901 | ||
|
|
affac19132 | ||
|
|
e7aa85c011 | ||
|
|
9a17664431 | ||
|
|
a975676399 | ||
|
|
0722546b20 | ||
|
|
48475a52af | ||
|
|
312a226707 | ||
|
|
857a051616 | ||
|
|
72c05b07d5 | ||
|
|
41b21156cc | ||
|
|
e65ae0e7fd | ||
|
|
4b8709ef5c | ||
|
|
48697c5f5c | ||
|
|
8dd296dd7d | ||
|
|
f17f3371be | ||
|
|
c1f93729b8 | ||
|
|
2aaa2cc409 | ||
|
|
631f476abe | ||
|
|
a72dce7da9 | ||
|
|
fc3906e93a | ||
|
|
a2f95abb6d | ||
|
|
3744720899 | ||
|
|
23c0362aec | ||
|
|
29312b2ec8 | ||
|
|
4f0eab7f6c | ||
|
|
9f3362933a | ||
|
|
fcd83424cf | ||
|
|
e68a9c6bfa | ||
|
|
1e5e73e0ae | ||
|
|
c44f5ec495 | ||
|
|
37dec69a7c | ||
|
|
08615c6f68 | ||
|
|
ae82e1ccf2 | ||
|
|
39f3075500 | ||
|
|
15f0f8ae23 | ||
|
|
df92e90d50 | ||
|
|
3dd9845e98 | ||
|
|
3c06e3c4bb | ||
|
|
95d99c9ba9 | ||
|
|
42b9349d8b | ||
|
|
57d908ea1f | ||
|
|
b278435074 | ||
|
|
fde1575ba2 | ||
|
|
5598d6f0b1 | ||
|
|
898099adba | ||
|
|
de46a16e43 | ||
|
|
dd714b617c | ||
|
|
80ccb3f7f7 | ||
|
|
ca476ecaa4 | ||
|
|
6f84c93e45 | ||
|
|
a9fe559f60 | ||
|
|
55d9b2ad9c | ||
|
|
f78f4364a0 | ||
|
|
2e3fbf41f9 | ||
|
|
8b40f3c231 | ||
|
|
a6d9db7dc1 | ||
|
|
5fc1552c04 | ||
|
|
3ca8006a8d | ||
|
|
bc6f6d9e83 | ||
|
|
f705826052 | ||
|
|
e6f95ee99b | ||
|
|
79f0345166 | ||
|
|
6d7be11454 | ||
|
|
12cfb76b65 | ||
|
|
62f57095a0 | ||
|
|
98bda8de71 | ||
|
|
1c7f015c4d | ||
|
|
abe67fdb83 | ||
|
|
4d1daeb9bd | ||
|
|
821458c4d6 | ||
|
|
80a58cd23c | ||
|
|
6cc12e1450 | ||
|
|
975ed901aa | ||
|
|
5ccdb1d352 | ||
|
|
788b1552a7 | ||
|
|
78e4644fa1 | ||
|
|
88c66d4859 | ||
|
|
66411756dd | ||
|
|
3a1b1142fe | ||
|
|
d672226d6f | ||
|
|
035c6c83e6 | ||
|
|
b893e59095 | ||
|
|
0515870902 | ||
|
|
8b4b057518 | ||
|
|
7d479f4abb | ||
|
|
2bc39cfebc | ||
|
|
90cbb8e02b | ||
|
|
3942e2a8bd | ||
|
|
98a7a1ba1f | ||
|
|
d247632b5b | ||
|
|
5664afaadc | ||
|
|
f341f630d3 | ||
|
|
88c6758d4e | ||
|
|
4f78737000 | ||
|
|
e202deaec4 | ||
|
|
23db803b34 | ||
|
|
13fb78bab1 | ||
|
|
13ed1f43c1 | ||
|
|
95ee25ace6 | ||
|
|
ad6607332b | ||
|
|
412cca6f6f | ||
|
|
8f26c3f326 | ||
|
|
8ee38d9d75 | ||
|
|
58abda0e58 | ||
|
|
43eb67855f | ||
|
|
b1d60772d8 | ||
|
|
da8b28cf1c | ||
|
|
d3ea04bb66 | ||
|
|
4396a984a8 | ||
|
|
6fbe1dbcae | ||
|
|
43f34af575 | ||
|
|
65429fbaac | ||
|
|
ea83d64507 | ||
|
|
a345d2ce86 | ||
|
|
878fb495fe | ||
|
|
1a082a349c | ||
|
|
26d0435146 | ||
|
|
34c165a274 | ||
|
|
db9d9523a6 | ||
|
|
70941fe41b | ||
|
|
f111b84e05 | ||
|
|
61cad20c12 | ||
|
|
b1976de01b | ||
|
|
81b5aabb33 | ||
|
|
a8d6e94635 | ||
|
|
5f8982d048 | ||
|
|
352e52716a | ||
|
|
2c5764d46f | ||
|
|
e982012daf | ||
|
|
f8fb5e5d98 | ||
|
|
ef537403e6 | ||
|
|
afa2c22e9c | ||
|
|
f34c1ee368 | ||
|
|
5695709fb7 | ||
|
|
16f8af514f | ||
|
|
962216c201 | ||
|
|
e06c1d7c7e | ||
|
|
92843788fa | ||
|
|
1251756d54 | ||
|
|
78f108d31a | ||
|
|
9382ddec52 | ||
|
|
a332f826a7 | ||
|
|
bddb9539f7 | ||
|
|
f1e32a8c82 | ||
|
|
0bdd62c8ac | ||
|
|
bc26250413 | ||
|
|
db44b1086c | ||
|
|
c4b7501956 | ||
|
|
e475621f2c | ||
|
|
488b76b95d | ||
|
|
2c9ed05832 | ||
|
|
c20a1c1be6 | ||
|
|
3d000d9521 | ||
|
|
411725b01c | ||
|
|
eb4754441f | ||
|
|
0f20565919 | ||
|
|
48e54e0c7a | ||
|
|
de64d45439 | ||
|
|
a67459f581 | ||
|
|
2eccd95ca4 | ||
|
|
b87194e0c6 | ||
|
|
02293b6bee | ||
|
|
e74c6b1674 | ||
|
|
702e243d98 | ||
|
|
2ace2ccd00 | ||
|
|
c8896a38ae | ||
|
|
288871505b | ||
|
|
6fce86d5ed | ||
|
|
5a81882c03 | ||
|
|
9ba2c90e16 | ||
|
|
ab94fecde3 | ||
|
|
b1085a21e5 | ||
|
|
3a0e43cb54 | ||
|
|
dceb1e7814 | ||
|
|
93a58dbed2 | ||
|
|
54ca6f05b1 | ||
|
|
d0433b6d1c | ||
|
|
2fba036202 | ||
|
|
fa15d6069c | ||
|
|
2830e45fe7 | ||
|
|
deeb3407ff | ||
|
|
b1322f570c | ||
|
|
7d2334f48d | ||
|
|
8a7f7d5cae | ||
|
|
b0a803d127 | ||
|
|
2c05c7e0ac | ||
|
|
b5dc4f7ce0 | ||
|
|
f0df3f5f82 | ||
|
|
dc5e38cf19 | ||
|
|
97be9bc1d5 | ||
|
|
91a6ed234d | ||
|
|
8ea8ebd2de | ||
|
|
43825a76bb | ||
|
|
1bbdd3bce1 | ||
|
|
3a97065f87 | ||
|
|
9a8854b5b1 | ||
|
|
ed03a30603 | ||
|
|
4fc273adda | ||
|
|
31391b8df3 | ||
|
|
963226543b | ||
|
|
194e17cd11 | ||
|
|
cc0b737e51 | ||
|
|
43a2fe1cd8 | ||
|
|
75b32c64ff | ||
|
|
e9c09b86e1 | ||
|
|
8b0ac98fe4 | ||
|
|
fc412af04a | ||
|
|
51ef66ed67 | ||
|
|
d6adcc98b5 | ||
|
|
3be12d1d9b | ||
|
|
4ccb92fcd0 | ||
|
|
0a682c6d70 | ||
|
|
26578c386d | ||
|
|
7ab89b02c4 | ||
|
|
b60aedc275 | ||
|
|
f8055473a4 | ||
|
|
2f08cb119c | ||
|
|
dc9fc4155e | ||
|
|
688cdc581d | ||
|
|
66a2690700 | ||
|
|
edcd5d08b6 | ||
|
|
e2b0768e96 | ||
|
|
6b8670b267 | ||
|
|
c62fdf8f11 | ||
|
|
fd42c6afba | ||
|
|
c06c27af73 | ||
|
|
43bd681c34 | ||
|
|
610bc7a194 | ||
|
|
2fa4b31386 | ||
|
|
6719d80101 | ||
|
|
1ffea56325 | ||
|
|
2928fcbb2c | ||
|
|
ae9f65537e | ||
|
|
eff53313f5 | ||
|
|
cb6e751008 | ||
|
|
10fe28c8ab | ||
|
|
6a5bcfef8d | ||
|
|
374a351444 | ||
|
|
1f6f91035e | ||
|
|
a3368ababa | ||
|
|
5ee719bae0 | ||
|
|
8b53a129f7 | ||
|
|
cd0fb34562 | ||
|
|
4a99c5ee5c | ||
|
|
44b68122c2 | ||
|
|
609271e651 | ||
|
|
2890b57e46 | ||
|
|
dc107bf495 | ||
|
|
5da651fcd2 | ||
|
|
475796a0d7 | ||
|
|
afd6890a78 | ||
|
|
059cbc13d3 | ||
|
|
2384eb7d62 | ||
|
|
ae13c5c551 | ||
|
|
b3d49ab0e4 | ||
|
|
89a0e85251 | ||
|
|
ca38506fb7 | ||
|
|
c278bfc448 | ||
|
|
e967627ad6 | ||
|
|
f197cf3630 | ||
|
|
6586cf7216 | ||
|
|
2977edaacd | ||
|
|
18ccd87eb9 | ||
|
|
db75202426 | ||
|
|
35ace375a9 | ||
|
|
201aeb2bb5 | ||
|
|
9290bf04e8 | ||
|
|
90544a10ee | ||
|
|
92535e9fa6 | ||
|
|
77318b5186 | ||
|
|
42ec547950 | ||
|
|
550550f746 | ||
|
|
71d341e2c0 | ||
|
|
72fc6bc4b1 | ||
|
|
991e30668f | ||
|
|
f73ee14bd9 | ||
|
|
76fcdc1afb | ||
|
|
0b2af004c1 | ||
|
|
19cfee427f | ||
|
|
cf65fad63a | ||
|
|
aecd5b89ee | ||
|
|
c767809b2f | ||
|
|
c2da7dc4a9 | ||
|
|
deea4d7f2c | ||
|
|
d98c96fc6c | ||
|
|
b31c3e04bc | ||
|
|
27d63c5b8d | ||
|
|
801cadc3b8 | ||
|
|
a575980813 | ||
|
|
adc9e9b587 | ||
|
|
4b5527ef2a | ||
|
|
1beb9b21e5 | ||
|
|
43f1b676bb | ||
|
|
43b3da1396 | ||
|
|
4c4c34aaeb | ||
|
|
035ffebe16 | ||
|
|
8d8903b8d3 | ||
|
|
db388374ed | ||
|
|
f8b0353fec | ||
|
|
701b1a548e | ||
|
|
4fdf886f5c | ||
|
|
626c663b26 | ||
|
|
24b033170f | ||
|
|
c24a1e3022 | ||
|
|
8064e685be | ||
|
|
2b8e0d43e9 | ||
|
|
4d60dbb9ef | ||
|
|
798ec79319 | ||
|
|
884cb737f0 | ||
|
|
5db38caece | ||
|
|
cc0c2ea603 | ||
|
|
efd46d53b5 | ||
|
|
95dff71df7 | ||
|
|
02e25f0a1e | ||
|
|
3ead31449f | ||
|
|
5c90e7a78f | ||
|
|
6852a1e704 | ||
|
|
fc05a725eb | ||
|
|
030e873758 | ||
|
|
1ed249ddbc | ||
|
|
1f852425d1 | ||
|
|
86bd61aace | ||
|
|
28575499df | ||
|
|
65da5375ea | ||
|
|
c0efc001af | ||
|
|
8a54c2929f | ||
|
|
86959aaf62 | ||
|
|
7e1fb1c7b7 | ||
|
|
583b24b682 | ||
|
|
d682cf90cf | ||
|
|
d3dfc03108 | ||
|
|
454d13652e | ||
|
|
009b5575fa | ||
|
|
4c9c90eea2 | ||
|
|
6c5d688dee | ||
|
|
7a2d291d50 | ||
|
|
73dbeb6f6f | ||
|
|
b266763335 | ||
|
|
d5478b94a6 | ||
|
|
fe72ba4684 | ||
|
|
8f4109e8cb | ||
|
|
29c090934b | ||
|
|
a90e5f5a6b | ||
|
|
67e663efbf | ||
|
|
d5f1b1b60f | ||
|
|
c232516005 | ||
|
|
db4021bc7c | ||
|
|
e8922acc53 | ||
|
|
2aefe30f18 | ||
|
|
d9c26ab299 | ||
|
|
c1872382ac | ||
|
|
96a04d4ab7 | ||
|
|
88d4de1da9 | ||
|
|
cb37652ca5 | ||
|
|
b5e6cabb8e | ||
|
|
0130405168 | ||
|
|
dbe9e0bfc2 | ||
|
|
d7acbbe2c3 | ||
|
|
e638a3d354 | ||
|
|
8d86cc6efe | ||
|
|
c06ad9f9c0 | ||
|
|
a10c309e63 | ||
|
|
7bdfc6fbe8 | ||
|
|
8a5402c232 | ||
|
|
1a247ba1d8 | ||
|
|
872da0aa0a | ||
|
|
a92fa9b2bc | ||
|
|
7904bff7ad | ||
|
|
7e88a009d2 | ||
|
|
67b53c04eb | ||
|
|
eea391830a | ||
|
|
4d54d1919c | ||
|
|
6b934d9243 | ||
|
|
e9eb586106 | ||
|
|
7a43e77e58 | ||
|
|
d37016f26d | ||
|
|
8d66ae62e9 | ||
|
|
262bcc637d | ||
|
|
cdc5600880 | ||
|
|
01850714ee | ||
|
|
ce6dde342b | ||
|
|
0cee8df65e | ||
|
|
838a7a9566 | ||
|
|
de8ff3170e | ||
|
|
8a06f6635e | ||
|
|
26a315308d | ||
|
|
689252082c | ||
|
|
405142087c | ||
|
|
b26fbe41b1 | ||
|
|
925ff7f2b2 | ||
|
|
1f40bd4cd9 | ||
|
|
3c98893a01 | ||
|
|
bb5398c687 | ||
|
|
1f3cd999e5 | ||
|
|
96a8cc1a44 | ||
|
|
8d88fb8bf3 | ||
|
|
692d30b7be | ||
|
|
aa9098cd46 | ||
|
|
99687096ca | ||
|
|
f0c30a0662 | ||
|
|
f3d2d4c630 | ||
|
|
ffd40bf495 | ||
|
|
70a60c43ab | ||
|
|
91b3f7b570 | ||
|
|
de894ef098 | ||
|
|
27fb33e8b7 | ||
|
|
49b44d537f | ||
|
|
06111162cf | ||
|
|
e4ebe9f1ff | ||
|
|
251c275305 | ||
|
|
d557151ce7 | ||
|
|
3bf9d3d82f | ||
|
|
08fe09e9d2 | ||
|
|
42cce22f2d | ||
|
|
6e9e37be3a | ||
|
|
a7bea2f140 | ||
|
|
6fab353df1 | ||
|
|
116671a8fb | ||
|
|
13682462c7 | ||
|
|
012840d145 | ||
|
|
3629062ab6 | ||
|
|
6a0dce93af | ||
|
|
009b8470eb | ||
|
|
c7239f2b00 | ||
|
|
5f5bbfd3f3 | ||
|
|
fb487bc38d | ||
|
|
28f5a1e6e9 | ||
|
|
60f7b32e4d | ||
|
|
ece41debc9 | ||
|
|
5b0e540882 | ||
|
|
b46e7d76b4 | ||
|
|
4cf3fd2752 | ||
|
|
62fb3d63c5 | ||
|
|
78b881f389 | ||
|
|
f04497bab2 | ||
|
|
3a50a0322f | ||
|
|
bf59a8db85 | ||
|
|
10ee55abf5 | ||
|
|
89bd184ea0 | ||
|
|
a0bbfb590c | ||
|
|
af1c7070f7 | ||
|
|
16da751e3b | ||
|
|
1bceefb2da | ||
|
|
2965b8c1fc | ||
|
|
2ebefcf3b9 | ||
|
|
26389258bb | ||
|
|
17ef8dba77 | ||
|
|
8b8d3d35c2 | ||
|
|
f2fbed70fd | ||
|
|
f46dbef810 | ||
|
|
9ce638248d | ||
|
|
a1c2b86701 | ||
|
|
91880600c7 | ||
|
|
5541451085 | ||
|
|
62feefddc7 | ||
|
|
89ea50a588 | ||
|
|
e78b61542d | ||
|
|
1ac3aa7e08 | ||
|
|
20505d8483 | ||
|
|
b244f61139 | ||
|
|
0c79e85ede | ||
|
|
1c7e920a9e | ||
|
|
1f470ecca6 | ||
|
|
0ebee4d29f | ||
|
|
98a8ea2203 | ||
|
|
a58e996039 | ||
|
|
1fa1b9a60c | ||
|
|
c4ee7a403e | ||
|
|
377d88cec0 | ||
|
|
0786889de0 | ||
|
|
27744e892a | ||
|
|
744d1fc1ea | ||
|
|
43c7615c51 | ||
|
|
ee63d3400a | ||
|
|
c6bed4ce3d | ||
|
|
d452cf054e |
No files matched your search
@@ -1,218 +0,0 @@
|
||||
PHP Coding Standards
|
||||
====================
|
||||
|
||||
|
||||
This file lists several standards that any programmer, adding or changing
|
||||
code in PHP, should follow. Since this file was added at a very late
|
||||
stage of the development of PHP v3.0, the code base does not (yet) fully
|
||||
follow it, but it's going in that general direction. Since we are now
|
||||
well into the version 4 releases, many sections have been recoded to use
|
||||
these rules.
|
||||
|
||||
|
||||
Code Implementation
|
||||
-------------------
|
||||
|
||||
[1] Functions that are given pointers to resources should not free them
|
||||
|
||||
For instance, function int mail(char *to, char *from) should NOT free
|
||||
to and/or from.
|
||||
Exceptions:
|
||||
|
||||
- The function's designated behavior is freeing that resource. E.g. efree()
|
||||
- The function is given a boolean argument, that controls whether or not
|
||||
the function may free its arguments (if true - the function must free its
|
||||
arguments, if false - it must not)
|
||||
- Low-level parser routines, that are tightly integrated with the token
|
||||
cache and the bison code for minimum memory copying overhead.
|
||||
|
||||
[2] Functions that are tightly integrated with other functions within the
|
||||
same module, and rely on each other non-trivial behavior, should be
|
||||
documented as such and declared 'static'. They should be avoided if
|
||||
possible.
|
||||
|
||||
[3] Use definitions and macros whenever possible, so that constants have
|
||||
meaningful names and can be easily manipulated. The only exceptions
|
||||
to this rule are 0 and 1, when used as false and true (respectively).
|
||||
Any other use of a numeric constant to specify different behavior
|
||||
or actions should be done through a #define.
|
||||
|
||||
[4] When writing functions that deal with strings, be sure to remember
|
||||
that PHP holds the length property of each string, and that it
|
||||
shouldn't be calculated with strlen(). Write your functions in a such
|
||||
a way so that they'll take advantage of the length property, both
|
||||
for efficiency and in order for them to be binary-safe.
|
||||
Functions that change strings and obtain their new lengths while
|
||||
doing so, should return that new length, so it doesn't have to be
|
||||
recalculated with strlen() (e.g. php_addslashes())
|
||||
|
||||
[5] Use php_error() to report any errors/warnings during code execution.
|
||||
Use descriptive error messages, and try to avoid using identical
|
||||
error strings for different stages of an error. For example,
|
||||
if in order to obtain a URL you have to parse the URL, connect,
|
||||
and retreive the text, assuming something can go wrong at each
|
||||
of these stages, don't report an error "Unable to get URL"
|
||||
on all of them, but instead, write something like "Unable
|
||||
to parse URL", "Unable to connect to URL server" and "Unable
|
||||
to fetch URL text", respectively.
|
||||
|
||||
[6] NEVER USE strncat(). If you're absolutely sure you know what you're doing,
|
||||
check its man page again, and only then, consider using it, and even then,
|
||||
try avoiding it.
|
||||
|
||||
|
||||
Naming Conventions
|
||||
------------------
|
||||
|
||||
[1] Function names for user-level functions should be enclosed with in
|
||||
the PHP_FUNCTION() macro. They should be in lowercase, with words
|
||||
underscore delimited, with care taken to minimize the letter count.
|
||||
Abbreviations should not be used when they greatly decrease the
|
||||
readability of the function name itself.
|
||||
|
||||
Good:
|
||||
'mcrypt_enc_self_test'
|
||||
'mysql_list_fields'
|
||||
|
||||
Ok:
|
||||
'mcrypt_module_get_algo_supported_key_sizes'
|
||||
(could be 'mcrypt_mod_get_algo_sup_key_sizes'?)
|
||||
'get_html_translation_table'
|
||||
(could be 'html_get_trans_table'?)
|
||||
|
||||
Bad:
|
||||
'hw_GetObjectByQueryCollObj'
|
||||
'pg_setclientencoding'
|
||||
'jf_n_s_i'
|
||||
|
||||
|
||||
[2] If they are part of a "parent set" of functions, that parent should
|
||||
be included in the user function name, and should be clearly related
|
||||
to the parent program or function family. This should be in the form
|
||||
of parent_*.
|
||||
|
||||
A family of 'foo' functions, for example:
|
||||
Good:
|
||||
'foo_select_bar'
|
||||
'foo_insert_baz'
|
||||
'foo_delete_baz'
|
||||
|
||||
Bad:
|
||||
'fooselect_bar'
|
||||
'fooinsertbaz'
|
||||
'delete_foo_baz'
|
||||
|
||||
[3] Function names used by user functions should be prefixed
|
||||
with "_php_", and followed by a word or an underscore-delimited list of
|
||||
words, in lowercase letters, that describes the function. If applicable,
|
||||
they should be declared 'static'.
|
||||
|
||||
[4] Variable names must be meaningful. One letter variable names must be
|
||||
avoided, except for places where the variable has no real meaning or
|
||||
a trivial meaning (e.g. for (i=0; i<100; i++) ...).
|
||||
|
||||
[5] Variable names should be in lowercase; Use underscores to seperate
|
||||
between words.
|
||||
|
||||
|
||||
Syntax and indentation
|
||||
----------------------
|
||||
|
||||
[1] Never use C++ style comments (i.e. // comment). Always use C-style
|
||||
comments instead. PHP is written in C, and is aimed at compiling
|
||||
under any ANSI-C compliant compiler. Even though many compilers
|
||||
accept C++-style comments in C code, you have to ensure that your
|
||||
code would compile with other compilers as well.
|
||||
The only exception to this rule is code that is Win32-specific,
|
||||
because the Win32 port is MS-Visual C++ specific, and this compiler
|
||||
is known to accept C++-style comments in C code.
|
||||
|
||||
[2] Use K&R-style. Of course, we can't and don't want to
|
||||
force anybody to use a style he or she is not used to, but,
|
||||
at the very least, when you write code that goes into the core
|
||||
of PHP or one of its standard modules, please maintain the K&R
|
||||
style. This applies to just about everything, starting with
|
||||
indentation and comment styles and up to function decleration
|
||||
syntax.
|
||||
|
||||
[3] Be generous with whitespace and braces. Always prefer:
|
||||
|
||||
if (foo) {
|
||||
bar;
|
||||
}
|
||||
|
||||
to:
|
||||
|
||||
if(foo)bar;
|
||||
|
||||
Keep one empty line between the variable decleration section and
|
||||
the statements in a block, as well as between logical statement
|
||||
groups in a block. Maintain at least one empty line between
|
||||
two functions, preferably two.
|
||||
|
||||
[4] When indenting, use the tab character. A tab is expected to represent
|
||||
four spaces. It is important to maintain consistency in indenture so
|
||||
that definitions, comments, and control structures line up correctly.
|
||||
|
||||
Documentation and Folding Hooks
|
||||
-------------------------------
|
||||
|
||||
In order to make sure that the online documentation stays in line with
|
||||
the code, each user-level function should have its user-level function
|
||||
prototype before it along with a brief one-line description of what the
|
||||
function does. It would look like this:
|
||||
|
||||
/* {{{ proto int abs(int number)
|
||||
Return the absolute value of the number */
|
||||
PHP_FUNCTION(abs)
|
||||
{
|
||||
...
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
The {{{ symbols are the default folding symbols for the folding mode in
|
||||
Emacs and vim (set fdm=marker). Folding is very useful when dealing with
|
||||
large files because you can scroll through the file quickly and just unfold
|
||||
the function you wish to work on. The }}} at the end of each function marks
|
||||
the end of the fold, and should be on a separate line.
|
||||
|
||||
The "proto" keyword there is just a helper for the doc/genfuncsummary script
|
||||
which generates a full function summary. Having this keyword in front of the
|
||||
function prototypes allows us to put folds elsewhere in the code without
|
||||
messing up the function summary.
|
||||
|
||||
Optional arguments are written like this:
|
||||
|
||||
/* {{{ proto object imap_header(int stream_id, int msg_no [, int from_length [, int subject_length [, string default_host]]])
|
||||
Returns a header object with the defined parameters. */
|
||||
|
||||
And yes, please keep the prototype on a single line, even if that line
|
||||
is massive.
|
||||
|
||||
New and Experimental Functions
|
||||
-----------------------------------
|
||||
To reduce the problems normally associated with the first public
|
||||
implementation of a new set of functions, it has been suggested
|
||||
that the first implementation include a file labeled 'EXPERIMENTAL'
|
||||
in the function directory, and that the functions follow the
|
||||
standard prefixing conventions during their initial implementation.
|
||||
|
||||
The file labelled 'EXPERIMENTAL' should include the following
|
||||
information:
|
||||
Any authoring infomration (known bugs, future directions of the module).
|
||||
Ongoing status notes which may not be appropriate for CVS comments.
|
||||
|
||||
Aliases & Legacy Documentation
|
||||
-----------------------------------
|
||||
You may also have some deprecated aliases with close to duplicate
|
||||
names, for example, somedb_select_result and somedb_selectresult. For
|
||||
documentation puposes, these will only be documented by the most
|
||||
current name, with the aliases listed in the documentation for
|
||||
the parent function. For ease of reference, user-functions with
|
||||
completely different names, that alias to the same function (such as
|
||||
highlight_file and show_source), will be separately documented. The
|
||||
proto should still be included, describing which function is aliased.
|
||||
|
||||
Backwards compatible functions and names should be maintained as long
|
||||
as the code can be reasonably be kept as part of the codebase. See
|
||||
/phpdoc/README for me information on documentation.
|
||||
@@ -1,2 +0,0 @@
|
||||
For the list of people who've put work into PHP 4.0, please see
|
||||
http://www.php.net/credits.php
|
||||
Binary file not shown.
Binary file not shown.
-434
@@ -1,434 +0,0 @@
|
||||
List of PHP maintainers
|
||||
=======================
|
||||
|
||||
Maintenance legend
|
||||
------------------
|
||||
Supported: Someone is actually paid to look after this.
|
||||
Maintained: Someone actually looks after it.
|
||||
Odd Fixes: It has a maintainer but they don't have time to do
|
||||
much other than throw the odd patch in. See below.
|
||||
Orphan: No current maintainer [but maybe you could take the
|
||||
role as you write your new code].
|
||||
Obsolete: Old code. Something tagged obsolete generally means
|
||||
it has been replaced by a better system and you
|
||||
should be using that.
|
||||
Unknown: Not known at this time.
|
||||
|
||||
Status legend
|
||||
-------------
|
||||
Working: Working under both Windows and Unix.
|
||||
Windows: Working only under Windows.
|
||||
Unix: Working only under Unix.
|
||||
Experimental: Under development or initial release.
|
||||
Not Working: Not working.
|
||||
Unknown: Status unknown.
|
||||
|
||||
|
||||
== Server APIs ==
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: aolserver
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: apache
|
||||
PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: cgi
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: fhttpd
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: isapi
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: nsapi
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: phttpd
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pi3web
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: roxen
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: servlet
|
||||
PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: thttpd
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
== Database extensions ==
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: dba
|
||||
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: dbase
|
||||
PRIMARY MAINTAINER: Jim Winstead <jimw@php.net>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: dbx
|
||||
PRIMARY MAINTAINER: Marc Boeren <M.Boeren@guidance.nl>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.6
|
||||
COMMENT: DB abstraction for odbc, mysql, pgsql, mssql, fbsql
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: filepro
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: hyperwave
|
||||
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: informix
|
||||
PRIMARY MAINTAINER: Danny Heijl <Danny.Heijl@cevi.be>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: ingres_ii
|
||||
PRIMARY MAINTAINER: David Hénot <henot@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: interbase
|
||||
PRIMARY MAINTAINER: Jouni Ahto <jouni.ahto@exdec.fi>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: msql
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mssql
|
||||
PRIMARY MAINTAINER: Frank M. Kromann <fmk@swwwing.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
COMMENT: Tested on phpts and isapi versions
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mysql
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pgsql
|
||||
PRIMARY MAINTAINER: Jouni Ahto <jouni.ahto@exdec.fi>
|
||||
MAINTENANCE: Odd fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sybase
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Not Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sybase_ct
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: oci8
|
||||
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: odbc
|
||||
PRIMARY MAINTAINER: Andreas Karajannis <Karajannis@gmd.de>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
COMMENT: Working except for persistent connections
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: oracle
|
||||
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
COMMENT: Using the new OCI8 driver is encouraged where possible.
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
== Other extensions ==
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: aspell
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
COMMENT: For aspell .27 and greater, check out the pspell extension
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: bcmath
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: bz2
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.3
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: calendar
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: com
|
||||
PRIMARY MAINTAINER: Harald Radi <h.radi@nme.at>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: cpdf
|
||||
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: crack
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.5
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: curl
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: cybercash
|
||||
PRIMARY MAINTAINER: Evan Klinger <evan715@sirius.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: domxml
|
||||
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: dotnet
|
||||
PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: exif
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
SINCE: 4.0.1
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: fdf
|
||||
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: ftp
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: gd
|
||||
PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: gettext
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: gmp
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
SINCE: 4.0.4
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: icap
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Obsolete
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: imap
|
||||
PRIMARY MAINTAINER: Chuck Hagenbuch <chuck@horde.org>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: java
|
||||
PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: ldap
|
||||
PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mcal
|
||||
PRIMARY MAINTAINER: Chuck Hagenbuch <chuck@horde.org>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mcrypt
|
||||
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mhash
|
||||
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: muscat
|
||||
PRIMARY MAINTAINER: Sam Liddicott <sam@ananova.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.5
|
||||
COMMENT: Not tested against windows, only core API completed, rest under development
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: openssl
|
||||
PRIMARY MAINTAINER: Wez Furlong <wez@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.4
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pcre
|
||||
PRIMARY MAINTAINER: Andrei Zmievski <andrei@ispi.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pdf
|
||||
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pfpro
|
||||
PRIMARY MAINTAINER: David Croft <david@infotrek.co.uk>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: posix
|
||||
PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: printer
|
||||
PRIMARY MAINTAINER: Daniel Beulshausen <daniel@php4win.de>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.4
|
||||
COMMENT: Only for Win32
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pspell
|
||||
PRIMARY MAINTAINER: Vlad Krupin <phpdevel@echospace.com>
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: qtdom
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.4
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: readline
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: recode
|
||||
PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sablot
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.3
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: satellite
|
||||
PRIMARY MAINTAINER: David Eriksson <eriksson@php.net>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.3
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: session
|
||||
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: shmop
|
||||
PRIMARY MAINTAINER: Unknown
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.3
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: snmp
|
||||
PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sockets
|
||||
PRIMARY MAINTAINER: Chris Vandomelen <chrisv@b0rked.dhs.org>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: swf
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Depreciated (Use the ming swf extension instead)
|
||||
COMMENT: Only for Unix (won't change)
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sysvsem
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sysvshm
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: vpopmail
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.5
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: wddx
|
||||
PRIMARY MAINTAINER: Andrei Zmievski <andrei@ispi.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: xml
|
||||
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: yaz
|
||||
PRIMARY MAINTAINER: Adam Dickmeiss <adam@indexdata.dk>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Unknown
|
||||
SINCE: 4.0.1
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: yp
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: zlib
|
||||
PRIMARY MAINTAINER: Stefan Roehrich <sr@linux.de>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: zziplib
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.5
|
||||
-------------------------------------------------------------------------------
|
||||
# iptc?
|
||||
@@ -1,406 +0,0 @@
|
||||
Installation Instructions for PHP 4.0
|
||||
-------------------------------------
|
||||
|
||||
For the impatient here is a quick set of steps that will build PHP as
|
||||
first a dynamic Apache module (DSO) for Apache 1.3.x with MySQL support
|
||||
and then a static module. A more verbose explanation follows.
|
||||
|
||||
For installing PHP on other web servers, refer to one of the following
|
||||
files:
|
||||
|
||||
sapi/aolserver/README
|
||||
sapi/pi3web/README
|
||||
sapi/servlet/README
|
||||
sapi/thttpd/README
|
||||
README.Zeus
|
||||
|
||||
Note! Only install either the static module or the dynamic one. Do not
|
||||
install both.
|
||||
|
||||
Note 2! If you are recompiling PHP to add new extensions or upgrading
|
||||
something like GD, remove the config.cache file before you re-run
|
||||
configure.
|
||||
|
||||
Note 3! If you are on Linux and have installed shared libraries, make
|
||||
sure the location of these shared libraries are listed in your
|
||||
/etc/ld.so.conf file. For example, if you have:
|
||||
|
||||
/usr/local/lib/mysql/libmysqlclient.so
|
||||
|
||||
Make sure /etc/ld.so.conf contains:
|
||||
|
||||
/usr/local/lib/mysql
|
||||
|
||||
Then run ldconfig.
|
||||
|
||||
If you want both PHP 3 and 4 modules in the same Apache server, check the
|
||||
bottom of this file for instructions.
|
||||
|
||||
INSTALLATION WITH THE ZEUS WEB SERVER:
|
||||
--Please see the 'README.Zeus' file included in this distribution
|
||||
|
||||
|
||||
QUICK INSTALL (DSO)
|
||||
|
||||
For this to work your Apache httpd must have mod_so enabled.
|
||||
Check using httpd -l. You should see something like:
|
||||
|
||||
Compiled-in modules:
|
||||
http_core.c
|
||||
mod_so.c
|
||||
|
||||
Chances are you will see a lot more modules than these two. That's ok,
|
||||
as long as mod_so.c shows up you can proceed with the following steps:
|
||||
|
||||
$ gunzip -c php-4.0.x.tar.gz | tar xf -
|
||||
$ cd php-4.0.x
|
||||
$ ./configure --with-mysql --with-apxs
|
||||
$ make
|
||||
$ make install
|
||||
|
||||
If you get an error telling you that the apxs script could not be found,
|
||||
look for it on your system and if you find it, provide the full path to it
|
||||
as: --with-apxs=/path/to/apxs
|
||||
|
||||
Next you must copy php.ini-dist to the appropriate place (normally
|
||||
/usr/local/lib/php.ini) and edit it as necessary to set PHP options.
|
||||
|
||||
The only thing left to do is to edit your httpd.conf file and make sure the
|
||||
PHP 4 mime type is there and uncommented. You need a line that looks like
|
||||
this:
|
||||
|
||||
AddType application/x-httpd-php .php
|
||||
|
||||
Then restart your server (apachectl restart) and you should be able to
|
||||
serve up PHP files now. Make a test file called test.php and put some
|
||||
PHP tags in it. Like <?phpinfo()?>, for example.
|
||||
|
||||
|
||||
QUICK INSTALL (Static)
|
||||
|
||||
$ gunzip -c apache_1.3.x.tar.gz | tar xf -
|
||||
$ cd apache_1.3.x
|
||||
$ ./configure
|
||||
$ cd ..
|
||||
|
||||
$ gunzip -c php-4.0.x.tar.gz | tar xf -
|
||||
$ cd php-4.0.x
|
||||
$ ./configure --with-mysql --with-apache=../apache_1.3.x --enable-track-vars
|
||||
$ make
|
||||
$ make install
|
||||
|
||||
$ cd ../apache_1.3.x
|
||||
$ ./configure --prefix=/www --activate-module=src/modules/php4/libphp4.a
|
||||
(The above line is correct! Yes, we know libphp4.a does not exist at this
|
||||
stage. It isn't supposed to. It will be created.)
|
||||
$ make
|
||||
(you should now have an httpd binary which you can copy to your Apache bin dir if
|
||||
is is your first install then you need to "make install" as well)
|
||||
$ cd ../php-4.0.x
|
||||
$ cp php.ini-dist /usr/local/lib/php.ini
|
||||
You can edit /usr/local/lib/php.ini file to set PHP options.
|
||||
Edit your httpd.conf or srm.conf file and add:
|
||||
AddType application/x-httpd-php .php
|
||||
|
||||
|
||||
VERBOSE INSTALL
|
||||
|
||||
Chances are you are reading this because the quick install steps above
|
||||
did not work for you. If this is the case, congratulations, you are
|
||||
among the elite few that actually reads documentation. It really is
|
||||
not a difficult install and once you have done it once you will fly
|
||||
through it.
|
||||
|
||||
Installing PHP can be done in four simple steps:
|
||||
|
||||
1. Unpack your distribution file.
|
||||
|
||||
You will have downloaded a file named something like php-4.0.x.tar.gz.
|
||||
Unzip this file with a command like: gunzip php-4.0.x.tar.gz
|
||||
|
||||
Next you have to untar it with: tar -xvf php-4.0.x.tar
|
||||
|
||||
This will create a php-4.0.x directory. cd into this new directory.
|
||||
|
||||
2a. Configure PHP (Dynamic Module) - Skip to 2b if you wish to build
|
||||
a static module
|
||||
|
||||
You now have to choose the options you would like. There are quite
|
||||
a few of them. To see a list, type: ./configure --help
|
||||
|
||||
The only options that you are likely to want to use are the ones in
|
||||
the last section entitled, "--enable and --with options recognized:"
|
||||
|
||||
A popular choice is to build the Apache module version. In order to
|
||||
build PHP as a dynamic module for Apache-1.3.x you have to first have
|
||||
Apache installed. Assuming Apache is already installed, make sure
|
||||
the shared object module is enabled. To check this, type: httpd -l
|
||||
You should see something like:
|
||||
|
||||
Compiled-in modules:
|
||||
http_core.c
|
||||
mod_so.c
|
||||
|
||||
You will most likely have a lot more modules than what is shown here.
|
||||
As long as mod_so.c shows up in the list, PHP should be happy.
|
||||
|
||||
Now, type: ./configure --with-mysql --with-apxs
|
||||
|
||||
If you get an error telling you that the apxs script could not be found,
|
||||
look for it on your system and if you find it, provide the full path to it
|
||||
as: --with-apxs=/path/to/apxs
|
||||
|
||||
You might also want other flags on this configure line. --with-mysql
|
||||
is just an example.
|
||||
|
||||
There are a few things that can go wrong during this configure step.
|
||||
The most common is that you have asked for an option and that the
|
||||
configure script can not find the files required to enable this
|
||||
option in PHP. Chances are you can provide the full path to the
|
||||
base directory under which the related files were installed. For
|
||||
example, if you have installed the GD library in /opt/gd which means
|
||||
that /opt/gd/include has your GD header files and /opt/gd/lib contains
|
||||
your GD library files, you would use --with-gd=/opt/gd
|
||||
|
||||
Skip to step 3 for compilation and installation instructions.
|
||||
|
||||
2b. Configure PHP (Static Module) - Skip if you performed 2a
|
||||
|
||||
You now have to choose the options you would like. There are quite
|
||||
a few of them. To see a list, type: ./configure --help
|
||||
|
||||
The only options that you are likely to want to use are the ones in
|
||||
the last section entitled, "--enable and --with options recognized:"
|
||||
|
||||
A popular choice is to build the Apache module version. You need
|
||||
to know where the source code directory for your Apache server is
|
||||
located. Then use an option like: --with-apache=/usr/local/src/apache
|
||||
if that is your Apache source code directory. If you only specify
|
||||
--with-apache, then it will default to look for your Apache source
|
||||
in /usr/local/etc/httpd.
|
||||
|
||||
NOTE: The directory you specify should be the top-level of the
|
||||
unpacked Apache (or Stronghold) distribution. The configure program
|
||||
will automatically look for httpd.h in different directories under that
|
||||
location depending on which version of Apache, including Stronghold,
|
||||
you are running.
|
||||
|
||||
For MySQL support, since newer versions of MySQL installs its various
|
||||
components under /usr/local, this is the default. If you have
|
||||
changed the location you can specify it with: --with-mysql=/opt/local
|
||||
for example. Otherwise just use: --with-mysql
|
||||
|
||||
*NOTE* If you are using Apache 1.3b6 or later, you should run the
|
||||
Apache Configure script at least once before compiling PHP. It
|
||||
doesn't matter how you have Apache configured at this point.
|
||||
|
||||
Skip to step 3b at this point.
|
||||
|
||||
3. Compile and install the files. Simply type: make install
|
||||
|
||||
3a. Dynamic Module Installation
|
||||
|
||||
Nothing else is needed here. Proceed to step 4a.
|
||||
|
||||
3b. Static Module Installation
|
||||
|
||||
For the Apache module version this will copy the appropriate files
|
||||
to the src/modules/php4 directory in your Apache distribution if
|
||||
you are using Apache 1.3.x. If you are still running Apache 1.2.x
|
||||
these files will be copied directly to the main src directory.
|
||||
|
||||
For Apache 1.3b6 and later, you can use the new APACI configuration
|
||||
mechanism. To automatically build Apache with PHP support, use:
|
||||
|
||||
cd apache_1.3.x
|
||||
./configure --prefix=/<path>/apache \
|
||||
--activate-module=src/modules/php4/libphp4.a
|
||||
make
|
||||
make install
|
||||
|
||||
If you do not wish to use this new configuration tool, the old
|
||||
install procedure (src/Configure) will work fine.
|
||||
|
||||
If you are using the old Apache ./Configure script, you will have to
|
||||
edit the Apache src/Configuration file manually. If you do not have
|
||||
this file, copy Configuration.tmpl to Configuration.
|
||||
|
||||
For Apache 1.3.x add:
|
||||
|
||||
AddModule modules/php4/libphp4.a
|
||||
|
||||
For Apache 1.3.x don't do anything else. Just add this line and then
|
||||
run "./Configure" followed by "make".
|
||||
|
||||
For Apache 1.2.x add:
|
||||
|
||||
Module php4_module mod_php4.o
|
||||
|
||||
For Apache 1.2.x you will also have to look in the libphp4.module file,
|
||||
which was copied to the src directory. The EXTRA_LIBS line in the Apache
|
||||
Configuration file needs to be set to use the same libs as specified on
|
||||
the LIBS line in libphp4.module. You also need to make sure to add
|
||||
"-L." to the beginning of the EXTRA_LIBS line.
|
||||
|
||||
So, as an example, your EXTRA_LIBS line might look like:
|
||||
|
||||
EXTRA_LIBS=-L. -lphp4 -lgdbm -ldb -L/usr/local/mysql/lib -lmysqlclient
|
||||
|
||||
NOTE: You should not enclose the EXTRA_LIBS line in double-quotes, as it
|
||||
is in the libphp4.module file.
|
||||
|
||||
Also, look at the RULE_WANTHSREGEX setting in the libphp4.module file
|
||||
and set the WANTHSREGEX directive accordingly in your Configuration file.
|
||||
This last step applies to versions of Apache prior to 1.3b3.
|
||||
|
||||
This is a bit of a hassle, but should serve as incentive to move to
|
||||
Apache 1.3.x where this step has been eliminated.
|
||||
|
||||
Once you are satisfied with your Configuration settings, type: ./Configure
|
||||
If you get errors, chances are that you forgot a library or made a typo
|
||||
somewhere. Re-edit Configuration and try again. If it goes well,
|
||||
type: make
|
||||
|
||||
Assuming it compiles without errors, proceed to step 4b.
|
||||
|
||||
4a. Setting up the server. (Dynamic Module)
|
||||
|
||||
The make install command in step 3 should have done most of your
|
||||
work for you. It actually edits your httpd.conf file and tries to
|
||||
enable the dynamic PHP module. To verify this, look for a line that
|
||||
looks like this:
|
||||
|
||||
LoadModule php4_module libexec/libphp4.so
|
||||
|
||||
The actual path before the libphp4.so part might differ slightly. This
|
||||
is likely fine. If you are paranoid you can examine the output from the
|
||||
make install step to see where the libphp4.so file was actually put and
|
||||
place the full path to this file on this LoadModule line.
|
||||
|
||||
If somewhere in your httpd.conf file you have a ClearModuleList line
|
||||
then you also need this line:
|
||||
|
||||
AddModule mod_php4.c
|
||||
|
||||
And finally you need to tell Apache which file extension should trigger
|
||||
PHP. You do this by creating a special mime type and associating it
|
||||
with an extension. We suggest using:
|
||||
|
||||
AddType application/x-httpd-php .php
|
||||
|
||||
You are however free to use any extension you wish, including .html.
|
||||
|
||||
Note! If a line has a # at the beginning, then it is commented out
|
||||
and you need to remove the # for that line to take effect.
|
||||
|
||||
Finally you need to copy php.ini-dist to the appropriate place
|
||||
(normally /usr/local/lib/php.ini) and edit if necessary.
|
||||
|
||||
Once you have made these changes you should be ready to restart your
|
||||
server and try it out. Type: apachectl restart
|
||||
|
||||
4b. Setting up the server. (Static Module)
|
||||
|
||||
You should now have a new httpd binary. Shut down your existing server,
|
||||
if you have one, and copy this new binary overtop of it. Perhaps make
|
||||
a backup of your previous one first. Then edit your conf/httpd.conf file
|
||||
and add the line:
|
||||
|
||||
AddType application/x-httpd-php .php
|
||||
|
||||
There is also an interesting feature which can be quite instructive and
|
||||
helpful while debugging. That is the option of having colour syntax
|
||||
highlighting. To enable this, add the following line:
|
||||
|
||||
AddType application/x-httpd-php-source .phps
|
||||
|
||||
Any file ending in .phps will now be displayed with full colour syntax
|
||||
highlighting instead of being executed.
|
||||
|
||||
Note that on some older server setups, the AddType lines are in the
|
||||
conf/srm.conf file instead of conf/httpd.conf.
|
||||
|
||||
Note! If a line has a # at the beginning, then it is commented out
|
||||
and you need to remove the # for that line to take effect.
|
||||
|
||||
When you are finished making changes to your httpd.conf file, you need
|
||||
to copy php.ini-dist to the appropriate place (normally
|
||||
/usr/local/lib/php.ini) and edit if necessary. You can then
|
||||
start up your server.
|
||||
|
||||
5. Testing it all worked
|
||||
|
||||
Create a test file named test.php in your web tree somewhere and
|
||||
put some test PHP tags in it. <?phpinfo()?> is a good first test.
|
||||
This tag tells PHP to do a braindump and tells you all sorts of things
|
||||
about itself.
|
||||
|
||||
|
||||
WHY DISABLING -fPIC WORKS ON LINUX
|
||||
|
||||
From: Martin v. Loewis <martin@loewis.home.cs.tu-berlin.de>
|
||||
To: glibc-linux@ricardo.ecn.wfu.edu
|
||||
Subject: Re: Shared library -shared vs. -fpic
|
||||
|
||||
[In reply to Kaz Kylheku <kaz@ashi.footprints.net>]
|
||||
|
||||
> PIC stands for Position-Independent Code.
|
||||
|
||||
Correct.
|
||||
|
||||
> Code isn't position-independent (or ``relocatable'') cannot be
|
||||
> loaded at an arbitrary address;
|
||||
|
||||
Wrong.
|
||||
|
||||
> it requires some references to be patched at load time.
|
||||
|
||||
Correct.
|
||||
|
||||
> Shared libraries need to be relocatable because it's not known
|
||||
> beforehand what address they will be loaded at
|
||||
|
||||
Correct, depending on the meaning of "relocatable". PIC code typically
|
||||
does not contain relocations; that's why its position-independent.
|
||||
|
||||
> Just because you don't specify -fPIC doesn't mean that the compiler
|
||||
> won't emit position-independent code; the option prevents it from
|
||||
> emitting position-dependent code in situations where it otherwise
|
||||
> would.
|
||||
|
||||
Correct. However, a non-trivial shared library typically won't be
|
||||
position-independent unless explicitly compiled with
|
||||
-fPIC. Linux/glibc indeed does not require a shared library to be
|
||||
position-independent; instead, it will perform the relocations in the
|
||||
binary, even if they refer to code pages. As a result, those relocated
|
||||
pages won't be shared across processes, anymore.
|
||||
|
||||
Regards,
|
||||
Martin
|
||||
|
||||
USING PHP 3 AND PHP 4 AS CONCURRENT APACHE MODULES
|
||||
|
||||
Recent operating systems provide the ability to perform versioning and
|
||||
scoping. This features make it possible to let PHP 3 and PHP 4 run as
|
||||
concurrent modules in one Apache server.
|
||||
|
||||
This feature is known to work on the following platforms:
|
||||
|
||||
- Linux with recent binutils (binutils 2.9.1.0.25 tested)
|
||||
- Solaris 2.5 or better
|
||||
- FreeBSD (3.2, 4.0 tested)
|
||||
- IRIX64 6.5
|
||||
|
||||
To enable it, configure PHP 3 and PHP 4 to use APXS (--with-apxs) and the
|
||||
necessary link extensions (--enable-versioning). Otherwise, all standard
|
||||
installations instructions apply. For example:
|
||||
|
||||
$ ./configure \
|
||||
--with-apxs=/apache/bin/apxs \
|
||||
--enable-versioning \
|
||||
--with-mysql \
|
||||
--enable-track-vars
|
||||
|
||||
If this also works on your platform or if you know a way to do it, please
|
||||
report it to our bug database at http://bugs.php.net
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
--------------------------------------------------------------------
|
||||
The PHP License, version 2.02
|
||||
Copyright (c) 1999, 2000 The PHP Group. All rights reserved.
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, is permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
3. The name "PHP" must not be used to endorse or promote products
|
||||
derived from this software without prior permission from the
|
||||
PHP Group. This does not apply to add-on libraries or tools
|
||||
that work in conjunction with PHP. In such a case the PHP
|
||||
name may be used to indicate that the product supports PHP.
|
||||
|
||||
4. The PHP Group may publish revised and/or new versions of the
|
||||
license from time to time. Each version will be given a
|
||||
distinguishing version number.
|
||||
Once covered code has been published under a particular version
|
||||
of the license, you may always continue to use it under the
|
||||
terms of that version. You may also choose to use such covered
|
||||
code under the terms of any subsequent version of the license
|
||||
published by the PHP Group. No one other than the PHP Group has
|
||||
the right to modify the terms applicable to covered code created
|
||||
under this License.
|
||||
|
||||
5. Redistributions of any form whatsoever must retain the following
|
||||
acknowledgment:
|
||||
"This product includes PHP, freely available from
|
||||
http://www.php.net/".
|
||||
|
||||
6. The software incorporates the Zend Engine, a product of Zend
|
||||
Technologies, Ltd. ("Zend"). The Zend Engine is licensed to the
|
||||
PHP Association (pursuant to a grant from Zend that can be
|
||||
found at http://www.php.net/license/ZendGrant/) for
|
||||
distribution to you under this license agreement, only as a
|
||||
part of PHP. In the event that you separate the Zend Engine
|
||||
(or any portion thereof) from the rest of the software, or
|
||||
modify the Zend Engine, or any portion thereof, your use of the
|
||||
separated or modified Zend Engine software shall not be governed
|
||||
by this license, and instead shall be governed by the license
|
||||
set forth at http://www.zend.com/license/ZendLicense/.
|
||||
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
|
||||
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
|
||||
DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
--------------------------------------------------------------------
|
||||
|
||||
This software consists of voluntary contributions made by many
|
||||
individuals on behalf of the PHP Group.
|
||||
|
||||
The PHP Group can be contacted via Email at group@php.net.
|
||||
|
||||
For more information on the PHP Group and the PHP project,
|
||||
please see <http://www.php.net>.
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
|
||||
ZEND_DIR = $(srcdir)/Zend
|
||||
SUBDIRS = Zend main ext sapi $(TSRM_DIR) $(REGEX_DIR) . $(PEAR_DIR)
|
||||
|
||||
LTLIBRARY_NAME = libphp4.la
|
||||
LTLIBRARY_SOURCES = stub.c
|
||||
|
||||
LTLIBRARY_DEPENDENCIES = \
|
||||
Zend/libZend.la \
|
||||
sapi/$(PHP_SAPI)/libsapi.la \
|
||||
main/libmain.la \
|
||||
$(REGEX_LIB) \
|
||||
$(EXT_LTLIBS) \
|
||||
$(TSRM_LIB)
|
||||
|
||||
LTLIBRARY_LDFLAGS = -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS)
|
||||
LTLIBRARY_LIBADD = $(LTLIBRARY_DEPENDENCIES) $(EXTRA_LIBS)
|
||||
|
||||
PROGRAM_NAME = php
|
||||
PROGRAM_SOURCES = stub.c
|
||||
PROGRAM_LDADD = libphp4.la $(EXT_PROGRAM_LDADD)
|
||||
PROGRAM_LDFLAGS = -export-dynamic
|
||||
PROGRAM_DEPENDENCIES = $(PROGRAM_LDADD)
|
||||
|
||||
targets = $(LTLIBRARY_NAME) $(PHP_PROGRAM)
|
||||
|
||||
install_targets = install-sapi install-modules
|
||||
|
||||
include $(top_srcdir)/build/rules.mk
|
||||
include $(top_srcdir)/build/library.mk
|
||||
include $(top_srcdir)/build/program.mk
|
||||
|
||||
install-sapi:
|
||||
@$(LIBTOOL) --silent --mode=install cp libphp4.la $(phptempdir)/libphp4.la >/dev/null 2>&1
|
||||
-@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
|
||||
-@if test ! -r $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME); then \
|
||||
for i in 0.0.0 0.0 0; do \
|
||||
if test -r $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME).$$i; then \
|
||||
$(LN_S) $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME).$$i $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME); \
|
||||
break; \
|
||||
fi; \
|
||||
done; \
|
||||
fi
|
||||
$(INSTALL_IT)
|
||||
|
||||
install-modules:
|
||||
@test -d modules && \
|
||||
$(mkinstalldirs) $(INSTALL_ROOT)$(moduledir) && \
|
||||
echo "installing shared modules into $(moduledir)" && \
|
||||
rm -f modules/*.la && \
|
||||
cp modules/* $(INSTALL_ROOT)$(moduledir) >/dev/null 2>&1 || true
|
||||
|
||||
install-tester:
|
||||
@echo "Installing regression tester"
|
||||
@$(mkinstalldirs) $(PEAR_INSTALLDIR)
|
||||
@$(INSTALL) -m 755 $(srcdir)/run-tests.php $(INSTALL_ROOT)$(PEAR_INSTALLDIR)
|
||||
|
||||
install-pear: install-modules
|
||||
(cd pear && $(MAKE) install)
|
||||
|
||||
install-su: install-pear install-tester
|
||||
|
||||
.NOEXPORT:
|
||||
@@ -1,105 +0,0 @@
|
||||
This is the first file you should be reading after you get your CVS account.
|
||||
We'll assume you're basically familiar with CVS, but feel free to post
|
||||
your questions on the mailing list.
|
||||
|
||||
PHP is developed through the efforts of a large number of people.
|
||||
Collaboration is a Good Thing(tm), and CVS lets us do this. Thus, following
|
||||
some basic rules with regards to CVS usage will:
|
||||
|
||||
a. Make everybody happier, especially those responsible for maintaining
|
||||
the CVS itself.
|
||||
b. Keep the changes consistently well documented and easily trackable.
|
||||
c. Prevent some of those 'Oops' moments.
|
||||
d. Increase the general level of good will on planet Earth.
|
||||
|
||||
|
||||
Having said that, here are the organizational rules:
|
||||
|
||||
1. Respect other people working on the project.
|
||||
|
||||
2. Discuss any significant changes on the list before committing.
|
||||
|
||||
3. Look at EXTENSIONS file to see who is the primary maintainer of
|
||||
the code you want to contribute to.
|
||||
|
||||
4. If you "strongly disagree" about something another person did, don't
|
||||
start fighting publicly - take it up in private email.
|
||||
|
||||
5. If you don't know how to do something, ask first!
|
||||
|
||||
6. Test your changes before committing them. We mean it. Really.
|
||||
|
||||
|
||||
The next few rules are more of a technical nature.
|
||||
|
||||
1. DO NOT TOUCH ChangeLog! It is automagically updated from the commit
|
||||
messages every day. Woe be to those who attempt to mess with it.
|
||||
|
||||
2. All news updates intended for public viewing, such as new features,
|
||||
bug fixes, improvements, etc., should go into the NEWS file. Also see
|
||||
the note below about automatically updating NEWS in your commit message.
|
||||
|
||||
3. Do not commit multiple file and dump all messages in one commit. If you
|
||||
modified several unrelated files, commit each group separately and
|
||||
provide a nice commit message for each one. See example below.
|
||||
|
||||
4. Do write your commit message in such a way that it makes sense even
|
||||
without the corresponding diff. One should be able to look at it, and
|
||||
immediately know what was modified. Definitely include the function name
|
||||
in the message as shown below.
|
||||
|
||||
5. In your commit messages, keep each line shorter than 80 characters. And
|
||||
try to align your lines vertically, if they wrap. It looks bad otherwise.
|
||||
|
||||
6. If you modified a function that is callable from PHP, prepend PHP to
|
||||
the function name as shown below.
|
||||
|
||||
|
||||
The format of the commit messages is pretty simple.
|
||||
|
||||
If a line begins with #, it is taken to be a comment and will not appear
|
||||
in the ChangeLog. If the line begins with @, it will be redirected to the
|
||||
NEWS file. Everything else goes into the ChangeLog.
|
||||
|
||||
It is important to note that if your comment or news logline spans multiple
|
||||
lines, you have to put # or @ at the beginning of _every_ such line. Every
|
||||
entry in NEWS has to have a name after it, so if you did it with someone's
|
||||
help, put both your names there. Your name WILL NOT be automatically put
|
||||
at the end of the NEWS entry - so, please provide it yourself.
|
||||
|
||||
Example. Say you modified two files, datetime.c and string.c. In datetime.c
|
||||
you added a new format option for date() function, and in string.c you fixed
|
||||
a memory leak in php_trim(). Don't commit both of these at once. Commit them
|
||||
separately and try to make sure your commit messages look something like the
|
||||
following.
|
||||
|
||||
For datetime.c:
|
||||
|
||||
(PHP date) Added new 'K' format modifier for printing out number of
|
||||
days until New Year's Eve.
|
||||
@- Added new 'K' format modifier that will output the number of days
|
||||
@ until New Year's Eve. (Bob)
|
||||
|
||||
For string.c:
|
||||
(php_trim) Fixed a memory leak resulting from improper use of zval_dtor().
|
||||
# Man, that thing was leaking all over the place!
|
||||
@- Memory leak in trim() function has finally been fixed. (Bob)
|
||||
|
||||
The lines above marked with @ will go into NEWS file automagically, and the
|
||||
# lines will be omitted from the ChangeLog. Alternatively, you might want
|
||||
to modify NEWS file directly and not use the @ lines.
|
||||
|
||||
If you don't see your messages in ChangeLog and NEWS right away, don't worry!
|
||||
These files are updated once a day, so your stuff will not show up until
|
||||
somewhat later. Don't go adding stuff to NEWS by hand if you already put @
|
||||
lines in the commit message.
|
||||
|
||||
You can use LXR (http://lxr.php.net/) and Bonsai (http://bonsai.php.net/)
|
||||
to look at PHP CVS repository in various ways.
|
||||
|
||||
To receive daily updates to ChangeLog and NEWS, send an empty message to
|
||||
php-cvs-daily-subscribe@lists.php.net.
|
||||
|
||||
Happy hacking,
|
||||
|
||||
PHP Team
|
||||
-184
@@ -1,184 +0,0 @@
|
||||
|
||||
WHAT IT IS
|
||||
|
||||
It's a tool for automatically creating the basic framework for a PHP module
|
||||
and writing C code handling arguments passed to your functions from a simple
|
||||
configuration file. See an example at the end of this file.
|
||||
|
||||
HOW TO USE IT
|
||||
|
||||
Very simple. First, cd do directory ext/ in PHP 4 sources. If you just need
|
||||
the basic framework and will be writing all the code in your functions
|
||||
yourself, you can now do
|
||||
|
||||
./ext_skel --extname=module_name
|
||||
|
||||
and everything you need is placed in directory module_name. In fact, if you
|
||||
don't need to test the existence of any external header files, libraries or
|
||||
functions in them, the module is already almost ready to be compiled in PHP.
|
||||
Just remove 3 comments in your_module_name/config.m4, cd back up to PHP
|
||||
sources top directory, and do
|
||||
|
||||
./buildconf; ./configure --enable-module_name; make
|
||||
|
||||
But if you already have planned the overall scheme of your module, what
|
||||
functions it will contain, their return types and the arguments they take
|
||||
(a very good idea) and don't want to bother yourself with creating function
|
||||
definitions and handling arguments passed yourself, it's time to create a
|
||||
function definitions file, which you will give as an argument to ext_skel
|
||||
with option
|
||||
|
||||
--proto=filename.
|
||||
|
||||
FORMAT OF FUNCTION DEFINITIONS FILE
|
||||
|
||||
All the definitions must be on one line. In it's simplest form, it's just
|
||||
the function name, ie.
|
||||
|
||||
my_function
|
||||
|
||||
but then you'll be left with an almost empty function body without any
|
||||
argument handling.
|
||||
|
||||
Arguments are given in parenthesis after the function name, and are of
|
||||
the form 'argument_type argument_name'. Arguments are separated from each
|
||||
other with a comma and optional space. Argument_type can be one of int,
|
||||
bool, double, float, string, array, object or mixed.
|
||||
|
||||
An optional argument is separated from the previous by an optional space,
|
||||
then '[' and of course comma and optional space, like all the other
|
||||
arguments. You should close a row of optional arguments with same amount of
|
||||
']'s as there where '['s. Currently, it does not harm if you forget to do it
|
||||
or there is a wrong amount of ']'s, but this may change in the future.
|
||||
|
||||
An additional short description may be added after the parameters.
|
||||
If present it will be filled into the 'proto' header comments in the stubs
|
||||
code and the <refpurpose> tag in the XML documentation.
|
||||
|
||||
An example:
|
||||
|
||||
my_function(int arg1, int arg2 [, int arg3 [, int arg4]]) this is my 1st
|
||||
|
||||
Arguments arg3 and arg4 are optional.
|
||||
|
||||
If possible, the function definition should also contain it's return type
|
||||
in front of the definition. It's not actually used for any C code generating
|
||||
purposes but PHP in-source documentation instead, and as such, very useful.
|
||||
It can be any of int, double, string, bool, array, object, resource, mixed
|
||||
or void.
|
||||
|
||||
The file must contain nothing else but function definitions, no comments or
|
||||
empty lines.
|
||||
|
||||
OTHER OPTIONS
|
||||
|
||||
--no-help
|
||||
|
||||
By default, ext_skel creates both comments in the source code and a test
|
||||
function to help first time module writers to get started and testing
|
||||
configuring and compiling their module. This option turns off all such things
|
||||
which may just annoy experienced PHP module coders. Especially useful with
|
||||
|
||||
--stubs=file
|
||||
|
||||
which will leave out also all module specific stuff and write just function
|
||||
stubs with function value declarations and passed argument handling, and
|
||||
function entries and definitions at the end of the file, for copying and
|
||||
pasting into an already existing module.
|
||||
|
||||
--assign-params
|
||||
--string-lens
|
||||
|
||||
By default, function proto 'void foo(string bar)' creates the following:
|
||||
...
|
||||
zval **bar;
|
||||
... (zend_get_parameters_ex() called in the middle...)
|
||||
convert_to_string_ex(bar);
|
||||
|
||||
Specifying both of these options changes the generated code to:
|
||||
...
|
||||
zval **bar_arg;
|
||||
int bar_len;
|
||||
char *bar = NULL;
|
||||
... (zend_get_parameters_ex() called in the middle...)
|
||||
convert_to_string_ex(bar_arg);
|
||||
bar = Z_STRVAL_PP(bar_arg);
|
||||
bar_len = Z_STRLEN_PP(bar_arg);
|
||||
|
||||
You shouldn't have to ask what happens if you leave --string-lens out. If you
|
||||
have to, it's questionable whether you should be reading this document.
|
||||
|
||||
--with-xml[=file]
|
||||
|
||||
Creates the basics for phpdoc .xml file.
|
||||
|
||||
--full-xml
|
||||
|
||||
Not implemented yet. When or if there will ever be created a framework for
|
||||
self-contained extensions to use phpdoc system for their documentation, this
|
||||
option enables it on the created xml file.
|
||||
|
||||
CURRENT LIMITATIONS, BUGS AND OTHER ODDITIES
|
||||
|
||||
Only arguments of types int, bool, double, float, string and array are
|
||||
handled. For other types you must write the code yourself. And for type
|
||||
mixed, it wouldn't even be possible to write anything, because only you
|
||||
know what to expect.
|
||||
|
||||
It can't handle correctly, and probably never will, variable list of
|
||||
of arguments. (void foo(int bar [, ...])
|
||||
|
||||
Don't trust the generated code too much. It tries to be useful in most of
|
||||
the situations you might encounter, but automatic code generation will never
|
||||
beat a programmer who knows the real situation at hand. ext_skel is generally
|
||||
best suited for quickly generating a wrapper for c-library functions you
|
||||
might want to have available in PHP too.
|
||||
|
||||
This program doesn't have a --help option. It has --no-help instead.
|
||||
|
||||
EXAMPLE
|
||||
|
||||
The following _one_ line
|
||||
|
||||
bool my_drawtext(resource image, string text, resource font, int x, int y [, int color])
|
||||
|
||||
will create this function definition for you (note that there are a few
|
||||
question marks to be replaced by you, and you must of course add your own
|
||||
value definitions too):
|
||||
|
||||
/* {{{ proto bool my_drawtext(resource image, string text, resource font, int x, int y[, int color])
|
||||
*/
|
||||
PHP_FUNCTION(my_drawtext)
|
||||
{
|
||||
zval **image, **text, **font, **x, **y, **color;
|
||||
int argc;
|
||||
int image_id = -1;
|
||||
int font_id = -1;
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
if (argc < 5 || argc > 6 || zend_get_parameters_ex(argc, &image, &text, &font, &x, &y, &color) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(???, ???, image, image_id, "???", ???_rsrc_id);
|
||||
ZEND_FETCH_RESOURCE(???, ???, font, font_id, "???", ???_rsrc_id);
|
||||
|
||||
switch (argc) {
|
||||
case 6:
|
||||
convert_to_long_ex(color);
|
||||
/* Fall-through. */
|
||||
case 5:
|
||||
convert_to_long_ex(y);
|
||||
convert_to_long_ex(x);
|
||||
/* font: fetching resources already handled. */
|
||||
convert_to_string_ex(text);
|
||||
/* image: fetching resources already handled. */
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
php_error(E_WARNING, "my_drawtext: not yet implemented");
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
QNX4 Installation Notes
|
||||
-----------------------
|
||||
|
||||
NOTE: General installation instructions are in the INSTALL file
|
||||
|
||||
|
||||
1. To compile and test PHP3 you have to grab, compile and install:
|
||||
- GNU dbm library or another db library;
|
||||
- GNU bison (1.25 or later; 1.25 tested);
|
||||
- GNU flex (any version supporting -o and -P options; 2.5.4 tested);
|
||||
- GNU diffutils (any version supporting -w option; 2.7 tested);
|
||||
|
||||
2. To use CVS version you may need also:
|
||||
- GNU CVS (1.9 tested);
|
||||
- GNU autoconf (2.12 tested);
|
||||
- GNU m4 (1.3 or later preferable; 1.4 tested);
|
||||
|
||||
3. To run configure define -lunix in command line:
|
||||
LDFLAGS=-lunix ./configure
|
||||
|
||||
4. To use Sybase SQL Anywhere define ODBC_QNX and CUSTOM_ODBC_LIBS in
|
||||
command line and run configure with --with-custom-odbc:
|
||||
CFLAGS=-DODBC_QNX LDFLAGS=-lunix CUSTOM_ODBC_LIBS="-ldblib -lodbc" ./configure --with-custom-odbc=/usr/lib/sqlany50
|
||||
If you have SQL Anywhere version 5.5.00, then you have to add
|
||||
CFLAGS=-DSQLANY_BUG
|
||||
to workaround its SQLFreeEnv() bug. Other versions has not been tested,
|
||||
so try without this flag first.
|
||||
|
||||
5. To build the Apache module, you may have to hardcode an include path for
|
||||
alloc.h in your Apache base directory:
|
||||
- APACHE_DIRECTORY/src/httpd.h:
|
||||
change #include "alloc.h"
|
||||
to #include "APACHE_DIRECTORY/src/alloc.h"
|
||||
Unless you want to use system regex library, you have to hardcode also
|
||||
a path to regex.h:
|
||||
- APACHE_DIRECTORY/src/conf.h:
|
||||
change #include <regex.h>
|
||||
to #include "APACHE_DIRECTORY/src/regex/regex.h"
|
||||
I don't know so far why this required for QNX, may be it is Watcom
|
||||
compiler problem.
|
||||
|
||||
If you building Apache module with SQL Anywhere support, you'll get
|
||||
symbol conflict with BOOL. It is defined in Apache (httpd.h) and in
|
||||
SQL Anywhere (odbc.h). This has nothing to do with PHP, so you have to
|
||||
fix it yourself someway.
|
||||
|
||||
6. With above precautions, it should compile as is and pass regression
|
||||
tests completely:
|
||||
make
|
||||
make check
|
||||
make install
|
||||
|
||||
Don't bother me unless you really sure you made that all but it
|
||||
still doesn't work.
|
||||
|
||||
June 28, 1998
|
||||
Igor Kovalenko -- owl@infomarket.ru
|
||||
@@ -1,174 +0,0 @@
|
||||
$Id$
|
||||
=============================================================================
|
||||
|
||||
HOW TO CREATE A SELF-CONTAINED PHP EXTENSION
|
||||
|
||||
A self-contained extension can be distributed independently of
|
||||
the PHP source. To create such an extension, three things are
|
||||
required:
|
||||
|
||||
- Makefile template (Makefile.in)
|
||||
- Configuration file (config.m4)
|
||||
- Source code for your module
|
||||
|
||||
We will describe now how to create these and how to put things
|
||||
together.
|
||||
|
||||
PREPARING YOUR SYSTEM
|
||||
|
||||
While the result will run on any system, a developer's setup needs these
|
||||
tools:
|
||||
|
||||
GNU autoconf
|
||||
GNU automake
|
||||
GNU libtool
|
||||
GNU m4
|
||||
|
||||
All of these are available from
|
||||
|
||||
ftp://ftp.gnu.org/pub/gnu/
|
||||
|
||||
CONVERTING AN EXISTING EXTENSION
|
||||
|
||||
Just to show you how easy it is to create a self-contained
|
||||
extension, we will convert an embedded extension into a
|
||||
self-contained one. Install PHP and execute the following
|
||||
commands.
|
||||
|
||||
$ mkdir /tmp/newext
|
||||
$ cd /tmp/newext
|
||||
|
||||
You now have an empty directory. We will copy the files from
|
||||
the mysql extension:
|
||||
|
||||
$ cp -rp php-4.0.X/ext/mysql/* .
|
||||
|
||||
It is time to finish the module. Run:
|
||||
|
||||
$ phpize
|
||||
|
||||
You can now ship the contents of the directory - the extension
|
||||
can live completely on its own.
|
||||
|
||||
The user instructions boil down to
|
||||
|
||||
$ ./configure \
|
||||
[--with-php-config=/path/to/php-config] \
|
||||
[--with-mysql=MYSQL-DIR]
|
||||
$ make install
|
||||
|
||||
The MySQL module will either use the embedded MySQL client
|
||||
library or the MySQL installation in MYSQL-DIR.
|
||||
|
||||
|
||||
DEFINING THE NEW EXTENSION
|
||||
|
||||
Our demo extension is called "foobar".
|
||||
|
||||
It consists of two source files "foo.c" and "bar.c"
|
||||
(and any arbitrary amount of header files, but that is not
|
||||
important here).
|
||||
|
||||
The demo extension does not reference any external
|
||||
libraries (that is important, because the user does not
|
||||
need to specify anything).
|
||||
|
||||
|
||||
CREATING THE MAKEFILE TEMPLATE
|
||||
|
||||
The Makefile Template (Makefile.in) contains three lines:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
LTLIBRARY_SHARED_NAME = foobar.la
|
||||
LTLIBRARY_SOURCES = foo.c bar.c
|
||||
|
||||
include $(top_srcdir)/build/dynlib.mk
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
LTLIBRARY_SHARED_NAME specifies the name of the extension.
|
||||
It must be of the form `ext-name.la'.
|
||||
|
||||
LTLIBRARY_SOURCES specifies the names of the sources files. You can
|
||||
name an arbitrary number of source files here.
|
||||
|
||||
The final include directive includes the build rules (you usually
|
||||
don't need to care about what happens there). rules.mk and other
|
||||
files are installed by phpize which we will cover later.
|
||||
|
||||
|
||||
CREATING THE M4 CONFIGURATION FILE
|
||||
|
||||
The m4 configuration can perform additional checks. For a
|
||||
self-contained extension, you do not need more than a few
|
||||
macro calls.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PHP_ARG_ENABLE(foobar,whether to enable foobar,
|
||||
[ --enable-foobar Enable foobar])
|
||||
|
||||
if test "$PHP_FOOBAR" != "no"; then
|
||||
PHP_EXTENSION(foobar, $ext_shared)
|
||||
fi
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PHP_ARG_ENABLE will automatically set the correct variables, so
|
||||
that the extension will be enabled by PHP_EXTENSION in shared mode.
|
||||
|
||||
Please use always PHP_ARG_ENABLE or PHP_ARG_WITH. Even if you do not
|
||||
plan to distribute your module with PHP, these facilities allow you
|
||||
to integrate your module easily into the main PHP module framework.
|
||||
|
||||
CREATING SOURCE FILES
|
||||
|
||||
ext_skel can be of great help when creating the common code for all modules
|
||||
in PHP for you and also writing basic function definitions and C code for
|
||||
handling arguments passed to your functions. See README.EXT_SKEL for further
|
||||
information.
|
||||
|
||||
As for the rest, you are currently alone here. There are a lot of existing
|
||||
modules, use a simple module as a starting point and add your own code.
|
||||
|
||||
|
||||
CREATING THE SELF-CONTAINED EXTENSION
|
||||
|
||||
Put Makefile.in, config.m4 and the source files into one directory.
|
||||
Then run phpize (this is installed during make install by PHP 4.0).
|
||||
For example, if you configured PHP with --prefix=/php, you would run
|
||||
|
||||
$ /php/bin/phpize
|
||||
|
||||
This will automatically copy the necessary build files and create
|
||||
configure from your config.m4.
|
||||
|
||||
And that's it. You now have a self-contained extension.
|
||||
|
||||
INSTALLING A SELF-CONTAINED EXTENSION
|
||||
|
||||
An extension can be installed by running:
|
||||
|
||||
$ ./configure \
|
||||
[--with-php-config=/path/to/php-config]
|
||||
$ make install
|
||||
|
||||
ADDING SHARED MODULE SUPPORT TO A MODULE
|
||||
|
||||
In order to be useful, a self-contained extension must be loadable
|
||||
as a shared module. I will explain now how you can add shared module
|
||||
support to an existing module called foo.
|
||||
|
||||
1. In config.m4, use PHP_ARG_WITH/PHP_ARG_ENABLE. Then you will
|
||||
automatically be able to use --with-foo=shared or
|
||||
--enable-foo=shared.
|
||||
|
||||
2. In config.m4, use PHP_EXTENSION(foo, $ext_shared) to enable
|
||||
building the extension.
|
||||
|
||||
3. Add the following line to Makefile.in:
|
||||
|
||||
LTLIBRARY_SHARED_NAME = foo.la
|
||||
|
||||
4. Add the following lines to your C source file:
|
||||
|
||||
#ifdef COMPILE_DL_FOO
|
||||
ZEND_GET_MODULE(foo)
|
||||
#endif
|
||||
-243
@@ -1,243 +0,0 @@
|
||||
An Overview of the PHP Streams abstraction
|
||||
==========================================
|
||||
$Id$
|
||||
|
||||
Please send comments to: Wez Furlong <wez@thebrainroom.com>
|
||||
|
||||
Note: this doc is preliminary and is intended to give the reader an idea of
|
||||
how streams work and should be used.
|
||||
|
||||
Why Streams?
|
||||
============
|
||||
You may have noticed a shed-load of issock parameters flying around the PHP
|
||||
code; we don't want them - they are ugly and cumbersome and force you to
|
||||
special case sockets and files everytime you need to work with a "user-level"
|
||||
PHP file pointer.
|
||||
Streams take care of that and present the PHP extension coder with an ANSI
|
||||
stdio-alike API that looks much nicer and can be extended to support non file
|
||||
based data sources.
|
||||
|
||||
Using Streams
|
||||
=============
|
||||
Streams use a php_stream* parameter just as ANSI stdio (fread etc.) use a
|
||||
FILE* parameter.
|
||||
|
||||
The main functions are:
|
||||
|
||||
PHPAPI size_t php_stream_read(php_stream * stream, char * buf, size_t count);
|
||||
PHPAPI size_t php_stream_write(php_stream * stream, const char * buf, size_t
|
||||
count);
|
||||
PHPAPI int php_stream_eof(php_stream * stream);
|
||||
PHPAPI int php_stream_getc(php_stream * stream);
|
||||
PHPAPI char *php_stream_gets(php_stream * stream, char *buf, size_t maxlen);
|
||||
PHPAPI int php_stream_close(php_stream * stream);
|
||||
PHPAPI int php_stream_flush(php_stream * stream);
|
||||
PHPAPI int php_stream_seek(php_stream * stream, off_t offset, int whence);
|
||||
PHPAPI off_t php_stream_tell(php_stream * stream);
|
||||
|
||||
These (should) behave in the same way as the ANSI stdio functions with similar
|
||||
names: fread, fwrite, feof, fgetc, fgets, fclose, fflush, fseek, ftell.
|
||||
|
||||
Opening Streams
|
||||
===============
|
||||
Ultimately, I aim to implement an fopen_wrapper-like call to do this with
|
||||
minimum fuss.
|
||||
Currently, mostly for testing purposes, you can use php_stream_fopen to open a
|
||||
stream on a regular file.
|
||||
|
||||
PHPAPI php_stream * php_stream_fopen(const char * filename, const char *
|
||||
mode);
|
||||
|
||||
This call behaves just like fopen(), except it returns a stream instead of a
|
||||
FILE *
|
||||
|
||||
Casting Streams
|
||||
===============
|
||||
What if your extension needs to access the FILE* of a user level file pointer?
|
||||
You need to "cast" the stream into a FILE*, and this is how you do it:
|
||||
|
||||
FILE * fp;
|
||||
php_stream * stream; /* already opened */
|
||||
|
||||
if (php_stream_cast(stream, PHP_STREAM_AS_STDIO, &fp, 1) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
The prototype is:
|
||||
|
||||
PHPAPI int php_stream_cast(php_stream * stream, int castas, void ** ret, int
|
||||
show_err);
|
||||
|
||||
The show_err parameter, if non-zero, will cause the function to display an
|
||||
appropriate error message of type E_WARNING if the cast fails.
|
||||
|
||||
castas can be one of the following values:
|
||||
PHP_STREAM_AS_STDIO - a stdio FILE*
|
||||
PHP_STREAM_AS_FD - a generic file descriptor
|
||||
PHP_STREAM_AS_SOCKETD - a socket descriptor
|
||||
|
||||
If you ask a socket stream for a FILE*, the abstraction will use fdopen to
|
||||
create it for you. Be warned that doing so may cause buffered data to be lost
|
||||
if you mix ANSI stdio calls on the FILE* with php stream calls on the stream.
|
||||
|
||||
If your system has the fopencookie function, php streams can synthesize a
|
||||
FILE* on top of any stream, which is useful for SSL sockets, memory based
|
||||
streams, data base streams etc. etc.
|
||||
NOTE: There might be situations where this is not desireable, and we need to
|
||||
provide a flag to inform the casting routine of this.
|
||||
|
||||
You can use:
|
||||
|
||||
PHPAPI int php_stream_can_cast(php_stream * stream, int castas)
|
||||
|
||||
to find out if a stream can be cast, without actually performing the cast, so
|
||||
to check if a stream is a socket you might use:
|
||||
|
||||
if (php_stream_can_cast(stream, PHP_STREAM_AS_SOCKETD) == SUCCESS) {
|
||||
/* it's a socket */
|
||||
}
|
||||
|
||||
|
||||
Stream Internals
|
||||
================
|
||||
|
||||
There are two main structures associated with a stream - the php_stream
|
||||
itself, which holds some state information (and possibly a buffer) and a
|
||||
php_stream_ops structure, which holds the "virtual method table" for the
|
||||
underlying implementation.
|
||||
|
||||
The php_streams ops struct consists of pointers to methods that implement
|
||||
read, write, close, flush, seek, gets and cast operations. Of these, an
|
||||
implementation need only implement write, read, close and flush. The gets
|
||||
method is intended to be used for non-buffered streams if there is an
|
||||
underlying method that can efficiently behave as fgets. The ops struct also
|
||||
contains a label for the implementation that will be used when printing error
|
||||
messages - the stdio implementation has a label of "STDIO" for example.
|
||||
|
||||
The idea is that a stream implementation defines a php_stream_ops struct, and
|
||||
associates it with a php_stream using php_stream_alloc.
|
||||
|
||||
As an example, the php_stream_fopen() function looks like this:
|
||||
|
||||
PHPAPI php_stream * php_stream_fopen(const char * filename, const char * mode)
|
||||
{
|
||||
FILE * fp = fopen(filename, mode);
|
||||
php_stream * ret;
|
||||
|
||||
if (fp) {
|
||||
ret = php_stream_alloc(&php_stream_stdio_ops, fp, 0, 0, mode);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
php_stream_stdio_ops is a php_stream_ops structure that can be used to handle
|
||||
FILE* based streams.
|
||||
|
||||
A socket based stream would use code similar to that above to create a stream
|
||||
to be passed back to fopen_wrapper (or it's yet to be implemented successor).
|
||||
|
||||
The prototype for php_stream_alloc is this:
|
||||
|
||||
PHPAPI php_stream * php_stream_alloc(php_stream_ops * ops, void * abstract,
|
||||
size_t bufsize, int persistent, const char * mode)
|
||||
|
||||
ops is a pointer to the implementation,
|
||||
abstract holds implementation specific data that is relevant to this instance
|
||||
of the stream,
|
||||
bufsize is the size of the buffer to use - if 0, then buffering at the stream
|
||||
level will be disabled (recommended for underlying sources that implement
|
||||
their own buffering - such a FILE*),
|
||||
persistent controls how the memory is to be allocated - persistently so that
|
||||
it lasts across requests, or non-persistently so that it is freed at the end
|
||||
of a request (it uses pemalloc),
|
||||
mode is the stdio-like mode of operation - php streams places no real meaning
|
||||
in the mode parameter, except that it checks for a 'w' in the string when
|
||||
attempting to write (this may change).
|
||||
|
||||
The mode parameter is passed on to fdopen/fopencookie when the stream is cast
|
||||
into a FILE*, so it should be compatible with the mode parameter of fopen().
|
||||
|
||||
Writing your own stream implementation
|
||||
======================================
|
||||
|
||||
First, you need to figure out what data you need to associate with the
|
||||
php_stream. For example, you might need a pointer to some memory for memory
|
||||
based streams, or if you were making a stream to read data from an RDBMS like
|
||||
mysql, you might want to store the connection and rowset handles.
|
||||
|
||||
The stream has a field called abstract that you can use to hold this data.
|
||||
If you need to store more than a single field of data, define a structure to
|
||||
hold it, allocate it (use pemalloc with the persistent flag set
|
||||
appropriately), and use the abstract pointer to refer to it.
|
||||
|
||||
For structured state you might have this:
|
||||
|
||||
struct my_state {
|
||||
MYSQL conn;
|
||||
MYSQL_RES * result;
|
||||
};
|
||||
|
||||
struct my_state * state = pemalloc(sizeof(struct my_state), persistent);
|
||||
|
||||
/* initialize the connection, and run a query, using the fields in state to
|
||||
* hold the results */
|
||||
|
||||
state->result = mysql_use_result(&state->conn);
|
||||
|
||||
/* now allocate the stream itself */
|
||||
stream = php_stream_alloc(&my_ops, state, 0, persistent, "r");
|
||||
|
||||
/* now stream->abstract == state */
|
||||
|
||||
Once you have that part figured out, you can write your implementation and
|
||||
define the your own php_stream_ops struct (we called it my_ops in the above
|
||||
example).
|
||||
|
||||
For example, for reading from this wierd mysql stream:
|
||||
|
||||
static size_t php_mysqlop_read(php_stream * stream, char * buf, size_t count)
|
||||
{
|
||||
struct my_state * state = (struct my_state*)stream->abstract;
|
||||
|
||||
if (buf == NULL && count == 0) {
|
||||
/* in this special case, php_streams is asking if we have reached the
|
||||
* end of file */
|
||||
if (... at end of file ...)
|
||||
return EOF;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* pull out some data from the stream and put it in buf */
|
||||
... mysql_fetch_row(state->result) ...
|
||||
/* we could do something strange, like format the data as XML here,
|
||||
and place that in the buf, but that brings in some complexities,
|
||||
such as coping with a buffer size too small to hold the data,
|
||||
so I won't even go in to how to do that here */
|
||||
}
|
||||
|
||||
Implement the other operations - remember that write, read, close and flush
|
||||
are all mandatory. The rest are optional. Declare your stream ops struct:
|
||||
|
||||
php_stream_ops my_ops = {
|
||||
php_mysqlop_write, php_mysqlop_read, php_mysqlop_close,
|
||||
php_mysqlop_flush, NULL, NULL, NULL,
|
||||
"Strange mySQL example"
|
||||
}
|
||||
|
||||
Thats it!
|
||||
|
||||
Take a look at the STDIO implementation in streams.c for more information
|
||||
about how these operations work.
|
||||
The main thing to remember is that in your close operation you need to release
|
||||
and free the resources you allocated for the abstract field. In the case of
|
||||
the example above, you need to use mysql_free_result on the rowset, close the
|
||||
connection and then use pefree to dispose of the struct you allocated.
|
||||
You may read the stream->persistent field to determine if your struct was
|
||||
allocated in persistent mode or not.
|
||||
|
||||
vim:tw=78
|
||||
-126
@@ -1,126 +0,0 @@
|
||||
Using PHP4 with the Zeus Web Server
|
||||
-----------------------------------
|
||||
|
||||
Zeus fully supports running PHP in combination with our
|
||||
webserver. There are three different interfaces that can be used to
|
||||
enable PHP:
|
||||
|
||||
* CGI
|
||||
* ISAPI
|
||||
* FastCGI
|
||||
|
||||
Of the three, we recommend using FastCGI, which has been tested and
|
||||
benchmarked as providing the best performance and reliability.
|
||||
|
||||
Full details of how to install PHP are available from our
|
||||
website, at:
|
||||
|
||||
http://support.zeus.com/products/php.html
|
||||
|
||||
If you have any problems, please check the support site for more
|
||||
up-to-date information and advice.
|
||||
|
||||
|
||||
Quick guide to installing FastCGI with Zeus
|
||||
-------------------------------------------
|
||||
|
||||
Step 1 - obtain and install FastCGI development kit.
|
||||
|
||||
Grab the package from:
|
||||
http://www.fastcgi.com/dist/devkit_2.2.0.tar.gz
|
||||
|
||||
Extract the package and follow the instructions:
|
||||
./configure
|
||||
make
|
||||
make export
|
||||
(run the last as root)
|
||||
|
||||
This will install to /usr/local/lib/libfcgi.a
|
||||
and /usr/local/include/*fcgi*
|
||||
|
||||
|
||||
|
||||
Step 2 - Compile PHP as FastCGI.
|
||||
|
||||
Compile as follows:
|
||||
./configure --with-fastcgi
|
||||
make
|
||||
|
||||
Note that PHP has many options to the configure script -
|
||||
e.g. --with-mysql. You will probably want to select your usual options
|
||||
before compiling; the above is just a bare minimum, for illustration.
|
||||
|
||||
After compilation finishes, you will be left with an executable
|
||||
program called 'php'. Copy this into your document root, under a
|
||||
dedicated FastCGI directory (e.g. $DOCROOT/fcgi-bin/php)
|
||||
|
||||
|
||||
Step 3 - configure Zeus
|
||||
|
||||
Four stages:
|
||||
- enable FastCGI
|
||||
- configure FastCGI
|
||||
- setup alias for FastCGI
|
||||
- setup alias for PHP
|
||||
|
||||
1) Using the admin server, go to the 'module configuration' page for
|
||||
your virtual server, and ensure that 'fastcgi' is enabled (select the
|
||||
tickbox to the left).
|
||||
|
||||
2) While we can run FastCGI's locally, there are known problems with
|
||||
some OS's (specifically, the communication between web server and
|
||||
FastCGI happens over a unix domain socket, and some OS's have trouble
|
||||
sustaining high connection rates over these sockets). So instead, we
|
||||
are going to set up the PHP FastCGI to run 'remotely' over localhost
|
||||
(this uses TCP sockets, which do not suffer this problem). Go to the
|
||||
'fastcgi configuration' page, and under 'add remote fastcgi':
|
||||
Add Remote FastCGI
|
||||
Docroot path /fcgi-bin/php
|
||||
Remote machine localhost:8002
|
||||
The first entry is where you saved PHP, above.
|
||||
The second entry is localhost:<any unused port>
|
||||
We will start the FastCGI listening on this port shortly.
|
||||
Click 'update' to commit these changes.
|
||||
|
||||
3) Go to the path mapping module and add an alias for FastCGI:
|
||||
Add Alias
|
||||
Docroot path /fcgi-bin
|
||||
Filesystem directory /path/to/docroot/fcgi-bin
|
||||
Alias type fastcgi
|
||||
Click 'update' to commit these changes
|
||||
|
||||
4) Also on the path mapping module, add a handler for PHP:
|
||||
Add handler
|
||||
File extension php
|
||||
Handler /fcgi-bin/php
|
||||
Click 'update' to commit these changes
|
||||
|
||||
Finally restart your virtual server for these changes to take effect.
|
||||
|
||||
|
||||
Step 4 - start PHP as a FastCGI runner
|
||||
|
||||
When you start PHP, it will pre-fork a given number of child processes
|
||||
to handle incoming PHP requests. Each process will handle a given
|
||||
number of requests before exiting (and being replaced by a newly
|
||||
forked process). You can control these two parameters by setting the
|
||||
following environment variables BEFORE starting the FastCGI runner:
|
||||
|
||||
PHP_FCGI_CHILDREN - the number of child processes to pre-fork. If not
|
||||
set, defaults to 8.
|
||||
|
||||
PHP_FCGI_MAX_REQUESTS - the number of requests each PHP child process
|
||||
handles before exiting. If not set, defaults to 500.
|
||||
|
||||
To start the FastCGI runner, execute '$ZEUSHOME/web/bin/fcgirunner
|
||||
8002 $DOCROOT/fcgi-bin/php'. Substitute the appropriate values for
|
||||
$ZEUSHOME and $DOCROOT; also substitute for 8002 the port you chose,
|
||||
above.
|
||||
|
||||
To stop the runner (e.g. to experiment with the above environment
|
||||
variables) you will need to manually stop and running PHP
|
||||
processes. (Use 'ps' and 'kill'). As it is PHP which is forking lots
|
||||
of children and not the runner, Zeus unfortunately cannot keep track
|
||||
of what processes are running, sorry. A typical command line may look
|
||||
like 'ps -efl | grep $DOCROOT/fcgi-bin/php | grep -v grep | awk
|
||||
'{print $4}' | xargs kill'
|
||||
-186
@@ -1,186 +0,0 @@
|
||||
Advisory on the PHP Release Cycle
|
||||
|
||||
|
||||
Copyright & Liciencing
|
||||
|
||||
This Document is (c) Copyright 2000,2001 by The PHP Group
|
||||
|
||||
This Document is distributed 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.
|
||||
|
||||
|
||||
Table of Contents
|
||||
|
||||
1. Introduction
|
||||
2. Dealing with bugs
|
||||
2.1 As a QA Team Member
|
||||
2.2 As a Developer
|
||||
3. Releaseing another RC
|
||||
4. CVS During the Release Process
|
||||
4.1 Useful CVS Commands
|
||||
5 The Final Release
|
||||
6 Summary
|
||||
|
||||
|
||||
1. Introduction
|
||||
|
||||
This cycle should take place over roughly 10 days. When it is
|
||||
decided it is time for an Release to occur Andi/Zeev (Or
|
||||
Whoever) will tarball RC1, Tag & Branch CVS (see section 4)
|
||||
and then announce the RC on PHP-QA and PHP-DEV. At this
|
||||
point the build tracker and QA Bug System come into play.
|
||||
If you successfully build PHP then report it in the build
|
||||
tracker, If you then run and complete all the tests you
|
||||
should report this too in the build tracker when
|
||||
these features become avalible.
|
||||
|
||||
2. Dealing with Bugs
|
||||
|
||||
2.1 As a QA Team member
|
||||
|
||||
If you find a bug in an RC that you think is a showstopper
|
||||
then, even if it is a known bug, you should report it in the
|
||||
QA Bug system. This marks the bug for discussion at least,
|
||||
and preferably fixing before the actual release. This system
|
||||
is separate from the main bugs system so that important bugs
|
||||
dont get lost in the midst if lots of feature/change request
|
||||
in the approach to a release. It is imperitive where
|
||||
appropraite that as a QA'er a test script, Configure options
|
||||
and PHP.ini files are provided to enable the developer to
|
||||
reproduce the bug, this is an important part of our job. If
|
||||
you have a serious bug then you should also create a test
|
||||
script to be added to the tests dir of the php source so
|
||||
that at the end of the process to enable us to make sure bug
|
||||
does not return. It is not difficult to create these test
|
||||
scripts and a readme on it can be found in
|
||||
php4/tests/README.
|
||||
|
||||
|
||||
2.2 As a Developer
|
||||
|
||||
What should happen is that when a bug is reported it
|
||||
is send to php-dev and php-qa as with other bugs. We should
|
||||
have far stricter assignment system in this bug cycle rather
|
||||
than just leaving them. Once again bugs should be able to be
|
||||
marked as To Be Fixed Before release or moved to other bug
|
||||
system. (This is currently the Release Masters responsibility)
|
||||
|
||||
Then before the actual release the qa bugs system can be
|
||||
checked and if there are outstanding To Be Fixed Before
|
||||
release bugs the Developers can see this easyly rather than
|
||||
show stoppers being dismissed and not worried about.
|
||||
|
||||
When a bug is fixed the QAer who reported the bug is emailed
|
||||
and asked to test again and see if the bug is fixed.
|
||||
|
||||
3 Releasing another RC
|
||||
|
||||
If it is felt necessary that a 2nd RC is needed then it
|
||||
should be packaged as before and announced to both lists
|
||||
again. The testing process then starts again, the RC2 is
|
||||
added to the build tracker and QA'ers are asked to build and
|
||||
retest the scripts as appropriate, espectially if you
|
||||
reported a bug, you should test thourghly for your
|
||||
bug and make sure it no longer occurs. This will normally
|
||||
add anouther 3 days to the cycle, giving QA'ers time to
|
||||
build test and report back, then for developers to
|
||||
fix any problems.
|
||||
|
||||
4 CVS during the release process
|
||||
|
||||
At the point where the first RC is create a branch is
|
||||
formed. This branch is not altered form that point onward
|
||||
other than major bug fixes. Minor non important bug
|
||||
fixes should not be applied to this branch but to the main
|
||||
tree instead. Any major bug fixes should be applied to both
|
||||
trees. The developer should test and check the RC tree then
|
||||
also test and check the MAIN tree. This is their
|
||||
responsibility to make sure (as far as possible) that the
|
||||
bug fix works on both trees.
|
||||
|
||||
4.1 Useful CVS Commands
|
||||
|
||||
To create a Branch <Should only be done by person tarballing
|
||||
the RC (The Release Master)>:
|
||||
|
||||
$ cvs tag -b php_4_0_<Version>RC<NUMBER>
|
||||
IE:
|
||||
$ cvs tag -b php_4_0_1RC1
|
||||
|
||||
This should be executed in the PHP directory of an up to
|
||||
date checkout. Remember to also tag the Zend and TSRM repositories.
|
||||
|
||||
You can retrieve a branch in one of two ways: by checking it
|
||||
out fresh from the repository, or by switching an existing
|
||||
working copy over to the branch, I would suggest you
|
||||
checkout a new copy.
|
||||
|
||||
To check out a new copy:
|
||||
$ cvs checkout -r php_4_0_<Version>RC<NUMBER> php4
|
||||
IE:
|
||||
$ cvs checkout -r php_4_0_1RC1 php4
|
||||
|
||||
|
||||
To switch a working copy (Not recomended due to possible
|
||||
commiting to wrong branch)
|
||||
$ cvs update -r php_4_0_<Version>RC<NUMBER> php4
|
||||
IE:
|
||||
$ cvs update -r php_4_0_1RC1 php4
|
||||
|
||||
This should be done in the PHP4 directory itself.
|
||||
|
||||
To revert back to normal branch you should use the
|
||||
following:
|
||||
$ cvs update -A
|
||||
|
||||
To Commit to the branch you follow exactly the same
|
||||
procedure as normal
|
||||
$ cvs commit file.c
|
||||
|
||||
MAKE SURE YOU DO NOT COMMIT TO THE WRONG BRANCH.
|
||||
|
||||
5 The Final Release
|
||||
|
||||
When it is time to make the final release the following
|
||||
proceedure should be followed. The person who is tarballing
|
||||
the final release should check the QA bugs system and make
|
||||
sure there are no showstoppers left unfixed. If there are
|
||||
then bug the person the bug is assigned to until they fix
|
||||
it. If there are no more qa bugs then they should tag the
|
||||
branch as php_4_0_<Version> and tarball as usual. An email
|
||||
should be sent to PHP-GEN, PHP_DEV and PHP-QA about the new
|
||||
release and it should be added to php.net. The windows
|
||||
binaries and servelets should be built as soon as possible
|
||||
and added too, as should the windows installer.
|
||||
|
||||
6 Summary
|
||||
|
||||
Here is a summary of what a release cycle might look like:
|
||||
|
||||
Thurs: RC is agreed on and packaged, an email is sent to
|
||||
PHP_QA and PHP-DEV, the CVS is Branched and the
|
||||
Release Cycle Begins.
|
||||
|
||||
Mon: After a weekends testing most show stoppers should
|
||||
have been found (Hopefully) and the developers get to
|
||||
work on fixing them.
|
||||
|
||||
Thurs: A second RC is released if needed with the new bug
|
||||
fixes in and the QAers test again.
|
||||
|
||||
Sun: A review is made of all outstanding bugs and any show
|
||||
stoppers should be fixed. if there are no show
|
||||
stoppers then the final release is packaged and
|
||||
released on the monday morning on php.net
|
||||
|
||||
Mon: Release is made.
|
||||
|
||||
|
||||
James
|
||||
--
|
||||
James Moore
|
||||
PHP QA Team
|
||||
jmoore@php.net
|
||||
|
||||
@@ -1,145 +0,0 @@
|
||||
Things to do or at least think about doing in the future. Name in
|
||||
parenthesis means that person has taken on this project.
|
||||
|
||||
Zend
|
||||
----
|
||||
* allow foreach ($array as $k => &$val) syntax. right now we cannot
|
||||
traverse an array without copying each element.
|
||||
* allow foreach ($array as $k => list($a, $b)) syntax for multi
|
||||
dimensional arrays.
|
||||
* look at replacing c-lib call tolower().
|
||||
* make hash API functions work with HASH_OF() to save time.
|
||||
* native large number support (probably with GNU GMP)
|
||||
* Const'ify APIs. Right now, many functions leave parameters untouched,
|
||||
but don't declare those as const. This makes interaction with other
|
||||
interfaces difficult which pass const parameters to us.
|
||||
* add try..catch/throw exception handling
|
||||
* Add configure test to determine if dlsym() requires underscore and set
|
||||
DLSYM_NEEDS_UNDERSCORE accordingly. Perl and zsh have it in configure,
|
||||
for example.
|
||||
|
||||
global
|
||||
------
|
||||
* when used in standalone (skell-script like) mode don't urldecode
|
||||
arguments passed to php. right now it's not possible to say
|
||||
/usr/local/bin/php somescript.php dog+cat.txt
|
||||
as "dog+cat.txt" will arrive in php as "dog cat.txt".
|
||||
* make everything on the language-level independent of your locale setings.
|
||||
* always build the standalone executable as well as the chosen SAPI
|
||||
target.
|
||||
* make sure all source files have the "right" copyright.
|
||||
* the following modules still use PHP3_TLS_*() macros (and thereby don't
|
||||
work in ZTS mode): ext/db/db.c, ext/gd/gd.c
|
||||
* make sure that all ZTS globals get destructed. Most ts_allocate_id()
|
||||
calls should have a dtor entry.
|
||||
* activate all extensions by default that don't rely on external
|
||||
dependices. (eg ftp)
|
||||
* --enable-all in configure. (--enable-shared=max ...)
|
||||
* make configure print out a summary when it's done (like XEmacs)
|
||||
* replace standard functions which work on static data with
|
||||
reentrancy-safe functions (DONE?).
|
||||
* on some platforms unimplemented function will just do nothing (e.g. symlink)
|
||||
they should print a warning or not even be defined!
|
||||
* implement javadoc based function docs template system.
|
||||
* use thread-safe resolver functions (either require BIND 8 or adns).
|
||||
* provide optional IPv6 support.
|
||||
* make SAPI conform to CGI/1.1. Currently, all SAPI modules
|
||||
define REMOTE_ADDR etc. themselves and reach only various level
|
||||
of compliance.
|
||||
* find a better way to implement script timeouts. SIGVTALRM is used
|
||||
by some POSIX threads implementations (i.e. OpenBSD) and is not
|
||||
available in ZTS mode.
|
||||
* add aliases to functions to conform to new naming conventions, e.g.
|
||||
str_to_upper().
|
||||
* see what functions might need to be changed to use HashPosition, so
|
||||
that the internal array pointer is not affected.
|
||||
|
||||
documentation
|
||||
-------------
|
||||
* add remarks in the documentation which functions are not implemented on win32.
|
||||
* add remarks in the documentation which functions are not binary-safe.
|
||||
* improve documentation for the sablotron extension
|
||||
* update curl documentation
|
||||
* write documentation for the bzip2 extension
|
||||
* write documentation for the zziplib extension
|
||||
|
||||
ext/curl
|
||||
--------
|
||||
* Use the cURL write handler to save data for use when returning data or outputting
|
||||
data.
|
||||
* Have a warning scheme for when people use unsupported features.
|
||||
|
||||
ext/dav
|
||||
--------
|
||||
* rewrite.
|
||||
|
||||
ext/oci8
|
||||
--------
|
||||
* all OCIFetch*() functions should return 0 for no more data and false on error.
|
||||
* have a flag that trims trailing spaces from CHAR fields on retrieval.
|
||||
* make allow_call_time_pass_reference=Off working.
|
||||
* for additional todo information, see oci8.c, in ext/oci8
|
||||
|
||||
ext/pcre
|
||||
--------
|
||||
* Allow user to set PCRE_NOTEMPTY, PCRE_ANCHORED at execution time, maybe
|
||||
* add option to preg_grep() to return entries that _don't_ match
|
||||
|
||||
ext/sablot
|
||||
----------
|
||||
* Re-write the error handling and reporting interface
|
||||
* Cleanup the underlying code a bit
|
||||
* Add proper support for the message handlers
|
||||
|
||||
ext/session
|
||||
-----------
|
||||
* maybe implement finer-grained session variables that could be
|
||||
locked individually.
|
||||
* write a network-transparent storage back-end with fallover
|
||||
facilities
|
||||
* provide a callback facility which is executed upon encountering
|
||||
an unknown classname during deserialization
|
||||
|
||||
ext/sockets
|
||||
-----------
|
||||
* Make the extension work on windows (Daniel Beulshausen)
|
||||
* Make the extension work with Solaris and the Sun GCC
|
||||
|
||||
ext/standard
|
||||
------------
|
||||
* add a version number to data serialized via serialize().
|
||||
* array_add(). (Andrei)
|
||||
* possibly modify parsing of GPC data to automatically create arrays if
|
||||
variable name is seen more than once.
|
||||
* implement regex-cache for url-functions.
|
||||
* stri_replace(). (Andrei)
|
||||
* move socket related functions to fsock.c.
|
||||
* NOT binary safe:
|
||||
strtok()
|
||||
basename()
|
||||
dirname()
|
||||
strrpos()
|
||||
strrchr()
|
||||
strip_tags()
|
||||
* rewrite win32 SMTP code to be useable for *ix to, maybe as a (default)
|
||||
module of its own (Hartmut)
|
||||
|
||||
ext/zziplib
|
||||
------------
|
||||
* more fully support the zziplib api
|
||||
|
||||
ext/wddx
|
||||
--------
|
||||
* See if we can support the remaining datatypes:
|
||||
dateTime
|
||||
binary
|
||||
recordset
|
||||
|
||||
http://www.wddx.org/WDDX_SDK_10a/7__References/WDDX_DTD.htm
|
||||
(Andrei)
|
||||
|
||||
* implement wddx_packet_as_javascript(). (Andrei)
|
||||
|
||||
other cool stuff
|
||||
----------------
|
||||
* PVM extension
|
||||
@@ -1,35 +0,0 @@
|
||||
* Change the odbc_fetch_into() function to require ALWAYS the first two
|
||||
parameters ($conn_id and $array), and make the third (row) be optional.
|
||||
|
||||
* Remove --with-openlink configure option (--with-iodbc replaces it).
|
||||
|
||||
* Always build CGI (--disable-cgi option to disable).
|
||||
|
||||
* Move most extensions and PEAR packages out of the PHP CVS tree,
|
||||
include them again during release packaging.
|
||||
|
||||
* Renaming functions, so that they all are conform to one standard form.
|
||||
|
||||
* Allow foreach($array as $key => &$value).
|
||||
|
||||
* Allow foreach($array as list($var1, $var2)).
|
||||
|
||||
* Clean up "$instance = &new object" syntax (default to the =& behaviour?).
|
||||
|
||||
* Allow to set a default value for call-by-reference-parameters. eg:
|
||||
function hallo (&$pallo = NULL) {}
|
||||
|
||||
* Change PHP error messages, so that they point to pages or sections in the
|
||||
PHP Manual.
|
||||
|
||||
* Fix Zend shallow copy issues with objects and arrays.
|
||||
|
||||
* Make all extensions thread-safe.
|
||||
|
||||
* Finish PHP streams abstraction, nuke all that issock stuff, implement SSL
|
||||
socket support. (wez)
|
||||
- ext/ftp/ -> all FILEs to streams
|
||||
- ext/bz2/ -> convert to stream impl.
|
||||
|
||||
* Using arg_separator.input to implode args in the CGI sapi extension
|
||||
and arg_separator.input to explode in php_build_argv().
|
||||
@@ -1,26 +0,0 @@
|
||||
Copyright (c) 1999, 2000, Andi Gutmans, Sascha Schumann, Zeev Suraski.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
- Neither name of the copyright holders nor the names of their contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,6 +0,0 @@
|
||||
## process this file with automake to produce Makefile.am
|
||||
AUTOMAKE_OPTIONS=foreign
|
||||
noinst_LTLIBRARIES=libtsrm.la
|
||||
libtsrm_la_SOURCES = TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c
|
||||
|
||||
depend:
|
||||
@@ -1,2 +0,0 @@
|
||||
- Improve the lock in ts_resource_ex() in order to cover less code.
|
||||
This can probably be done by more careful hash table access
|
||||
-588
@@ -1,588 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Thread Safe Resource Manager |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1999, 2000, Andi Gutmans, Sascha Schumann, Zeev Suraski|
|
||||
| This source file is subject to the TSRM license, that is bundled |
|
||||
| with this package in the file LICENSE |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "TSRM.h"
|
||||
|
||||
#ifdef ZTS
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
typedef struct _tsrm_tls_entry tsrm_tls_entry;
|
||||
|
||||
struct _tsrm_tls_entry {
|
||||
void **storage;
|
||||
int count;
|
||||
THREAD_T thread_id;
|
||||
tsrm_tls_entry *next;
|
||||
};
|
||||
|
||||
|
||||
typedef struct {
|
||||
size_t size;
|
||||
ts_allocate_ctor ctor;
|
||||
ts_allocate_dtor dtor;
|
||||
} tsrm_resource_type;
|
||||
|
||||
|
||||
/* The memory manager table */
|
||||
static tsrm_tls_entry **tsrm_tls_table=NULL;
|
||||
static int tsrm_tls_table_size;
|
||||
static ts_rsrc_id id_count;
|
||||
|
||||
/* The resource sizes table */
|
||||
static tsrm_resource_type *resource_types_table=NULL;
|
||||
static int resource_types_table_size;
|
||||
|
||||
|
||||
static MUTEX_T tsmm_mutex; /* thread-safe memory manager mutex */
|
||||
|
||||
/* New thread handlers */
|
||||
static tsrm_thread_begin_func_t tsrm_new_thread_begin_handler;
|
||||
static tsrm_thread_end_func_t tsrm_new_thread_end_handler;
|
||||
|
||||
/* Debug support */
|
||||
int tsrm_error(int level, const char *format, ...);
|
||||
|
||||
/* Read a resource from a thread's resource storage */
|
||||
static int tsrm_error_level;
|
||||
static FILE *tsrm_error_file;
|
||||
|
||||
#if TSRM_DEBUG
|
||||
#define TSRM_ERROR(args) tsrm_error args
|
||||
#define TSRM_SAFE_RETURN_RSRC(array, offset, range) \
|
||||
{ \
|
||||
int unshuffled_offset = TSRM_UNSHUFFLE_RSRC_ID(offset); \
|
||||
\
|
||||
if (offset==0) { \
|
||||
return &array; \
|
||||
} else if ((unshuffled_offset)>=0 && (unshuffled_offset)<(range)) { \
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Successfully fetched resource id %d for thread id %ld - 0x%0.8X", \
|
||||
unshuffled_offset, (long) thread_resources->thread_id, array[unshuffled_offset])); \
|
||||
return array[unshuffled_offset]; \
|
||||
} else { \
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Resource id %d is out of range (%d..%d)", \
|
||||
unshuffled_offset, TSRM_SHUFFLE_RSRC_ID(0), TSRM_SHUFFLE_RSRC_ID(thread_resources->count-1))); \
|
||||
return NULL; \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define TSRM_ERROR
|
||||
#define TSRM_SAFE_RETURN_RSRC(array, offset, range) \
|
||||
if (offset==0) { \
|
||||
return &array; \
|
||||
} else { \
|
||||
return array[TSRM_UNSHUFFLE_RSRC_ID(offset)]; \
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PTHREADS)
|
||||
/* Thread local storage */
|
||||
static pthread_key_t tls_key;
|
||||
#elif defined(TSRM_ST)
|
||||
static int tls_key;
|
||||
#elif defined(TSRM_WIN32)
|
||||
static DWORD tls_key;
|
||||
#endif
|
||||
|
||||
|
||||
/* Startup TSRM (call once for the entire process) */
|
||||
TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_level, char *debug_filename)
|
||||
{
|
||||
#if defined(GNUPTH)
|
||||
pth_init();
|
||||
#elif defined(PTHREADS)
|
||||
pthread_key_create( &tls_key, 0 );
|
||||
#elif defined(TSRM_ST)
|
||||
st_init();
|
||||
st_key_create(&tls_key, 0);
|
||||
#elif defined(TSRM_WIN32)
|
||||
tls_key = TlsAlloc();
|
||||
#endif
|
||||
|
||||
tsrm_error_file = stderr;
|
||||
tsrm_error_set(debug_level, debug_filename);
|
||||
tsrm_tls_table_size = expected_threads;
|
||||
|
||||
tsrm_tls_table = (tsrm_tls_entry **) calloc(tsrm_tls_table_size, sizeof(tsrm_tls_entry *));
|
||||
if (!tsrm_tls_table) {
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Unable to allocate TLS table"));
|
||||
return 0;
|
||||
}
|
||||
id_count=0;
|
||||
|
||||
resource_types_table_size = expected_resources;
|
||||
resource_types_table = (tsrm_resource_type *) calloc(resource_types_table_size, sizeof(tsrm_resource_type));
|
||||
if (!resource_types_table) {
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Unable to allocate resource types table"));
|
||||
free(tsrm_tls_table);
|
||||
tsrm_tls_table = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
tsmm_mutex = tsrm_mutex_alloc();
|
||||
|
||||
tsrm_new_thread_begin_handler = tsrm_new_thread_end_handler = NULL;
|
||||
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Started up TSRM, %d expected threads, %d expected resources", expected_threads, expected_resources));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Shutdown TSRM (call once for the entire process) */
|
||||
TSRM_API void tsrm_shutdown(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (tsrm_tls_table) {
|
||||
for (i=0; i<tsrm_tls_table_size; i++) {
|
||||
tsrm_tls_entry *p = tsrm_tls_table[i], *next_p;
|
||||
|
||||
while (p) {
|
||||
int j;
|
||||
|
||||
next_p = p->next;
|
||||
for (j=0; j<id_count; j++) {
|
||||
free(p->storage[j]);
|
||||
}
|
||||
free(p->storage);
|
||||
free(p);
|
||||
p = next_p;
|
||||
}
|
||||
}
|
||||
free(tsrm_tls_table);
|
||||
tsrm_tls_table = NULL;
|
||||
}
|
||||
if (resource_types_table) {
|
||||
free(resource_types_table);
|
||||
resource_types_table=NULL;
|
||||
}
|
||||
tsrm_mutex_free(tsmm_mutex);
|
||||
tsmm_mutex = NULL;
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Shutdown TSRM"));
|
||||
if (tsrm_error_file!=stderr) {
|
||||
fclose(tsrm_error_file);
|
||||
}
|
||||
#if defined(GNUPTH)
|
||||
pth_kill();
|
||||
#elif defined(PTHREADS)
|
||||
pthread_key_delete(tls_key);
|
||||
#elif defined(TSRM_WIN32)
|
||||
TlsFree(tls_key);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* allocates a new thread-safe-resource id */
|
||||
TSRM_API ts_rsrc_id ts_allocate_id(ts_rsrc_id *rsrc_id, size_t size, ts_allocate_ctor ctor, ts_allocate_dtor dtor)
|
||||
{
|
||||
int i;
|
||||
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Obtaining a new resource id, %d bytes", size));
|
||||
|
||||
tsrm_mutex_lock(tsmm_mutex);
|
||||
|
||||
/* obtain a resource id */
|
||||
*rsrc_id = TSRM_SHUFFLE_RSRC_ID(id_count++);
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Obtained resource id %d", *rsrc_id));
|
||||
|
||||
/* store the new resource type in the resource sizes table */
|
||||
if (resource_types_table_size < id_count) {
|
||||
resource_types_table = (tsrm_resource_type *) realloc(resource_types_table, sizeof(tsrm_resource_type)*id_count);
|
||||
if (!resource_types_table) {
|
||||
tsrm_mutex_unlock(tsmm_mutex);
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Unable to allocate storage for resource"));
|
||||
*rsrc_id = 0;
|
||||
return 0;
|
||||
}
|
||||
resource_types_table_size = id_count;
|
||||
}
|
||||
resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].size = size;
|
||||
resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].ctor = ctor;
|
||||
resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].dtor = dtor;
|
||||
|
||||
/* enlarge the arrays for the already active threads */
|
||||
for (i=0; i<tsrm_tls_table_size; i++) {
|
||||
tsrm_tls_entry *p = tsrm_tls_table[i];
|
||||
|
||||
while (p) {
|
||||
if (p->count < id_count) {
|
||||
int j;
|
||||
|
||||
p->storage = (void *) realloc(p->storage, sizeof(void *)*id_count);
|
||||
for (j=p->count; j<id_count; j++) {
|
||||
p->storage[j] = (void *) malloc(resource_types_table[j].size);
|
||||
if (resource_types_table[j].ctor) {
|
||||
resource_types_table[j].ctor(p->storage[j], &p->storage);
|
||||
}
|
||||
}
|
||||
p->count = id_count;
|
||||
}
|
||||
p = p->next;
|
||||
}
|
||||
}
|
||||
tsrm_mutex_unlock(tsmm_mutex);
|
||||
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Successfully allocated new resource id %d", *rsrc_id));
|
||||
return *rsrc_id;
|
||||
}
|
||||
|
||||
|
||||
static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_T thread_id)
|
||||
{
|
||||
int i;
|
||||
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Creating data structures for thread %x", thread_id));
|
||||
(*thread_resources_ptr) = (tsrm_tls_entry *) malloc(sizeof(tsrm_tls_entry));
|
||||
(*thread_resources_ptr)->storage = (void **) malloc(sizeof(void *)*id_count);
|
||||
(*thread_resources_ptr)->count = id_count;
|
||||
(*thread_resources_ptr)->thread_id = thread_id;
|
||||
(*thread_resources_ptr)->next = NULL;
|
||||
|
||||
#if defined(PTHREADS)
|
||||
/* Set thread local storage to this new thread resources structure */
|
||||
pthread_setspecific(tls_key, (void *) *thread_resources_ptr);
|
||||
#elif defined(TSRM_ST)
|
||||
st_thread_setspecific(tls_key, (void *) *thread_resources_ptr);
|
||||
#elif defined(TSRM_WIN32)
|
||||
TlsSetValue(tls_key, (void *) *thread_resources_ptr);
|
||||
#endif
|
||||
|
||||
if (tsrm_new_thread_begin_handler) {
|
||||
tsrm_new_thread_begin_handler(thread_id, &((*thread_resources_ptr)->storage));
|
||||
}
|
||||
for (i=0; i<id_count; i++) {
|
||||
(*thread_resources_ptr)->storage[i] = (void *) malloc(resource_types_table[i].size);
|
||||
if (resource_types_table[i].ctor) {
|
||||
resource_types_table[i].ctor((*thread_resources_ptr)->storage[i], &(*thread_resources_ptr)->storage);
|
||||
}
|
||||
}
|
||||
|
||||
tsrm_mutex_unlock(tsmm_mutex);
|
||||
|
||||
if (tsrm_new_thread_end_handler) {
|
||||
tsrm_new_thread_end_handler(thread_id, &((*thread_resources_ptr)->storage));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* fetches the requested resource for the current thread */
|
||||
TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id)
|
||||
{
|
||||
THREAD_T thread_id;
|
||||
int hash_value;
|
||||
tsrm_tls_entry *thread_resources;
|
||||
|
||||
if (!th_id) {
|
||||
#if defined(PTHREADS)
|
||||
/* Fast path for looking up the resources for the current
|
||||
* thread. Its used by just about every call to
|
||||
* ts_resource_ex(). This avoids the need for a mutex lock
|
||||
* and our hashtable lookup.
|
||||
*/
|
||||
thread_resources = pthread_getspecific(tls_key);
|
||||
#elif defined(TSRM_ST)
|
||||
thread_resources = st_thread_getspecific(tls_key);
|
||||
#elif defined(TSRM_WIN32)
|
||||
thread_resources = TlsGetValue(tls_key);
|
||||
#else
|
||||
thread_resources = NULL;
|
||||
#endif
|
||||
if (thread_resources) {
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Fetching resource id %d for current thread %d", id, (long) thread_resources->thread_id));
|
||||
/* Read a specific resource from the thread's resources.
|
||||
* This is called outside of a mutex, so have to be aware about external
|
||||
* changes to the structure as we read it.
|
||||
*/
|
||||
TSRM_SAFE_RETURN_RSRC(thread_resources->storage, id, thread_resources->count);
|
||||
}
|
||||
thread_id = tsrm_thread_id();
|
||||
} else {
|
||||
thread_id = *th_id;
|
||||
}
|
||||
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Fetching resource id %d for thread %ld", id, (long) thread_id));
|
||||
tsrm_mutex_lock(tsmm_mutex);
|
||||
|
||||
hash_value = THREAD_HASH_OF(thread_id, tsrm_tls_table_size);
|
||||
thread_resources = tsrm_tls_table[hash_value];
|
||||
|
||||
if (!thread_resources) {
|
||||
allocate_new_resource(&tsrm_tls_table[hash_value], thread_id);
|
||||
return ts_resource_ex(id, &thread_id);
|
||||
} else {
|
||||
do {
|
||||
if (thread_resources->thread_id == thread_id) {
|
||||
break;
|
||||
}
|
||||
if (thread_resources->next) {
|
||||
thread_resources = thread_resources->next;
|
||||
} else {
|
||||
allocate_new_resource(&thread_resources->next, thread_id);
|
||||
return ts_resource_ex(id, &thread_id);
|
||||
/*
|
||||
* thread_resources = thread_resources->next;
|
||||
* break;
|
||||
*/
|
||||
}
|
||||
} while (thread_resources);
|
||||
}
|
||||
tsrm_mutex_unlock(tsmm_mutex);
|
||||
/* Read a specific resource from the thread's resources.
|
||||
* This is called outside of a mutex, so have to be aware about external
|
||||
* changes to the structure as we read it.
|
||||
*/
|
||||
TSRM_SAFE_RETURN_RSRC(thread_resources->storage, id, thread_resources->count);
|
||||
}
|
||||
|
||||
|
||||
/* frees all resources allocated for the current thread */
|
||||
void ts_free_thread(void)
|
||||
{
|
||||
tsrm_tls_entry *thread_resources;
|
||||
int i;
|
||||
THREAD_T thread_id = tsrm_thread_id();
|
||||
int hash_value;
|
||||
tsrm_tls_entry *last=NULL;
|
||||
|
||||
tsrm_mutex_lock(tsmm_mutex);
|
||||
hash_value = THREAD_HASH_OF(thread_id, tsrm_tls_table_size);
|
||||
thread_resources = tsrm_tls_table[hash_value];
|
||||
|
||||
while (thread_resources) {
|
||||
if (thread_resources->thread_id == thread_id) {
|
||||
for (i=0; i<thread_resources->count; i++) {
|
||||
if (resource_types_table[i].dtor) {
|
||||
resource_types_table[i].dtor(thread_resources->storage[i], &thread_resources->storage);
|
||||
}
|
||||
}
|
||||
for (i=0; i<thread_resources->count; i++) {
|
||||
free(thread_resources->storage[i]);
|
||||
}
|
||||
free(thread_resources->storage);
|
||||
if (last) {
|
||||
last->next = thread_resources->next;
|
||||
} else {
|
||||
tsrm_tls_table[hash_value] = thread_resources->next;
|
||||
}
|
||||
#if defined(PTHREADS)
|
||||
pthread_setspecific(tls_key, 0);
|
||||
#elif defined(TSRM_WIN32)
|
||||
TlsSetValue(tls_key, 0);
|
||||
#endif
|
||||
free(thread_resources);
|
||||
break;
|
||||
}
|
||||
if (thread_resources->next) {
|
||||
last = thread_resources;
|
||||
}
|
||||
thread_resources = thread_resources->next;
|
||||
}
|
||||
tsrm_mutex_unlock(tsmm_mutex);
|
||||
}
|
||||
|
||||
|
||||
/* deallocates all occurrences of a given id */
|
||||
void ts_free_id(ts_rsrc_id id)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Utility Functions
|
||||
*/
|
||||
|
||||
/* Obtain the current thread id */
|
||||
TSRM_API THREAD_T tsrm_thread_id(void)
|
||||
{
|
||||
#ifdef TSRM_WIN32
|
||||
return GetCurrentThreadId();
|
||||
#elif defined(GNUPTH)
|
||||
return pth_self();
|
||||
#elif defined(PTHREADS)
|
||||
return pthread_self();
|
||||
#elif defined(NSAPI)
|
||||
return systhread_current();
|
||||
#elif defined(PI3WEB)
|
||||
return PIThread_getCurrent();
|
||||
#elif defined(TSRM_ST)
|
||||
return st_thread_self();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Allocate a mutex */
|
||||
TSRM_API MUTEX_T tsrm_mutex_alloc(void)
|
||||
{
|
||||
MUTEX_T mutexp;
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
mutexp = malloc(sizeof(CRITICAL_SECTION));
|
||||
InitializeCriticalSection(mutexp);
|
||||
#elif defined(GNUPTH)
|
||||
mutexp = (MUTEX_T) malloc(sizeof(*mutexp));
|
||||
pth_mutex_init(mutexp);
|
||||
#elif defined(PTHREADS)
|
||||
mutexp = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t));
|
||||
pthread_mutex_init(mutexp,NULL);
|
||||
#elif defined(NSAPI)
|
||||
mutexp = crit_init();
|
||||
#elif defined(PI3WEB)
|
||||
mutexp = PIPlatform_allocLocalMutex();
|
||||
#elif defined(TSRM_ST)
|
||||
mutexp = st_mutex_new();
|
||||
#endif
|
||||
#ifdef THR_DEBUG
|
||||
printf("Mutex created thread: %d\n",mythreadid());
|
||||
#endif
|
||||
return( mutexp );
|
||||
}
|
||||
|
||||
|
||||
/* Free a mutex */
|
||||
TSRM_API void tsrm_mutex_free(MUTEX_T mutexp)
|
||||
{
|
||||
if (mutexp) {
|
||||
#ifdef TSRM_WIN32
|
||||
DeleteCriticalSection(mutexp);
|
||||
#elif defined(GNUPTH)
|
||||
free(mutexp);
|
||||
#elif defined(PTHREADS)
|
||||
pthread_mutex_destroy(mutexp);
|
||||
free(mutexp);
|
||||
#elif defined(NSAPI)
|
||||
crit_terminate(mutexp);
|
||||
#elif defined(PI3WEB)
|
||||
PISync_delete(mutexp);
|
||||
#elif defined(TSRM_ST)
|
||||
st_mutex_destroy(mutexp);
|
||||
#endif
|
||||
}
|
||||
#ifdef THR_DEBUG
|
||||
printf("Mutex freed thread: %d\n",mythreadid());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Lock a mutex */
|
||||
TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp)
|
||||
{
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Mutex locked thread: %ld", tsrm_thread_id()));
|
||||
#ifdef TSRM_WIN32
|
||||
EnterCriticalSection(mutexp);
|
||||
return 1;
|
||||
#elif defined(GNUPTH)
|
||||
return pth_mutex_acquire(mutexp, 0, NULL);
|
||||
#elif defined(PTHREADS)
|
||||
return pthread_mutex_lock(mutexp);
|
||||
#elif defined(NSAPI)
|
||||
return crit_enter(mutexp);
|
||||
#elif defined(PI3WEB)
|
||||
return PISync_lock(mutexp);
|
||||
#elif defined(TSRM_ST)
|
||||
return st_mutex_lock(mutexp);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Unlock a mutex */
|
||||
TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp)
|
||||
{
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Mutex unlocked thread: %ld", tsrm_thread_id()));
|
||||
#ifdef TSRM_WIN32
|
||||
LeaveCriticalSection(mutexp);
|
||||
return 1;
|
||||
#elif defined(GNUPTH)
|
||||
return pth_mutex_release(mutexp);
|
||||
#elif defined(PTHREADS)
|
||||
return pthread_mutex_unlock(mutexp);
|
||||
#elif defined(NSAPI)
|
||||
return crit_exit(mutexp);
|
||||
#elif defined(PI3WEB)
|
||||
return PISync_unlock(mutexp);
|
||||
#elif defined(TSRM_ST)
|
||||
return st_mutex_unlock(mutexp);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
TSRM_API void *tsrm_set_new_thread_begin_handler(tsrm_thread_begin_func_t new_thread_begin_handler)
|
||||
{
|
||||
void *retval = (void *) tsrm_new_thread_begin_handler;
|
||||
|
||||
tsrm_new_thread_begin_handler = new_thread_begin_handler;
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
TSRM_API void *tsrm_set_new_thread_end_handler(tsrm_thread_end_func_t new_thread_end_handler)
|
||||
{
|
||||
void *retval = (void *) tsrm_new_thread_end_handler;
|
||||
|
||||
tsrm_new_thread_end_handler = new_thread_end_handler;
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Debug support
|
||||
*/
|
||||
|
||||
#if TSRM_DEBUG
|
||||
int tsrm_error(int level, const char *format, ...)
|
||||
{
|
||||
if (level<=tsrm_error_level) {
|
||||
va_list args;
|
||||
int size;
|
||||
|
||||
fprintf(tsrm_error_file, "TSRM: ");
|
||||
va_start(args, format);
|
||||
size = vfprintf(tsrm_error_file, format, args);
|
||||
va_end(args);
|
||||
fprintf(tsrm_error_file, "\n");
|
||||
fflush(tsrm_error_file);
|
||||
return size;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void tsrm_error_set(int level, char *debug_filename)
|
||||
{
|
||||
tsrm_error_level = level;
|
||||
|
||||
#if TSRM_DEBUG
|
||||
if (tsrm_error_file!=stderr) { /* close files opened earlier */
|
||||
fclose(tsrm_error_file);
|
||||
}
|
||||
|
||||
if (debug_filename) {
|
||||
tsrm_error_file = fopen(debug_filename, "w");
|
||||
if (!tsrm_error_file) {
|
||||
tsrm_error_file = stderr;
|
||||
}
|
||||
} else {
|
||||
tsrm_error_file = stderr;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* ZTS */
|
||||
-186
@@ -1,186 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="TSRM" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=TSRM - Win32 Debug_TS
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "TSRM.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "TSRM.mak" CFG="TSRM - Win32 Debug_TS"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "TSRM - Win32 Debug_TS" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "TSRM - Win32 Release_TS" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "TSRM - Win32 Release_TS_inline" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "TSRM - Win32 Release_TSDbg" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "TSRM - Win32 Debug_TS"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "TSRM___Win32_Debug_TS"
|
||||
# PROP BASE Intermediate_Dir "TSRM___Win32_Debug_TS"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug_TS"
|
||||
# PROP Intermediate_Dir "Debug_TS"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "C:\Projects\TSRM" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=1 /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x40d /d "_DEBUG"
|
||||
# ADD RSC /l 0x40d /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TS"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "TSRM___Win32_Release_TS"
|
||||
# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TS"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release_TS"
|
||||
# PROP Intermediate_Dir "Release_TS"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
|
||||
# ADD BASE RSC /l 0x40d /d "NDEBUG"
|
||||
# ADD RSC /l 0x40d /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TS_inline"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "TSRM___Win32_Release_TS_inline"
|
||||
# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TS_inline"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release_TS_inline"
|
||||
# PROP Intermediate_Dir "Release_TS_inline"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "TSRM_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
|
||||
# ADD BASE RSC /l 0x40d /d "NDEBUG"
|
||||
# ADD RSC /l 0x40d /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TSDbg"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "TSRM___Win32_Release_TSDbg"
|
||||
# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TSDbg"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release_TSDbg"
|
||||
# PROP Intermediate_Dir "Release_TSDbg"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
|
||||
# ADD BASE RSC /l 0x40d /d "NDEBUG"
|
||||
# ADD RSC /l 0x40d /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "TSRM - Win32 Debug_TS"
|
||||
# Name "TSRM - Win32 Release_TS"
|
||||
# Name "TSRM - Win32 Release_TS_inline"
|
||||
# Name "TSRM - Win32 Release_TSDbg"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\TSRM.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_strtok_r.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_virtual_cwd.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_win32.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\readdir.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\TSRM.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_config.w32.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_config_common.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_strtok_r.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_virtual_cwd.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_win32.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
-143
@@ -1,143 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Thread Safe Resource Manager |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1999, 2000, Andi Gutmans, Sascha Schumann, Zeev Suraski|
|
||||
| This source file is subject to the TSRM license, that is bundled |
|
||||
| with this package in the file LICENSE |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef TSRM_H
|
||||
#define TSRM_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "tsrm_config.h"
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
# define TSRM_WIN32
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
# ifdef TSRM_EXPORTS
|
||||
# define TSRM_API __declspec(dllexport)
|
||||
# else
|
||||
# define TSRM_API __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
# define TSRM_API
|
||||
#endif
|
||||
|
||||
/* Only compile multi-threading functions if we're in ZTS mode */
|
||||
#ifdef ZTS
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
# include <windows.h>
|
||||
#elif defined(GNUPTH)
|
||||
# include <pth.h>
|
||||
#elif defined(PTHREADS)
|
||||
# include <pthread.h>
|
||||
#elif defined(TSRM_ST)
|
||||
# include <st.h>
|
||||
#endif
|
||||
|
||||
typedef int ts_rsrc_id;
|
||||
|
||||
/* Define THREAD_T and MUTEX_T */
|
||||
#ifdef TSRM_WIN32
|
||||
# define THREAD_T DWORD
|
||||
# define MUTEX_T CRITICAL_SECTION *
|
||||
#elif defined(GNUPTH)
|
||||
# define THREAD_T pth_t
|
||||
# define MUTEX_T pth_mutex_t *
|
||||
#elif defined(PTHREADS)
|
||||
# define THREAD_T pthread_t
|
||||
# define MUTEX_T pthread_mutex_t *
|
||||
#elif defined(NSAPI)
|
||||
# define THREAD_T SYS_THREAD
|
||||
# define MUTEX_T CRITICAL
|
||||
#elif defined(PI3WEB)
|
||||
# define THREAD_T PIThread *
|
||||
# define MUTEX_T PISync *
|
||||
#elif defined(TSRM_ST)
|
||||
# define THREAD_T st_thread_t
|
||||
# define MUTEX_T st_mutex_t
|
||||
#endif
|
||||
|
||||
typedef void (*ts_allocate_ctor)(void *, void ***);
|
||||
typedef void (*ts_allocate_dtor)(void *, void ***);
|
||||
|
||||
#define THREAD_HASH_OF(thr,ts) (unsigned long)thr%(unsigned long)ts
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* startup/shutdown */
|
||||
TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_level, char *debug_filename);
|
||||
TSRM_API void tsrm_shutdown(void);
|
||||
|
||||
/* allocates a new thread-safe-resource id */
|
||||
TSRM_API ts_rsrc_id ts_allocate_id(ts_rsrc_id *rsrc_id, size_t size, ts_allocate_ctor ctor, ts_allocate_dtor dtor);
|
||||
|
||||
/* fetches the requested resource for the current thread */
|
||||
TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id);
|
||||
#define ts_resource(id) ts_resource_ex(id, NULL)
|
||||
|
||||
/* frees all resources allocated for the current thread */
|
||||
TSRM_API void ts_free_thread(void);
|
||||
|
||||
/* deallocates all occurrences of a given id */
|
||||
TSRM_API void ts_free_id(ts_rsrc_id id);
|
||||
|
||||
|
||||
/* Debug support */
|
||||
#define TSRM_ERROR_LEVEL_ERROR 1
|
||||
#define TSRM_ERROR_LEVEL_CORE 2
|
||||
#define TSRM_ERROR_LEVEL_INFO 3
|
||||
|
||||
typedef void (*tsrm_thread_begin_func_t)(THREAD_T thread_id, void ***tsrm_ls);
|
||||
typedef void (*tsrm_thread_end_func_t)(THREAD_T thread_id, void ***tsrm_ls);
|
||||
|
||||
|
||||
TSRM_API int tsrm_error(int level, const char *format, ...);
|
||||
TSRM_API void tsrm_error_set(int level, char *debug_filename);
|
||||
|
||||
/* utility functions */
|
||||
TSRM_API THREAD_T tsrm_thread_id(void);
|
||||
TSRM_API MUTEX_T tsrm_mutex_alloc(void);
|
||||
TSRM_API void tsrm_mutex_free(MUTEX_T mutexp);
|
||||
TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp);
|
||||
TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp);
|
||||
|
||||
TSRM_API void *tsrm_set_new_thread_begin_handler(tsrm_thread_begin_func_t new_thread_begin_handler);
|
||||
TSRM_API void *tsrm_set_new_thread_end_handler(tsrm_thread_end_func_t new_thread_end_handler);
|
||||
|
||||
#define TSRM_SHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)+1)
|
||||
#define TSRM_UNSHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)-1)
|
||||
|
||||
#define TSRMLS_FETCH() void ***tsrm_ls = (void ***) ts_resource_ex(0, NULL)
|
||||
#define TSRMG(id, type, element) (((type) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)
|
||||
#define TSRMLS_D void ***tsrm_ls
|
||||
#define TSRMLS_DC , TSRMLS_D
|
||||
#define TSRMLS_C tsrm_ls
|
||||
#define TSRMLS_CC , TSRMLS_C
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#else /* non ZTS */
|
||||
|
||||
#define TSRMLS_FETCH()
|
||||
#define TSRMLS_D void
|
||||
#define TSRMLS_DC
|
||||
#define TSRMLS_C
|
||||
#define TSRMLS_CC
|
||||
|
||||
#endif /* ZTS */
|
||||
|
||||
#endif /* TSRM_H */
|
||||
@@ -1 +0,0 @@
|
||||
#undef PTHREADS
|
||||
@@ -1,5 +0,0 @@
|
||||
|
||||
AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[
|
||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
|
||||
])
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
# Makefile to generate build tools
|
||||
#
|
||||
# Standard usage:
|
||||
# make -f build.mk
|
||||
#
|
||||
# Written by Sascha Schumann
|
||||
#
|
||||
# $Id$
|
||||
|
||||
|
||||
LT_TARGETS = ltmain.sh ltconfig
|
||||
|
||||
config_h_in = tsrm_config.h.in
|
||||
|
||||
makefile_am_files = Makefile.am
|
||||
makefile_in_files = $(makefile_am_files:.am=.in)
|
||||
makefile_files = $(makefile_am_files:e.am=e)
|
||||
|
||||
targets = $(makefile_in_files) $(LT_TARGETS) configure $(config_h_in)
|
||||
|
||||
all: $(targets)
|
||||
|
||||
clean:
|
||||
rm -f $(targets)
|
||||
|
||||
$(LT_TARGETS):
|
||||
rm -f $(LT_TARGETS)
|
||||
libtoolize --automake $(AMFLAGS) -f
|
||||
|
||||
$(makefile_in_files): $(makefile_am_files)
|
||||
automake -a -i $(AMFLAGS) $(makefile_files)
|
||||
|
||||
aclocal.m4: configure.in acinclude.m4
|
||||
aclocal
|
||||
|
||||
$(config_h_in): configure.in acconfig.h
|
||||
# explicitly remove target since autoheader does not seem to work
|
||||
# correctly otherwise (timestamps are not updated)
|
||||
@rm -f $@
|
||||
autoheader
|
||||
|
||||
configure: aclocal.m4 configure.in
|
||||
autoconf
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
case "$1" in
|
||||
--copy)
|
||||
automake_flags=--copy
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
|
||||
libtoolize --force --automake $automake_flags
|
||||
|
||||
mv aclocal.m4 aclocal.m4.old 2>/dev/null
|
||||
aclocal
|
||||
if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then
|
||||
echo "buildconf: keeping ${1}aclocal.m4"
|
||||
mv aclocal.m4.old aclocal.m4
|
||||
else
|
||||
echo "buildconf: created or modified ${1}aclocal.m4"
|
||||
fi
|
||||
|
||||
autoheader
|
||||
|
||||
automake --add-missing --include-deps $automake_flags
|
||||
|
||||
mv configure configure.old 2>/dev/null
|
||||
autoconf
|
||||
if cmp configure.old configure > /dev/null 2>&1; then
|
||||
echo "buildconf: keeping ${1}configure"
|
||||
mv configure.old configure
|
||||
else
|
||||
echo "buildconf: created or modified ${1}configure"
|
||||
fi
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
dnl $Id$
|
||||
dnl
|
||||
dnl Minimalistic configure.in for TSRM.
|
||||
dnl
|
||||
|
||||
AC_INIT(TSRM.c)
|
||||
AM_INIT_AUTOMAKE(TSRM, 1.0, nodefine)
|
||||
AM_CONFIG_HEADER(tsrm_config.h)
|
||||
|
||||
sinclude(tsrm.m4)
|
||||
|
||||
TSRM_BASIC_CHECKS
|
||||
TSRM_THREADS_CHECKS
|
||||
|
||||
AM_PROG_LIBTOOL
|
||||
if test "$enable_debug" != "yes"; then
|
||||
AM_SET_LIBTOOL_VARIABLE([--silent])
|
||||
fi
|
||||
|
||||
dnl TSRM_PTHREAD
|
||||
|
||||
AC_CHECK_HEADERS(
|
||||
utime.h \
|
||||
dirent.h \
|
||||
stdarg.h \
|
||||
alloca.h \
|
||||
unistd.h \
|
||||
limits.h
|
||||
)
|
||||
|
||||
AC_OUTPUT(Makefile)
|
||||
@@ -1,44 +0,0 @@
|
||||
#ifndef READDIR_H
|
||||
#define READDIR_H
|
||||
|
||||
|
||||
/*
|
||||
* Structures and types used to implement opendir/readdir/closedir
|
||||
* on Windows 95/NT.
|
||||
*/
|
||||
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
/* struct dirent - same as Unix */
|
||||
|
||||
struct dirent {
|
||||
long d_ino; /* inode (always 1 in WIN32) */
|
||||
off_t d_off; /* offset to this dirent */
|
||||
unsigned short d_reclen; /* length of d_name */
|
||||
char d_name[_MAX_FNAME + 1]; /* filename (null terminated) */
|
||||
};
|
||||
|
||||
|
||||
/* typedef DIR - not the same as Unix */
|
||||
typedef struct {
|
||||
long handle; /* _findfirst/_findnext handle */
|
||||
short offset; /* offset into directory */
|
||||
short finished; /* 1 if there are not more files */
|
||||
struct _finddata_t fileinfo; /* from _findfirst/_findnext */
|
||||
char *dir; /* the dir we are reading */
|
||||
struct dirent dent; /* the dirent to return */
|
||||
} DIR;
|
||||
|
||||
/* Function prototypes */
|
||||
DIR *opendir(const char *);
|
||||
struct dirent *readdir(DIR *);
|
||||
int readdir_r(DIR *, struct dirent *, struct dirent **);
|
||||
int closedir(DIR *);
|
||||
void rewinddir(DIR *);
|
||||
|
||||
|
||||
#endif /* READDIR_H */
|
||||
-160
@@ -1,160 +0,0 @@
|
||||
dnl Copyright (c) 1999, 2000 Sascha Schumann. All rights reserved.
|
||||
dnl
|
||||
dnl Redistribution and use in source and binary forms, with or without
|
||||
dnl modification, are permitted provided that the following conditions
|
||||
dnl are met:
|
||||
dnl
|
||||
dnl 1. Redistributions of source code must retain the above copyright
|
||||
dnl notice, this list of conditions and the following disclaimer.
|
||||
dnl
|
||||
dnl 2. Redistributions in binary form must reproduce the above copyright
|
||||
dnl notice, this list of conditions and the following disclaimer in
|
||||
dnl the documentation and/or other materials provided with the
|
||||
dnl distribution.
|
||||
dnl
|
||||
dnl THIS SOFTWARE IS PROVIDED BY SASCHA SCHUMANN ``AS IS'' AND ANY
|
||||
dnl EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
dnl PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SASCHA SCHUMANN OR
|
||||
dnl HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
dnl SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
dnl NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
dnl LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
dnl HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
dnl STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
dnl ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
dnl OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
dnl
|
||||
dnl PTHREADS_FLAGS
|
||||
dnl
|
||||
dnl Set some magic defines to achieve POSIX threads conformance
|
||||
dnl
|
||||
AC_DEFUN(PTHREADS_FLAGS,[
|
||||
if test -z "$host_alias" && test -n "$host"; then
|
||||
host_alias=$host
|
||||
fi
|
||||
if test -z "$host_alias"; then
|
||||
AC_MSG_ERROR(host_alias is not set. Make sure to run config.guess)
|
||||
fi
|
||||
case $host_alias in
|
||||
*solaris*)
|
||||
PTHREAD_FLAGS="-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT";;
|
||||
*freebsd*)
|
||||
PTHREAD_FLAGS="-D_REENTRANT -D_THREAD_SAFE";;
|
||||
*linux*)
|
||||
PTHREAD_FLAGS=-D_REENTRANT;;
|
||||
*aix*)
|
||||
PTHREAD_FLAGS=-D_THREAD_SAFE;;
|
||||
*irix*)
|
||||
PTHREAD_FLAGS=-D_POSIX_THREAD_SAFE_FUNCTIONS;;
|
||||
*hpux*)
|
||||
PTHREAD_FLAGS=-D_REENTRANT;;
|
||||
*sco*)
|
||||
PTHREAD_FLAGS=-D_REENTRANT;;
|
||||
dnl Solves sigwait() problem, creates problems with u_long etc.
|
||||
dnl PTHREAD_FLAGS="-D_REENTRANT -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=199506 -D_XOPEN_SOURCE_EXTENDED=1";;
|
||||
esac
|
||||
|
||||
if test -n "$PTHREAD_FLAGS"; then
|
||||
CPPFLAGS="$CPPFLAGS $PTHREAD_FLAGS"
|
||||
fi
|
||||
])dnl
|
||||
dnl
|
||||
dnl PTHREADS_CHECK_COMPILE
|
||||
dnl
|
||||
dnl Check whether the current setup can use POSIX threads calls
|
||||
dnl
|
||||
AC_DEFUN(PTHREADS_CHECK_COMPILE, [
|
||||
AC_TRY_RUN( [
|
||||
#include <pthread.h>
|
||||
#include <stddef.h>
|
||||
|
||||
void *thread_routine(void *data) {
|
||||
return data;
|
||||
}
|
||||
|
||||
int main() {
|
||||
pthread_t thd;
|
||||
pthread_mutexattr_t mattr;
|
||||
int data = 1;
|
||||
pthread_mutexattr_init(&mattr);
|
||||
return pthread_create(&thd, NULL, thread_routine, &data);
|
||||
} ], [
|
||||
pthreads_working=yes
|
||||
], [
|
||||
pthreads_working=no
|
||||
], pthreads_working=no ) ] )dnl
|
||||
dnl
|
||||
dnl PTHREADS_CHECK()
|
||||
dnl
|
||||
dnl Try to find a way to enable POSIX threads
|
||||
dnl
|
||||
dnl Magic flags
|
||||
dnl -kthread gcc (FreeBSD)
|
||||
dnl -Kthread UDK cc (UnixWare)
|
||||
dnl -mt WorkShop cc (Solaris)
|
||||
dnl -mthreads gcc (AIX)
|
||||
dnl -pthread gcc (Linux, FreeBSD, NetBSD, OpenBSD)
|
||||
dnl -pthreads gcc (Solaris)
|
||||
dnl -qthreaded AIX cc V5
|
||||
dnl -threads gcc (HP-UX)
|
||||
dnl
|
||||
AC_DEFUN(PTHREADS_CHECK,[
|
||||
|
||||
save_CFLAGS=$CFLAGS
|
||||
save_LIBS=$LIBS
|
||||
PTHREADS_ASSIGN_VARS
|
||||
PTHREADS_CHECK_COMPILE
|
||||
LIBS=$save_LIBS
|
||||
CFLAGS=$save_CFLAGS
|
||||
|
||||
AC_CACHE_CHECK(for pthreads_cflags,ac_cv_pthreads_cflags,[
|
||||
ac_cv_pthreads_cflags=
|
||||
if test "$pthreads_working" != "yes"; then
|
||||
for flag in -kthread -pthread -pthreads -mthreads -Kthread -threads -mt -qthreaded; do
|
||||
ac_save=$CFLAGS
|
||||
CFLAGS="$CFLAGS $flag"
|
||||
PTHREADS_CHECK_COMPILE
|
||||
CFLAGS=$ac_save
|
||||
if test "$pthreads_working" = "yes"; then
|
||||
ac_cv_pthreads_cflags=$flag
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK(for pthreads_lib, ac_cv_pthreads_lib,[
|
||||
ac_cv_pthreads_lib=
|
||||
if test "$pthreads_working" != "yes"; then
|
||||
for lib in pthread pthreads c_r; do
|
||||
ac_save=$LIBS
|
||||
LIBS="$LIBS -l$lib"
|
||||
PTHREADS_CHECK_COMPILE
|
||||
LIBS=$ac_save
|
||||
if test "$pthreads_working" = "yes"; then
|
||||
ac_cv_pthreads_lib=$lib
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
])
|
||||
|
||||
if test "$pthreads_working" = "yes"; then
|
||||
threads_result="POSIX-Threads found"
|
||||
else
|
||||
threads_result="POSIX-Threads not found"
|
||||
fi
|
||||
])dnl
|
||||
dnl
|
||||
dnl
|
||||
AC_DEFUN(PTHREADS_ASSIGN_VARS,[
|
||||
if test -n "$ac_cv_pthreads_lib"; then
|
||||
LIBS="$LIBS -l$ac_cv_pthreads_lib"
|
||||
fi
|
||||
|
||||
if test -n "$ac_cv_pthreads_cflags"; then
|
||||
CFLAGS="$CFLAGS $ac_cv_pthreads_cflags"
|
||||
fi
|
||||
])dnl
|
||||
-124
@@ -1,124 +0,0 @@
|
||||
|
||||
dnl TSRM_CHECK_GCC_ARG(ARG, ACTION-IF-FOUND, ACTION-IF-NOT_FOUND)
|
||||
AC_DEFUN(TSRM_CHECK_GCC_ARG,[
|
||||
gcc_arg_name=[ac_cv_gcc_arg]translit($1,A-Z-,a-z_)
|
||||
AC_CACHE_CHECK([whether $CC supports $1], [ac_cv_gcc_arg]translit($1,A-Z-,a-z_), [
|
||||
echo 'void somefunc() { };' > conftest.c
|
||||
cmd='$CC $1 -c conftest.c'
|
||||
if eval $cmd 2>&1 | egrep -e $1 >/dev/null ; then
|
||||
ac_result=no
|
||||
else
|
||||
ac_result=yes
|
||||
fi
|
||||
eval $gcc_arg_name=$ac_result
|
||||
rm -f conftest.*
|
||||
])
|
||||
if eval test "\$$gcc_arg_name" = "yes"; then
|
||||
$2
|
||||
else
|
||||
:
|
||||
$3
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN(TSRM_BASIC_CHECKS,[
|
||||
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
dnl AC_REQUIRE([AM_PROG_CC_STDC])dnl
|
||||
AC_REQUIRE([AC_PROG_CC_C_O])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
|
||||
AC_CHECK_HEADERS(stdarg.h)
|
||||
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN(TSRM_CHECK_PTH,[
|
||||
|
||||
AC_MSG_CHECKING(for GNU Pth)
|
||||
PTH_PREFIX="`$1 --prefix`"
|
||||
if test -z "$PTH_PREFIX"; then
|
||||
AC_MSG_RESULT(Please check your Pth installation)
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS `$1 --cflags`"
|
||||
LDFLAGS="$LDFLAGS `$1 --ldflags`"
|
||||
LIBS="$LIBS `$1 --libs`"
|
||||
|
||||
AC_DEFINE(GNUPTH, 1, [Whether you use GNU Pth])
|
||||
AC_MSG_RESULT(yes - installed in $PTH_PREFIX)
|
||||
|
||||
])
|
||||
|
||||
AC_DEFUN(TSRM_CHECK_ST,[
|
||||
if test -r "$1/include/st.h"; then
|
||||
CPPFLAGS="$CPPFLAGS -I$1/include"
|
||||
LDFLAGS="$LDFLAGS -L$1/lib"
|
||||
elif test -r "$1/st.h"; then
|
||||
CPPFLAGS="$CPPFLAGS -I$1"
|
||||
LDFLAGS="$LDFLAGS -L$1"
|
||||
fi
|
||||
AC_CHECK_HEADERS(st.h,[],[
|
||||
AC_MSG_ERROR([Sorry[,] I was unable to locate the State Threads header file. Please specify the prefix using --with-tsrm-st=/prefix])
|
||||
])
|
||||
LIBS="$LIBS -lst"
|
||||
AC_MSG_CHECKING(for SGI's State Threads)
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(TSRM_ST, 1, [ ])
|
||||
])
|
||||
|
||||
sinclude(threads.m4)
|
||||
sinclude(TSRM/threads.m4)
|
||||
|
||||
AC_DEFUN(TSRM_CHECK_PTHREADS,[
|
||||
|
||||
PTHREADS_CHECK
|
||||
|
||||
if test "$pthreads_working" != "yes"; then
|
||||
AC_MSG_ERROR(Your system seems to lack POSIX threads.)
|
||||
fi
|
||||
|
||||
AC_DEFINE(PTHREADS, 1, Whether to use Pthreads)
|
||||
|
||||
AC_MSG_CHECKING(for POSIX threads)
|
||||
AC_MSG_RESULT(yes)
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN(TSRM_THREADS_CHECKS,[
|
||||
|
||||
dnl For the thread implementations, we always use --with-*
|
||||
dnl to maintain consistency
|
||||
|
||||
AC_ARG_WITH(tsrm-pth,
|
||||
[ --with-tsrm-pth[=pth-config] Use GNU Pth.],[
|
||||
TSRM_PTH=$withval
|
||||
],[
|
||||
TSRM_PTH=no
|
||||
])
|
||||
|
||||
AC_ARG_WITH(tsrm-st,
|
||||
[ --with-tsrm-st],[
|
||||
TSRM_ST=$withval
|
||||
],[
|
||||
TSRM_ST=no
|
||||
])
|
||||
|
||||
AC_ARG_WITH(tsrm-pthreads,
|
||||
[ --with-tsrm-pthreads Use POSIX threads (default)],[
|
||||
TSRM_PTHREADS=$withval
|
||||
],[
|
||||
TSRM_PTHREADS=yes
|
||||
])
|
||||
|
||||
test "$TSRM_PTH" = "yes" && TSRM_PTH=pth-config
|
||||
|
||||
if test "$TSRM_PTH" != "no"; then
|
||||
TSRM_CHECK_PTH($TSRM_PTH)
|
||||
elif test "$TSRM_ST" != "no"; then
|
||||
TSRM_CHECK_ST($TSRM_ST)
|
||||
elif test "$TSRM_PTHREADS" != "no"; then
|
||||
TSRM_CHECK_PTHREADS
|
||||
fi
|
||||
|
||||
])
|
||||
@@ -1,15 +0,0 @@
|
||||
#ifndef TSRM_CONFIG_W32_H
|
||||
#define TSRM_CONFIG_W32_H
|
||||
|
||||
#define HAVE_UTIME 1
|
||||
#define HAVE_ALLOCA 1
|
||||
|
||||
#undef inline
|
||||
#ifdef ZEND_WIN32_FORCE_INLINE
|
||||
# define inline __forceinline
|
||||
#else
|
||||
# define inline
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,47 +0,0 @@
|
||||
#ifndef TSRM_CONFIG_COMMON_H
|
||||
#define TSRM_CONFIG_COMMON_H
|
||||
|
||||
#if WINNT|WIN32
|
||||
# define TSRM_WIN32
|
||||
#endif
|
||||
|
||||
#ifndef TSRM_WIN32
|
||||
# include "tsrm_config.h"
|
||||
# include <sys/param.h>
|
||||
#else
|
||||
# include "tsrm_config.w32.h"
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
# ifdef PATH_MAX
|
||||
# define MAXPATHLEN PATH_MAX
|
||||
# else
|
||||
# define MAXPATHLEN 256
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2))
|
||||
# define tsrm_do_alloca(p) alloca(p)
|
||||
# define tsrm_free_alloca(p)
|
||||
#else
|
||||
# define tsrm_do_alloca(p) malloc(p)
|
||||
# define tsrm_free_alloca(p) free(p)
|
||||
#endif
|
||||
|
||||
#endif /* TSRM_CONFIG_COMMON_H */
|
||||
@@ -1,63 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "tsrm_config_common.h"
|
||||
#include "tsrm_strtok_r.h"
|
||||
|
||||
static inline int in_character_class(char ch, const char *delim)
|
||||
{
|
||||
while (*delim) {
|
||||
if (*delim == ch) {
|
||||
return 1;
|
||||
}
|
||||
delim++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *tsrm_strtok_r(char *s, const char *delim, char **last)
|
||||
{
|
||||
char *token;
|
||||
|
||||
if (s == NULL) {
|
||||
s = *last;
|
||||
}
|
||||
|
||||
while (*s && in_character_class(*s, delim)) {
|
||||
s++;
|
||||
}
|
||||
if (!*s) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
token = s;
|
||||
|
||||
while (*s && !in_character_class(*s, delim)) {
|
||||
s++;
|
||||
}
|
||||
if (!*s) {
|
||||
*last = s;
|
||||
} else {
|
||||
*s = '\0';
|
||||
*last = s + 1;
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
main()
|
||||
{
|
||||
char foo[] = "/foo/bar//\\barbara";
|
||||
char *last;
|
||||
char *token;
|
||||
|
||||
token = tsrm_strtok_r(foo, "/\\", &last);
|
||||
while (token) {
|
||||
printf ("Token = '%s'\n", token);
|
||||
token = tsrm_strtok_r(NULL, "/\\", &last);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,6 +0,0 @@
|
||||
#ifndef TSRM_STRTOK_R
|
||||
#define TSRM_STRTOK_R
|
||||
|
||||
char *tsrm_strtok_r(char *s, const char *delim, char **last);
|
||||
|
||||
#endif
|
||||
@@ -1,773 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP version 4.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/2_02.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Sascha Schumann <sascha@schumann.cx> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "tsrm_virtual_cwd.h"
|
||||
#include "tsrm_strtok_r.h"
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
#include <io.h>
|
||||
#include "tsrm_win32.h"
|
||||
#endif
|
||||
|
||||
#define VIRTUAL_CWD_DEBUG 0
|
||||
|
||||
#include "TSRM.h"
|
||||
|
||||
/* Only need mutex for popen() in Windows because it doesn't chdir() on UNIX */
|
||||
#if defined(TSRM_WIN32) && defined(ZTS)
|
||||
MUTEX_T cwd_mutex;
|
||||
#endif
|
||||
|
||||
#ifdef ZTS
|
||||
static ts_rsrc_id cwd_globals_id;
|
||||
#else
|
||||
static virtual_cwd_globals cwd_globals;
|
||||
#endif
|
||||
|
||||
cwd_state main_cwd_state; /* True global */
|
||||
|
||||
#ifndef TSRM_WIN32
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
#ifndef S_ISDIR
|
||||
#define S_ISDIR(mode) ((mode) & _S_IFDIR)
|
||||
#endif
|
||||
|
||||
#ifndef S_ISREG
|
||||
#define S_ISREG(mode) ((mode) & _S_IFREG)
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
#define tsrm_strtok_r(a,b,c) strtok((a),(b))
|
||||
#define TOKENIZER_STRING "/\\"
|
||||
|
||||
static int php_check_dots(const char *element, int n)
|
||||
{
|
||||
while (n-- > 0) if (element[n] != '.') break;
|
||||
|
||||
return (n != -1);
|
||||
}
|
||||
|
||||
#define IS_DIRECTORY_UP(element, len) \
|
||||
(len >= 2 && !php_check_dots(element, len))
|
||||
|
||||
#define IS_DIRECTORY_CURRENT(element, len) \
|
||||
(len == 1 && ptr[0] == '.')
|
||||
|
||||
|
||||
#else
|
||||
#define TOKENIZER_STRING "/"
|
||||
#endif
|
||||
|
||||
|
||||
/* default macros */
|
||||
|
||||
#ifndef IS_DIRECTORY_UP
|
||||
#define IS_DIRECTORY_UP(element, len) \
|
||||
(len == 2 && memcmp(element, "..", 2) == 0)
|
||||
#endif
|
||||
|
||||
#ifndef IS_DIRECTORY_CURRENT
|
||||
#define IS_DIRECTORY_CURRENT(element, len) \
|
||||
(len == 1 && ptr[0] == '.')
|
||||
#endif
|
||||
|
||||
/* define this to check semantics */
|
||||
#define IS_DIR_OK(s) (1)
|
||||
|
||||
#ifndef IS_DIR_OK
|
||||
#define IS_DIR_OK(state) (php_is_dir_ok(state) == 0)
|
||||
#endif
|
||||
|
||||
|
||||
#define CWD_STATE_COPY(d, s) \
|
||||
(d)->cwd_length = (s)->cwd_length; \
|
||||
(d)->cwd = (char *) malloc((s)->cwd_length+1); \
|
||||
memcpy((d)->cwd, (s)->cwd, (s)->cwd_length+1);
|
||||
|
||||
#define CWD_STATE_FREE(s) \
|
||||
free((s)->cwd);
|
||||
|
||||
static int php_is_dir_ok(const cwd_state *state)
|
||||
{
|
||||
struct stat buf;
|
||||
|
||||
if (stat(state->cwd, &buf) == 0 && S_ISDIR(buf.st_mode))
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static int php_is_file_ok(const cwd_state *state)
|
||||
{
|
||||
struct stat buf;
|
||||
|
||||
if (stat(state->cwd, &buf) == 0 && S_ISREG(buf.st_mode))
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void cwd_globals_ctor(virtual_cwd_globals *cwd_globals TSRMLS_DC)
|
||||
{
|
||||
CWD_STATE_COPY(&cwd_globals->cwd, &main_cwd_state);
|
||||
}
|
||||
|
||||
static void cwd_globals_dtor(virtual_cwd_globals *cwd_globals TSRMLS_DC)
|
||||
{
|
||||
CWD_STATE_FREE(&cwd_globals->cwd);
|
||||
}
|
||||
|
||||
static char *tsrm_strndup(const char *s, size_t length)
|
||||
{
|
||||
char *p;
|
||||
|
||||
p = (char *) malloc(length+1);
|
||||
if (!p) {
|
||||
return (char *)NULL;
|
||||
}
|
||||
if (length) {
|
||||
memcpy(p,s,length);
|
||||
}
|
||||
p[length]=0;
|
||||
return p;
|
||||
}
|
||||
|
||||
CWD_API void virtual_cwd_startup(void)
|
||||
{
|
||||
char cwd[MAXPATHLEN];
|
||||
char *result;
|
||||
|
||||
result = getcwd(cwd, sizeof(cwd));
|
||||
if (!result) {
|
||||
cwd[0] = '\0';
|
||||
}
|
||||
main_cwd_state.cwd = strdup(cwd);
|
||||
main_cwd_state.cwd_length = strlen(cwd);
|
||||
|
||||
#ifdef ZTS
|
||||
ts_allocate_id(&cwd_globals_id, sizeof(virtual_cwd_globals), (ts_allocate_ctor) cwd_globals_ctor, (ts_allocate_dtor) cwd_globals_dtor);
|
||||
#else
|
||||
cwd_globals_ctor(&cwd_globals TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
#if defined(TSRM_WIN32) && defined(ZTS)
|
||||
cwd_mutex = tsrm_mutex_alloc();
|
||||
#endif
|
||||
}
|
||||
|
||||
CWD_API void virtual_cwd_shutdown(void)
|
||||
{
|
||||
#ifndef ZTS
|
||||
cwd_globals_dtor(&cwd_globals TSRMLS_CC);
|
||||
#endif
|
||||
#if defined(TSRM_WIN32) && defined(ZTS)
|
||||
tsrm_mutex_free(cwd_mutex);
|
||||
#endif
|
||||
|
||||
free(main_cwd_state.cwd); /* Don't use CWD_STATE_FREE because the non global states will probably use emalloc()/efree() */
|
||||
}
|
||||
|
||||
CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC)
|
||||
{
|
||||
cwd_state *state;
|
||||
|
||||
state = &CWDG(cwd);
|
||||
|
||||
if (state->cwd_length == 0) {
|
||||
char *retval;
|
||||
|
||||
*length = 1;
|
||||
retval = (char *) malloc(2);
|
||||
retval[0] = DEFAULT_SLASH;
|
||||
retval[1] = '\0';
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
/* If we have something like C: */
|
||||
if (state->cwd_length == 2 && state->cwd[state->cwd_length-1] == ':') {
|
||||
char *retval;
|
||||
|
||||
*length = state->cwd_length+1;
|
||||
retval = (char *) malloc(*length+1);
|
||||
memcpy(retval, state->cwd, *length);
|
||||
retval[*length-1] = DEFAULT_SLASH;
|
||||
retval[*length] = '\0';
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
*length = state->cwd_length;
|
||||
return strdup(state->cwd);
|
||||
}
|
||||
|
||||
|
||||
/* Same semantics as UNIX getcwd() */
|
||||
CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC)
|
||||
{
|
||||
size_t length;
|
||||
char *cwd;
|
||||
|
||||
cwd = virtual_getcwd_ex(&length TSRMLS_CC);
|
||||
|
||||
if (buf == NULL) {
|
||||
return cwd;
|
||||
}
|
||||
if (length > size-1) {
|
||||
free(cwd);
|
||||
errno = ERANGE; /* Is this OK? */
|
||||
return NULL;
|
||||
}
|
||||
memcpy(buf, cwd, length+1);
|
||||
free(cwd);
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* Resolve path relatively to state and put the real path into state */
|
||||
/* returns 0 for ok, 1 for error */
|
||||
CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path)
|
||||
{
|
||||
int path_length = strlen(path);
|
||||
char *ptr, *path_copy;
|
||||
char *tok = NULL;
|
||||
int ptr_length;
|
||||
cwd_state *old_state;
|
||||
int ret = 0;
|
||||
int copy_amount = -1;
|
||||
char *free_path;
|
||||
unsigned char is_absolute = 0;
|
||||
#ifndef TSRM_WIN32
|
||||
char resolved_path[MAXPATHLEN];
|
||||
#endif
|
||||
|
||||
if (path_length == 0)
|
||||
return (0);
|
||||
|
||||
#if !defined(TSRM_WIN32) && !defined(__BEOS__)
|
||||
if (IS_ABSOLUTE_PATH(path, path_length)) {
|
||||
if (realpath(path, resolved_path)) {
|
||||
path = resolved_path;
|
||||
path_length = strlen(path);
|
||||
}
|
||||
} else { /* Concat current directory with relative path and then run realpath() on it */
|
||||
char *tmp;
|
||||
char *ptr;
|
||||
|
||||
ptr = tmp = (char *) malloc(state->cwd_length+path_length+sizeof("/"));
|
||||
if (!tmp) {
|
||||
return 1;
|
||||
}
|
||||
memcpy(ptr, state->cwd, state->cwd_length);
|
||||
ptr += state->cwd_length;
|
||||
*ptr++ = DEFAULT_SLASH;
|
||||
memcpy(ptr, path, path_length);
|
||||
ptr += path_length;
|
||||
*ptr = '\0';
|
||||
if (realpath(tmp, resolved_path)) {
|
||||
path = resolved_path;
|
||||
path_length = strlen(path);
|
||||
}
|
||||
free(tmp);
|
||||
}
|
||||
#endif
|
||||
free_path = path_copy = tsrm_strndup(path, path_length);
|
||||
|
||||
old_state = (cwd_state *) malloc(sizeof(cwd_state));
|
||||
CWD_STATE_COPY(old_state, state);
|
||||
#if VIRTUAL_CWD_DEBUG
|
||||
fprintf(stderr,"cwd = %s path = %s\n", state->cwd, path);
|
||||
#endif
|
||||
if (IS_ABSOLUTE_PATH(path_copy, path_length)) {
|
||||
copy_amount = COPY_WHEN_ABSOLUTE;
|
||||
is_absolute = 1;
|
||||
#ifdef TSRM_WIN32
|
||||
} else if (IS_UNC_PATH(path_copy, path_length)) {
|
||||
copy_amount = 2;
|
||||
is_absolute = 1;
|
||||
} else if (IS_SLASH(path_copy[0])) {
|
||||
copy_amount = 2;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (copy_amount != -1) {
|
||||
state->cwd = (char *) realloc(state->cwd, copy_amount + 1);
|
||||
if (copy_amount) {
|
||||
if (is_absolute) {
|
||||
memcpy(state->cwd, path_copy, copy_amount);
|
||||
path_copy += copy_amount;
|
||||
} else {
|
||||
memcpy(state->cwd, old_state->cwd, copy_amount);
|
||||
}
|
||||
}
|
||||
state->cwd[copy_amount] = '\0';
|
||||
state->cwd_length = copy_amount;
|
||||
}
|
||||
|
||||
|
||||
ptr = tsrm_strtok_r(path_copy, TOKENIZER_STRING, &tok);
|
||||
while (ptr) {
|
||||
ptr_length = strlen(ptr);
|
||||
|
||||
if (IS_DIRECTORY_UP(ptr, ptr_length)) {
|
||||
char save;
|
||||
|
||||
save = DEFAULT_SLASH;
|
||||
|
||||
#define PREVIOUS state->cwd[state->cwd_length - 1]
|
||||
|
||||
while (IS_ABSOLUTE_PATH(state->cwd, state->cwd_length) &&
|
||||
!IS_SLASH(PREVIOUS)) {
|
||||
save = PREVIOUS;
|
||||
PREVIOUS = '\0';
|
||||
state->cwd_length--;
|
||||
}
|
||||
|
||||
if (!IS_ABSOLUTE_PATH(state->cwd, state->cwd_length)) {
|
||||
state->cwd[state->cwd_length++] = save;
|
||||
state->cwd[state->cwd_length] = '\0';
|
||||
} else {
|
||||
PREVIOUS = '\0';
|
||||
state->cwd_length--;
|
||||
}
|
||||
} else if (!IS_DIRECTORY_CURRENT(ptr, ptr_length)) {
|
||||
state->cwd = (char *) realloc(state->cwd, state->cwd_length+ptr_length+1+1);
|
||||
#ifdef TSRM_WIN32
|
||||
/* Windows 9x will consider C:\\Foo as a network path. Avoid it. */
|
||||
if (state->cwd[state->cwd_length-1]!='\\' && state->cwd[state->cwd_length-1]!='/') {
|
||||
state->cwd[state->cwd_length++] = DEFAULT_SLASH;
|
||||
}
|
||||
#else
|
||||
state->cwd[state->cwd_length++] = DEFAULT_SLASH;
|
||||
#endif
|
||||
memcpy(&state->cwd[state->cwd_length], ptr, ptr_length+1);
|
||||
state->cwd_length += ptr_length;
|
||||
}
|
||||
ptr = tsrm_strtok_r(NULL, TOKENIZER_STRING, &tok);
|
||||
}
|
||||
|
||||
if (state->cwd_length == COPY_WHEN_ABSOLUTE) {
|
||||
state->cwd = (char *) realloc(state->cwd, state->cwd_length+1+1);
|
||||
state->cwd[state->cwd_length] = DEFAULT_SLASH;
|
||||
state->cwd[state->cwd_length+1] = '\0';
|
||||
state->cwd_length++;
|
||||
}
|
||||
|
||||
if (verify_path && verify_path(state)) {
|
||||
CWD_STATE_FREE(state);
|
||||
|
||||
*state = *old_state;
|
||||
|
||||
ret = 1;
|
||||
} else {
|
||||
CWD_STATE_FREE(old_state);
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
free(old_state);
|
||||
|
||||
free(free_path);
|
||||
#if VIRTUAL_CWD_DEBUG
|
||||
fprintf (stderr, "virtual_file_ex() = %s\n",state->cwd);
|
||||
#endif
|
||||
return (ret);
|
||||
}
|
||||
|
||||
CWD_API int virtual_chdir(const char *path TSRMLS_DC)
|
||||
{
|
||||
return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok)?-1:0;
|
||||
}
|
||||
|
||||
CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path TSRMLS_DC) TSRMLS_DC)
|
||||
{
|
||||
int length = strlen(path);
|
||||
char *temp;
|
||||
int retval;
|
||||
|
||||
if (length == 0) {
|
||||
return 1; /* Can't cd to empty string */
|
||||
}
|
||||
while(--length >= 0 && !IS_SLASH(path[length])) {
|
||||
}
|
||||
|
||||
if (length == -1) {
|
||||
/* No directory only file name */
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (length == COPY_WHEN_ABSOLUTE && IS_ABSOLUTE_PATH(path, length+1)) { /* Also use trailing slash if this is absolute */
|
||||
length++;
|
||||
}
|
||||
temp = (char *) tsrm_do_alloca(length+1);
|
||||
memcpy(temp, path, length);
|
||||
temp[length] = 0;
|
||||
#if VIRTUAL_CWD_DEBUG
|
||||
fprintf (stderr, "Changing directory to %s\n", temp);
|
||||
#endif
|
||||
retval = p_chdir(temp TSRMLS_CC);
|
||||
tsrm_free_alloca(temp);
|
||||
return retval;
|
||||
}
|
||||
|
||||
CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
retval = virtual_file_ex(&new_state, path, NULL);
|
||||
|
||||
if (!retval) {
|
||||
int len = new_state.cwd_length>MAXPATHLEN-1?MAXPATHLEN-1:new_state.cwd_length;
|
||||
memcpy(real_path, new_state.cwd, len);
|
||||
real_path[len] = '\0';
|
||||
return real_path;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
retval = virtual_file_ex(&new_state, path, verify_path);
|
||||
|
||||
*filepath = new_state.cwd;
|
||||
|
||||
return retval;
|
||||
|
||||
}
|
||||
|
||||
CWD_API int virtual_filepath(const char *path, char **filepath TSRMLS_DC)
|
||||
{
|
||||
return virtual_filepath_ex(path, filepath, php_is_file_ok TSRMLS_CC);
|
||||
}
|
||||
|
||||
CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
FILE *f;
|
||||
|
||||
if (path[0] == '\0') { /* Fail to open empty path */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, path, NULL);
|
||||
|
||||
f = fopen(new_state.cwd, mode);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return f;
|
||||
}
|
||||
|
||||
#if HAVE_UTIME
|
||||
CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int ret;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, filename, NULL);
|
||||
|
||||
ret = utime(new_state.cwd, buf);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int ret;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, filename, NULL);
|
||||
|
||||
ret = chmod(new_state.cwd, mode);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef TSRM_WIN32
|
||||
CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int ret;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, filename, NULL);
|
||||
|
||||
ret = chown(new_state.cwd, owner, group);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int f;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, path, NULL);
|
||||
|
||||
if (flags & O_CREAT) {
|
||||
mode_t mode;
|
||||
va_list arg;
|
||||
|
||||
va_start(arg, flags);
|
||||
mode = va_arg(arg, mode_t);
|
||||
va_end(arg);
|
||||
|
||||
f = open(new_state.cwd, flags, mode);
|
||||
} else {
|
||||
f = open(new_state.cwd, flags);
|
||||
}
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return f;
|
||||
}
|
||||
|
||||
CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int f;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, path, NULL);
|
||||
|
||||
f = creat(new_state.cwd, mode);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return f;
|
||||
}
|
||||
|
||||
CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC)
|
||||
{
|
||||
cwd_state old_state;
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&old_state, &CWDG(cwd));
|
||||
virtual_file_ex(&old_state, oldname, NULL);
|
||||
oldname = old_state.cwd;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, newname, NULL);
|
||||
newname = new_state.cwd;
|
||||
|
||||
retval = rename(oldname, newname);
|
||||
|
||||
CWD_STATE_FREE(&old_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, path, NULL);
|
||||
|
||||
retval = stat(new_state.cwd, buf);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifndef TSRM_WIN32
|
||||
|
||||
CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, path, NULL);
|
||||
|
||||
retval = lstat(new_state.cwd, buf);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
CWD_API int virtual_unlink(const char *path TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, path, NULL);
|
||||
|
||||
retval = unlink(new_state.cwd);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
|
||||
CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, pathname, NULL);
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
retval = mkdir(new_state.cwd);
|
||||
#else
|
||||
retval = mkdir(new_state.cwd, mode);
|
||||
#endif
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
|
||||
CWD_API int virtual_rmdir(const char *pathname TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, pathname, NULL);
|
||||
|
||||
retval = rmdir(new_state.cwd);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
DIR *opendir(const char *name);
|
||||
#endif
|
||||
|
||||
CWD_API DIR *virtual_opendir(const char *pathname TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
DIR *retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, pathname, NULL);
|
||||
|
||||
retval = opendir(new_state.cwd);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifndef TSRM_WIN32
|
||||
|
||||
CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC)
|
||||
{
|
||||
int command_length;
|
||||
char *command_line;
|
||||
char *ptr;
|
||||
FILE *retval;
|
||||
|
||||
command_length = strlen(command);
|
||||
|
||||
ptr = command_line = (char *) malloc(command_length + sizeof("cd ; ") + CWDG(cwd).cwd_length+1);
|
||||
if (!command_line) {
|
||||
return NULL;
|
||||
}
|
||||
memcpy(ptr, "cd ", sizeof("cd ")-1);
|
||||
ptr += sizeof("cd ")-1;
|
||||
|
||||
if (CWDG(cwd).cwd_length == 0) {
|
||||
*ptr++ = DEFAULT_SLASH;
|
||||
} else {
|
||||
memcpy(ptr, CWDG(cwd).cwd, CWDG(cwd).cwd_length);
|
||||
ptr += CWDG(cwd).cwd_length;
|
||||
}
|
||||
|
||||
*ptr++ = ' ';
|
||||
*ptr++ = ';';
|
||||
*ptr++ = ' ';
|
||||
|
||||
memcpy(ptr, command, command_length+1);
|
||||
retval = popen(command_line, type);
|
||||
|
||||
free(command_line);
|
||||
return retval;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* On Windows the trick of prepending "cd cwd; " doesn't work so we need to perform
|
||||
a real chdir() and mutex it
|
||||
*/
|
||||
CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC)
|
||||
{
|
||||
char prev_cwd[MAXPATHLEN];
|
||||
char *getcwd_result;
|
||||
FILE *retval;
|
||||
|
||||
getcwd_result = getcwd(prev_cwd, MAXPATHLEN);
|
||||
if (!getcwd_result) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef ZTS
|
||||
tsrm_mutex_lock(cwd_mutex);
|
||||
#endif
|
||||
|
||||
chdir(CWDG(cwd).cwd);
|
||||
retval = popen(command, type);
|
||||
chdir(prev_cwd);
|
||||
|
||||
#ifdef ZTS
|
||||
tsrm_mutex_unlock(cwd_mutex);
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -1,215 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP version 4.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/2_02.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Sascha Schumann <sascha@schumann.cx> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef VIRTUAL_CWD_H
|
||||
#define VIRTUAL_CWD_H
|
||||
|
||||
#include "TSRM.h"
|
||||
#include "tsrm_config_common.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_UTIME_H
|
||||
#include <utime.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#ifndef TSRM_WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
#include "readdir.h"
|
||||
#include <sys/utime.h>
|
||||
/* mode_t isn't defined on Windows */
|
||||
typedef unsigned short mode_t;
|
||||
|
||||
#define DEFAULT_SLASH '\\'
|
||||
#define DEFAULT_DIR_SEPARATOR ';'
|
||||
#define IS_SLASH(c) ((c) == '/' || (c) == '\\')
|
||||
#define COPY_WHEN_ABSOLUTE 2
|
||||
#define IS_ABSOLUTE_PATH(path, len) \
|
||||
(len >= 2 && isalpha(path[0]) && path[1] == ':')
|
||||
#define IS_UNC_PATH(path, len) \
|
||||
(len >= 2 && IS_SLASH(path[0]) && IS_SLASH(path[1]))
|
||||
|
||||
#else
|
||||
#ifdef HAVE_DIRENT_H
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
#define DEFAULT_SLASH '/'
|
||||
#define DEFAULT_DIR_SEPARATOR ':'
|
||||
#define IS_SLASH(c) ((c) == '/')
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef COPY_WHEN_ABSOLUTE
|
||||
#define COPY_WHEN_ABSOLUTE 0
|
||||
#endif
|
||||
|
||||
#ifndef IS_ABSOLUTE_PATH
|
||||
#define IS_ABSOLUTE_PATH(path, len) \
|
||||
(IS_SLASH(path[0]))
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_EXPORTS
|
||||
#define CWD_EXPORTS
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
# ifdef CWD_EXPORTS
|
||||
# define CWD_API __declspec(dllexport)
|
||||
# else
|
||||
# define CWD_API __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
#define CWD_API
|
||||
#endif
|
||||
|
||||
typedef struct _cwd_state {
|
||||
char *cwd;
|
||||
int cwd_length;
|
||||
} cwd_state;
|
||||
|
||||
typedef int (*verify_path_func)(const cwd_state *);
|
||||
|
||||
CWD_API void virtual_cwd_startup(void);
|
||||
CWD_API void virtual_cwd_shutdown(void);
|
||||
CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC);
|
||||
CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC);
|
||||
CWD_API int virtual_chdir(const char *path TSRMLS_DC);
|
||||
CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path TSRMLS_DC) TSRMLS_DC);
|
||||
CWD_API int virtual_filepath(const char *path, char **filepath TSRMLS_DC);
|
||||
CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path TSRMLS_DC);
|
||||
CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC);
|
||||
CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC);
|
||||
CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...);
|
||||
CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC);
|
||||
CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC);
|
||||
CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC);
|
||||
#ifndef TSRM_WIN32
|
||||
CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC);
|
||||
#endif
|
||||
CWD_API int virtual_unlink(const char *path TSRMLS_DC);
|
||||
CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC);
|
||||
CWD_API int virtual_rmdir(const char *pathname TSRMLS_DC);
|
||||
CWD_API DIR *virtual_opendir(const char *pathname TSRMLS_DC);
|
||||
CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC);
|
||||
#if HAVE_UTIME
|
||||
CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC);
|
||||
#endif
|
||||
CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC);
|
||||
#ifndef TSRM_WIN32
|
||||
CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group TSRMLS_DC);
|
||||
#endif
|
||||
|
||||
CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path);
|
||||
|
||||
typedef struct _virtual_cwd_globals {
|
||||
cwd_state cwd;
|
||||
} virtual_cwd_globals;
|
||||
|
||||
#ifdef ZTS
|
||||
# define CWDG(v) TSRMG(cwd_globals_id, virtual_cwd_globals *, v)
|
||||
#else
|
||||
# define CWDG(v) (cwd_globals.v)
|
||||
#endif
|
||||
|
||||
/* The actual macros to be used in programs using TSRM
|
||||
* If the program defines VIRTUAL_DIR it will use the
|
||||
* virtual_* functions
|
||||
*/
|
||||
|
||||
#ifdef VIRTUAL_DIR
|
||||
|
||||
#define VCWD_GETCWD(buff, size) virtual_getcwd(buff, size TSRMLS_CC)
|
||||
#define VCWD_FOPEN(path, mode) virtual_fopen(path, mode TSRMLS_CC)
|
||||
/* Because open() has two modes, we have to macros to replace it */
|
||||
#define VCWD_OPEN(path, flags) virtual_open(path TSRMLS_CC, flags)
|
||||
#define VCWD_OPEN_MODE(path, flags, mode) virtual_open(path TSRMLS_CC, flags, mode)
|
||||
#define VCWD_CREAT(path, mode) virtual_creat(path, mode TSRMLS_CC)
|
||||
#define VCWD_CHDIR(path) virtual_chdir(path TSRMLS_CC)
|
||||
#define VCWD_CHDIR_FILE(path) virtual_chdir_file(path, virtual_chdir TSRMLS_CC)
|
||||
#define VCWD_GETWD(buf)
|
||||
#define VCWD_REALPATH(path, real_path) virtual_realpath(path, real_path TSRMLS_CC)
|
||||
#define VCWD_RENAME(oldname, newname) virtual_rename(oldname, newname TSRMLS_CC)
|
||||
#define VCWD_STAT(path, buff) virtual_stat(path, buff TSRMLS_CC)
|
||||
#ifdef TSRM_WIN32
|
||||
#define VCWD_LSTAT(path, buff) virtual_stat(path, buff TSRMLS_CC)
|
||||
#else
|
||||
#define VCWD_LSTAT(path, buff) virtual_lstat(path, buff TSRMLS_CC)
|
||||
#endif
|
||||
#define VCWD_UNLINK(path) virtual_unlink(path TSRMLS_CC)
|
||||
#define VCWD_MKDIR(pathname, mode) virtual_mkdir(pathname, mode TSRMLS_CC)
|
||||
#define VCWD_RMDIR(pathname) virtual_rmdir(pathname TSRMLS_CC)
|
||||
#define VCWD_OPENDIR(pathname) virtual_opendir(pathname TSRMLS_CC)
|
||||
#define VCWD_POPEN(command, type) virtual_popen(command, type TSRMLS_CC)
|
||||
#if HAVE_UTIME
|
||||
#define VCWD_UTIME(path, time) virtual_utime(path, time TSRMLS_CC)
|
||||
#endif
|
||||
#define VCWD_CHMOD(path, mode) virtual_chmod(path, mode TSRMLS_CC)
|
||||
#ifndef TSRM_WIN32
|
||||
#define VCWD_CHOWN(path, owner, group) virtual_chown(path, owner, group TSRMLS_CC)
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define VCWD_GETCWD(buff, size) getcwd(buff, size)
|
||||
#define VCWD_FOPEN(path, mode) fopen(path, mode)
|
||||
#define VCWD_OPEN(path, flags) open(path, flags)
|
||||
#define VCWD_OPEN_MODE(path, flags, mode) open(path, flags, mode)
|
||||
#define VCWD_CREAT(path, mode) creat(path, mode)
|
||||
#define VCWD_RENAME(oldname, newname) rename(oldname, newname)
|
||||
#define VCWD_CHDIR(path) chdir(path)
|
||||
#define VCWD_CHDIR_FILE(path) virtual_chdir_file(path, chdir)
|
||||
#define VCWD_GETWD(buf) getwd(buf)
|
||||
#define VCWD_STAT(path, buff) stat(path, buff)
|
||||
#define VCWD_LSTAT(path, buff) lstat(path, buff)
|
||||
#define VCWD_UNLINK(path) unlink(path)
|
||||
#define VCWD_MKDIR(pathname, mode) mkdir(pathname, mode)
|
||||
#define VCWD_RMDIR(pathname) rmdir(pathname)
|
||||
#define VCWD_OPENDIR(pathname) opendir(pathname)
|
||||
#define VCWD_POPEN(command, type) popen(command, type)
|
||||
|
||||
#ifndef TSRM_WIN32
|
||||
#define VCWD_REALPATH(path, real_path) realpath(path, real_path)
|
||||
#else
|
||||
#define VCWD_REALPATH(path, real_path) strcpy(real_path, path)
|
||||
#endif
|
||||
|
||||
#if HAVE_UTIME
|
||||
#define VCWD_UTIME(path, time) utime(path, time)
|
||||
#endif
|
||||
#define VCWD_CHMOD(path, mode) chmod(path, mode)
|
||||
#ifndef TSRM_WIN32
|
||||
#define VCWD_CHOWN(path, owner, group) chown(path, owner, group)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* VIRTUAL_CWD_H */
|
||||
@@ -1,359 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP version 4.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/2_02.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Daniel Beulshausen <daniel@php4win.de> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#include <process.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "TSRM.h"
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
#include <windows.h>
|
||||
#include "tsrm_win32.h"
|
||||
|
||||
#ifdef ZTS
|
||||
static ts_rsrc_id win32_globals_id;
|
||||
#else
|
||||
static tsrm_win32_globals win32_globals;
|
||||
#endif
|
||||
|
||||
static void tsrm_win32_ctor(tsrm_win32_globals *globals TSRMLS_DC)
|
||||
{
|
||||
globals->process = NULL;
|
||||
globals->shm = NULL;
|
||||
globals->process_size = 0;
|
||||
globals->shm_size = 0;
|
||||
globals->comspec = _strdup((GetVersion()<0x80000000)?"cmd.exe":"command.com");
|
||||
}
|
||||
|
||||
static void tsrm_win32_dtor(tsrm_win32_globals *globals TSRMLS_DC)
|
||||
{
|
||||
shm_pair *ptr;
|
||||
|
||||
if (globals->process) {
|
||||
free(globals->process);
|
||||
}
|
||||
|
||||
if (globals->shm) {
|
||||
for (ptr = globals->shm; ptr < (globals->shm + globals->shm_size); ptr++) {
|
||||
UnmapViewOfFile(ptr->addr);
|
||||
CloseHandle(ptr->segment);
|
||||
UnmapViewOfFile(ptr->descriptor);
|
||||
CloseHandle(ptr->info);
|
||||
}
|
||||
free(globals->shm);
|
||||
}
|
||||
|
||||
free(globals->comspec);
|
||||
}
|
||||
|
||||
TSRM_API void tsrm_win32_startup(void)
|
||||
{
|
||||
#ifdef ZTS
|
||||
ts_allocate_id(&win32_globals_id, sizeof(tsrm_win32_globals), (ts_allocate_ctor)tsrm_win32_ctor, (ts_allocate_ctor)tsrm_win32_dtor);
|
||||
#else
|
||||
tsrm_win32_ctor(&win32_globals TSRMLS_CC);
|
||||
#endif
|
||||
}
|
||||
|
||||
TSRM_API void tsrm_win32_shutdown(void)
|
||||
{
|
||||
#ifndef ZTS
|
||||
tsrm_win32_dtor(&win32_globals TSRMLS_CC);
|
||||
#endif
|
||||
}
|
||||
|
||||
static process_pair *process_get(FILE *stream TSRMLS_DC)
|
||||
{
|
||||
process_pair *ptr;
|
||||
process_pair *newptr;
|
||||
|
||||
for (ptr = TWG(process); ptr < (TWG(process) + TWG(process_size)); ptr++) {
|
||||
if (ptr->stream == stream) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ptr < (TWG(process) + TWG(process_size))) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
newptr = (process_pair*)realloc((void*)TWG(process), (TWG(process_size)+1)*sizeof(process_pair));
|
||||
if (newptr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TWG(process) = newptr;
|
||||
ptr = newptr + TWG(process_size);
|
||||
TWG(process_size)++;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static shm_pair *shm_get(int key, void *addr)
|
||||
{
|
||||
shm_pair *ptr;
|
||||
shm_pair *newptr;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
for (ptr = TWG(shm); ptr < (TWG(shm) + TWG(shm_size)); ptr++) {
|
||||
if (!ptr->descriptor) {
|
||||
continue;
|
||||
}
|
||||
if (!addr && ptr->descriptor->shm_perm.key == key) {
|
||||
break;
|
||||
} else if (ptr->addr == addr) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ptr < (TWG(shm) + TWG(shm_size))) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
newptr = (shm_pair*)realloc((void*)TWG(shm), (TWG(shm_size)+1)*sizeof(shm_pair));
|
||||
if (newptr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TWG(shm) = newptr;
|
||||
ptr = newptr + TWG(shm_size);
|
||||
TWG(shm_size)++;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static HANDLE dupHandle(HANDLE fh, BOOL inherit) {
|
||||
HANDLE copy, self = GetCurrentProcess();
|
||||
if (!DuplicateHandle(self, fh, self, ©, 0, inherit, DUPLICATE_SAME_ACCESS|DUPLICATE_CLOSE_SOURCE)) {
|
||||
return NULL;
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
TSRM_API FILE *popen(const char *command, const char *type)
|
||||
{
|
||||
FILE *stream = NULL;
|
||||
int fno, str_len = strlen(type), read, mode;
|
||||
STARTUPINFO startup;
|
||||
PROCESS_INFORMATION process;
|
||||
SECURITY_ATTRIBUTES security;
|
||||
HANDLE in, out;
|
||||
char *cmd;
|
||||
process_pair *proc;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
security.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
security.bInheritHandle = TRUE;
|
||||
security.lpSecurityDescriptor = NULL;
|
||||
|
||||
if (!str_len || !CreatePipe(&in, &out, &security, 2048L)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(&startup, 0, sizeof(STARTUPINFO));
|
||||
memset(&process, 0, sizeof(PROCESS_INFORMATION));
|
||||
|
||||
startup.cb = sizeof(STARTUPINFO);
|
||||
startup.dwFlags = STARTF_USESTDHANDLES;
|
||||
startup.hStdError = GetStdHandle(STD_ERROR_HANDLE);
|
||||
|
||||
read = (type[0] == 'r') ? TRUE : FALSE;
|
||||
mode = ((str_len == 2) && (type[1] == 'b')) ? O_BINARY : O_TEXT;
|
||||
|
||||
|
||||
if (read) {
|
||||
in = dupHandle(in, FALSE);
|
||||
startup.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
|
||||
startup.hStdOutput = out;
|
||||
} else {
|
||||
out = dupHandle(out, FALSE);
|
||||
startup.hStdInput = in;
|
||||
startup.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
}
|
||||
|
||||
cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof(" /c "));
|
||||
sprintf(cmd, "%s /c %s", TWG(comspec), command);
|
||||
if (!CreateProcess(NULL, cmd, &security, &security, security.bInheritHandle, NORMAL_PRIORITY_CLASS, NULL, NULL, &startup, &process)) {
|
||||
return NULL;
|
||||
}
|
||||
free(cmd);
|
||||
|
||||
CloseHandle(process.hThread);
|
||||
proc = process_get(NULL TSRMLS_CC);
|
||||
|
||||
if (read) {
|
||||
fno = _open_osfhandle((long)in, _O_RDONLY | mode);
|
||||
CloseHandle(out);
|
||||
} else {
|
||||
fno = _open_osfhandle((long)out, _O_WRONLY | mode);
|
||||
CloseHandle(in);
|
||||
}
|
||||
|
||||
stream = _fdopen(fno, type);
|
||||
proc->prochnd = process.hProcess;
|
||||
proc->stream = stream;
|
||||
return stream;
|
||||
}
|
||||
|
||||
TSRM_API int pclose(FILE *stream)
|
||||
{
|
||||
DWORD termstat = 0;
|
||||
process_pair *process;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if ((process = process_get(stream TSRMLS_CC)) == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
fflush(process->stream);
|
||||
fclose(process->stream);
|
||||
|
||||
WaitForSingleObject(process->prochnd, INFINITE);
|
||||
GetExitCodeProcess(process->prochnd, &termstat);
|
||||
process->stream = NULL;
|
||||
CloseHandle(process->prochnd);
|
||||
|
||||
return termstat;
|
||||
}
|
||||
|
||||
TSRM_API int shmget(int key, int size, int flags)
|
||||
{
|
||||
shm_pair *shm;
|
||||
char shm_segment[26], shm_info[29];
|
||||
HANDLE shm_handle, info_handle;
|
||||
BOOL created = FALSE;
|
||||
|
||||
if (size < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
sprintf(shm_segment, "TSRM_SHM_SEGMENT:%d", key);
|
||||
sprintf(shm_info, "TSRM_SHM_DESCRIPTOR:%d", key);
|
||||
|
||||
shm_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_segment);
|
||||
info_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_info);
|
||||
|
||||
if ((!shm_handle && !info_handle)) {
|
||||
if (flags & IPC_EXCL) {
|
||||
return -1;
|
||||
}
|
||||
if (flags & IPC_CREAT) {
|
||||
shm_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, size, shm_segment);
|
||||
info_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(shm->descriptor), shm_info);
|
||||
created = TRUE;
|
||||
}
|
||||
if ((!shm_handle || !info_handle)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
shm = shm_get(key, NULL);
|
||||
shm->segment = shm_handle;
|
||||
shm->info = info_handle;
|
||||
shm->descriptor = MapViewOfFileEx(shm->info, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL);
|
||||
|
||||
if (created) {
|
||||
shm->descriptor->shm_perm.key = key;
|
||||
shm->descriptor->shm_segsz = size;
|
||||
shm->descriptor->shm_ctime = time(NULL);
|
||||
shm->descriptor->shm_cpid = getpid();
|
||||
shm->descriptor->shm_perm.mode = flags;
|
||||
|
||||
shm->descriptor->shm_perm.cuid = shm->descriptor->shm_perm.cgid= 0;
|
||||
shm->descriptor->shm_perm.gid = shm->descriptor->shm_perm.uid = 0;
|
||||
shm->descriptor->shm_atime = shm->descriptor->shm_dtime = 0;
|
||||
shm->descriptor->shm_lpid = shm->descriptor->shm_nattch = 0;
|
||||
shm->descriptor->shm_perm.mode = shm->descriptor->shm_perm.seq = 0;
|
||||
}
|
||||
|
||||
if (shm->descriptor->shm_perm.key != key || size > shm->descriptor->shm_segsz ) {
|
||||
CloseHandle(shm->segment);
|
||||
UnmapViewOfFile(shm->descriptor);
|
||||
CloseHandle(shm->info);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
TSRM_API void *shmat(int key, const void *shmaddr, int flags)
|
||||
{
|
||||
shm_pair *shm = shm_get(key, NULL);
|
||||
|
||||
if (!shm->segment) {
|
||||
return (void*)-1;
|
||||
}
|
||||
|
||||
shm->descriptor->shm_atime = time(NULL);
|
||||
shm->descriptor->shm_lpid = getpid();
|
||||
shm->descriptor->shm_nattch++;
|
||||
|
||||
shm->addr = MapViewOfFileEx(shm->segment, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL);
|
||||
|
||||
return shm->addr;
|
||||
}
|
||||
|
||||
TSRM_API int shmdt(const void *shmaddr)
|
||||
{
|
||||
shm_pair *shm = shm_get(0, (void*)shmaddr);
|
||||
|
||||
if (!shm->segment) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
shm->descriptor->shm_dtime = time(NULL);
|
||||
shm->descriptor->shm_lpid = getpid();
|
||||
shm->descriptor->shm_nattch--;
|
||||
|
||||
return UnmapViewOfFile(shm->addr) ? 0 : -1;
|
||||
}
|
||||
|
||||
TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf) {
|
||||
shm_pair *shm = shm_get(key, NULL);
|
||||
|
||||
if (!shm->segment) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (cmd) {
|
||||
case IPC_STAT:
|
||||
memcpy(buf, shm->descriptor, sizeof(struct shmid_ds));
|
||||
return 0;
|
||||
|
||||
case IPC_SET:
|
||||
shm->descriptor->shm_ctime = time(NULL);
|
||||
shm->descriptor->shm_perm.uid = buf->shm_perm.uid;
|
||||
shm->descriptor->shm_perm.gid = buf->shm_perm.gid;
|
||||
shm->descriptor->shm_perm.mode = buf->shm_perm.mode;
|
||||
return 0;
|
||||
|
||||
case IPC_RMID:
|
||||
if (shm->descriptor->shm_nattch < 1) {
|
||||
shm->descriptor->shm_perm.key = -1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP version 4.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/2_02.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Daniel Beulshausen <daniel@php4win.de> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef TSRM_WIN32_H
|
||||
#define TSRM_WIN32_H
|
||||
|
||||
#include "TSRM.h"
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
#include <windows.h>
|
||||
|
||||
struct ipc_perm {
|
||||
int key;
|
||||
unsigned short uid;
|
||||
unsigned short gid;
|
||||
unsigned short cuid;
|
||||
unsigned short cgid;
|
||||
unsigned short mode;
|
||||
unsigned short seq;
|
||||
};
|
||||
|
||||
struct shmid_ds {
|
||||
struct ipc_perm shm_perm;
|
||||
int shm_segsz;
|
||||
time_t shm_atime;
|
||||
time_t shm_dtime;
|
||||
time_t shm_ctime;
|
||||
unsigned short shm_cpid;
|
||||
unsigned short shm_lpid;
|
||||
short shm_nattch;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
FILE *stream;
|
||||
HANDLE prochnd;
|
||||
} process_pair;
|
||||
|
||||
typedef struct {
|
||||
void *addr;
|
||||
HANDLE info;
|
||||
HANDLE segment;
|
||||
struct shmid_ds *descriptor;
|
||||
} shm_pair;
|
||||
|
||||
typedef struct {
|
||||
process_pair *process;
|
||||
shm_pair *shm;
|
||||
int process_size;
|
||||
int shm_size;
|
||||
char *comspec;
|
||||
} tsrm_win32_globals;
|
||||
|
||||
#ifdef ZTS
|
||||
# define TWG(v) TSRMG(win32_globals_id, tsrm_win32_globals *, v)
|
||||
#else
|
||||
# define TWG(v) (win32_globals.v)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define IPC_PRIVATE 0
|
||||
#define IPC_CREAT 00001000
|
||||
#define IPC_EXCL 00002000
|
||||
#define IPC_NOWAIT 00004000
|
||||
|
||||
#define IPC_RMID 0
|
||||
#define IPC_SET 1
|
||||
#define IPC_STAT 2
|
||||
#define IPC_INFO 3
|
||||
|
||||
#define SHM_R PAGE_READONLY
|
||||
#define SHM_W PAGE_READWRITE
|
||||
|
||||
#define SHM_RDONLY FILE_MAP_READ
|
||||
#define SHM_RND FILE_MAP_WRITE
|
||||
#define SHM_REMAP FILE_MAP_COPY
|
||||
|
||||
|
||||
TSRM_API void tsrm_win32_startup(void);
|
||||
TSRM_API void tsrm_win32_shutdown(void);
|
||||
|
||||
TSRM_API FILE *popen(const char *command, const char *type);
|
||||
TSRM_API int pclose(FILE *stream);
|
||||
|
||||
TSRM_API int shmget(int key, int size, int flags);
|
||||
TSRM_API void *shmat(int key, const void *shmaddr, int flags);
|
||||
TSRM_API int shmdt(const void *shmaddr);
|
||||
TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf);
|
||||
|
||||
#endif
|
||||
@@ -1,186 +0,0 @@
|
||||
// $Header$
|
||||
|
||||
// FlexLexer.h -- define interfaces for lexical analyzer classes generated
|
||||
// by flex
|
||||
|
||||
// Copyright (c) 1993 The Regents of the University of California.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This code is derived from software contributed to Berkeley by
|
||||
// Kent Williams and Tom Epperly.
|
||||
//
|
||||
// Redistribution and use in source and binary forms with or without
|
||||
// modification are permitted provided that: (1) source distributions retain
|
||||
// this entire copyright notice and comment, and (2) distributions including
|
||||
// binaries display the following acknowledgement: ``This product includes
|
||||
// software developed by the University of California, Berkeley and its
|
||||
// contributors'' in the documentation or other materials provided with the
|
||||
// distribution and in all advertising materials mentioning features or use
|
||||
// of this software. Neither the name of the University nor the names of
|
||||
// its contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
|
||||
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
// WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
// This file defines FlexLexer, an abstract class which specifies the
|
||||
// external interface provided to flex C++ lexer objects, and yyFlexLexer,
|
||||
// which defines a particular lexer class.
|
||||
//
|
||||
// If you want to create multiple lexer classes, you use the -P flag
|
||||
// to rename each yyFlexLexer to some other xxFlexLexer. You then
|
||||
// include <FlexLexer.h> in your other sources once per lexer class:
|
||||
//
|
||||
// #undef yyFlexLexer
|
||||
// #define yyFlexLexer xxFlexLexer
|
||||
// #include <FlexLexer.h>
|
||||
//
|
||||
// #undef yyFlexLexer
|
||||
// #define yyFlexLexer zzFlexLexer
|
||||
// #include <FlexLexer.h>
|
||||
// ...
|
||||
|
||||
#ifndef FLEXLEXER_H
|
||||
// Never included before - need to define base class.
|
||||
#define FLEXLEXER_H
|
||||
#include <iostream.h>
|
||||
|
||||
extern "C++" {
|
||||
|
||||
struct yy_buffer_state;
|
||||
typedef int yy_state_type;
|
||||
|
||||
class FlexLexer {
|
||||
public:
|
||||
virtual ~FlexLexer() { }
|
||||
|
||||
const char* YYText() { return yytext; }
|
||||
int YYLeng() { return yyleng; }
|
||||
|
||||
virtual void
|
||||
yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
|
||||
virtual struct yy_buffer_state*
|
||||
yy_create_buffer( istream* s, int size ) = 0;
|
||||
virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
|
||||
virtual void yyrestart( istream* s ) = 0;
|
||||
|
||||
virtual int yylex() = 0;
|
||||
|
||||
// Call yylex with new input/output sources.
|
||||
int yylex( istream* new_in, ostream* new_out = 0 )
|
||||
{
|
||||
switch_streams( new_in, new_out );
|
||||
return yylex();
|
||||
}
|
||||
|
||||
// Switch to new input/output streams. A nil stream pointer
|
||||
// indicates "keep the current one".
|
||||
virtual void switch_streams( istream* new_in = 0,
|
||||
ostream* new_out = 0 ) = 0;
|
||||
|
||||
int lineno() const { return yylineno; }
|
||||
|
||||
int debug() const { return yy_flex_debug; }
|
||||
void set_debug( int flag ) { yy_flex_debug = flag; }
|
||||
|
||||
protected:
|
||||
char* yytext;
|
||||
int yyleng;
|
||||
int yylineno; // only maintained if you use %option yylineno
|
||||
int yy_flex_debug; // only has effect with -d or "%option debug"
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
|
||||
// Either this is the first time through (yyFlexLexerOnce not defined),
|
||||
// or this is a repeated include to define a different flavor of
|
||||
// yyFlexLexer, as discussed in the flex man page.
|
||||
#define yyFlexLexerOnce
|
||||
|
||||
class yyFlexLexer : public FlexLexer {
|
||||
public:
|
||||
// arg_yyin and arg_yyout default to the cin and cout, but we
|
||||
// only make that assignment when initializing in yylex().
|
||||
yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 );
|
||||
|
||||
virtual ~yyFlexLexer();
|
||||
|
||||
void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
|
||||
struct yy_buffer_state* yy_create_buffer( istream* s, int size );
|
||||
void yy_delete_buffer( struct yy_buffer_state* b );
|
||||
void yyrestart( istream* s );
|
||||
|
||||
virtual int yylex();
|
||||
virtual void switch_streams( istream* new_in, ostream* new_out );
|
||||
|
||||
protected:
|
||||
virtual int LexerInput( char* buf, int max_size );
|
||||
virtual void LexerOutput( const char* buf, int size );
|
||||
virtual void LexerError( const char* msg );
|
||||
|
||||
void yyunput( int c, char* buf_ptr );
|
||||
int yyinput();
|
||||
|
||||
void yy_load_buffer_state();
|
||||
void yy_init_buffer( struct yy_buffer_state* b, istream* s );
|
||||
void yy_flush_buffer( struct yy_buffer_state* b );
|
||||
|
||||
int yy_start_stack_ptr;
|
||||
int yy_start_stack_depth;
|
||||
int* yy_start_stack;
|
||||
|
||||
void yy_push_state( int new_state );
|
||||
void yy_pop_state();
|
||||
int yy_top_state();
|
||||
|
||||
yy_state_type yy_get_previous_state();
|
||||
yy_state_type yy_try_NUL_trans( yy_state_type current_state );
|
||||
int yy_get_next_buffer();
|
||||
|
||||
istream* yyin; // input source for default LexerInput
|
||||
ostream* yyout; // output sink for default LexerOutput
|
||||
|
||||
struct yy_buffer_state* yy_current_buffer;
|
||||
|
||||
// yy_hold_char holds the character lost when yytext is formed.
|
||||
char yy_hold_char;
|
||||
|
||||
// Number of characters read into yy_ch_buf.
|
||||
int yy_n_chars;
|
||||
|
||||
// Points to current character in buffer.
|
||||
char* yy_c_buf_p;
|
||||
|
||||
int yy_init; // whether we need to initialize
|
||||
int yy_start; // start state number
|
||||
|
||||
// Flag which is used to allow yywrap()'s to do buffer switches
|
||||
// instead of setting up a fresh yyin. A bit of a hack ...
|
||||
int yy_did_buffer_switch_on_eof;
|
||||
|
||||
// The following are not always needed, but may be depending
|
||||
// on use of certain flex features (like REJECT or yymore()).
|
||||
|
||||
yy_state_type yy_last_accepting_state;
|
||||
char* yy_last_accepting_cpos;
|
||||
|
||||
yy_state_type* yy_state_buf;
|
||||
yy_state_type* yy_state_ptr;
|
||||
|
||||
char* yy_full_match;
|
||||
int* yy_full_state;
|
||||
int yy_full_lp;
|
||||
|
||||
int yy_lp;
|
||||
int yy_looking_for_trail_begin;
|
||||
|
||||
int yy_more_flag;
|
||||
int yy_more_len;
|
||||
int yy_more_offset;
|
||||
int yy_prev_more_offset;
|
||||
};
|
||||
|
||||
#endif
|
||||
-116
@@ -1,116 +0,0 @@
|
||||
---------------------------------------------------------------------------
|
||||
The Zend License, version 0.92
|
||||
Copyright (C) 1999-2001 Zend Technologies Ltd.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
The Zend scripting engine library is a product of Zend Technologies Ltd.
|
||||
It may be used and/or distributed under the terms of the Q Public
|
||||
License (QPL) version 1.0, enclosed below.
|
||||
|
||||
For more information about Zend please visit http://www.zend.com/
|
||||
For license related questions please mail license@zend.com
|
||||
|
||||
===========================================================================
|
||||
|
||||
THE Q PUBLIC LICENSE
|
||||
version 1.0
|
||||
|
||||
Copyright (C) 1999 Troll Tech AS, Norway.
|
||||
Everyone is permitted to copy and
|
||||
distribute this license document.
|
||||
|
||||
The intent of this license is to establish freedom to share and change the
|
||||
software regulated by this license under the open source model.
|
||||
|
||||
This license applies to any software containing a notice placed by the
|
||||
copyright holder saying that it may be distributed under the terms of
|
||||
the Q Public License version 1.0. Such software is herein referred to as
|
||||
the Software. This license covers modification and distribution of the
|
||||
Software, use of third-party application programs based on the Software,
|
||||
and development of free software which uses the Software.
|
||||
|
||||
Granted Rights
|
||||
|
||||
1. You are granted the non-exclusive rights set forth in this license
|
||||
provided you agree to and comply with any and all conditions in this
|
||||
license. Whole or partial distribution of the Software, or software
|
||||
items that link with the Software, in any form signifies acceptance of
|
||||
this license.
|
||||
|
||||
2. You may copy and distribute the Software in unmodified form provided
|
||||
that the entire package, including - but not restricted to - copyright,
|
||||
trademark notices and disclaimers, as released by the initial developer
|
||||
of the Software, is distributed.
|
||||
|
||||
3. You may make modifications to the Software and distribute your
|
||||
modifications, in a form that is separate from the Software, such as
|
||||
patches. The following restrictions apply to modifications:
|
||||
|
||||
a. Modifications must not alter or remove any copyright notices in
|
||||
the Software.
|
||||
|
||||
b. When modifications to the Software are released under this
|
||||
license, a non-exclusive royalty-free right is granted to the
|
||||
initial developer of the Software to distribute your modification
|
||||
in future versions of the Software provided such versions remain
|
||||
available under these terms in addition to any other license(s) of
|
||||
the initial developer.
|
||||
|
||||
4. You may distribute machine-executable forms of the Software or
|
||||
machine-executable forms of modified versions of the Software, provided
|
||||
that you meet these restrictions:
|
||||
|
||||
a. You must include this license document in the distribution.
|
||||
|
||||
b. You must ensure that all recipients of the machine-executable forms
|
||||
are also able to receive the complete machine-readable source code
|
||||
to the distributed Software, including all modifications, without
|
||||
any charge beyond the costs of data transfer, and place prominent
|
||||
notices in the distribution explaining this.
|
||||
|
||||
c. You must ensure that all modifications included in the
|
||||
machine-executable forms are available under the terms of this
|
||||
license.
|
||||
|
||||
5. You may use the original or modified versions of the Software to
|
||||
compile, link and run application programs legally developed by you
|
||||
or by others.
|
||||
|
||||
6. You may develop application programs, reusable components and other
|
||||
software items that link with the original or modified versions of the
|
||||
Software. These items, when distributed, are subject to the following
|
||||
requirements:
|
||||
|
||||
a. You must ensure that all recipients of machine-executable forms of
|
||||
these items are also able to receive and use the complete
|
||||
machine-readable source code to the items without any charge
|
||||
beyond the costs of data transfer.
|
||||
|
||||
b. You must explicitly license all recipients of your items to use
|
||||
and re-distribute original and modified versions of the items in
|
||||
both machine-executable and source code forms. The recipients must
|
||||
be able to do so without any charges whatsoever, and they must be
|
||||
able to re-distribute to anyone they choose.
|
||||
|
||||
|
||||
c. If the items are not available to the general public, and the
|
||||
initial developer of the Software requests a copy of the items,
|
||||
then you must supply one.
|
||||
|
||||
Limitations of Liability
|
||||
|
||||
In no event shall the initial developers or copyright holders be liable
|
||||
for any damages whatsoever, including - but not restricted to - lost
|
||||
revenue or profits or other direct, indirect, special, incidental or
|
||||
consequential damages, even if they have been advised of the possibility
|
||||
of such damages, except to the extent invariable law, if any, provides
|
||||
otherwise.
|
||||
|
||||
No Warranty
|
||||
|
||||
The Software and this license document are provided AS IS with NO WARRANTY
|
||||
OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
===========================================================================
|
||||
@@ -1,49 +0,0 @@
|
||||
## Process this file with automake to produce Makefile.in -*- makefile -*-
|
||||
|
||||
#CLEANFILES = zend_language_parser.c zend_language_parser.h zend_language_scanner.c zend_language_parser.output zend_ini_parser.c zend_ini_parser.h zend_ini_scanner.c zend_ini_parser.output
|
||||
|
||||
AUTOMAKE_OPTIONS=foreign
|
||||
noinst_LTLIBRARIES=libZend.la
|
||||
|
||||
libZend_la_SOURCES=\
|
||||
zend_language_parser.y zend_language_scanner.l \
|
||||
zend_ini_parser.y zend_ini_scanner.l \
|
||||
zend_alloc.c zend_compile.c zend_constants.c zend_dynamic_array.c \
|
||||
zend_execute.c zend_execute_API.c zend_highlight.c zend_llist.c \
|
||||
zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
|
||||
zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
|
||||
zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \
|
||||
zend_ini.c zend_qsort.c zend_objects.c
|
||||
|
||||
libZend_la_LDFLAGS = @EXTRA_LIBS@
|
||||
|
||||
# automake isn't too clever about "non-standard" use of lex and yacc
|
||||
|
||||
$(libZend_la_OBJECTS): zend_language_parser.h
|
||||
|
||||
zend_ini_scanner.lo: zend_ini_parser.h
|
||||
|
||||
# Language parser/scanner rules
|
||||
|
||||
zend_language_scanner.c: $(srcdir)/zend_language_scanner.l
|
||||
$(LEX) -Pzend -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_language_scanner.l
|
||||
|
||||
zend_language_parser.h: zend_language_parser.c
|
||||
zend_language_parser.c: $(srcdir)/zend_language_parser.y
|
||||
$(YACC) -p zend -v -d $(srcdir)/zend_language_parser.y -o zend_language_parser.c
|
||||
|
||||
# INI parser/scanner rules
|
||||
|
||||
zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
|
||||
$(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o zend_ini_parser.c
|
||||
|
||||
zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
|
||||
$(LEX) -Pini_ -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_ini_scanner.l
|
||||
|
||||
zend_ini_parser.h: zend_ini_parser.c
|
||||
|
||||
depend:
|
||||
|
||||
zend_execute.lo: $(srcdir)/zend_execute.c
|
||||
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(INLINE_CFLAGS) -c $(srcdir)/zend_execute.c
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
Revamped object model using object handles
|
||||
===========================================
|
||||
|
||||
Background
|
||||
----------
|
||||
|
||||
In the Zend Engine 1.0 (and its predecessor the PHP 3 scripting
|
||||
engine) the object model's design is that instantiated objects are
|
||||
language values. This means that when programmers are performing
|
||||
operations, such variable assignment and passing parameters to
|
||||
functions, objects are handled very similarly to the way other
|
||||
primitive types are handled such as integers and strings.
|
||||
Semantically this means that the whole object is being copied. The
|
||||
approach Java takes is different where one refers to objects by handle
|
||||
and not by value (one can think of a handle as an objects' ID).
|
||||
|
||||
Need
|
||||
----
|
||||
|
||||
Unfortunately, the approach taken up to now has severely limited the
|
||||
Zend Engine's object oriented model, both feature and simplicity
|
||||
wise. One of the main problems with the former approach is that object
|
||||
instantiation and duplication is very hard to control, a problem which
|
||||
can not only lead to inefficient development but also often to strange
|
||||
run-time behavior. Changing the object model to a handle oriented
|
||||
model will allow the addressing of many needs such as destructors,
|
||||
de-referencing method return values, tight control of object
|
||||
duplication and more.
|
||||
|
||||
Overview
|
||||
--------
|
||||
|
||||
The proposed object model is very much influenced by the Java
|
||||
model. In general, when you create a new object you will be getting a
|
||||
handle to the object instead of the object itself. When this handle is
|
||||
sent to functions, assigned and copied it is only the handle which is
|
||||
copied/sent/assigned. The object itself is never copied nor
|
||||
duplicated. This results in all handles of this object to always point
|
||||
at the same object making it a very consistent solution and saving
|
||||
unnecessary duplication and confusing behavior.
|
||||
|
||||
Functionality
|
||||
-------------
|
||||
|
||||
After this change the basic use of objects will be almost identical to
|
||||
previous versions of the scripting engine. However, you won't bump
|
||||
into awkward and confusing copying & destructing of objects. In order
|
||||
to create and use a new object instance you will do the following:
|
||||
$object = new MyClass(); $object->method();
|
||||
|
||||
The previous code will assign $object the handle of a new instance of
|
||||
the class MyClass and call one of its methods.
|
||||
|
||||
|
||||
Consider the following code:
|
||||
|
||||
1 class MyClass
|
||||
2 {
|
||||
3 function setMember($value)
|
||||
4 {
|
||||
5 $this->member = $value;
|
||||
6 }
|
||||
7
|
||||
8 function getMember()
|
||||
9 {
|
||||
10 return $this->member;
|
||||
11 }
|
||||
12 }
|
||||
13
|
||||
14 function foo($obj)
|
||||
15 {
|
||||
16 $obj->setMember("foo");
|
||||
17 }
|
||||
18
|
||||
19 $object = new MyClass();
|
||||
20 $object->setMember("bar");
|
||||
21 foo($object);
|
||||
22 print $object->getMember();
|
||||
|
||||
Without the new Java-like handles, at line 20 the objects' data member
|
||||
member is set to the string value of "bar". Because of the internal
|
||||
representation of objects in the Zend Engine 1.0, the object is marked
|
||||
as a reference, and when it is sent by value to the function foo, it
|
||||
is duplicated (!). Therefore, the call to foo() on line 21 will
|
||||
result in the $obj->setMember("foo") call being called on a duplicate
|
||||
of $object. Line 22 will then result in "bar" being printed.
|
||||
|
||||
This is how the scripting engine has worked until today. Most
|
||||
developers are probably unaware of the fact that they aren't always
|
||||
talking to the same object but often duplicates; others may have
|
||||
realized this can usually be solved by always passing objects by
|
||||
reference (unless a replica is actually desired, which is uncommon).
|
||||
|
||||
The new object model will allow for a much more intuitive
|
||||
implementation of the code. On line 21, the object's handle (ID) is
|
||||
passed to foo() by value. Inside foo(), the object is fetched
|
||||
according to this handle and, therefore, the setMember() method is
|
||||
called on the originally instantiated object and not a copy. Line 22
|
||||
will therefore result in "foo" being printed. This approach gives
|
||||
developers tighter control of when objects are created and duplicated.
|
||||
An additional not-as-important benefit is that the object handle will
|
||||
be passed to foo() by value, which most probably will also save
|
||||
unnecessary duplication of the value containing the ID itself and thus
|
||||
additionally improving run-time performance.
|
||||
|
||||
This was just a simple description of why the new object model solves
|
||||
awkward behavior and makes object handling much easier, intuitive and
|
||||
efficient. The importance of this change goes far beyond what is
|
||||
mentioned in this section as you will see in further sections which
|
||||
describe new features with a majority of them being based on this
|
||||
change.
|
||||
|
||||
Compatibility Notes
|
||||
--------------------
|
||||
|
||||
Many PHP programmers aren't even aware of the copying quirks of the
|
||||
current object model and, therefore, there is a relatively good chance
|
||||
that the amount of PHP applications that will work out of the box or
|
||||
after a very small amount of modifications would be high.
|
||||
|
||||
To simplify migration, version 2.0 will support an optional
|
||||
'auto-clone' feature, which will perform a cloning of the object
|
||||
whenever it would have been copied in version 1.0. Optionally, it
|
||||
will also be possible to request that the engine will emit an E_NOTICE
|
||||
message whenever such an automatic clone occurs, in order to allow
|
||||
developers to gradually migrate to the version 2.0-style behavior
|
||||
(without automatic clones).
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
The new object model is not dependent on other features. Many of the
|
||||
other Zend Engine 2.0 features, such as the $foo->bar()->barbara()
|
||||
syntax, destructors and others completely rely on this new object
|
||||
model.
|
||||
|
||||
@@ -1,169 +0,0 @@
|
||||
Title: Zend 2.0 Namespaces
|
||||
Version: $Revision$
|
||||
Status: draft
|
||||
Maintainer: Stig S. Bakken <ssb@fast.no>
|
||||
Created: 2001-09-08
|
||||
Modified: 2001-09-08
|
||||
|
||||
|
||||
1. Background/Need
|
||||
==================
|
||||
|
||||
PHP and Zend 1.0 have come to a point where a lot of reusable code is
|
||||
being written; from simple functions and classes to entire application
|
||||
frameworks. It is becoming increasingly difficult to avoid symbol
|
||||
name collisions with the current scoping methods.
|
||||
|
||||
The symbol scopes available in Zend 1.0 are the global scope, the
|
||||
class scope and the function scope. All scopes but classes may
|
||||
contain variables, only the class and global scopes may contain
|
||||
functions, while only the global scope may contain constants and
|
||||
classes. This means that all of Zend 1.0's scoping methods are
|
||||
inherently limited for solving symbol name collision problems.
|
||||
|
||||
|
||||
2. Overview
|
||||
===========
|
||||
|
||||
Namespaces in Zend 2.0 provide a way to manage the symbol collision
|
||||
problem by making it possible to define multiple symbol tables able to
|
||||
contain all types of symbols. Zend will get the notion of a current
|
||||
namespace, defaulting to the current global one. The current name
|
||||
space may be changed on a file-by-file basis. Symbols in other name
|
||||
spaces than the current one may be referenced using a new namespace
|
||||
operator. It will be possible to "import" symbols from one namespace
|
||||
into another.
|
||||
|
||||
|
||||
3. Functionality
|
||||
================
|
||||
|
||||
3.1. Namespace Syntax
|
||||
=====================
|
||||
|
||||
The namespace operator ":" is used to refer to symbols in other
|
||||
namespaces than the current one:
|
||||
|
||||
Class: Namespace:class
|
||||
Function: Namespace:function
|
||||
Static method: Namespace:class::method
|
||||
Variable: $Namespace:variable
|
||||
Constant: Namespace:CONSTANT
|
||||
Class variable: $Namespace:class::variable
|
||||
|
||||
To refer to symbols in the global namespace, symbols are prefixed with
|
||||
only the namespace operator:
|
||||
|
||||
Class: :class
|
||||
Function: :function
|
||||
Static method: :class::method
|
||||
Variable: $:variable
|
||||
Constant: :CONSTANT
|
||||
Class variable: $:class::variable
|
||||
|
||||
Note: $:variable will effectively be just another syntax for
|
||||
$GLOBALS['variable'].
|
||||
|
||||
A namespace may have a name containing a ":", it is always the last
|
||||
":" character in the symbol qualifier that is the actual namespace
|
||||
operator:
|
||||
|
||||
Class: Name:Space:class
|
||||
Function: Name:Space:function
|
||||
Static method: Name:Space:class::method
|
||||
Variable: $Name:Space:variable
|
||||
Constant: Name:Space:CONSTANT
|
||||
Class variable: $Name:Space:class::variable
|
||||
|
||||
(Here, the ":" between "Name" and "Space" is part of the name, it is
|
||||
the one after "Space" that is the namespace operator.)
|
||||
|
||||
|
||||
3.2. Defining Namespaces
|
||||
========================
|
||||
|
||||
Individual files may define a namespace that will apply to the entire
|
||||
file. If no "namespace" operator occurs in the file, it will be in
|
||||
the global namespace:
|
||||
|
||||
1 namespace HTML;
|
||||
2
|
||||
3 class Form {
|
||||
4 function Form() {
|
||||
5 // constructor
|
||||
6 }
|
||||
7 // ...
|
||||
8 }
|
||||
|
||||
Or with the "nested" name syntax:
|
||||
|
||||
1 namespace HTML:Form;
|
||||
2
|
||||
3 class Image {
|
||||
4 var $src;
|
||||
5 function Image($src) {
|
||||
6 $this->src = $src;
|
||||
7 }
|
||||
8 // ...
|
||||
9 }
|
||||
|
||||
Code executed within the "HTML" namespace may refer to the Form class
|
||||
as just "Form". Code executed from within other namespaces has to
|
||||
refer to it as "HTML:Form". The "namespace" statement must occur
|
||||
before any other statements in the file.
|
||||
|
||||
# [ssb 2001-09-08]:
|
||||
# Should it be possible to "add" symbols to a namespace by including a
|
||||
# second file with the same namespace statement?
|
||||
|
||||
|
||||
3.3. Importing Symbols
|
||||
======================
|
||||
|
||||
It is possible to import symbols from another namespace into the
|
||||
current one with the "import" statement:
|
||||
|
||||
import * from HTML; // all symbols
|
||||
|
||||
import Form from HTML; // single symbols
|
||||
|
||||
import Form,Table from HTML; // multiple symbols
|
||||
|
||||
There is a potential for name clashes between symols of different
|
||||
types that have the same qualifier syntax. These are resolved in this
|
||||
order: class, function, constant.
|
||||
|
||||
Optionally, the symbol type may be explicitly given to import (as
|
||||
"class", "function", "variable" or "constant"):
|
||||
|
||||
import class Form from HTML;
|
||||
|
||||
And finally, you may import all symbols of a given type:
|
||||
|
||||
import constant * from HTML:Table;
|
||||
|
||||
The namespace with its symbols must already be defined before using
|
||||
"import".
|
||||
|
||||
|
||||
4. Compatibility Notes
|
||||
======================
|
||||
|
||||
Old code that does not take advantage of namespaces will run without
|
||||
modifications.
|
||||
|
||||
|
||||
5. Dependencies
|
||||
===============
|
||||
|
||||
The class variable syntax depends on this class variables being
|
||||
implemented in the new ZE2 object model.
|
||||
|
||||
|
||||
6. Acknowledgements
|
||||
===================
|
||||
|
||||
Andi Gutmans <andi@zend.com> and Zeev Suraski <zeev@zend.com> for
|
||||
initial ZE2 namespaces proposal
|
||||
|
||||
Dean Hall <php@apt7.com> for the initial symbol qualification syntax
|
||||
@@ -1,72 +0,0 @@
|
||||
Title: Loose type requirements for functions
|
||||
Version: $Revision$
|
||||
Status: draft
|
||||
Maintainer: Brian Moon <brianm@dealnews.com>
|
||||
Created: 2001-09-17
|
||||
Modified: 2001-09-17
|
||||
|
||||
|
||||
1. Background/Need
|
||||
==================
|
||||
|
||||
Many internal function of PHP will reject parameters because of their
|
||||
type (the array and variable function come to mind). For userland
|
||||
this is not an easy task as there is no uniform way to do it. An
|
||||
addition to the engine for requiring loose types would allow
|
||||
delevopers to know that the data passed to their functions is of the
|
||||
correct type and reduce the need for duplicating the same code in
|
||||
every function to check for the type of data.
|
||||
|
||||
|
||||
2. Overview
|
||||
===========
|
||||
|
||||
Loose typing mostly means evaluating the contents of the variable and
|
||||
not the type of the variable itself. The requirements for this would
|
||||
and should work much like several of the is_* functions do now.
|
||||
|
||||
The typing of parameters would be optional and those not typed would
|
||||
simply continue to be treated as they are now.
|
||||
|
||||
3. Functionality
|
||||
================
|
||||
|
||||
3.1. Allowed Types
|
||||
==================
|
||||
|
||||
Only loose types should be needed to ensure the data is usable by the
|
||||
function. Duplicating the functionallity of is_scalar, is_resource,
|
||||
is_array and is_object should give developers all the information they
|
||||
need to use a variable correctly.
|
||||
|
||||
3.2. Syntax
|
||||
===========
|
||||
|
||||
The current function syntax should be expanded to allow typing of
|
||||
variables inline in a C style.
|
||||
|
||||
function foo ($var){
|
||||
}
|
||||
|
||||
could be changed to require an array such as:
|
||||
|
||||
function foo (array $var){
|
||||
}
|
||||
|
||||
3.3. Errors
|
||||
===========
|
||||
|
||||
Mis-matches in type should be reported as fatal errors and should halt
|
||||
the execution of a script as that function can not be run and code
|
||||
following could not reliably run.
|
||||
|
||||
|
||||
4. Compatibility Notes
|
||||
======================
|
||||
|
||||
Old code that does not take advantage of this will run without
|
||||
modifications.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,233 +0,0 @@
|
||||
Changes in the Zend Engine 2.0
|
||||
|
||||
* New object model.
|
||||
|
||||
The Zend Engine's handling of objects has been completely
|
||||
changed in order to allow for new features, but also to increase
|
||||
its performance.
|
||||
|
||||
Objects were handled in previous versions like primitive types
|
||||
(for instance integers and strings). The drawback of this method
|
||||
is, that semantically the whole object was copied when a
|
||||
variable was assigned or parameters were passed to a method. The
|
||||
new approach refers to objects by handle and not by value (one
|
||||
can think of a handle as an objects' ID).
|
||||
|
||||
Many PHP programmers aren't even aware of the copying quirks of
|
||||
the old object model and, therefore, there is a relatively good
|
||||
chance that the amount of PHP applications that will work out of
|
||||
the box or after a very small amount of modifications would be
|
||||
high.
|
||||
|
||||
To simplify migration, the Zend Engine 2.0 supports an optional
|
||||
'auto-clone' feature, which performs a cloning of the object
|
||||
whenever it would have been copied in version 1.0. Optionally,
|
||||
it emits an E_NOTICE message whenever such an automatic clone
|
||||
occurs, in order to allow developers to gradually migrate to the
|
||||
version 2.0-style behavior (without automatic clones).
|
||||
|
||||
* delete statement.
|
||||
|
||||
The Zend Engine 1.0 had no means to force deletion of an object
|
||||
if there are still references to it. The newly introduces delete
|
||||
statement calls the object’s destructor and frees it even if the
|
||||
object is referenced by some other places in the engine. Other
|
||||
references to the deleted object become stale and trying to
|
||||
access them results in a fatal error.
|
||||
|
||||
Note that if you have a user-defined function delete() in an old
|
||||
script, this script will yield a parser error with the Zend
|
||||
Engine 2.0, since 'delete' is now a reserved word.
|
||||
|
||||
* Exceptions.
|
||||
|
||||
The Zend Engine 1.0 had no exception handling. The Zend Engine 2.0
|
||||
introduces a exception model similar to that of other programming
|
||||
languages.
|
||||
|
||||
Example
|
||||
|
||||
try {
|
||||
code
|
||||
|
||||
if (failure) {
|
||||
throw new MyException(Failure);
|
||||
}
|
||||
|
||||
code
|
||||
} catch ($exception) {
|
||||
handle exception
|
||||
|
||||
throw $exception; // Re-throw exception.
|
||||
}
|
||||
|
||||
Old code that does not use exceptions will run without
|
||||
modifications.
|
||||
|
||||
* Namespaces.
|
||||
|
||||
The Zend Engine 1.0 provided only three scopes: the global
|
||||
scope, the class scope and the function scope. All scopes but
|
||||
classes could contain variables, only the class and global
|
||||
scopes could contain functions, while only the global scope
|
||||
could contain constants and classes. This means that all of the
|
||||
Zend Engine 1.0's scoping methods were inherently limited for
|
||||
solving symbol name collision problems.
|
||||
|
||||
The Zend Engine 2.0 introduces the concept of namespaces to
|
||||
manage the symbol collision problem by making it possible to
|
||||
define multiple symbol tables able to contain all types of
|
||||
symbols. The Zend Engine is aware of a current namespace,
|
||||
defaulting to the current global one. The current namespace may
|
||||
be changed on a file-by-file basis. Symbols in other namespaces
|
||||
than the current one may be referenced using a new namespace
|
||||
operator. It is possible to "import" symbols from one namespace
|
||||
into another.
|
||||
|
||||
Old code that does not take advantage of namespaces will run
|
||||
without modifications.
|
||||
|
||||
Changes in the Zend Engine 1.0
|
||||
|
||||
The Zend Engine was designed from the ground up for increased speed,
|
||||
reduced memory consumption and more reliable execution. We dare say
|
||||
it meets all of these goals and does so pretty well. Beyond that,
|
||||
there are several improvements in the language engine features:
|
||||
|
||||
* References support.
|
||||
|
||||
$foo = &$a; would make $foo and $a be two names to the same
|
||||
variable. This works with arrays as well, on either side; e.g.,
|
||||
$foo = &$a[7]; would make $foo and $a[7] be two names to the
|
||||
same variable. Changing one would change the other and vice
|
||||
versa.
|
||||
|
||||
* Object overloading support.
|
||||
|
||||
This feature allows various OO libraries to use the OO notation
|
||||
of PHP to access their functionality. Right now, no use is made
|
||||
of that feature, but we'd have a COM module ready by the time
|
||||
PHP 4.0 is released. A CORBA module would probably follow.
|
||||
|
||||
* include() and eval() are now functions, and not statements.
|
||||
|
||||
That means they return a value. The default return value from
|
||||
include() and eval() is 1, so that you can do if (include())
|
||||
without further coding. The return value may be changed by
|
||||
returning a value from the global scope of the included file or
|
||||
the evaluated string. For example, if 'return 7;' is executed in
|
||||
the global scope of foo.inc, include("foo.inc") would evaluate
|
||||
to 7.
|
||||
|
||||
* Automatic resource deallocation.
|
||||
|
||||
Several people have been bitten by the fact that PHP 3.0 had no
|
||||
concept of reference counting. The Zend Engine adds full
|
||||
reference counting for every value in the system, including
|
||||
resources. As soon as a resource is no longer referenced from
|
||||
any variable, it is automatically destroyed to save memory and
|
||||
resources. The most obvious example for the advantage in this is
|
||||
a loop that has an SQL query inside it, something like '$result
|
||||
= sql_query(...);'. In PHP 3.0, every iteration resulted in
|
||||
another SQL result-set allocated in the memory, and all of the
|
||||
result sets weren't destroyed until the end of the script's
|
||||
execution. With the Zend Engine, as soon as we overwrite an old
|
||||
result set with a new one, the old result set which is no longer
|
||||
referenced, is destroyed.
|
||||
|
||||
* Full support for nesting arrays and objects within each other,
|
||||
in as many levels as you want.
|
||||
|
||||
* true and false are now constants of type boolean.
|
||||
|
||||
Comparing any other value to them would convert that value to a
|
||||
boolean first, and conduct the comparison later. That means, for
|
||||
example, that 5==true would evaluate to true (in PHP 3.0, true
|
||||
was nothing but a constant for the integer value of 1, so
|
||||
5==true was identical to 5==1, which was false).
|
||||
|
||||
* Runtime binding of function names.
|
||||
|
||||
This complex name has a simple explanation - you can now call
|
||||
functions before they're declared!
|
||||
|
||||
* Added here-docs support.
|
||||
|
||||
* Added foreach.
|
||||
|
||||
Two syntaxes supported:
|
||||
|
||||
foreach(array_expr as $val) statement
|
||||
foreach(array_expr as $key => $val) statement
|
||||
|
||||
* A true unset() implementation.
|
||||
|
||||
A variable or element that is unset(), is now sent to oblivion
|
||||
in its entirely, no trace remains from it.
|
||||
|
||||
* Output buffering support.
|
||||
|
||||
Use ob_start() to begin output buffering, ob_end_flush() to end
|
||||
buffering and send out the buffered contents, ob_end_clean() to
|
||||
end buffering without sending the buffered contents, and
|
||||
ob_get_contents() to retreive the current contents of the output
|
||||
buffer. Header information (header(), content type, cookies) are
|
||||
not buffered. By turning on output buffering, you can
|
||||
effectively send header information all throughout your file,
|
||||
regardless of whether you've emitted body output or not.
|
||||
|
||||
* Full variable reference within quoted strings:
|
||||
|
||||
${expr} - full indirect reference support for scalar
|
||||
variables
|
||||
{variable} - full variable support
|
||||
|
||||
For example:
|
||||
|
||||
$foo[5]["bar"] = "foobar";
|
||||
print "{$foo[5]["bar"]}"; // would print "foobar"
|
||||
|
||||
* Ability to call member functions of other classes from within
|
||||
member functions or from the global scope.
|
||||
|
||||
You can now, for example, override a parent function with a
|
||||
child function, and call the parent function from it.
|
||||
|
||||
* Runtime information for classes (class name, parent, available
|
||||
functions, etc.).
|
||||
|
||||
* Much more efficient syntax highlighter - runs much quicker,
|
||||
performs more reliably, and generates much tighter HTML.
|
||||
|
||||
* A full-featured debugger has been integrated with the language
|
||||
(supports breakpoints, expression evaluation, step-in/over,
|
||||
function call backtrace, and more).
|
||||
|
||||
The Zend Engine claims 100% compatability with the engine of PHP
|
||||
3.0, and is shamelessly lying about it. Here's why:
|
||||
|
||||
* Static variable initializers only accept scalar values
|
||||
(in PHP 3.0 they accepted any valid expression). The impact
|
||||
should be somewhere in between void and non existent, since
|
||||
initializing a static variable with anything but a simple
|
||||
static value makes no sense at all.
|
||||
|
||||
* The scope of break and continue is local to that of an
|
||||
include()'d file or an eval()'d string. The impact should
|
||||
be somewhat smaller of the one above.
|
||||
|
||||
* The return statement no longer works from a require()'d file. It
|
||||
hardly worked in PHP 3.0, so the impact should be fairly small. If
|
||||
you want this functionality - use include() instead.
|
||||
|
||||
* unset() is no longer a function, but a statement.
|
||||
|
||||
* The following letter combination is not supported within
|
||||
encapsulated strings: "{$". If you have a string that includes
|
||||
this letter combination, for example, print "{$somevar"; (which
|
||||
printed the letter { and the contents of the variable $somevar in
|
||||
PHP 3.0), it will result in a parse error with the Zend Engine.
|
||||
In this case, you would have to change the code to print
|
||||
"\{$somevar"; This incompatability is due to the full variable
|
||||
reference within quoted strings feature added in the Zend
|
||||
Engine.
|
||||
-502
@@ -1,502 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="Zend" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=Zend - Win32 Release_inline
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "Zend.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "Zend.mak" CFG="Zend - Win32 Release_inline"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "Zend - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "Zend - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "Zend - Win32 Release_inline" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "Zend - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDebug" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug" /D "_LIB" /D "Zend_EXPORTS" /D ZEND_DEBUG=0 /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /FR /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x40d /d "NDebug"
|
||||
# ADD RSC /l 0x40d /d "NDebug"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_Debug" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_Debug" /D "_LIB" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D ZEND_DEBUG=1 /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x40d /d "_Debug"
|
||||
# ADD RSC /l 0x40d /d "_Debug"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Output_Dir "Zend___Win32_Release_inline"
|
||||
# PROP BASE Intermediate_Dir "Zend___Win32_Release_inline"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Output_Dir "Release_inline"
|
||||
# PROP Intermediate_Dir "Release_inline"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug" /D "_LIB" /D "Zend_EXPORTS" /D ZEND_DEBUG=0 /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /FR /FD /c
|
||||
# SUBTRACT BASE CPP /YX
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug" /D "_LIB" /D "Zend_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /FR /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x40d /d "NDebug"
|
||||
# ADD RSC /l 0x40d /d "NDebug"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "Zend - Win32 Release"
|
||||
# Name "Zend - Win32 Debug"
|
||||
# Name "Zend - Win32 Release_inline"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_alloc.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_API.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_builtin_functions.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_compile.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_constants.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_execute.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_execute_API.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_extensions.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_hash.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_highlight.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_indent.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ini.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ini_parser.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ini_scanner.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend_language_parser.c"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend_language_scanner.c"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_list.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_llist.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_opcode.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_operators.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ptr_stack.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_qsort.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_sprintf.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_stack.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_variables.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\FlexLexer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_alloc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_API.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_builtin_functions.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_compile.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_config.w32.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_constants.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_errors.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_execute.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_extensions.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_fast_cache.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_globals.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_hash.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_highlight.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_indent.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ini.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend_language_parser.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend_language_scanner.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_list.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_llist.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_modules.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_operators.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ptr_stack.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_qsort.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_stack.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_variables.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Parsers"
|
||||
|
||||
# PROP Default_Filter "y"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ini_parser.y
|
||||
|
||||
!IF "$(CFG)" == "Zend - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=.
|
||||
InputPath=.\zend_ini_parser.y
|
||||
|
||||
BuildCmds= \
|
||||
bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
|
||||
|
||||
"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
|
||||
"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend_language_parser.y"
|
||||
|
||||
!IF "$(CFG)" == "Zend - Win32 Release"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=.
|
||||
InputPath=".\zend_language_parser.y"
|
||||
|
||||
BuildCmds= \
|
||||
bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
|
||||
|
||||
"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
|
||||
"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=.
|
||||
InputPath=".\zend_language_parser.y"
|
||||
|
||||
BuildCmds= \
|
||||
bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
|
||||
|
||||
"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
|
||||
"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=.
|
||||
InputPath=".\zend_language_parser.y"
|
||||
|
||||
BuildCmds= \
|
||||
bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
|
||||
|
||||
"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
|
||||
"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Scanners"
|
||||
|
||||
# PROP Default_Filter "l"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\flex.skl
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ini_scanner.l
|
||||
|
||||
!IF "$(CFG)" == "Zend - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
|
||||
|
||||
# Begin Custom Build
|
||||
InputPath=.\zend_ini_scanner.l
|
||||
|
||||
"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend_language_scanner.l"
|
||||
|
||||
!IF "$(CFG)" == "Zend - Win32 Release"
|
||||
|
||||
# Begin Custom Build
|
||||
InputPath=".\zend_language_scanner.l"
|
||||
|
||||
"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
flex -i -Pzend -ozend_language_scanner.c zend_language_scanner.l
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
|
||||
|
||||
# Begin Custom Build
|
||||
InputPath=".\zend_language_scanner.l"
|
||||
|
||||
"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
flex -i -Pzend -ozend_language_scanner.c zend_language_scanner.l
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
|
||||
|
||||
# Begin Custom Build
|
||||
InputPath=".\zend_language_scanner.l"
|
||||
|
||||
"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
flex -i -Pzend -ozend_language_scanner.c zend_language_scanner.l
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Text Files"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ZEND_BUGS
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ZEND_CHANGES
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ZEND_TODO
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resources"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend.ico
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
-197
@@ -1,197 +0,0 @@
|
||||
|
||||
AC_DEFUN(LIBZEND_BISON_CHECK,[
|
||||
|
||||
if test "$YACC" != "bison -y"; then
|
||||
AC_MSG_WARN(You will need bison if you want to regenerate the Zend parser.)
|
||||
else
|
||||
AC_MSG_CHECKING(bison version)
|
||||
set `bison --version| sed -e 's/^GNU Bison version //' -e 's/\./ /'`
|
||||
if test "${1}" = "1" -a "${2}" -lt "28"; then
|
||||
AC_MSG_WARN(You will need bison 1.28 if you want to regenerate the Zend parser (found ${1}.${2}).)
|
||||
fi
|
||||
AC_MSG_RESULT(${1}.${2} (ok))
|
||||
fi
|
||||
|
||||
])
|
||||
|
||||
AC_DEFUN(LIBZEND_BASIC_CHECKS,[
|
||||
|
||||
AC_REQUIRE([AC_PROG_YACC])
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
AC_REQUIRE([AC_PROG_CC_C_O])
|
||||
AC_REQUIRE([AC_PROG_LEX])
|
||||
AC_REQUIRE([AC_HEADER_STDC])
|
||||
AC_REQUIRE([AC_PROG_LIBTOOL])
|
||||
|
||||
LIBZEND_BISON_CHECK
|
||||
|
||||
dnl Ugly hack to get around a problem with gcc on AIX.
|
||||
if test "$CC" = "gcc" -a "$ac_cv_prog_cc_g" = "yes" -a \
|
||||
"`uname -sv`" = "AIX 4"; then
|
||||
CFLAGS=`echo $CFLAGS | sed -e 's/-g//'`
|
||||
fi
|
||||
|
||||
dnl Hack to work around a Mac OS X cpp problem
|
||||
dnl Known versions needing this workaround are 5.3 and 5.4
|
||||
if test "$ac_cv_prog_gcc" = "yes" -a "`uname -s`" = "Rhapsody"; then
|
||||
CPPFLAGS="$CPPFLAGS -traditional-cpp"
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADERS(
|
||||
limits.h \
|
||||
malloc.h \
|
||||
string.h \
|
||||
unistd.h \
|
||||
stdarg.h \
|
||||
sys/types.h \
|
||||
sys/time.h \
|
||||
signal.h \
|
||||
unix.h \
|
||||
dlfcn.h)
|
||||
|
||||
AC_TYPE_SIZE_T
|
||||
AC_TYPE_SIGNAL
|
||||
|
||||
AC_CHECK_LIB(dl, dlopen, [LIBS="-ldl $LIBS"])
|
||||
AC_CHECK_FUNC(dlopen,[AC_DEFINE(HAVE_LIBDL, 1,[ ])])
|
||||
|
||||
dnl
|
||||
dnl Ugly hack to check if dlsym() requires a leading underscore in symbol name.
|
||||
dnl
|
||||
AC_MSG_CHECKING([whether dlsym() requires a leading underscode in symbol names])
|
||||
_LT_AC_TRY_DLOPEN_SELF([
|
||||
AC_MSG_RESULT(no)
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(DLSYM_NEEDS_UNDERSCORE, 1, [Define if dlsym() requires a leading underscode in symbol names. ])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
], [])
|
||||
|
||||
dnl This is required for QNX and may be some BSD derived systems
|
||||
AC_CHECK_TYPE( uint, unsigned int )
|
||||
AC_CHECK_TYPE( ulong, unsigned long )
|
||||
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_FUNC_VPRINTF
|
||||
AC_FUNC_MEMCMP
|
||||
AC_FUNC_ALLOCA
|
||||
AC_CHECK_FUNCS(memcpy strdup getpid kill strtod strtol finite fpclass)
|
||||
AC_ZEND_BROKEN_SPRINTF
|
||||
|
||||
AC_CHECK_FUNCS(finite isfinite isinf isnan)
|
||||
|
||||
ZEND_FP_EXCEPT
|
||||
|
||||
])
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
AC_DEFUN(LIBZEND_ENABLE_DEBUG,[
|
||||
|
||||
AC_ARG_ENABLE(debug,
|
||||
[ --enable-debug Compile with debugging symbols],[
|
||||
ZEND_DEBUG=$enableval
|
||||
],[
|
||||
ZEND_DEBUG=no
|
||||
])
|
||||
|
||||
])
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
AC_DEFUN(LIBZEND_OTHER_CHECKS,[
|
||||
|
||||
AC_ARG_ENABLE(experimental-zts,
|
||||
[ --enable-experimental-zts This will most likely break your build],[
|
||||
ZEND_EXPERIMENTAL_ZTS=$enableval
|
||||
],[
|
||||
ZEND_EXPERIMENTAL_ZTS=no
|
||||
])
|
||||
|
||||
AC_ARG_ENABLE(inline-optimization,
|
||||
[ --enable-inline-optimization If you have much memory and are using
|
||||
gcc, you might try this.],[
|
||||
ZEND_INLINE_OPTIMIZATION=$enableval
|
||||
],[
|
||||
ZEND_INLINE_OPTIMIZATION=no
|
||||
])
|
||||
|
||||
AC_ARG_ENABLE(memory-limit,
|
||||
[ --enable-memory-limit Compile with memory limit support. ], [
|
||||
ZEND_MEMORY_LIMIT=$enableval
|
||||
],[
|
||||
ZEND_MEMORY_LIMIT=no
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING(whether to enable experimental ZTS)
|
||||
AC_MSG_RESULT($ZEND_EXPERIMENTAL_ZTS)
|
||||
|
||||
AC_MSG_CHECKING(whether to enable inline optimization for GCC)
|
||||
AC_MSG_RESULT($ZEND_INLINE_OPTIMIZATION)
|
||||
|
||||
AC_MSG_CHECKING(whether to enable a memory limit)
|
||||
AC_MSG_RESULT($ZEND_MEMORY_LIMIT)
|
||||
|
||||
AC_MSG_CHECKING(whether to enable Zend debugging)
|
||||
AC_MSG_RESULT($ZEND_DEBUG)
|
||||
|
||||
if test "$ZEND_DEBUG" = "yes"; then
|
||||
AC_DEFINE(ZEND_DEBUG,1,[ ])
|
||||
echo " $CFLAGS" | grep ' -g' >/dev/null || DEBUG_CFLAGS="-g"
|
||||
if test "$CFLAGS" = "-g -O2"; then
|
||||
CFLAGS=-g
|
||||
fi
|
||||
test -n "$GCC" && DEBUG_CFLAGS="$DEBUG_CFLAGS -Wall"
|
||||
test -n "$GCC" && test "$USE_MAINTAINER_MODE" = "yes" && \
|
||||
DEBUG_CFLAGS="$DEBUG_CFLAGS -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations"
|
||||
else
|
||||
AC_DEFINE(ZEND_DEBUG,0,[ ])
|
||||
fi
|
||||
|
||||
test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
|
||||
|
||||
if test "$ZEND_EXPERIMENTAL_ZTS" = "yes"; then
|
||||
AC_DEFINE(ZTS,1,[ ])
|
||||
CFLAGS="$CFLAGS -DZTS"
|
||||
LIBZEND_CPLUSPLUS_CHECKS
|
||||
fi
|
||||
|
||||
if test "$ZEND_MEMORY_LIMIT" = "yes"; then
|
||||
AC_DEFINE(MEMORY_LIMIT, 1, [Memory limit])
|
||||
else
|
||||
AC_DEFINE(MEMORY_LIMIT, 0, [Memory limit])
|
||||
fi
|
||||
|
||||
|
||||
changequote({,})
|
||||
if test -n "$GCC" && test "$ZEND_INLINE_OPTIMIZATION" != "yes"; then
|
||||
INLINE_CFLAGS=`echo $ac_n "$CFLAGS $ac_c" | sed s/-O[0-9s]*//`
|
||||
else
|
||||
INLINE_CFLAGS="$CFLAGS"
|
||||
fi
|
||||
changequote([,])
|
||||
|
||||
AC_C_INLINE
|
||||
|
||||
AC_SUBST(INLINE_CFLAGS)
|
||||
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN(LIBZEND_CPLUSPLUS_CHECKS,[
|
||||
|
||||
])
|
||||
|
||||
@@ -1,258 +0,0 @@
|
||||
# Microsoft Developer Studio Generated Dependency File, included by ZendCore.mak
|
||||
|
||||
.\zend_alloc.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\zend_compile.h"\
|
||||
".\zend_config.w32.h"\
|
||||
".\zend_execute.h"\
|
||||
".\zend_llist.h"\
|
||||
".\zend_ptr_stack.h"\
|
||||
".\zend_stack.h"\
|
||||
".\zend.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_globals.h"\
|
||||
".\zend_hash.h"\
|
||||
|
||||
|
||||
.\alloca.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_config.w32.h"\
|
||||
".\zend.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_hash.h"\
|
||||
|
||||
|
||||
.\zend_compile.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\zend_compile.h"\
|
||||
".\zend_config.w32.h"\
|
||||
".\zend_execute.h"\
|
||||
".\zend_llist.h"\
|
||||
".\zend_modules.h"\
|
||||
".\zend_operators.h"\
|
||||
".\zend_ptr_stack.h"\
|
||||
".\zend_stack.h"\
|
||||
".\zend_variables.h"\
|
||||
".\zend.h"\
|
||||
".\zend_API.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_globals.h"\
|
||||
".\zend_hash.h"\
|
||||
".\zend_ini.h"\
|
||||
|
||||
|
||||
.\zend_constants.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\zend_config.w32.h"\
|
||||
".\zend_constants.h"\
|
||||
".\zend_operators.h"\
|
||||
".\zend_variables.h"\
|
||||
".\zend.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_hash.h"\
|
||||
|
||||
|
||||
.\zend_execute.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\zend_compile.h"\
|
||||
".\zend_config.w32.h"\
|
||||
".\zend_constants.h"\
|
||||
".\zend_execute.h"\
|
||||
".\zend_llist.h"\
|
||||
".\zend_modules.h"\
|
||||
".\zend_operators.h"\
|
||||
".\zend_ptr_stack.h"\
|
||||
".\zend_stack.h"\
|
||||
".\zend_variables.h"\
|
||||
".\zend.h"\
|
||||
".\zend_API.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_globals.h"\
|
||||
".\zend_hash.h"\
|
||||
".\zend_ini.h"\
|
||||
|
||||
|
||||
.\zend_highlight.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\zend_compile.h"\
|
||||
".\zend_config.w32.h"\
|
||||
".\zend_execute.h"\
|
||||
".\zend_highlight.h"\
|
||||
".\zend_llist.h"\
|
||||
".\zend_ptr_stack.h"\
|
||||
".\zend_stack.h"\
|
||||
".\zend_language_parser.tab.h"\
|
||||
".\zend.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_globals.h"\
|
||||
".\zend_hash.h"\
|
||||
|
||||
|
||||
.\zend_llist.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\zend_config.w32.h"\
|
||||
".\zend_llist.h"\
|
||||
".\zend.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_hash.h"\
|
||||
|
||||
|
||||
.\zend_opcode.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\zend_compile.h"\
|
||||
".\zend_config.w32.h"\
|
||||
".\zend_execute.h"\
|
||||
".\zend_llist.h"\
|
||||
".\zend_modules.h"\
|
||||
".\zend_operators.h"\
|
||||
".\zend_ptr_stack.h"\
|
||||
".\zend_stack.h"\
|
||||
".\zend_variables.h"\
|
||||
".\zend.h"\
|
||||
".\zend_API.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_globals.h"\
|
||||
".\zend_hash.h"\
|
||||
".\zend_ini.h"\
|
||||
|
||||
|
||||
.\zend_operators.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\zend_compile.h"\
|
||||
".\zend_config.w32.h"\
|
||||
".\zend_execute.h"\
|
||||
".\zend_llist.h"\
|
||||
".\zend_operators.h"\
|
||||
".\zend_ptr_stack.h"\
|
||||
".\zend_stack.h"\
|
||||
".\zend_variables.h"\
|
||||
".\zend.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_globals.h"\
|
||||
".\zend_hash.h"\
|
||||
|
||||
|
||||
.\zend_ptr_stack.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\zend_config.w32.h"\
|
||||
".\zend_ptr_stack.h"\
|
||||
".\zend.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_hash.h"\
|
||||
|
||||
|
||||
.\zend_stack.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\zend_config.w32.h"\
|
||||
".\zend_stack.h"\
|
||||
".\zend.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_hash.h"\
|
||||
|
||||
|
||||
.\zend_variables.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\zend_compile.h"\
|
||||
".\zend_config.w32.h"\
|
||||
".\zend_constants.h"\
|
||||
".\zend_execute.h"\
|
||||
".\zend_llist.h"\
|
||||
".\zend_modules.h"\
|
||||
".\zend_ptr_stack.h"\
|
||||
".\zend_stack.h"\
|
||||
".\zend_variables.h"\
|
||||
".\zend.h"\
|
||||
".\zend_API.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_globals.h"\
|
||||
".\zend_hash.h"\
|
||||
".\zend_ini.h"\
|
||||
".\zend_list.h"\
|
||||
|
||||
|
||||
.\zend.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\zend_config.w32.h"\
|
||||
".\zend_operators.h"\
|
||||
".\zend_variables.h"\
|
||||
".\zend.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_hash.h"\
|
||||
|
||||
|
||||
.\zend_API.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\zend_compile.h"\
|
||||
".\zend_config.w32.h"\
|
||||
".\zend_constants.h"\
|
||||
".\zend_execute.h"\
|
||||
".\zend_llist.h"\
|
||||
".\zend_modules.h"\
|
||||
".\zend_operators.h"\
|
||||
".\zend_ptr_stack.h"\
|
||||
".\zend_stack.h"\
|
||||
".\zend_variables.h"\
|
||||
".\zend.h"\
|
||||
".\zend_API.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_globals.h"\
|
||||
".\zend_hash.h"\
|
||||
".\zend_ini.h"\
|
||||
".\zend_list.h"\
|
||||
|
||||
|
||||
.\zend_hash.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_config.w32.h"\
|
||||
".\zend.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_hash.h"\
|
||||
|
||||
|
||||
.\zend_ini.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\zend_config.w32.h"\
|
||||
".\zend.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_hash.h"\
|
||||
".\zend_ini.h"\
|
||||
|
||||
|
||||
!IF "$(CFG)" == "ZendCore - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "ZendCore - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "ZendCore - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "ZendCore - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
-659
@@ -1,659 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="ZendTS" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=ZendTS - Win32 Release_TSDbg
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "ZendTS.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "ZendTS.mak" CFG="ZendTS - Win32 Release_TSDbg"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "ZendTS - Win32 Release_TS" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "ZendTS - Win32 Debug_TS" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "ZendTS - Win32 Release_TS_inline" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "ZendTS - Win32 Release_TSDbg" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Output_Dir "Release_TS"
|
||||
# PROP BASE Intermediate_Dir "Release_TS"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Output_Dir "Release_TS"
|
||||
# PROP Intermediate_Dir "Release_TS"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDebug_TS" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x40d /d "NDebug_TS"
|
||||
# ADD RSC /l 0x40d /d "NDebug_TS"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Output_Dir "Debug_TS"
|
||||
# PROP BASE Intermediate_Dir "Debug_TS"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Output_Dir "Debug_TS"
|
||||
# PROP Intermediate_Dir "Debug_TS"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_Debug_TS" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_Debug_TS" /D ZEND_DEBUG=1 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x40d /d "_Debug_TS"
|
||||
# ADD RSC /l 0x40d /d "_Debug_TS"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Output_Dir "ZendTS___Win32_Release_TS_inline"
|
||||
# PROP BASE Intermediate_Dir "ZendTS___Win32_Release_TS_inline"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Output_Dir "Release_TS_inline"
|
||||
# PROP Intermediate_Dir "Release_TS_inline"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /FD /c
|
||||
# SUBTRACT BASE CPP /YX
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x40d /d "NDebug_TS"
|
||||
# ADD RSC /l 0x40d /d "NDebug_TS"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Output_Dir "ZendTS___Win32_Release_TSDbg"
|
||||
# PROP BASE Intermediate_Dir "ZendTS___Win32_Release_TSDbg"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Output_Dir "Release_TSDbg"
|
||||
# PROP Intermediate_Dir "Release_TSDbg"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
|
||||
# SUBTRACT BASE CPP /YX
|
||||
# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x40d /d "NDebug_TS"
|
||||
# ADD RSC /l 0x40d /d "NDebug_TS"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "ZendTS - Win32 Release_TS"
|
||||
# Name "ZendTS - Win32 Debug_TS"
|
||||
# Name "ZendTS - Win32 Release_TS_inline"
|
||||
# Name "ZendTS - Win32 Release_TSDbg"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_alloc.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_API.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_builtin_functions.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_compile.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_constants.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_dynamic_array.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_execute.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_execute_API.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_extensions.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_hash.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_highlight.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_indent.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ini.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ini_parser.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ini_scanner.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend_language_parser.c"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_language_scanner.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_list.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_llist.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_objects.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_opcode.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_operators.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ptr_stack.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_qsort.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_sprintf.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_stack.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_variables.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\FlexLexer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_alloc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_API.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_builtin_functions.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_compile.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_config.w32.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_constants.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_dynamic_array.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_errors.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_execute.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_execute_locks.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_extensions.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_fast_cache.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_globals.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_globals_macros.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_hash.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_highlight.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_indent.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ini.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ini_parser.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ini_scanner.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_istdiostream.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend_language_parser.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend_language_scanner.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_list.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_llist.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_modules.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_objects.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_operators.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ptr_stack.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_qsort.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_stack.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_variables.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Parsers"
|
||||
|
||||
# PROP Default_Filter "y"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ini_parser.y
|
||||
|
||||
!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=.
|
||||
InputPath=.\zend_ini_parser.y
|
||||
|
||||
BuildCmds= \
|
||||
bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
|
||||
|
||||
"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
|
||||
"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=.
|
||||
InputPath=.\zend_ini_parser.y
|
||||
|
||||
BuildCmds= \
|
||||
bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
|
||||
|
||||
"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
|
||||
"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=.
|
||||
InputPath=.\zend_ini_parser.y
|
||||
|
||||
BuildCmds= \
|
||||
bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
|
||||
|
||||
"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
|
||||
"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=.
|
||||
InputPath=.\zend_ini_parser.y
|
||||
|
||||
BuildCmds= \
|
||||
bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
|
||||
|
||||
"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
|
||||
"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend_language_parser.y"
|
||||
|
||||
!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=.
|
||||
InputPath=".\zend_language_parser.y"
|
||||
|
||||
BuildCmds= \
|
||||
bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
|
||||
|
||||
"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
|
||||
"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=.
|
||||
InputPath=".\zend_language_parser.y"
|
||||
|
||||
BuildCmds= \
|
||||
bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
|
||||
|
||||
"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
|
||||
"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=.
|
||||
InputPath=".\zend_language_parser.y"
|
||||
|
||||
BuildCmds= \
|
||||
bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
|
||||
|
||||
"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
|
||||
"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=.
|
||||
InputPath=".\zend_language_parser.y"
|
||||
|
||||
BuildCmds= \
|
||||
bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
|
||||
|
||||
"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
|
||||
"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Scanners"
|
||||
|
||||
# PROP Default_Filter "l"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\flex.skl
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ini_scanner.l
|
||||
|
||||
!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
|
||||
|
||||
# Begin Custom Build
|
||||
InputPath=.\zend_ini_scanner.l
|
||||
|
||||
"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
|
||||
|
||||
# Begin Custom Build
|
||||
InputPath=.\zend_ini_scanner.l
|
||||
|
||||
"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
|
||||
|
||||
# Begin Custom Build
|
||||
InputPath=.\zend_ini_scanner.l
|
||||
|
||||
"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
|
||||
|
||||
# Begin Custom Build
|
||||
InputPath=.\zend_ini_scanner.l
|
||||
|
||||
"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend_language_scanner.l"
|
||||
|
||||
!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
|
||||
|
||||
# Begin Custom Build
|
||||
InputPath=".\zend_language_scanner.l"
|
||||
|
||||
"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
|
||||
|
||||
# Begin Custom Build
|
||||
InputPath=".\zend_language_scanner.l"
|
||||
|
||||
"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
|
||||
|
||||
# Begin Custom Build
|
||||
InputPath=".\zend_language_scanner.l"
|
||||
|
||||
"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
|
||||
|
||||
# Begin Custom Build
|
||||
InputPath=".\zend_language_scanner.l"
|
||||
|
||||
"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Text Files"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LICENSE
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ZEND_BUGS
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ZEND_CHANGES
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resources"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend.ico
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -1,76 +0,0 @@
|
||||
#define ZEND_API
|
||||
#define ZEND_DLEXPORT
|
||||
|
||||
@TOP@
|
||||
|
||||
#undef uint
|
||||
#undef ulong
|
||||
|
||||
/* Define if you want to enable memory limit support */
|
||||
#define MEMORY_LIMIT 0
|
||||
|
||||
@BOTTOM@
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_IEEEFP_H
|
||||
# include <ieeefp.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#if ZEND_BROKEN_SPRINTF
|
||||
int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#else
|
||||
# define zend_sprintf sprintf
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#ifdef HAVE_ISNAN
|
||||
#define zend_isnan(a) isnan(a)
|
||||
#elif defined(NAN)
|
||||
#define zend_isnan(a) (((a)==NAN)?1:0)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
|
||||
#else
|
||||
#define zend_isnan(a) 0
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ISINF
|
||||
#define zend_isinf(a) isinf(a)
|
||||
#elif defined(INFINITY)
|
||||
/* Might not work, but is required by ISO C99 */
|
||||
#define zend_isinf(a) (((a)==INFINITY)?1:0)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
|
||||
#else
|
||||
#define zend_isinf(a) 0
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FINITE
|
||||
#define zend_finite(a) finite(a)
|
||||
#elif defined(HAVE_ISFINITE) || defined(isfinite)
|
||||
#define zend_finite(a) isfinite(a)
|
||||
#elif defined(fpclassify)
|
||||
#define zend_finite(a) ((fpclassify((a))!=FP_INFINITE&&fpclassify((a))!=FP_NAN)?1:0)
|
||||
#else
|
||||
#define zend_finite(a) (zend_isnan(a) ? 0 : zend_isinf(a) ? 0 : 1)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -1,47 +0,0 @@
|
||||
dnl $Id$
|
||||
dnl
|
||||
dnl This file contains local autoconf functions.
|
||||
|
||||
AC_DEFUN(ZEND_FP_EXCEPT,[
|
||||
AC_CACHE_CHECK(whether fp_except is defined, ac_cv_type_fp_except,[
|
||||
AC_TRY_COMPILE([
|
||||
#include <floatingpoint.h>
|
||||
],[
|
||||
fp_except x = (fp_except) 0;
|
||||
],[
|
||||
ac_cv_type_fp_except=yes
|
||||
],[
|
||||
ac_cv_type_fp_except=no
|
||||
],[
|
||||
ac_cv_type_fp_except=no
|
||||
])])
|
||||
if test "$ac_cv_type_fp_except" = "yes"; then
|
||||
AC_DEFINE(HAVE_FP_EXCEPT, 1, [whether floatingpoint.h defines fp_except])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Check for broken sprintf()
|
||||
dnl
|
||||
AC_DEFUN(AC_ZEND_BROKEN_SPRINTF,[
|
||||
AC_CACHE_CHECK(whether sprintf is broken, ac_cv_broken_sprintf,[
|
||||
AC_TRY_RUN([main() {char buf[20];exit(sprintf(buf,"testing 123")!=11); }],[
|
||||
ac_cv_broken_sprintf=no
|
||||
],[
|
||||
ac_cv_broken_sprintf=yes
|
||||
],[
|
||||
ac_cv_broken_sprintf=no
|
||||
])
|
||||
])
|
||||
if test "$ac_cv_broken_sprintf" = "yes"; then
|
||||
ac_result=1
|
||||
else
|
||||
ac_result=0
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(ZEND_BROKEN_SPRINTF, $ac_result, [Whether sprintf is broken])
|
||||
])
|
||||
|
||||
AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[
|
||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
|
||||
])
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
# Makefile to generate build tools
|
||||
#
|
||||
# Standard usage:
|
||||
# make -f build.mk
|
||||
#
|
||||
# Written by Sascha Schumann
|
||||
#
|
||||
# $Id$
|
||||
|
||||
|
||||
LT_TARGETS = ltmain.sh ltconfig
|
||||
|
||||
config_h_in = zend_config.h.in
|
||||
|
||||
makefile_am_files = Makefile.am
|
||||
makefile_in_files = $(makefile_am_files:.am=.in)
|
||||
makefile_files = $(makefile_am_files:e.am=e)
|
||||
|
||||
targets = $(makefile_in_files) $(LT_TARGETS) configure $(config_h_in)
|
||||
|
||||
all: $(targets)
|
||||
|
||||
clean:
|
||||
rm -f $(targets)
|
||||
|
||||
$(LT_TARGETS):
|
||||
rm -f $(LT_TARGETS)
|
||||
libtoolize --automake $(AMFLAGS) -f
|
||||
|
||||
$(makefile_in_files): $(makefile_am_files)
|
||||
automake -a -i $(AMFLAGS) $(makefile_files)
|
||||
|
||||
aclocal.m4: configure.in acinclude.m4
|
||||
aclocal
|
||||
|
||||
$(config_h_in): configure.in acconfig.h
|
||||
# explicitly remove target since autoheader does not seem to work
|
||||
# correctly otherwise (timestamps are not updated)
|
||||
@rm -f $@
|
||||
autoheader
|
||||
|
||||
configure: aclocal.m4 configure.in
|
||||
autoconf
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
case "$1" in
|
||||
--copy)
|
||||
automake_flags=--copy
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
|
||||
libtoolize --force --automake $automake_flags
|
||||
|
||||
mv aclocal.m4 aclocal.m4.old 2>/dev/null
|
||||
aclocal
|
||||
if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then
|
||||
echo "buildconf: keeping ${1}aclocal.m4"
|
||||
mv aclocal.m4.old aclocal.m4
|
||||
else
|
||||
echo "buildconf: created or modified ${1}aclocal.m4"
|
||||
fi
|
||||
|
||||
autoheader
|
||||
|
||||
automake --add-missing --include-deps $automake_flags
|
||||
|
||||
mv configure configure.old 2>/dev/null
|
||||
autoconf
|
||||
if cmp configure.old configure > /dev/null 2>&1; then
|
||||
echo "buildconf: keeping ${1}configure"
|
||||
mv configure.old configure
|
||||
else
|
||||
echo "buildconf: created or modified ${1}configure"
|
||||
fi
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
dnl $Id$
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_INIT(zend.c)
|
||||
AM_INIT_AUTOMAKE(zend, 0.80A, nodefine)
|
||||
AM_CONFIG_HEADER(zend_config.h)
|
||||
AM_SANITY_CHECK
|
||||
AM_MAINTAINER_MODE
|
||||
AC_PROG_CC
|
||||
AM_PROG_LEX
|
||||
AM_PROG_CC_STDC
|
||||
ZEND_VERSION=$VERSION
|
||||
|
||||
dnl We want this one before the checks, so the checks can modify CFLAGS.
|
||||
test -z "$CFLAGS" && auto_cflags=1
|
||||
|
||||
sinclude(Zend.m4)
|
||||
|
||||
LIBZEND_BASIC_CHECKS
|
||||
|
||||
AM_PROG_LIBTOOL
|
||||
if test "$enable_debug" != "yes"; then
|
||||
AM_SET_LIBTOOL_VARIABLE([--silent])
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Check for /usr/pkg/{lib,include} which is where NetBSD puts binary
|
||||
dnl and source packages. This should be harmless on other OSs.
|
||||
dnl
|
||||
if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then
|
||||
CFLAGS="$CFLAGS -I/usr/pkg/include"
|
||||
LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
|
||||
fi
|
||||
|
||||
LIBZEND_ENABLE_DEBUG
|
||||
LIBZEND_OTHER_CHECKS
|
||||
|
||||
EXTRA_LIBS="$LIBS"
|
||||
LIBS=""
|
||||
AC_SUBST(EXTRA_LIBS)
|
||||
AC_OUTPUT(Makefile)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 4
|
||||
# End:
|
||||
-1628
File diff suppressed because it is too large.
Load diff
-880
@@ -1,880 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_extensions.h"
|
||||
#include "zend_modules.h"
|
||||
#include "zend_constants.h"
|
||||
#include "zend_list.h"
|
||||
#include "zend_API.h"
|
||||
#include "zend_builtin_functions.h"
|
||||
#include "zend_ini.h"
|
||||
|
||||
#ifdef ZTS
|
||||
# define GLOBAL_FUNCTION_TABLE global_function_table
|
||||
# define GLOBAL_CLASS_TABLE global_class_table
|
||||
# define GLOBAL_CONSTANTS_TABLE global_constants_table
|
||||
# define GLOBAL_AUTO_GLOBALS_TABLE global_auto_globals_table
|
||||
# define GLOBAL_NAMESPACES_TABLE global_namespaces_table
|
||||
#else
|
||||
# define GLOBAL_FUNCTION_TABLE CG(function_table)
|
||||
# define GLOBAL_CLASS_TABLE CG(class_table)
|
||||
# define GLOBAL_CONSTANTS_TABLE CG(zend_constants)
|
||||
# define GLOBAL_AUTO_GLOBALS_TABLE CG(auto_globals)
|
||||
# define GLOBAL_NAMESPACES_TABLE CG(namespaces)
|
||||
#endif
|
||||
|
||||
#if defined(ZEND_WIN32) && ZEND_DEBUG
|
||||
BOOL WINAPI IsDebuggerPresent(VOID);
|
||||
#endif
|
||||
|
||||
/* true multithread-shared globals */
|
||||
ZEND_API zend_class_entry zend_standard_class_def;
|
||||
ZEND_API int (*zend_printf)(const char *format, ...);
|
||||
ZEND_API zend_write_func_t zend_write;
|
||||
ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path);
|
||||
ZEND_API void (*zend_block_interruptions)(void);
|
||||
ZEND_API void (*zend_unblock_interruptions)(void);
|
||||
ZEND_API void (*zend_ticks_function)(int ticks);
|
||||
ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
|
||||
|
||||
static void (*zend_message_dispatcher_p)(long message, void *data);
|
||||
static int (*zend_get_configuration_directive_p)(char *name, uint name_length, zval *contents);
|
||||
|
||||
|
||||
#ifdef ZTS
|
||||
ZEND_API int compiler_globals_id;
|
||||
ZEND_API int executor_globals_id;
|
||||
ZEND_API int alloc_globals_id;
|
||||
HashTable *global_function_table;
|
||||
HashTable *global_class_table;
|
||||
HashTable *global_constants_table;
|
||||
HashTable *global_auto_globals_table;
|
||||
HashTable *global_namespaces_table;
|
||||
#endif
|
||||
|
||||
zend_utility_values zend_uv;
|
||||
|
||||
ZEND_API zval zval_used_for_init; /* True global variable */
|
||||
|
||||
/* version information */
|
||||
static char *zend_version_info;
|
||||
static uint zend_version_info_length;
|
||||
#define ZEND_CORE_VERSION_INFO "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998-2001 Zend Technologies\n"
|
||||
|
||||
|
||||
#define PRINT_ZVAL_INDENT 4
|
||||
|
||||
static void print_hash(HashTable *ht, int indent)
|
||||
{
|
||||
zval **tmp;
|
||||
char *string_key;
|
||||
HashPosition iterator;
|
||||
ulong num_key;
|
||||
uint str_len;
|
||||
int i;
|
||||
|
||||
for (i=0; i<indent; i++) {
|
||||
ZEND_PUTS(" ");
|
||||
}
|
||||
ZEND_PUTS("(\n");
|
||||
indent += PRINT_ZVAL_INDENT;
|
||||
zend_hash_internal_pointer_reset_ex(ht, &iterator);
|
||||
while (zend_hash_get_current_data_ex(ht, (void **) &tmp, &iterator) == SUCCESS) {
|
||||
for (i=0; i<indent; i++) {
|
||||
ZEND_PUTS(" ");
|
||||
}
|
||||
ZEND_PUTS("[");
|
||||
switch (zend_hash_get_current_key_ex(ht, &string_key, &str_len, &num_key, 0, &iterator)) {
|
||||
case HASH_KEY_IS_STRING:
|
||||
ZEND_PUTS(string_key);
|
||||
break;
|
||||
case HASH_KEY_IS_LONG:
|
||||
zend_printf("%ld", num_key);
|
||||
break;
|
||||
}
|
||||
ZEND_PUTS("] => ");
|
||||
zend_print_zval_r(*tmp, indent+PRINT_ZVAL_INDENT);
|
||||
ZEND_PUTS("\n");
|
||||
zend_hash_move_forward_ex(ht, &iterator);
|
||||
}
|
||||
indent -= PRINT_ZVAL_INDENT;
|
||||
for (i=0; i<indent; i++) {
|
||||
ZEND_PUTS(" ");
|
||||
}
|
||||
ZEND_PUTS(")\n");
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy)
|
||||
{
|
||||
if (expr->type==IS_STRING) {
|
||||
*use_copy = 0;
|
||||
return;
|
||||
}
|
||||
switch (expr->type) {
|
||||
case IS_NULL:
|
||||
expr_copy->value.str.len = 0;
|
||||
expr_copy->value.str.val = empty_string;
|
||||
break;
|
||||
case IS_BOOL:
|
||||
if (expr->value.lval) {
|
||||
expr_copy->value.str.len = 1;
|
||||
expr_copy->value.str.val = estrndup("1", 1);
|
||||
} else {
|
||||
expr_copy->value.str.len = 0;
|
||||
expr_copy->value.str.val = empty_string;
|
||||
}
|
||||
break;
|
||||
case IS_RESOURCE:
|
||||
expr_copy->value.str.val = (char *) emalloc(sizeof("Resource id #")-1 + MAX_LENGTH_OF_LONG);
|
||||
expr_copy->value.str.len = sprintf(expr_copy->value.str.val, "Resource id #%ld", expr->value.lval);
|
||||
break;
|
||||
case IS_ARRAY:
|
||||
expr_copy->value.str.len = sizeof("Array")-1;
|
||||
expr_copy->value.str.val = estrndup("Array", expr_copy->value.str.len);
|
||||
break;
|
||||
case IS_OBJECT:
|
||||
expr_copy->value.str.len = sizeof("Object")-1;
|
||||
expr_copy->value.str.val = estrndup("Object", expr_copy->value.str.len);
|
||||
break;
|
||||
default:
|
||||
*expr_copy = *expr;
|
||||
zval_copy_ctor(expr_copy);
|
||||
convert_to_string(expr_copy);
|
||||
break;
|
||||
}
|
||||
expr_copy->type = IS_STRING;
|
||||
*use_copy = 1;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_print_zval(zval *expr, int indent)
|
||||
{
|
||||
return zend_print_zval_ex(zend_write, expr, indent);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent)
|
||||
{
|
||||
zval expr_copy;
|
||||
int use_copy;
|
||||
|
||||
zend_make_printable_zval(expr, &expr_copy, &use_copy);
|
||||
if (use_copy) {
|
||||
expr = &expr_copy;
|
||||
}
|
||||
if (expr->value.str.len==0) { /* optimize away empty strings */
|
||||
if (use_copy) {
|
||||
zval_dtor(expr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
write_func(expr->value.str.val, expr->value.str.len);
|
||||
if (use_copy) {
|
||||
zval_dtor(expr);
|
||||
}
|
||||
return expr->value.str.len;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_print_zval_r(zval *expr, int indent)
|
||||
{
|
||||
zend_print_zval_r_ex(zend_write, expr, indent);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent)
|
||||
{
|
||||
switch(expr->type) {
|
||||
case IS_ARRAY:
|
||||
ZEND_PUTS("Array\n");
|
||||
if (++expr->value.ht->nApplyCount>1) {
|
||||
ZEND_PUTS(" *RECURSION*");
|
||||
expr->value.ht->nApplyCount=0;
|
||||
return;
|
||||
}
|
||||
print_hash(expr->value.ht, indent);
|
||||
expr->value.ht->nApplyCount--;
|
||||
break;
|
||||
case IS_OBJECT:
|
||||
{
|
||||
zend_object *object = Z_OBJ_P(expr);
|
||||
|
||||
if (++object->properties->nApplyCount>1) {
|
||||
ZEND_PUTS(" *RECURSION*");
|
||||
object->properties->nApplyCount=0;
|
||||
return;
|
||||
}
|
||||
zend_printf("%s Object\n", object->ce->name);
|
||||
print_hash(object->properties, indent);
|
||||
object->properties->nApplyCount--;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
zend_print_variable(expr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static FILE *zend_fopen_wrapper(const char *filename, char **opened_path)
|
||||
{
|
||||
if (opened_path) {
|
||||
*opened_path = estrdup(filename);
|
||||
}
|
||||
return fopen(filename, "rb");
|
||||
}
|
||||
|
||||
|
||||
static void register_standard_class(void)
|
||||
{
|
||||
zend_standard_class_def.type = ZEND_INTERNAL_CLASS;
|
||||
zend_standard_class_def.name_length = sizeof("stdClass") - 1;
|
||||
zend_standard_class_def.name = zend_strndup("stdClass", zend_standard_class_def.name_length);
|
||||
zend_standard_class_def.parent = NULL;
|
||||
zend_hash_init_ex(&zend_standard_class_def.default_properties, 0, NULL, ZVAL_PTR_DTOR, 1, 0);
|
||||
zend_hash_init_ex(&zend_standard_class_def.function_table, 0, NULL, ZEND_FUNCTION_DTOR, 1, 0);
|
||||
zend_standard_class_def.handle_function_call = NULL;
|
||||
zend_standard_class_def.handle_property_get = NULL;
|
||||
zend_standard_class_def.handle_property_set = NULL;
|
||||
zend_standard_class_def.refcount = (int *) malloc(sizeof(int));
|
||||
*zend_standard_class_def.refcount = 1;
|
||||
zend_hash_add(GLOBAL_CLASS_TABLE, "stdclass", sizeof("stdclass"), &zend_standard_class_def, sizeof(zend_class_entry), NULL);
|
||||
}
|
||||
|
||||
|
||||
static void zend_set_default_compile_time_values(TSRMLS_D)
|
||||
{
|
||||
/* default compile-time values */
|
||||
CG(asp_tags) = 0;
|
||||
CG(short_tags) = 1;
|
||||
CG(allow_call_time_pass_reference) = 1;
|
||||
CG(extended_info) = 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef ZTS
|
||||
static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS_DC)
|
||||
{
|
||||
zend_function tmp_func;
|
||||
zend_class_entry tmp_class;
|
||||
|
||||
compiler_globals->compiled_filename = NULL;
|
||||
|
||||
compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable));
|
||||
zend_hash_init_ex(compiler_globals->function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0);
|
||||
zend_hash_copy(compiler_globals->function_table, global_function_table, NULL, &tmp_func, sizeof(zend_function));
|
||||
|
||||
compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable));
|
||||
zend_hash_init_ex(compiler_globals->class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
|
||||
zend_hash_copy(compiler_globals->class_table, global_class_table, (copy_ctor_func_t) zend_class_add_ref, &tmp_class, sizeof(zend_class_entry));
|
||||
|
||||
zend_set_default_compile_time_values(TSRMLS_C);
|
||||
|
||||
CG(interactive) = 0;
|
||||
|
||||
compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable));
|
||||
zend_hash_init_ex(compiler_globals->class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
|
||||
zend_hash_copy(compiler_globals->class_table, global_class_table, (copy_ctor_func_t) zend_class_add_ref, &tmp_class, sizeof(zend_class_entry));
|
||||
|
||||
compiler_globals->auto_globals = (HashTable *) malloc(sizeof(HashTable));
|
||||
zend_hash_init_ex(compiler_globals->auto_globals, 8, NULL, NULL, 1, 0);
|
||||
zend_hash_copy(compiler_globals->auto_globals, global_auto_globals_table, NULL, NULL, sizeof(void *) /* empty element */);
|
||||
}
|
||||
|
||||
|
||||
static void compiler_globals_dtor(zend_compiler_globals *compiler_globals TSRMLS_DC)
|
||||
{
|
||||
if (compiler_globals->function_table != global_function_table) {
|
||||
zend_hash_destroy(compiler_globals->function_table);
|
||||
free(compiler_globals->function_table);
|
||||
}
|
||||
if (compiler_globals->class_table != global_class_table) {
|
||||
zend_hash_destroy(compiler_globals->class_table);
|
||||
free(compiler_globals->class_table);
|
||||
}
|
||||
if (compiler_globals->auto_globals != global_auto_globals_table) {
|
||||
zend_hash_destroy(compiler_globals->auto_globals);
|
||||
free(compiler_globals->auto_globals);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS_DC)
|
||||
{
|
||||
if (global_constants_table) {
|
||||
zend_startup_constants(TSRMLS_C);
|
||||
zend_copy_constants(EG(zend_constants), global_constants_table);
|
||||
}
|
||||
zend_init_rsrc_plist(TSRMLS_C);
|
||||
EG(lambda_count)=0;
|
||||
EG(user_error_handler) = NULL;
|
||||
EG(in_execution) = 0;
|
||||
}
|
||||
|
||||
|
||||
static void executor_globals_dtor(zend_executor_globals *executor_globals TSRMLS_DC)
|
||||
{
|
||||
zend_shutdown_constants(TSRMLS_C);
|
||||
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
|
||||
zend_ini_shutdown(TSRMLS_C);
|
||||
}
|
||||
|
||||
|
||||
static void zend_new_thread_end_handler(THREAD_T thread_id TSRMLS_DC)
|
||||
{
|
||||
zend_copy_ini_directives(TSRMLS_C);
|
||||
zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP TSRMLS_CC);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static void alloc_globals_ctor(zend_alloc_globals *alloc_globals_p TSRMLS_DC)
|
||||
{
|
||||
start_memory_manager(TSRMLS_C);
|
||||
}
|
||||
|
||||
|
||||
static void alloc_globals_dtor(zend_alloc_globals *alloc_globals_p TSRMLS_DC)
|
||||
{
|
||||
shutdown_memory_manager(0, 1);
|
||||
}
|
||||
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
/* FreeBSD floating point precision fix */
|
||||
#include <floatingpoint.h>
|
||||
#endif
|
||||
|
||||
|
||||
static void scanner_globals_ctor(zend_scanner_globals *scanner_globals_p TSRMLS_DC)
|
||||
{
|
||||
scanner_globals_p->c_buf_p = (char *) 0;
|
||||
scanner_globals_p->init = 1;
|
||||
scanner_globals_p->start = 0;
|
||||
scanner_globals_p->current_buffer = NULL;
|
||||
scanner_globals_p->yy_in = NULL;
|
||||
scanner_globals_p->yy_out = NULL;
|
||||
scanner_globals_p->_yy_more_flag = 0;
|
||||
scanner_globals_p->_yy_more_len = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int zend_startup(zend_utility_functions *utility_functions, char **extensions, int start_builtin_functions)
|
||||
{
|
||||
#ifdef ZTS
|
||||
zend_compiler_globals *compiler_globals;
|
||||
zend_executor_globals *executor_globals;
|
||||
void ***tsrm_ls;
|
||||
#ifdef ZTS
|
||||
extern ZEND_API ts_rsrc_id ini_scanner_globals_id;
|
||||
extern ZEND_API ts_rsrc_id language_scanner_globals_id;
|
||||
#else
|
||||
extern zend_scanner_globals ini_scanner_globals;
|
||||
extern zend_scanner_globals language_scanner_globals;
|
||||
#endif
|
||||
|
||||
ts_allocate_id(&alloc_globals_id, sizeof(zend_alloc_globals), (ts_allocate_ctor) alloc_globals_ctor, (ts_allocate_dtor) alloc_globals_dtor);
|
||||
#else
|
||||
alloc_globals_ctor(&alloc_globals TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
/* FreeBSD floating point precision fix */
|
||||
fpsetmask(0);
|
||||
#endif
|
||||
|
||||
zend_startup_extensions_mechanism();
|
||||
|
||||
/* Set up utility functions and values */
|
||||
zend_error_cb = utility_functions->error_function;
|
||||
zend_printf = utility_functions->printf_function;
|
||||
zend_write = (zend_write_func_t) utility_functions->write_function;
|
||||
zend_fopen = utility_functions->fopen_function;
|
||||
if (!zend_fopen) {
|
||||
zend_fopen = zend_fopen_wrapper;
|
||||
}
|
||||
zend_message_dispatcher_p = utility_functions->message_handler;
|
||||
zend_block_interruptions = utility_functions->block_interruptions;
|
||||
zend_unblock_interruptions = utility_functions->unblock_interruptions;
|
||||
zend_get_configuration_directive_p = utility_functions->get_configuration_directive;
|
||||
zend_ticks_function = utility_functions->ticks_function;
|
||||
|
||||
zend_compile_file = compile_file;
|
||||
zend_execute = execute;
|
||||
|
||||
/* set up version */
|
||||
zend_version_info = strdup(ZEND_CORE_VERSION_INFO);
|
||||
zend_version_info_length = sizeof(ZEND_CORE_VERSION_INFO)-1;
|
||||
|
||||
GLOBAL_FUNCTION_TABLE = (HashTable *) malloc(sizeof(HashTable));
|
||||
GLOBAL_CLASS_TABLE = (HashTable *) malloc(sizeof(HashTable));
|
||||
GLOBAL_AUTO_GLOBALS_TABLE = (HashTable *) malloc(sizeof(HashTable));
|
||||
GLOBAL_NAMESPACES_TABLE = (HashTable *) malloc(sizeof(HashTable));
|
||||
zend_hash_init_ex(GLOBAL_FUNCTION_TABLE, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0);
|
||||
zend_hash_init_ex(GLOBAL_CLASS_TABLE, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
|
||||
zend_hash_init_ex(GLOBAL_AUTO_GLOBALS_TABLE, 8, NULL, NULL, 1, 0);
|
||||
zend_hash_init_ex(GLOBAL_NAMESPACES_TABLE, 8, NULL, NULL, 1, 0);
|
||||
|
||||
{
|
||||
zend_namespace main_namespace;
|
||||
|
||||
main_namespace.type = INTERNAL_NAMESPACE;
|
||||
main_namespace.class_table = GLOBAL_CLASS_TABLE;
|
||||
main_namespace.function_table = GLOBAL_FUNCTION_TABLE;
|
||||
|
||||
zend_hash_update(GLOBAL_NAMESPACES_TABLE, "", sizeof(""), &main_namespace, sizeof(zend_namespace), NULL);
|
||||
}
|
||||
|
||||
register_standard_class();
|
||||
zend_hash_init_ex(&module_registry, 50, NULL, ZEND_MODULE_DTOR, 1, 0);
|
||||
zend_init_rsrc_list_dtors();
|
||||
|
||||
/* This zval can be used to initialize allocate zval's to an uninit'ed value */
|
||||
zval_used_for_init.is_ref = 0;
|
||||
zval_used_for_init.refcount = 1;
|
||||
zval_used_for_init.type = IS_NULL;
|
||||
|
||||
#ifdef ZTS
|
||||
global_constants_table = NULL;
|
||||
ts_allocate_id(&compiler_globals_id, sizeof(zend_compiler_globals), (ts_allocate_ctor) compiler_globals_ctor, (ts_allocate_dtor) compiler_globals_dtor);
|
||||
ts_allocate_id(&executor_globals_id, sizeof(zend_executor_globals), (ts_allocate_ctor) executor_globals_ctor, (ts_allocate_dtor) executor_globals_dtor);
|
||||
ts_allocate_id(&language_scanner_globals_id, sizeof(zend_scanner_globals), (ts_allocate_ctor) scanner_globals_ctor, NULL);
|
||||
ts_allocate_id(&ini_scanner_globals_id, sizeof(zend_scanner_globals), (ts_allocate_ctor) scanner_globals_ctor, NULL);
|
||||
compiler_globals = ts_resource(compiler_globals_id);
|
||||
executor_globals = ts_resource(executor_globals_id);
|
||||
tsrm_ls = ts_resource_ex(0, NULL);
|
||||
compiler_globals_dtor(compiler_globals, tsrm_ls);
|
||||
compiler_globals->function_table = GLOBAL_FUNCTION_TABLE;
|
||||
compiler_globals->class_table = GLOBAL_CLASS_TABLE;
|
||||
compiler_globals->auto_globals = GLOBAL_AUTO_GLOBALS_TABLE;
|
||||
compiler_globals->namespaces = GLOBAL_NAMESPACES_TABLE;
|
||||
zend_startup_constants(tsrm_ls);
|
||||
GLOBAL_CONSTANTS_TABLE = EG(zend_constants);
|
||||
#else
|
||||
zend_hash_init_ex(CG(auto_globals), 8, NULL, NULL, 1, 0);
|
||||
scanner_globals_ctor(&ini_scanner_globals TSRMLS_CC);
|
||||
scanner_globals_ctor(&language_scanner_globals TSRMLS_CC);
|
||||
zend_startup_constants();
|
||||
zend_set_default_compile_time_values(TSRMLS_C);
|
||||
EG(user_error_handler) = NULL;
|
||||
#endif
|
||||
zend_register_standard_constants(TSRMLS_C);
|
||||
|
||||
#ifndef ZTS
|
||||
zend_init_rsrc_plist(TSRMLS_C);
|
||||
#endif
|
||||
|
||||
if (start_builtin_functions) {
|
||||
zend_startup_builtin_functions(TSRMLS_C);
|
||||
}
|
||||
|
||||
zend_ini_startup(TSRMLS_C);
|
||||
|
||||
#ifdef ZTS
|
||||
tsrm_set_new_thread_end_handler(zend_new_thread_end_handler);
|
||||
#endif
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
void zend_shutdown(TSRMLS_D)
|
||||
{
|
||||
#ifdef ZEND_WIN32
|
||||
zend_shutdown_timeout_thread();
|
||||
#endif
|
||||
#ifndef ZTS
|
||||
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
|
||||
#endif
|
||||
zend_destroy_rsrc_list_dtors();
|
||||
zend_hash_destroy(&module_registry);
|
||||
zend_hash_destroy(GLOBAL_FUNCTION_TABLE);
|
||||
free(GLOBAL_FUNCTION_TABLE);
|
||||
zend_hash_destroy(GLOBAL_CLASS_TABLE);
|
||||
free(GLOBAL_CLASS_TABLE);
|
||||
zend_hash_destroy(GLOBAL_AUTO_GLOBALS_TABLE);
|
||||
free(GLOBAL_AUTO_GLOBALS_TABLE);
|
||||
zend_hash_destroy(GLOBAL_NAMESPACES_TABLE);
|
||||
free(GLOBAL_NAMESPACES_TABLE);
|
||||
zend_shutdown_extensions(TSRMLS_C);
|
||||
free(zend_version_info);
|
||||
#ifndef ZTS
|
||||
zend_shutdown_constants();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void zend_set_utility_values(zend_utility_values *utility_values)
|
||||
{
|
||||
zend_uv = *utility_values;
|
||||
zend_uv.import_use_extension_length = strlen(zend_uv.import_use_extension);
|
||||
}
|
||||
|
||||
|
||||
/* this should be compatible with the standard zenderror */
|
||||
void zenderror(char *error)
|
||||
{
|
||||
zend_error(E_PARSE, error);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void _zend_bailout(char *filename, uint lineno)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (!EG(bailout_set)) {
|
||||
zend_output_debug_string(1, "%s(%d) : Bailed out without a bailout address!", filename, lineno);
|
||||
exit(-1);
|
||||
}
|
||||
CG(unclean_shutdown) = 1;
|
||||
CG(in_compilation) = EG(in_execution) = 0;
|
||||
longjmp(EG(bailout), FAILURE);
|
||||
}
|
||||
END_EXTERN_C()
|
||||
|
||||
|
||||
void zend_append_version_info(zend_extension *extension)
|
||||
{
|
||||
char *new_info;
|
||||
uint new_info_length;
|
||||
|
||||
new_info_length = sizeof(" with v, by \n")
|
||||
+ strlen(extension->name)
|
||||
+ strlen(extension->version)
|
||||
+ strlen(extension->copyright)
|
||||
+ strlen(extension->author);
|
||||
|
||||
new_info = (char *) malloc(new_info_length+1);
|
||||
|
||||
sprintf(new_info, " with %s v%s, %s, by %s\n", extension->name, extension->version, extension->copyright, extension->author);
|
||||
|
||||
zend_version_info = (char *) realloc(zend_version_info, zend_version_info_length+new_info_length+1);
|
||||
strcat(zend_version_info, new_info);
|
||||
zend_version_info_length += new_info_length;
|
||||
free(new_info);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API char *get_zend_version()
|
||||
{
|
||||
return zend_version_info;
|
||||
}
|
||||
|
||||
|
||||
void zend_activate(TSRMLS_D)
|
||||
{
|
||||
init_compiler(TSRMLS_C);
|
||||
init_executor(TSRMLS_C);
|
||||
startup_scanner(TSRMLS_C);
|
||||
}
|
||||
|
||||
|
||||
void zend_activate_modules(TSRMLS_D)
|
||||
{
|
||||
zend_hash_apply(&module_registry, (apply_func_t) module_registry_request_startup TSRMLS_CC);
|
||||
}
|
||||
|
||||
void zend_deactivate_modules(TSRMLS_D)
|
||||
{
|
||||
EG(opline_ptr) = NULL; /* we're no longer executing anything */
|
||||
|
||||
zend_try {
|
||||
zend_hash_apply(&module_registry, (apply_func_t) module_registry_cleanup TSRMLS_CC);
|
||||
} zend_end_try();
|
||||
}
|
||||
|
||||
void zend_deactivate(TSRMLS_D)
|
||||
{
|
||||
/* we're no longer executing anything */
|
||||
EG(opline_ptr) = NULL;
|
||||
EG(active_symbol_table) = NULL;
|
||||
|
||||
zend_try {
|
||||
shutdown_scanner(TSRMLS_C);
|
||||
} zend_end_try();
|
||||
|
||||
/* shutdown_executor() takes care of its own bailout handling */
|
||||
shutdown_executor(TSRMLS_C);
|
||||
|
||||
zend_try {
|
||||
shutdown_compiler(TSRMLS_C);
|
||||
} zend_end_try();
|
||||
|
||||
zend_try {
|
||||
zend_ini_deactivate(TSRMLS_C);
|
||||
} zend_end_try();
|
||||
}
|
||||
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void zend_message_dispatcher(long message, void *data)
|
||||
{
|
||||
if (zend_message_dispatcher_p) {
|
||||
zend_message_dispatcher_p(message, data);
|
||||
}
|
||||
}
|
||||
END_EXTERN_C()
|
||||
|
||||
|
||||
ZEND_API int zend_get_configuration_directive(char *name, uint name_length, zval *contents)
|
||||
{
|
||||
if (zend_get_configuration_directive_p) {
|
||||
return zend_get_configuration_directive_p(name, name_length, contents);
|
||||
} else {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define ZEND_ERROR_BUFFER_SIZE 1024
|
||||
|
||||
ZEND_API void zend_error(int type, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
zval ***params;
|
||||
zval *retval;
|
||||
zval *z_error_type, *z_error_message, *z_error_filename, *z_error_lineno, *z_context;
|
||||
char *error_filename;
|
||||
uint error_lineno;
|
||||
zval *orig_user_error_handler;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
/* Obtain relevant filename and lineno */
|
||||
switch (type) {
|
||||
case E_CORE_ERROR:
|
||||
case E_CORE_WARNING:
|
||||
error_filename = NULL;
|
||||
error_lineno = 0;
|
||||
break;
|
||||
case E_PARSE:
|
||||
case E_COMPILE_ERROR:
|
||||
case E_COMPILE_WARNING:
|
||||
case E_ERROR:
|
||||
case E_NOTICE:
|
||||
case E_WARNING:
|
||||
case E_USER_ERROR:
|
||||
case E_USER_WARNING:
|
||||
case E_USER_NOTICE:
|
||||
if (zend_is_compiling(TSRMLS_C)) {
|
||||
error_filename = zend_get_compiled_filename(TSRMLS_C);
|
||||
error_lineno = zend_get_compiled_lineno(TSRMLS_C);
|
||||
} else if (zend_is_executing(TSRMLS_C)) {
|
||||
error_filename = zend_get_executed_filename(TSRMLS_C);
|
||||
error_lineno = zend_get_executed_lineno(TSRMLS_C);
|
||||
} else {
|
||||
error_filename = NULL;
|
||||
error_lineno = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
error_filename = NULL;
|
||||
error_lineno = 0;
|
||||
break;
|
||||
}
|
||||
if (!error_filename) {
|
||||
error_filename = "Unknown";
|
||||
}
|
||||
|
||||
|
||||
va_start(args, format);
|
||||
|
||||
/* if we don't have a user defined error handler */
|
||||
if (!EG(user_error_handler)) {
|
||||
zend_error_cb(type, error_filename, error_lineno, format, args);
|
||||
} else switch (type) {
|
||||
case E_ERROR:
|
||||
case E_PARSE:
|
||||
case E_CORE_ERROR:
|
||||
case E_CORE_WARNING:
|
||||
case E_COMPILE_ERROR:
|
||||
case E_COMPILE_WARNING:
|
||||
/* The error may not be safe to handle in user-space */
|
||||
zend_error_cb(type, error_filename, error_lineno, format, args);
|
||||
break;
|
||||
default:
|
||||
/* Handle the error in user space */
|
||||
ALLOC_INIT_ZVAL(z_error_message);
|
||||
ALLOC_INIT_ZVAL(z_error_type);
|
||||
ALLOC_INIT_ZVAL(z_error_filename);
|
||||
ALLOC_INIT_ZVAL(z_error_lineno);
|
||||
ALLOC_INIT_ZVAL(z_context);
|
||||
z_error_message->value.str.val = (char *) emalloc(ZEND_ERROR_BUFFER_SIZE);
|
||||
|
||||
#ifdef HAVE_VSNPRINTF
|
||||
z_error_message->value.str.len = vsnprintf(z_error_message->value.str.val, ZEND_ERROR_BUFFER_SIZE, format, args);
|
||||
if (z_error_message->value.str.len > ZEND_ERROR_BUFFER_SIZE-1) {
|
||||
z_error_message->value.str.len = ZEND_ERROR_BUFFER_SIZE-1;
|
||||
}
|
||||
#else
|
||||
strncpy(z_error_message->value.str.val, format, ZEND_ERROR_BUFFER_SIZE);
|
||||
/* This is risky... */
|
||||
/* z_error_message->value.str.len = vsprintf(z_error_message->value.str.val, format, args); */
|
||||
#endif
|
||||
z_error_message->type = IS_STRING;
|
||||
|
||||
z_error_type->value.lval = type;
|
||||
z_error_type->type = IS_LONG;
|
||||
|
||||
if (error_filename) {
|
||||
z_error_filename->value.str.len = strlen(error_filename);
|
||||
z_error_filename->value.str.val = estrndup(error_filename, z_error_filename->value.str.len);
|
||||
z_error_filename->type = IS_STRING;
|
||||
}
|
||||
|
||||
z_error_lineno->value.lval = error_lineno;
|
||||
z_error_lineno->type = IS_LONG;
|
||||
|
||||
z_context->value.ht = EG(active_symbol_table);
|
||||
z_context->type = IS_ARRAY;
|
||||
ZVAL_ADDREF(z_context); /* we don't want this one to be freed */
|
||||
|
||||
params = (zval ***) emalloc(sizeof(zval **)*5);
|
||||
params[0] = &z_error_type;
|
||||
params[1] = &z_error_message;
|
||||
params[2] = &z_error_filename;
|
||||
params[3] = &z_error_lineno;
|
||||
params[4] = &z_context;
|
||||
|
||||
orig_user_error_handler = EG(user_error_handler);
|
||||
EG(user_error_handler) = NULL;
|
||||
if (call_user_function_ex(CG(function_table), NULL, orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC)==SUCCESS) {
|
||||
zval_ptr_dtor(&retval);
|
||||
} else {
|
||||
/* The user error handler failed, use built-in error handler */
|
||||
zend_error_cb(type, error_filename, error_lineno, format, args);
|
||||
}
|
||||
EG(user_error_handler) = orig_user_error_handler;
|
||||
|
||||
efree(params);
|
||||
zval_ptr_dtor(&z_error_message);
|
||||
zval_ptr_dtor(&z_error_type);
|
||||
zval_ptr_dtor(&z_error_filename);
|
||||
zval_ptr_dtor(&z_error_lineno);
|
||||
if (ZVAL_REFCOUNT(z_context)==2) {
|
||||
FREE_ZVAL(z_context);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
va_end(args);
|
||||
|
||||
if (type==E_PARSE) {
|
||||
zend_init_compiler_data_structures(TSRMLS_C);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_output_debug_string(zend_bool trigger_break, char *format, ...)
|
||||
{
|
||||
#if ZEND_DEBUG
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
# ifdef ZEND_WIN32
|
||||
{
|
||||
char output_buf[1024];
|
||||
|
||||
vsnprintf(output_buf, 1024, format, args);
|
||||
OutputDebugString(output_buf);
|
||||
OutputDebugString("\n");
|
||||
if (trigger_break && IsDebuggerPresent()) {
|
||||
DebugBreak();
|
||||
}
|
||||
}
|
||||
# else
|
||||
vfprintf(stderr, format, args);
|
||||
fprintf(stderr, "\n");
|
||||
# endif
|
||||
va_end(args);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_count, ...)
|
||||
{
|
||||
va_list files;
|
||||
int i;
|
||||
zend_file_handle *file_handle;
|
||||
zend_op_array *orig_op_array = EG(active_op_array);
|
||||
zval *local_retval=NULL;
|
||||
|
||||
va_start(files, file_count);
|
||||
for (i=0; i<file_count; i++) {
|
||||
file_handle = va_arg(files, zend_file_handle *);
|
||||
if (!file_handle) {
|
||||
continue;
|
||||
}
|
||||
EG(active_op_array) = zend_compile_file(file_handle, ZEND_INCLUDE TSRMLS_CC);
|
||||
zend_destroy_file_handle(file_handle TSRMLS_CC);
|
||||
if (EG(active_op_array)) {
|
||||
EG(return_value_ptr_ptr) = retval ? retval : &local_retval;
|
||||
zend_execute(EG(active_op_array) TSRMLS_CC);
|
||||
if (!retval) {
|
||||
zval_ptr_dtor(EG(return_value_ptr_ptr));
|
||||
local_retval = NULL;
|
||||
}
|
||||
destroy_op_array(EG(active_op_array));
|
||||
efree(EG(active_op_array));
|
||||
} else if (type==ZEND_REQUIRE) {
|
||||
va_end(files);
|
||||
EG(active_op_array) = orig_op_array;
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
va_end(files);
|
||||
EG(active_op_array) = orig_op_array;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
#define COMPILED_STRING_DESCRIPTION_FORMAT "%s(%d) : %s"
|
||||
|
||||
ZEND_API char *zend_make_compiled_string_description(char *name TSRMLS_DC)
|
||||
{
|
||||
char *cur_filename;
|
||||
int cur_lineno;
|
||||
char *compiled_string_description;
|
||||
|
||||
if (zend_is_compiling(TSRMLS_C)) {
|
||||
cur_filename = zend_get_compiled_filename(TSRMLS_C);
|
||||
cur_lineno = zend_get_compiled_lineno(TSRMLS_C);
|
||||
} else if (zend_is_executing(TSRMLS_C)) {
|
||||
cur_filename = zend_get_executed_filename(TSRMLS_C);
|
||||
cur_lineno = zend_get_executed_lineno(TSRMLS_C);
|
||||
} else {
|
||||
cur_filename = "Unknown";
|
||||
cur_lineno = 0;
|
||||
}
|
||||
|
||||
compiled_string_description = emalloc(sizeof(COMPILED_STRING_DESCRIPTION_FORMAT)+strlen(name)+strlen(cur_filename)+MAX_LENGTH_OF_LONG);
|
||||
sprintf(compiled_string_description, COMPILED_STRING_DESCRIPTION_FORMAT, cur_filename, cur_lineno, name);
|
||||
return compiled_string_description;
|
||||
}
|
||||
|
||||
|
||||
void free_estring(char **str_p)
|
||||
{
|
||||
efree(*str_p);
|
||||
}
|
||||
-547
@@ -1,547 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ZEND_H
|
||||
#define ZEND_H
|
||||
|
||||
#define ZEND_VERSION "2.0.0-dev"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define BEGIN_EXTERN_C() extern "C" {
|
||||
#define END_EXTERN_C() }
|
||||
#else
|
||||
#define BEGIN_EXTERN_C()
|
||||
#define END_EXTERN_C()
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
* general definitions
|
||||
*/
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
# include "zend_config.w32.h"
|
||||
# define ZEND_PATHS_SEPARATOR ';'
|
||||
#else
|
||||
# include "zend_config.h"
|
||||
# define ZEND_PATHS_SEPARATOR ':'
|
||||
#endif
|
||||
|
||||
/* all HAVE_XXX test have to be after the include of zend_config above */
|
||||
|
||||
#ifdef HAVE_UNIX_H
|
||||
# include <unix.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDARG_H
|
||||
# include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DLFCN_H
|
||||
# include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_LIBDL)
|
||||
|
||||
# ifndef RTLD_LAZY
|
||||
# define RTLD_LAZY 1 /* Solaris 1, FreeBSD's (2.1.7.1 and older) */
|
||||
# endif
|
||||
|
||||
# ifndef RTLD_GLOBAL
|
||||
# define RTLD_GLOBAL 0
|
||||
# endif
|
||||
|
||||
# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL)
|
||||
# define DL_UNLOAD dlclose
|
||||
# if defined(DLSYM_NEEDS_UNDERSCORE)
|
||||
# define DL_FETCH_SYMBOL(h,s) dlsym((h), "_" ## s)
|
||||
# else
|
||||
# define DL_FETCH_SYMBOL dlsym
|
||||
# endif
|
||||
# define DL_HANDLE void *
|
||||
# define ZEND_EXTENSIONS_SUPPORT 1
|
||||
#elif defined(ZEND_WIN32)
|
||||
# define DL_LOAD(libname) LoadLibrary(libname)
|
||||
# define DL_FETCH_SYMBOL GetProcAddress
|
||||
# define DL_UNLOAD FreeLibrary
|
||||
# define DL_HANDLE HMODULE
|
||||
# define ZEND_EXTENSIONS_SUPPORT 1
|
||||
#else
|
||||
# define DL_HANDLE void *
|
||||
# define ZEND_EXTENSIONS_SUPPORT 0
|
||||
#endif
|
||||
|
||||
#if HAVE_ALLOCA_H
|
||||
# include <alloca.h>
|
||||
#endif
|
||||
|
||||
#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(ZEND_WIN32))
|
||||
# define do_alloca(p) alloca(p)
|
||||
# define free_alloca(p)
|
||||
#else
|
||||
# define do_alloca(p) emalloc(p)
|
||||
# define free_alloca(p) efree(p)
|
||||
#endif
|
||||
|
||||
#if ZEND_DEBUG
|
||||
#define ZEND_FILE_LINE_D char *__zend_filename, uint __zend_lineno
|
||||
#define ZEND_FILE_LINE_DC , ZEND_FILE_LINE_D
|
||||
#define ZEND_FILE_LINE_ORIG_D char *__zend_orig_filename, uint __zend_orig_lineno
|
||||
#define ZEND_FILE_LINE_ORIG_DC , ZEND_FILE_LINE_ORIG_D
|
||||
#define ZEND_FILE_LINE_RELAY_C __zend_filename, __zend_lineno
|
||||
#define ZEND_FILE_LINE_RELAY_CC , ZEND_FILE_LINE_RELAY_C
|
||||
#define ZEND_FILE_LINE_C __FILE__, __LINE__
|
||||
#define ZEND_FILE_LINE_CC , ZEND_FILE_LINE_C
|
||||
#define ZEND_FILE_LINE_EMPTY_C NULL, 0
|
||||
#define ZEND_FILE_LINE_EMPTY_CC , ZEND_FILE_LINE_EMPTY_C
|
||||
#define ZEND_FILE_LINE_ORIG_RELAY_C __zend_orig_filename, __zend_orig_lineno
|
||||
#define ZEND_FILE_LINE_ORIG_RELAY_CC , ZEND_FILE_LINE_ORIG_RELAY_C
|
||||
#else
|
||||
#define ZEND_FILE_LINE_D
|
||||
#define ZEND_FILE_LINE_DC
|
||||
#define ZEND_FILE_LINE_ORIG_D
|
||||
#define ZEND_FILE_LINE_ORIG_DC
|
||||
#define ZEND_FILE_LINE_RELAY_C
|
||||
#define ZEND_FILE_LINE_RELAY_CC
|
||||
#define ZEND_FILE_LINE_C
|
||||
#define ZEND_FILE_LINE_CC
|
||||
#define ZEND_FILE_LINE_EMPTY_C
|
||||
#define ZEND_FILE_LINE_EMPTY_CC
|
||||
#define ZEND_FILE_LINE_ORIG_RELAY_C
|
||||
#define ZEND_FILE_LINE_ORIG_RELAY_CC
|
||||
#endif /* ZEND_DEBUG */
|
||||
|
||||
#ifdef ZTS
|
||||
#define ZTS_V 1
|
||||
#else
|
||||
#define ZTS_V 0
|
||||
#endif
|
||||
|
||||
#include "zend_errors.h"
|
||||
#include "zend_alloc.h"
|
||||
|
||||
typedef unsigned char zend_bool;
|
||||
typedef unsigned char zend_uchar;
|
||||
typedef unsigned int zend_uint;
|
||||
typedef unsigned long zend_ulong;
|
||||
typedef unsigned short zend_ushort;
|
||||
|
||||
#ifdef HAVE_LIMITS_H
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifndef LONG_MAX
|
||||
#define LONG_MAX 2147483647L
|
||||
#endif
|
||||
|
||||
#ifndef LONG_MIN
|
||||
#define LONG_MIN (- LONG_MAX - 1)
|
||||
#endif
|
||||
|
||||
#undef SUCCESS
|
||||
#undef FAILURE
|
||||
#define SUCCESS 0
|
||||
#define FAILURE -1 /* this MUST stay a negative number, or it may affect functions! */
|
||||
|
||||
|
||||
#include "zend_hash.h"
|
||||
#include "zend_llist.h"
|
||||
|
||||
#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, zval *this_ptr, int return_value_used TSRMLS_DC
|
||||
#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, this_ptr, return_value_used TSRMLS_CC
|
||||
|
||||
typedef enum {
|
||||
INTERNAL_NAMESPACE = 0,
|
||||
USER_NAMESPACE = 1
|
||||
} namespace_type;
|
||||
|
||||
typedef struct _zend_namespace_struct {
|
||||
namespace_type type;
|
||||
HashTable *class_table;
|
||||
HashTable *function_table;
|
||||
} zend_namespace;
|
||||
|
||||
/*
|
||||
* zval
|
||||
*/
|
||||
typedef struct _zval_struct zval;
|
||||
typedef struct _zend_class_entry zend_class_entry;
|
||||
|
||||
typedef struct _zend_object {
|
||||
zend_class_entry *ce;
|
||||
HashTable *properties;
|
||||
} zend_object;
|
||||
|
||||
typedef unsigned int zend_object_handle;
|
||||
|
||||
typedef struct _zend_object_handlers zend_object_handlers;
|
||||
|
||||
typedef struct _zend_object_value {
|
||||
zend_object_handle handle;
|
||||
zend_object_handlers *handlers;
|
||||
} zend_object_value;
|
||||
|
||||
typedef zend_object *(*get_address_t)(zend_object_handle handle); /* Don't return zval ** so that we can't change it */
|
||||
typedef zval **(*get_property_address_t)(zend_object_handle handle, zval *offset, int type);
|
||||
typedef void (*add_ref_t)(zend_object_handle handle);
|
||||
typedef void (*del_ref_t)(zend_object_handle handle);
|
||||
typedef void (*delete_obj_t)(zend_object_handle handle);
|
||||
typedef zend_object_value (*clone_obj_t)(zend_object_handle handle);
|
||||
|
||||
struct _zend_object_handlers {
|
||||
get_address_t get_address;
|
||||
get_property_address_t get_property_address;
|
||||
add_ref_t add_ref;
|
||||
del_ref_t del_ref;
|
||||
delete_obj_t delete_obj;
|
||||
clone_obj_t clone_obj;
|
||||
};
|
||||
|
||||
#include "zend_objects.h"
|
||||
|
||||
typedef union _zvalue_value {
|
||||
long lval; /* long value */
|
||||
double dval; /* double value */
|
||||
struct {
|
||||
char *val;
|
||||
int len;
|
||||
} str;
|
||||
HashTable *ht; /* hash table value */
|
||||
/* struct {
|
||||
zend_class_entry *ce;
|
||||
HashTable *properties;
|
||||
} obj;
|
||||
*/
|
||||
zend_object_value obj;
|
||||
} zvalue_value;
|
||||
|
||||
|
||||
struct _zval_struct {
|
||||
/* Variable information */
|
||||
zvalue_value value; /* value */
|
||||
zend_uchar type; /* active type */
|
||||
zend_uchar is_ref;
|
||||
zend_ushort refcount;
|
||||
};
|
||||
|
||||
|
||||
|
||||
typedef struct _zend_function_entry {
|
||||
char *fname;
|
||||
void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
|
||||
unsigned char *func_arg_types;
|
||||
} zend_function_entry;
|
||||
|
||||
|
||||
typedef struct _zend_property_reference {
|
||||
int type; /* read, write or r/w */
|
||||
zval *object;
|
||||
zend_llist *elements_list;
|
||||
} zend_property_reference;
|
||||
|
||||
|
||||
|
||||
typedef struct _zend_overloaded_element {
|
||||
int type; /* array offset or object proprety */
|
||||
zval element;
|
||||
} zend_overloaded_element;
|
||||
|
||||
/* excpt.h on Digital Unix 4.0 defines function_table */
|
||||
#undef function_table
|
||||
|
||||
struct _zend_class_entry {
|
||||
char type;
|
||||
char *name;
|
||||
uint name_length;
|
||||
struct _zend_class_entry *parent;
|
||||
int *refcount;
|
||||
zend_bool constants_updated;
|
||||
|
||||
HashTable function_table;
|
||||
HashTable default_properties;
|
||||
zend_function_entry *builtin_functions;
|
||||
|
||||
/* handlers */
|
||||
void (*handle_function_call)(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
|
||||
zval (*handle_property_get)(zend_property_reference *property_reference);
|
||||
int (*handle_property_set)(zend_property_reference *property_reference, zval *value);
|
||||
};
|
||||
|
||||
|
||||
|
||||
typedef struct _zend_utility_functions {
|
||||
void (*error_function)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
|
||||
int (*printf_function)(const char *format, ...);
|
||||
int (*write_function)(const char *str, uint str_length);
|
||||
FILE *(*fopen_function)(const char *filename, char **opened_path);
|
||||
void (*message_handler)(long message, void *data);
|
||||
void (*block_interruptions)(void);
|
||||
void (*unblock_interruptions)(void);
|
||||
int (*get_configuration_directive)(char *name, uint name_length, zval *contents);
|
||||
void (*ticks_function)(int ticks);
|
||||
} zend_utility_functions;
|
||||
|
||||
|
||||
typedef struct _zend_utility_values {
|
||||
char *import_use_extension;
|
||||
uint import_use_extension_length;
|
||||
} zend_utility_values;
|
||||
|
||||
|
||||
typedef int (*zend_write_func_t)(const char *str, uint str_length);
|
||||
|
||||
|
||||
#undef MIN
|
||||
#undef MAX
|
||||
#define MAX(a, b) (((a)>(b))?(a):(b))
|
||||
#define MIN(a, b) (((a)<(b))?(a):(b))
|
||||
#define ZEND_STRL(str) (str), (sizeof(str)-1)
|
||||
#define ZEND_STRS(str) (str), (sizeof(str))
|
||||
#define ZEND_NORMALIZE_BOOL(n) \
|
||||
((n) ? (((n)>0) ? 1 : -1) : 0)
|
||||
|
||||
|
||||
/* data types */
|
||||
#define IS_NULL 0
|
||||
#define IS_LONG 1
|
||||
#define IS_DOUBLE 2
|
||||
#define IS_STRING 3
|
||||
#define IS_ARRAY 4
|
||||
#define IS_OBJECT 5
|
||||
#define IS_BOOL 6
|
||||
#define IS_RESOURCE 7
|
||||
#define IS_CONSTANT 8
|
||||
#define IS_CONSTANT_ARRAY 9
|
||||
|
||||
/* Special data type to temporarily mark large numbers */
|
||||
#define FLAG_IS_BC 10 /* for parser internal use only */
|
||||
|
||||
/* Ugly hack to support constants as static array indices */
|
||||
#define IS_CONSTANT_INDEX 0x80
|
||||
|
||||
|
||||
/* overloaded elements data types */
|
||||
#define OE_IS_ARRAY (1<<0)
|
||||
#define OE_IS_OBJECT (1<<1)
|
||||
#define OE_IS_METHOD (1<<2)
|
||||
|
||||
|
||||
/* Argument passing types */
|
||||
#define BYREF_NONE 0
|
||||
#define BYREF_FORCE 1
|
||||
#define BYREF_ALLOW 2
|
||||
#define BYREF_FORCE_REST 3
|
||||
|
||||
int zend_startup(zend_utility_functions *utility_functions, char **extensions, int start_builtin_functions);
|
||||
void zend_shutdown(TSRMLS_D);
|
||||
|
||||
void zend_set_utility_values(zend_utility_values *utility_values);
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void _zend_bailout(char *filename, uint lineno);
|
||||
END_EXTERN_C()
|
||||
|
||||
#define zend_bailout() _zend_bailout(__FILE__, __LINE__)
|
||||
|
||||
#define zend_try \
|
||||
{ \
|
||||
jmp_buf orig_bailout; \
|
||||
zend_bool orig_bailout_set=EG(bailout_set); \
|
||||
\
|
||||
EG(bailout_set) = 1; \
|
||||
memcpy(&orig_bailout, &EG(bailout), sizeof(jmp_buf)); \
|
||||
if (setjmp(EG(bailout))==0)
|
||||
#define zend_catch \
|
||||
else
|
||||
#define zend_end_try() \
|
||||
memcpy(&EG(bailout), &orig_bailout, sizeof(jmp_buf)); \
|
||||
EG(bailout_set) = orig_bailout_set; \
|
||||
}
|
||||
#define zend_first_try EG(bailout_set)=0; zend_try
|
||||
|
||||
ZEND_API char *get_zend_version(void);
|
||||
ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy);
|
||||
ZEND_API int zend_print_zval(zval *expr, int indent);
|
||||
ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent);
|
||||
ZEND_API void zend_print_zval_r(zval *expr, int indent);
|
||||
ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent);
|
||||
ZEND_API void zend_output_debug_string(zend_bool trigger_break, char *format, ...);
|
||||
|
||||
#if ZEND_DEBUG
|
||||
#define Z_DBG(expr) (expr)
|
||||
#else
|
||||
#define Z_DBG(expr)
|
||||
#endif
|
||||
|
||||
ZEND_API extern char *empty_string;
|
||||
|
||||
ZEND_API void free_estring(char **str_p);
|
||||
|
||||
#define STR_FREE(ptr) if (ptr && ptr!=empty_string) { efree(ptr); }
|
||||
#define STR_FREE_REL(ptr) if (ptr && ptr!=empty_string) { efree_rel(ptr); }
|
||||
|
||||
#define STR_REALLOC(ptr, size) \
|
||||
if (ptr!=empty_string) { \
|
||||
ptr = (char *) erealloc(ptr, size); \
|
||||
} else { \
|
||||
ptr = (char *) emalloc(size); \
|
||||
memset(ptr, 0, size); \
|
||||
}
|
||||
|
||||
/* output support */
|
||||
#define ZEND_WRITE(str, str_len) zend_write((str), (str_len))
|
||||
#define ZEND_PUTS(str) zend_write((str), strlen((str)))
|
||||
#define ZEND_PUTC(c) zend_write(&(c), 1), (c)
|
||||
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
extern ZEND_API int (*zend_printf)(const char *format, ...);
|
||||
extern ZEND_API zend_write_func_t zend_write;
|
||||
extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path);
|
||||
extern ZEND_API void (*zend_block_interruptions)(void);
|
||||
extern ZEND_API void (*zend_unblock_interruptions)(void);
|
||||
extern ZEND_API void (*zend_ticks_function)(int ticks);
|
||||
extern ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
|
||||
|
||||
|
||||
ZEND_API void zend_error(int type, const char *format, ...);
|
||||
|
||||
void zenderror(char *error);
|
||||
|
||||
extern ZEND_API zend_class_entry zend_standard_class_def;
|
||||
extern zend_utility_values zend_uv;
|
||||
extern ZEND_API zval zval_used_for_init;
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
#define ZEND_UV(name) (zend_uv.name)
|
||||
|
||||
|
||||
#define HANDLE_BLOCK_INTERRUPTIONS() if (zend_block_interruptions) { zend_block_interruptions(); }
|
||||
#define HANDLE_UNBLOCK_INTERRUPTIONS() if (zend_unblock_interruptions) { zend_unblock_interruptions(); }
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void zend_message_dispatcher(long message, void *data);
|
||||
END_EXTERN_C()
|
||||
|
||||
ZEND_API int zend_get_configuration_directive(char *name, uint name_length, zval *contents);
|
||||
|
||||
|
||||
/* Messages for applications of Zend */
|
||||
#define ZMSG_FAILED_INCLUDE_FOPEN 1L
|
||||
#define ZMSG_FAILED_REQUIRE_FOPEN 2L
|
||||
#define ZMSG_FAILED_HIGHLIGHT_FOPEN 3L
|
||||
#define ZMSG_MEMORY_LEAK_DETECTED 4L
|
||||
#define ZMSG_MEMORY_LEAK_REPEATED 5L
|
||||
#define ZMSG_LOG_SCRIPT_NAME 6L
|
||||
|
||||
|
||||
#define ZVAL_ADDREF(pz) (++(pz)->refcount)
|
||||
#define ZVAL_DELREF(pz) (--(pz)->refcount)
|
||||
#define ZVAL_REFCOUNT(pz) ((pz)->refcount)
|
||||
|
||||
#define INIT_PZVAL(z) \
|
||||
(z)->refcount = 1; \
|
||||
(z)->is_ref = 0;
|
||||
|
||||
#define INIT_ZVAL(z) z = zval_used_for_init;
|
||||
|
||||
#define ALLOC_INIT_ZVAL(zp) \
|
||||
ALLOC_ZVAL(zp); \
|
||||
INIT_ZVAL(*zp);
|
||||
|
||||
#define MAKE_STD_ZVAL(zv) \
|
||||
ALLOC_ZVAL(zv); \
|
||||
INIT_PZVAL(zv);
|
||||
|
||||
#define PZVAL_IS_REF(z) ((z)->is_ref)
|
||||
|
||||
#define SEPARATE_ZVAL(ppzv) \
|
||||
{ \
|
||||
zval *orig_ptr = *(ppzv); \
|
||||
\
|
||||
if (orig_ptr->refcount>1) { \
|
||||
orig_ptr->refcount--; \
|
||||
ALLOC_ZVAL(*(ppzv)); \
|
||||
**(ppzv) = *orig_ptr; \
|
||||
zval_copy_ctor(*(ppzv)); \
|
||||
(*(ppzv))->refcount=1; \
|
||||
(*(ppzv))->is_ref = 0; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define SEPARATE_ZVAL_IF_NOT_REF(ppzv) \
|
||||
if (!PZVAL_IS_REF(*ppzv)) { \
|
||||
SEPARATE_ZVAL(ppzv); \
|
||||
}
|
||||
|
||||
#define SEPARATE_ZVAL_TO_MAKE_IS_REF(ppzv) \
|
||||
if (!PZVAL_IS_REF(*ppzv)) { \
|
||||
SEPARATE_ZVAL(ppzv); \
|
||||
(*(ppzv))->is_ref = 1; \
|
||||
}
|
||||
|
||||
#define COPY_PZVAL_TO_ZVAL(zv, pzv) \
|
||||
(zv) = *(pzv); \
|
||||
if ((pzv)->refcount>1) { \
|
||||
zval_copy_ctor(&(zv)); \
|
||||
(pzv)->refcount--; \
|
||||
} else { \
|
||||
FREE_ZVAL(pzv); \
|
||||
} \
|
||||
INIT_PZVAL(&(zv));
|
||||
|
||||
#define REPLACE_ZVAL_VALUE(ppzv_dest, pzv_src, copy) { \
|
||||
int is_ref, refcount; \
|
||||
\
|
||||
SEPARATE_ZVAL_IF_NOT_REF(ppzv_dest); \
|
||||
is_ref = (*ppzv_dest)->is_ref; \
|
||||
refcount = (*ppzv_dest)->refcount; \
|
||||
zval_dtor(*ppzv_dest); \
|
||||
**ppzv_dest = *pzv_src; \
|
||||
if (copy) { \
|
||||
zval_copy_ctor(*ppzv_dest); \
|
||||
} \
|
||||
(*ppzv_dest)->is_ref = is_ref; \
|
||||
(*ppzv_dest)->refcount = refcount; \
|
||||
}
|
||||
|
||||
#define ZEND_MAX_RESERVED_RESOURCES 4
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
/* Only use this macro if you know for sure that all of the switches values
|
||||
are covered by its case statements */
|
||||
#define EMPTY_SWITCH_DEFAULT_CASE() \
|
||||
default: \
|
||||
__assume(0); \
|
||||
break;
|
||||
#else
|
||||
#define EMPTY_SWITCH_DEFAULT_CASE()
|
||||
#endif
|
||||
|
||||
#endif /* ZEND_H */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 KiB |
-1386
File diff suppressed because it is too large.
Load diff
-425
@@ -1,425 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
| Andrei Zmievski <andrei@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ZEND_API_H
|
||||
#define ZEND_API_H
|
||||
|
||||
#include "zend_modules.h"
|
||||
#include "zend_list.h"
|
||||
#include "zend_fast_cache.h"
|
||||
#include "zend_operators.h"
|
||||
#include "zend_variables.h"
|
||||
#include "zend_execute.h"
|
||||
|
||||
#define ZEND_FN(name) zif_##name
|
||||
#define ZEND_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS)
|
||||
#define ZEND_FUNCTION(name) ZEND_NAMED_FUNCTION(ZEND_FN(name))
|
||||
|
||||
#define ZEND_NAMED_FE(zend_name, name, arg_types) { #zend_name, name, arg_types },
|
||||
#define ZEND_FE(name, arg_types) ZEND_NAMED_FE(name, ZEND_FN(name), arg_types)
|
||||
#define ZEND_FALIAS(name, alias, arg_types) ZEND_NAMED_FE(name, ZEND_FN(alias), arg_types)
|
||||
#define ZEND_STATIC_FE(name, impl_name, arg_types) { name, impl_name, arg_types },
|
||||
|
||||
/* Name macros */
|
||||
#define ZEND_MODULE_STARTUP_N(module) zm_startup_##module
|
||||
#define ZEND_MODULE_SHUTDOWN_N(module) zm_shutdown_##module
|
||||
#define ZEND_MODULE_ACTIVATE_N(module) zm_activate_##module
|
||||
#define ZEND_MODULE_DEACTIVATE_N(module) zm_deactivate_##module
|
||||
#define ZEND_MODULE_INFO_N(module) zm_info_##module
|
||||
|
||||
/* Declaration macros */
|
||||
#define ZEND_MODULE_STARTUP_D(module) int ZEND_MODULE_STARTUP_N(module)(INIT_FUNC_ARGS)
|
||||
#define ZEND_MODULE_SHUTDOWN_D(module) int ZEND_MODULE_SHUTDOWN_N(module)(SHUTDOWN_FUNC_ARGS)
|
||||
#define ZEND_MODULE_ACTIVATE_D(module) int ZEND_MODULE_ACTIVATE_N(module)(INIT_FUNC_ARGS)
|
||||
#define ZEND_MODULE_DEACTIVATE_D(module) int ZEND_MODULE_DEACTIVATE_N(module)(SHUTDOWN_FUNC_ARGS)
|
||||
#define ZEND_MODULE_INFO_D(module) void ZEND_MODULE_INFO_N(module)(ZEND_MODULE_INFO_FUNC_ARGS)
|
||||
|
||||
#define ZEND_GET_MODULE(name) \
|
||||
ZEND_DLEXPORT zend_module_entry *get_module(void) { return &name##_module_entry; }
|
||||
|
||||
#define ZEND_BEGIN_MODULE_GLOBALS(module_name) \
|
||||
typedef struct _zend_##module_name##_globals {
|
||||
#define ZEND_END_MODULE_GLOBALS(module_name) \
|
||||
} zend_##module_name##_globals;
|
||||
|
||||
#ifdef ZTS
|
||||
|
||||
#define ZEND_DECLARE_MODULE_GLOBALS(module_name) \
|
||||
ts_rsrc_id module_name##_globals_id;
|
||||
#define ZEND_EXTERN_MODULE_GLOBALS(module_name) \
|
||||
extern ts_rsrc_id module_name##_globals_id;
|
||||
#define ZEND_INIT_MODULE_GLOBALS(module_name, globals_ctor, globals_dtor) \
|
||||
ts_allocate_id(&module_name##_globals_id, sizeof(zend_##module_name##_globals), (ts_allocate_ctor) globals_ctor, (ts_allocate_dtor) globals_dtor);
|
||||
|
||||
#else
|
||||
|
||||
#define ZEND_DECLARE_MODULE_GLOBALS(module_name) \
|
||||
zend_##module_name##_globals module_name##_globals;
|
||||
#define ZEND_EXTERN_MODULE_GLOBALS(module_name) \
|
||||
extern zend_##module_name##_globals module_name##_globals;
|
||||
#define ZEND_INIT_MODULE_GLOBALS(module_name, globals_ctor, globals_dtor) \
|
||||
globals_ctor(&module_name##_globals);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define INIT_CLASS_ENTRY(class_container, class_name, functions) \
|
||||
{ \
|
||||
class_container.name = strdup(class_name); \
|
||||
class_container.name_length = sizeof(class_name)-1; \
|
||||
class_container.builtin_functions = functions; \
|
||||
class_container.handle_function_call = NULL; \
|
||||
class_container.handle_property_get = NULL; \
|
||||
class_container.handle_property_set = NULL; \
|
||||
}
|
||||
|
||||
#define INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset) \
|
||||
{ \
|
||||
class_container.name = strdup(class_name); \
|
||||
class_container.name_length = sizeof(class_name)-1; \
|
||||
class_container.builtin_functions = functions; \
|
||||
class_container.handle_function_call = handle_fcall; \
|
||||
class_container.handle_property_get = handle_propget; \
|
||||
class_container.handle_property_set = handle_propset; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
int zend_next_free_module(void);
|
||||
|
||||
ZEND_API int zend_get_parameters(int ht, int param_count, ...);
|
||||
ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval **argument_array TSRMLS_DC);
|
||||
ZEND_API int zend_get_parameters_ex(int param_count, ...);
|
||||
ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_array TSRMLS_DC);
|
||||
|
||||
#define zend_get_parameters_array(ht, param_count, argument_array) \
|
||||
_zend_get_parameters_array(ht, param_count, argument_array TSRMLS_CC)
|
||||
#define zend_get_parameters_array_ex(param_count, argument_array) \
|
||||
_zend_get_parameters_array_ex(param_count, argument_array TSRMLS_CC)
|
||||
|
||||
|
||||
/* Parameter parsing API -- andrei */
|
||||
|
||||
#define ZEND_PARSE_PARAMS_QUIET 1<<1
|
||||
ZEND_API int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, ...);
|
||||
ZEND_API int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC, char *type_spec, ...);
|
||||
|
||||
/* End of parameter parsing API -- andrei */
|
||||
|
||||
int zend_register_functions(zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC);
|
||||
void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC);
|
||||
ZEND_API int zend_register_module(zend_module_entry *module_entry);
|
||||
|
||||
ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_entry TSRMLS_DC);
|
||||
ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce, char *parent_name TSRMLS_DC);
|
||||
|
||||
ZEND_API zend_module_entry *zend_get_module(int module_number);
|
||||
ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC);
|
||||
|
||||
ZEND_API void zend_wrong_param_count(TSRMLS_D);
|
||||
ZEND_API zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callable_name);
|
||||
|
||||
#define getThis() (this_ptr)
|
||||
|
||||
#define WRONG_PARAM_COUNT ZEND_WRONG_PARAM_COUNT()
|
||||
#define WRONG_PARAM_COUNT_WITH_RETVAL(ret) ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(ret)
|
||||
#define ARG_COUNT(dummy) (ht)
|
||||
#define ZEND_NUM_ARGS() (ht)
|
||||
#define ZEND_WRONG_PARAM_COUNT() { zend_wrong_param_count(TSRMLS_C); return; }
|
||||
#define ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(ret) { zend_wrong_param_count(TSRMLS_C); return ret; }
|
||||
|
||||
#ifndef ZEND_WIN32
|
||||
#define DLEXPORT
|
||||
#endif
|
||||
|
||||
ZEND_API int zend_startup_module(zend_module_entry *module);
|
||||
|
||||
#define array_init(arg) _array_init((arg) ZEND_FILE_LINE_CC)
|
||||
#define object_init(arg) _object_init((arg) ZEND_FILE_LINE_CC TSRMLS_CC)
|
||||
#define object_init_ex(arg, ce) _object_init_ex((arg), (ce) ZEND_FILE_LINE_CC TSRMLS_CC)
|
||||
#define object_and_properties_init(arg, ce, properties) _object_and_properties_init((arg), (ce), (properties) ZEND_FILE_LINE_CC TSRMLS_CC)
|
||||
ZEND_API int _array_init(zval *arg ZEND_FILE_LINE_DC);
|
||||
ZEND_API int _object_init(zval *arg ZEND_FILE_LINE_DC TSRMLS_DC);
|
||||
ZEND_API int _object_init_ex(zval *arg, zend_class_entry *ce ZEND_FILE_LINE_DC TSRMLS_DC);
|
||||
ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *ce, HashTable *properties ZEND_FILE_LINE_DC TSRMLS_DC);
|
||||
|
||||
/* no longer supported */
|
||||
ZEND_API int add_assoc_function(zval *arg, char *key, void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS));
|
||||
|
||||
ZEND_API int add_assoc_long_ex(zval *arg, char *key, uint key_len, long n);
|
||||
ZEND_API int add_assoc_null_ex(zval *arg, char *key, uint key_len);
|
||||
ZEND_API int add_assoc_bool_ex(zval *arg, char *key, uint key_len, int b);
|
||||
ZEND_API int add_assoc_resource_ex(zval *arg, char *key, uint key_len, int r);
|
||||
ZEND_API int add_assoc_double_ex(zval *arg, char *key, uint key_len, double d);
|
||||
ZEND_API int add_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate);
|
||||
ZEND_API int add_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate);
|
||||
ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value);
|
||||
|
||||
#define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key)+1, __n)
|
||||
#define add_assoc_null(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1)
|
||||
#define add_assoc_bool(__arg, __key, __b) add_assoc_bool_ex(__arg, __key, strlen(__key)+1, __b)
|
||||
#define add_assoc_resource(__arg, __key, __r) add_assoc_resource_ex(__arg, __key, strlen(__key)+1, __r)
|
||||
#define add_assoc_double(__arg, __key, __d) add_assoc_double_ex(__arg, __key, strlen(__key)+1, __d)
|
||||
#define add_assoc_string(__arg, __key, __str, __duplicate) add_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
|
||||
#define add_assoc_stringl(__arg, __key, __str, __length, __duplicate) add_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
|
||||
#define add_assoc_zval(__arg, __key, __value) add_assoc_zval_ex(__arg, __key, strlen(__key)+1, __value)
|
||||
|
||||
/* unset() functions are only suported for legacy modules and null() functions should be used */
|
||||
#define add_assoc_unset(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1)
|
||||
#define add_index_unset(__arg, __key) add_index_null(__arg, __key)
|
||||
#define add_next_index_unset(__arg) add_next_index_null(__arg)
|
||||
#define add_property_unset(__arg, __key) add_property_null(__arg, __key)
|
||||
|
||||
ZEND_API int add_index_long(zval *arg, uint idx, long n);
|
||||
ZEND_API int add_index_null(zval *arg, uint idx);
|
||||
ZEND_API int add_index_bool(zval *arg, uint idx, int b);
|
||||
ZEND_API int add_index_resource(zval *arg, uint idx, int r);
|
||||
ZEND_API int add_index_double(zval *arg, uint idx, double d);
|
||||
ZEND_API int add_index_string(zval *arg, uint idx, char *str, int duplicate);
|
||||
ZEND_API int add_index_stringl(zval *arg, uint idx, char *str, uint length, int duplicate);
|
||||
ZEND_API int add_index_zval(zval *arg, uint index, zval *value);
|
||||
|
||||
ZEND_API int add_next_index_long(zval *arg, long n);
|
||||
ZEND_API int add_next_index_null(zval *arg);
|
||||
ZEND_API int add_next_index_bool(zval *arg, int b);
|
||||
ZEND_API int add_next_index_resource(zval *arg, int r);
|
||||
ZEND_API int add_next_index_double(zval *arg, double d);
|
||||
ZEND_API int add_next_index_string(zval *arg, char *str, int duplicate);
|
||||
ZEND_API int add_next_index_stringl(zval *arg, char *str, uint length, int duplicate);
|
||||
ZEND_API int add_next_index_zval(zval *arg, zval *value);
|
||||
|
||||
ZEND_API int add_get_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, void **dest, int duplicate);
|
||||
ZEND_API int add_get_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, void **dest, int duplicate);
|
||||
|
||||
#define add_get_assoc_string(__arg, __key, __str, __dest, __duplicate) add_get_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __dest, __duplicate)
|
||||
#define add_get_assoc_stringl(__arg, __key, __str, __length, __dest, __duplicate) add_get_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __dest, __duplicate)
|
||||
|
||||
ZEND_API int add_get_index_long(zval *arg, uint idx, long l, void **dest);
|
||||
ZEND_API int add_get_index_double(zval *arg, uint idx, double d, void **dest);
|
||||
ZEND_API int add_get_index_string(zval *arg, uint idx, char *str, void **dest, int duplicate);
|
||||
ZEND_API int add_get_index_stringl(zval *arg, uint idx, char *str, uint length, void **dest, int duplicate);
|
||||
|
||||
ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, long l);
|
||||
ZEND_API int add_property_null_ex(zval *arg, char *key, uint key_len);
|
||||
ZEND_API int add_property_bool_ex(zval *arg, char *key, uint key_len, int b);
|
||||
ZEND_API int add_property_resource_ex(zval *arg, char *key, uint key_len, long r);
|
||||
ZEND_API int add_property_double_ex(zval *arg, char *key, uint key_len, double d);
|
||||
ZEND_API int add_property_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate);
|
||||
ZEND_API int add_property_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate);
|
||||
ZEND_API int add_property_zval_ex(zval *arg, char *key, uint key_len, zval *value);
|
||||
|
||||
#define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key)+1, __n)
|
||||
#define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key) + 1)
|
||||
#define add_property_bool(__arg, __key, __b) add_property_bool_ex(__arg, __key, strlen(__key)+1, __b)
|
||||
#define add_property_resource(__arg, __key, __r) add_property_resource_ex(__arg, __key, strlen(__key)+1, __r)
|
||||
#define add_property_double(__arg, __key, __d) add_property_double_ex(__arg, __key, strlen(__key)+1, __d)
|
||||
#define add_property_string(__arg, __key, __str, __duplicate) add_property_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
|
||||
#define add_property_stringl(__arg, __key, __str, __length, __duplicate) add_property_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
|
||||
#define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key)+1, __value)
|
||||
|
||||
ZEND_API int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, int param_count, zval *params[] TSRMLS_DC);
|
||||
ZEND_API int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, int param_count, zval **params[], int no_separation, HashTable *symbol_table TSRMLS_DC);
|
||||
|
||||
ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length,
|
||||
int is_ref, int num_symbol_tables, ...);
|
||||
|
||||
#define add_method(arg, key, method) add_assoc_function((arg), (key), (method))
|
||||
|
||||
#if ZEND_DEBUG
|
||||
#define CHECK_ZVAL_STRING(z) \
|
||||
if ((z)->value.str.val[ (z)->value.str.len ] != '\0') zend_error(E_WARNING, "String is not zero-terminated (%s)", (z)->value.str.val);
|
||||
#define CHECK_ZVAL_STRING_REL(z) \
|
||||
if ((z)->value.str.val[ (z)->value.str.len ] != '\0') zend_error(E_WARNING, "String is not zero-terminated (%s) (source: %s:%d)", (z)->value.str.val ZEND_FILE_LINE_RELAY_CC);
|
||||
#else
|
||||
#define CHECK_ZVAL_STRING(z)
|
||||
#define CHECK_ZVAL_STRING_REL(z)
|
||||
#endif
|
||||
|
||||
#define ZVAL_RESOURCE(z, l) { \
|
||||
(z)->type = IS_RESOURCE; \
|
||||
(z)->value.lval = l; \
|
||||
}
|
||||
|
||||
#define ZVAL_BOOL(z, b) { \
|
||||
(z)->type = IS_BOOL; \
|
||||
(z)->value.lval = b; \
|
||||
}
|
||||
|
||||
#define ZVAL_NULL(z) { \
|
||||
(z)->type = IS_NULL; \
|
||||
}
|
||||
|
||||
#define ZVAL_LONG(z, l) { \
|
||||
(z)->type = IS_LONG; \
|
||||
(z)->value.lval = l; \
|
||||
}
|
||||
|
||||
#define ZVAL_DOUBLE(z, d) { \
|
||||
(z)->type = IS_DOUBLE; \
|
||||
(z)->value.dval = d; \
|
||||
}
|
||||
|
||||
#define ZVAL_STRING(z, s, duplicate) { \
|
||||
char *__s=(s); \
|
||||
(z)->value.str.len = strlen(__s); \
|
||||
(z)->value.str.val = (duplicate?estrndup(__s, (z)->value.str.len):__s); \
|
||||
(z)->type = IS_STRING; \
|
||||
}
|
||||
|
||||
#define ZVAL_STRINGL(z, s, l, duplicate) { \
|
||||
char *__s=(s); int __l=l; \
|
||||
(z)->value.str.len = __l; \
|
||||
(z)->value.str.val = (duplicate?estrndup(__s, __l):__s); \
|
||||
(z)->type = IS_STRING; \
|
||||
}
|
||||
|
||||
#define ZVAL_EMPTY_STRING(z) { \
|
||||
(z)->value.str.len = 0; \
|
||||
(z)->value.str.val = empty_string; \
|
||||
(z)->type = IS_STRING; \
|
||||
}
|
||||
|
||||
#define ZVAL_FALSE(z) ZVAL_BOOL(z, 0)
|
||||
#define ZVAL_TRUE(z) ZVAL_BOOL(z, 1)
|
||||
|
||||
#define RETVAL_RESOURCE(l) ZVAL_RESOURCE(return_value, l)
|
||||
#define RETVAL_BOOL(b) ZVAL_BOOL(return_value, b)
|
||||
#define RETVAL_NULL() ZVAL_NULL(return_value)
|
||||
#define RETVAL_LONG(l) ZVAL_LONG(return_value, l)
|
||||
#define RETVAL_DOUBLE(d) ZVAL_DOUBLE(return_value, d)
|
||||
#define RETVAL_STRING(s, duplicate) ZVAL_STRING(return_value, s, duplicate)
|
||||
#define RETVAL_STRINGL(s, l, duplicate) ZVAL_STRINGL(return_value, s, l, duplicate)
|
||||
#define RETVAL_EMPTY_STRING() ZVAL_EMPTY_STRING(return_value)
|
||||
#define RETVAL_FALSE ZVAL_BOOL(return_value, 0)
|
||||
#define RETVAL_TRUE ZVAL_BOOL(return_value, 1)
|
||||
|
||||
#define RETURN_RESOURCE(l) { RETVAL_RESOURCE(l); return; }
|
||||
#define RETURN_BOOL(b) { RETVAL_BOOL(b); return; }
|
||||
#define RETURN_NULL() { RETVAL_NULL(); return;}
|
||||
#define RETURN_LONG(l) { RETVAL_LONG(l); return; }
|
||||
#define RETURN_DOUBLE(d) { RETVAL_DOUBLE(d); return; }
|
||||
#define RETURN_STRING(s, duplicate) { RETVAL_STRING(s, duplicate); return; }
|
||||
#define RETURN_STRINGL(s, l, duplicate) { RETVAL_STRINGL(s, l, duplicate); return; }
|
||||
#define RETURN_EMPTY_STRING() { RETVAL_EMPTY_STRING(); return; }
|
||||
#define RETURN_FALSE { RETVAL_FALSE; return; }
|
||||
#define RETURN_TRUE { RETVAL_TRUE; return; }
|
||||
|
||||
#define SET_VAR_STRING(n, v) { \
|
||||
{ \
|
||||
zval *var; \
|
||||
ALLOC_ZVAL(var); \
|
||||
ZVAL_STRING(var, v, 0); \
|
||||
ZEND_SET_GLOBAL_VAR(n, var); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define SET_VAR_STRINGL(n, v, l) { \
|
||||
{ \
|
||||
zval *var; \
|
||||
ALLOC_ZVAL(var); \
|
||||
ZVAL_STRINGL(var, v, l, 0); \
|
||||
ZEND_SET_GLOBAL_VAR(n, var); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define SET_VAR_LONG(n, v) { \
|
||||
{ \
|
||||
zval *var; \
|
||||
ALLOC_ZVAL(var); \
|
||||
ZVAL_LONG(var, v); \
|
||||
ZEND_SET_GLOBAL_VAR(n, var); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define SET_VAR_DOUBLE(n, v) { \
|
||||
{ \
|
||||
zval *var; \
|
||||
ALLOC_ZVAL(var); \
|
||||
ZVAL_DOUBLE(var, v); \
|
||||
ZEND_SET_GLOBAL_VAR(n, var); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#define ZEND_SET_SYMBOL(symtable, name, var) \
|
||||
{ \
|
||||
char *_name = (name); \
|
||||
\
|
||||
ZEND_SET_SYMBOL_WITH_LENGTH(symtable, _name, strlen(_name)+1, var, 1, 0); \
|
||||
}
|
||||
|
||||
#define ZEND_SET_SYMBOL_WITH_LENGTH(symtable, name, name_length, var, _refcount, _is_ref) \
|
||||
{ \
|
||||
zval **orig_var; \
|
||||
\
|
||||
if (zend_hash_find(symtable, (name), (name_length), (void **) &orig_var)==SUCCESS \
|
||||
&& PZVAL_IS_REF(*orig_var)) { \
|
||||
(var)->refcount = (*orig_var)->refcount; \
|
||||
(var)->is_ref = 1; \
|
||||
\
|
||||
if (_refcount) { \
|
||||
(var)->refcount += _refcount-1; \
|
||||
} \
|
||||
zval_dtor(*orig_var); \
|
||||
**orig_var = *(var); \
|
||||
FREE_ZVAL(var); \
|
||||
} else { \
|
||||
(var)->is_ref = _is_ref; \
|
||||
if (_refcount) { \
|
||||
(var)->refcount = _refcount; \
|
||||
} \
|
||||
zend_hash_update(symtable, (name), (name_length), &(var), sizeof(zval *), NULL); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#define ZEND_SET_GLOBAL_VAR(name, var) \
|
||||
ZEND_SET_SYMBOL(&EG(symbol_table), name, var)
|
||||
|
||||
#define ZEND_SET_GLOBAL_VAR_WITH_LENGTH(name, name_length, var, _refcount, _is_ref) \
|
||||
ZEND_SET_SYMBOL_WITH_LENGTH(&EG(symbol_table), name, name_length, var, _refcount, _is_ref)
|
||||
|
||||
#define HASH_OF(p) ((p)->type==IS_ARRAY ? (p)->value.ht : (((p)->type==IS_OBJECT ? Z_OBJPROP_P(p) : NULL)))
|
||||
#define ZVAL_IS_NULL(z) ((z)->type==IS_NULL)
|
||||
|
||||
/* For compatibility */
|
||||
#define ZEND_MINIT ZEND_MODULE_STARTUP_N
|
||||
#define ZEND_MSHUTDOWN ZEND_MODULE_SHUTDOWN_N
|
||||
#define ZEND_RINIT ZEND_MODULE_ACTIVATE_N
|
||||
#define ZEND_RSHUTDOWN ZEND_MODULE_DEACTIVATE_N
|
||||
#define ZEND_MINFO ZEND_MODULE_INFO_N
|
||||
|
||||
#define ZEND_MINIT_FUNCTION ZEND_MODULE_STARTUP_D
|
||||
#define ZEND_MSHUTDOWN_FUNCTION ZEND_MODULE_SHUTDOWN_D
|
||||
#define ZEND_RINIT_FUNCTION ZEND_MODULE_ACTIVATE_D
|
||||
#define ZEND_RSHUTDOWN_FUNCTION ZEND_MODULE_DEACTIVATE_D
|
||||
#define ZEND_MINFO_FUNCTION ZEND_MODULE_INFO_D
|
||||
|
||||
#endif /* ZEND_API_H */
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -1,769 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_alloc.h"
|
||||
#include "zend_globals.h"
|
||||
#include "zend_fast_cache.h"
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
# include <signal.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef ZTS
|
||||
ZEND_API zend_alloc_globals alloc_globals;
|
||||
#endif
|
||||
|
||||
|
||||
#define ZEND_DISABLE_MEMORY_CACHE 0
|
||||
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
#define ZEND_DO_MALLOC(size) (AG(memory_heap) ? HeapAlloc(AG(memory_heap), HEAP_NO_SERIALIZE, size) : malloc(size))
|
||||
#define ZEND_DO_FREE(ptr) (AG(memory_heap) ? HeapFree(AG(memory_heap), HEAP_NO_SERIALIZE, ptr) : free(ptr))
|
||||
#define ZEND_DO_REALLOC(ptr, size) (AG(memory_heap) ? HeapReAlloc(AG(memory_heap), HEAP_NO_SERIALIZE, ptr, size) : realloc(ptr, size))
|
||||
#else
|
||||
#define ZEND_DO_MALLOC(size) malloc(size)
|
||||
#define ZEND_DO_FREE(ptr) free(ptr)
|
||||
#define ZEND_DO_REALLOC(ptr, size) realloc(ptr, size)
|
||||
#endif
|
||||
|
||||
#if ZEND_DEBUG
|
||||
# define END_MAGIC_SIZE sizeof(long)
|
||||
static long mem_block_end_magic = MEM_BLOCK_END_MAGIC;
|
||||
#else
|
||||
# define END_MAGIC_SIZE 0
|
||||
#endif
|
||||
|
||||
|
||||
# if MEMORY_LIMIT
|
||||
# if ZEND_DEBUG
|
||||
#define CHECK_MEMORY_LIMIT(s, rs) _CHECK_MEMORY_LIMIT(s, rs, __zend_filename, __zend_lineno)
|
||||
# else
|
||||
#define CHECK_MEMORY_LIMIT(s, rs) _CHECK_MEMORY_LIMIT(s, rs, NULL, 0)
|
||||
# endif
|
||||
|
||||
#define _CHECK_MEMORY_LIMIT(s, rs, file, lineno) { AG(allocated_memory) += rs;\
|
||||
if (AG(memory_limit)<AG(allocated_memory)) {\
|
||||
if ((AG(memory_limit)+1048576)<AG(allocated_memory)) { \
|
||||
/* failed to handle this gracefully, exit() */ \
|
||||
exit(1); \
|
||||
} \
|
||||
if (!AG(memory_exhausted)) { \
|
||||
if (!file) { \
|
||||
zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted (tried to allocate %d bytes)", AG(memory_limit), s); \
|
||||
} else { \
|
||||
zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes)", AG(memory_limit), file, lineno, s); \
|
||||
} \
|
||||
AG(memory_exhausted)=1; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
# endif
|
||||
|
||||
#ifndef CHECK_MEMORY_LIMIT
|
||||
#define CHECK_MEMORY_LIMIT(s, rs)
|
||||
#endif
|
||||
|
||||
|
||||
#define REMOVE_POINTER_FROM_LIST(p) \
|
||||
if (!p->persistent && p==AG(head)) { \
|
||||
AG(head) = p->pNext; \
|
||||
} else if (p->persistent && p==AG(phead)) { \
|
||||
AG(phead) = p->pNext; \
|
||||
} else { \
|
||||
p->pLast->pNext = p->pNext; \
|
||||
} \
|
||||
if (p->pNext) { \
|
||||
p->pNext->pLast = p->pLast; \
|
||||
}
|
||||
|
||||
#define ADD_POINTER_TO_LIST(p) \
|
||||
if (p->persistent) { \
|
||||
p->pNext = AG(phead); \
|
||||
if (AG(phead)) { \
|
||||
AG(phead)->pLast = p; \
|
||||
} \
|
||||
AG(phead) = p; \
|
||||
} else { \
|
||||
p->pNext = AG(head); \
|
||||
if (AG(head)) { \
|
||||
AG(head)->pLast = p; \
|
||||
} \
|
||||
AG(head) = p; \
|
||||
} \
|
||||
p->pLast = (zend_mem_header *) NULL;
|
||||
|
||||
#define DECLARE_CACHE_VARS() \
|
||||
unsigned int real_size; \
|
||||
unsigned int cache_index
|
||||
|
||||
#define REAL_SIZE(size) ((size+7) & ~0x7)
|
||||
|
||||
#define CALCULATE_REAL_SIZE_AND_CACHE_INDEX(size) \
|
||||
real_size = REAL_SIZE(size); \
|
||||
cache_index = real_size >> 3;
|
||||
|
||||
#define SIZE real_size
|
||||
|
||||
#define CACHE_INDEX cache_index
|
||||
|
||||
ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
{
|
||||
zend_mem_header *p;
|
||||
DECLARE_CACHE_VARS();
|
||||
TSRMLS_FETCH();
|
||||
|
||||
CALCULATE_REAL_SIZE_AND_CACHE_INDEX(size);
|
||||
|
||||
if (!ZEND_DISABLE_MEMORY_CACHE && (CACHE_INDEX < MAX_CACHED_MEMORY) && (AG(cache_count)[CACHE_INDEX] > 0)) {
|
||||
p = AG(cache)[CACHE_INDEX][--AG(cache_count)[CACHE_INDEX]];
|
||||
#if ZEND_DEBUG
|
||||
p->filename = __zend_filename;
|
||||
p->lineno = __zend_lineno;
|
||||
p->orig_filename = __zend_orig_filename;
|
||||
p->orig_lineno = __zend_orig_lineno;
|
||||
p->magic = MEM_BLOCK_START_MAGIC;
|
||||
p->reported = 0;
|
||||
/* Setting the thread id should not be necessary, because we fetched this block
|
||||
* from this thread's cache
|
||||
*/
|
||||
AG(cache_stats)[CACHE_INDEX][1]++;
|
||||
memcpy((((char *) p) + sizeof(zend_mem_header) + MEM_HEADER_PADDING + size), &mem_block_end_magic, sizeof(long));
|
||||
#endif
|
||||
p->persistent = 0;
|
||||
p->cached = 0;
|
||||
p->size = size;
|
||||
return (void *)((char *)p + sizeof(zend_mem_header) + MEM_HEADER_PADDING);
|
||||
} else {
|
||||
#if ZEND_DEBUG
|
||||
if (CACHE_INDEX<MAX_CACHED_MEMORY) {
|
||||
AG(cache_stats)[CACHE_INDEX][0]++;
|
||||
}
|
||||
#endif
|
||||
p = (zend_mem_header *) ZEND_DO_MALLOC(sizeof(zend_mem_header) + MEM_HEADER_PADDING + SIZE + END_MAGIC_SIZE);
|
||||
}
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
if (!p) {
|
||||
fprintf(stderr,"FATAL: emalloc(): Unable to allocate %ld bytes\n", (long) size);
|
||||
#if ZEND_DEBUG && defined(HAVE_KILL) && defined(HAVE_GETPID)
|
||||
kill(getpid(), SIGSEGV);
|
||||
#else
|
||||
exit(1);
|
||||
#endif
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return (void *)p;
|
||||
}
|
||||
p->persistent = p->cached = 0;
|
||||
ADD_POINTER_TO_LIST(p);
|
||||
p->size = size; /* Save real size for correct cache output */
|
||||
#if ZEND_DEBUG
|
||||
p->filename = __zend_filename;
|
||||
p->lineno = __zend_lineno;
|
||||
p->orig_filename = __zend_orig_filename;
|
||||
p->orig_lineno = __zend_orig_lineno;
|
||||
p->magic = MEM_BLOCK_START_MAGIC;
|
||||
p->reported = 0;
|
||||
# ifdef ZTS
|
||||
p->thread_id = tsrm_thread_id();
|
||||
# endif
|
||||
memcpy((((char *) p) + sizeof(zend_mem_header) + MEM_HEADER_PADDING + size), &mem_block_end_magic, sizeof(long));
|
||||
#endif
|
||||
#if MEMORY_LIMIT
|
||||
CHECK_MEMORY_LIMIT(size, SIZE);
|
||||
if (AG(allocated_memory) > AG(allocated_memory_peak)) {
|
||||
AG(allocated_memory_peak) = AG(allocated_memory);
|
||||
}
|
||||
#endif
|
||||
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return (void *)((char *)p + sizeof(zend_mem_header) + MEM_HEADER_PADDING);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
{
|
||||
zend_mem_header *p = (zend_mem_header *) ((char *)ptr - sizeof(zend_mem_header) - MEM_HEADER_PADDING);
|
||||
DECLARE_CACHE_VARS();
|
||||
TSRMLS_FETCH();
|
||||
|
||||
#if defined(ZTS) && TSRM_DEBUG
|
||||
if (p->thread_id != tsrm_thread_id()) {
|
||||
tsrm_error(TSRM_ERROR_LEVEL_ERROR, "Memory block allocated at %s:(%d) on thread %x freed at %s:(%d) on thread %x, ignoring",
|
||||
p->filename, p->lineno, p->thread_id,
|
||||
__zend_filename, __zend_lineno, tsrm_thread_id());
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
CALCULATE_REAL_SIZE_AND_CACHE_INDEX(p->size);
|
||||
#if ZEND_DEBUG
|
||||
if (!_mem_block_check(ptr, 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC)) {
|
||||
return;
|
||||
}
|
||||
memset(ptr, 0x5a, p->size);
|
||||
#endif
|
||||
|
||||
if (!ZEND_DISABLE_MEMORY_CACHE
|
||||
&& !p->persistent && (CACHE_INDEX < MAX_CACHED_MEMORY) && (AG(cache_count)[CACHE_INDEX] < MAX_CACHED_ENTRIES)) {
|
||||
AG(cache)[CACHE_INDEX][AG(cache_count)[CACHE_INDEX]++] = p;
|
||||
p->cached = 1;
|
||||
#if ZEND_DEBUG
|
||||
p->magic = MEM_BLOCK_CACHED_MAGIC;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
REMOVE_POINTER_FROM_LIST(p);
|
||||
|
||||
#if MEMORY_LIMIT
|
||||
AG(allocated_memory) -= SIZE;
|
||||
#endif
|
||||
|
||||
ZEND_DO_FREE(p);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
{
|
||||
void *p;
|
||||
int final_size = size*nmemb;
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
p = _emalloc(final_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
if (!p) {
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return (void *) p;
|
||||
}
|
||||
memset(p, 0, final_size);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
{
|
||||
zend_mem_header *p;
|
||||
zend_mem_header *orig;
|
||||
DECLARE_CACHE_VARS();
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (!ptr) {
|
||||
return _emalloc(size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
}
|
||||
|
||||
p = orig = (zend_mem_header *) ((char *)ptr-sizeof(zend_mem_header)-MEM_HEADER_PADDING);
|
||||
|
||||
#if defined(ZTS) && TSRM_DEBUG
|
||||
if (p->thread_id != tsrm_thread_id()) {
|
||||
void *new_p;
|
||||
|
||||
tsrm_error(TSRM_ERROR_LEVEL_ERROR, "Memory block allocated at %s:(%d) on thread %x reallocated at %s:(%d) on thread %x, duplicating",
|
||||
p->filename, p->lineno, p->thread_id,
|
||||
__zend_filename, __zend_lineno, tsrm_thread_id());
|
||||
new_p = _emalloc(size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
memcpy(new_p, ptr, p->size);
|
||||
return new_p;
|
||||
}
|
||||
#endif
|
||||
|
||||
CALCULATE_REAL_SIZE_AND_CACHE_INDEX(size);
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
REMOVE_POINTER_FROM_LIST(p);
|
||||
p = (zend_mem_header *) ZEND_DO_REALLOC(p, sizeof(zend_mem_header)+MEM_HEADER_PADDING+SIZE+END_MAGIC_SIZE);
|
||||
if (!p) {
|
||||
if (!allow_failure) {
|
||||
fprintf(stderr,"FATAL: erealloc(): Unable to allocate %ld bytes\n", (long) size);
|
||||
#if ZEND_DEBUG && HAVE_KILL && HAVE_GETPID
|
||||
kill(getpid(), SIGSEGV);
|
||||
#else
|
||||
exit(1);
|
||||
#endif
|
||||
}
|
||||
ADD_POINTER_TO_LIST(orig);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return (void *)NULL;
|
||||
}
|
||||
ADD_POINTER_TO_LIST(p);
|
||||
#if ZEND_DEBUG
|
||||
p->filename = __zend_filename;
|
||||
p->lineno = __zend_lineno;
|
||||
p->magic = MEM_BLOCK_START_MAGIC;
|
||||
memcpy((((char *) p) + sizeof(zend_mem_header) + MEM_HEADER_PADDING + size), &mem_block_end_magic, sizeof(long));
|
||||
#endif
|
||||
#if MEMORY_LIMIT
|
||||
CHECK_MEMORY_LIMIT(size - p->size, SIZE - REAL_SIZE(p->size));
|
||||
if (AG(allocated_memory) > AG(allocated_memory_peak)) {
|
||||
AG(allocated_memory_peak) = AG(allocated_memory);
|
||||
}
|
||||
#endif
|
||||
|
||||
p->size = size;
|
||||
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return (void *)((char *)p+sizeof(zend_mem_header)+MEM_HEADER_PADDING);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
{
|
||||
int length;
|
||||
char *p;
|
||||
|
||||
length = strlen(s)+1;
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
p = (char *) _emalloc(length ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
if (!p) {
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return (char *)NULL;
|
||||
}
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
memcpy(p, s, length);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API char *_estrndup(const char *s, uint length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
{
|
||||
char *p;
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
p = (char *) _emalloc(length+1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
if (!p) {
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return (char *)NULL;
|
||||
}
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
memcpy(p, s, length);
|
||||
p[length] = 0;
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API char *zend_strndup(const char *s, uint length)
|
||||
{
|
||||
char *p;
|
||||
|
||||
p = (char *) malloc(length+1);
|
||||
if (!p) {
|
||||
return (char *)NULL;
|
||||
}
|
||||
if (length) {
|
||||
memcpy(p, s, length);
|
||||
}
|
||||
p[length] = 0;
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_set_memory_limit(unsigned int memory_limit)
|
||||
{
|
||||
#if MEMORY_LIMIT
|
||||
TSRMLS_FETCH();
|
||||
|
||||
AG(memory_limit) = memory_limit;
|
||||
return SUCCESS;
|
||||
#else
|
||||
return FAILURE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void start_memory_manager(TSRMLS_D)
|
||||
{
|
||||
#if 0
|
||||
#ifndef ZTS
|
||||
int i, j;
|
||||
void *cached_entries[MAX_CACHED_MEMORY][MAX_CACHED_ENTRIES];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
AG(phead) = AG(head) = NULL;
|
||||
|
||||
#if MEMORY_LIMIT
|
||||
AG(memory_limit) = 1<<30; /* ridiculous limit, effectively no limit */
|
||||
AG(allocated_memory) = 0;
|
||||
AG(memory_exhausted) = 0;
|
||||
AG(allocated_memory_peak) = 0;
|
||||
#endif
|
||||
|
||||
memset(AG(fast_cache_list_head), 0, sizeof(AG(fast_cache_list_head)));
|
||||
memset(AG(cache_count), 0, sizeof(AG(cache_count)));
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
AG(memory_heap) = HeapCreate(HEAP_NO_SERIALIZE, 256*1024, 0);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#ifndef ZTS
|
||||
/* Initialize cache, to prevent fragmentation */
|
||||
/* We can't do this in ZTS mode, because calling emalloc() from within start_memory_manager()
|
||||
* will yield an endless recursion calling to alloc_globals_ctor()
|
||||
*/
|
||||
for (i=1; i<MAX_CACHED_MEMORY; i++) {
|
||||
for (j=0; j<PRE_INIT_CACHE_ENTRIES; j++) {
|
||||
cached_entries[i][j] = emalloc(8*i);
|
||||
}
|
||||
}
|
||||
for (i=1; i<MAX_CACHED_MEMORY; i++) {
|
||||
for (j=0; j<PRE_INIT_CACHE_ENTRIES; j++) {
|
||||
efree(cached_entries[i][j]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ZEND_DEBUG
|
||||
memset(AG(cache_stats), 0, sizeof(AG(cache_stats)));
|
||||
memset(AG(fast_cache_stats), 0, sizeof(AG(fast_cache_stats)));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void shutdown_memory_manager(int silent, int clean_cache)
|
||||
{
|
||||
zend_mem_header *p, *t;
|
||||
unsigned int fci, i, j;
|
||||
#if ZEND_DEBUG
|
||||
int had_leaks = 0;
|
||||
#endif
|
||||
zend_fast_cache_list_entry *fast_cache_list_entry, *next_fast_cache_list_entry;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
#if defined(ZEND_WIN32) && !ZEND_DEBUG
|
||||
if (clean_cache && AG(memory_heap)) {
|
||||
HeapDestroy(AG(memory_heap));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (fci=0; fci<MAX_FAST_CACHE_TYPES; fci++) {
|
||||
fast_cache_list_entry = AG(fast_cache_list_head)[fci];
|
||||
while (fast_cache_list_entry) {
|
||||
next_fast_cache_list_entry = fast_cache_list_entry->next;
|
||||
efree(fast_cache_list_entry);
|
||||
fast_cache_list_entry = next_fast_cache_list_entry;
|
||||
}
|
||||
AG(fast_cache_list_head)[fci] = NULL;
|
||||
}
|
||||
|
||||
if (1 || clean_cache) {
|
||||
zend_mem_header *ptr;
|
||||
|
||||
for (i=1; i<MAX_CACHED_MEMORY; i++) {
|
||||
for (j=0; j<AG(cache_count)[i]; j++) {
|
||||
ptr = (zend_mem_header *) AG(cache)[i][j];
|
||||
#if MEMORY_LIMIT
|
||||
AG(allocated_memory) -= REAL_SIZE(ptr->size);
|
||||
#endif
|
||||
REMOVE_POINTER_FROM_LIST(ptr);
|
||||
ZEND_DO_FREE(ptr);
|
||||
}
|
||||
AG(cache_count)[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
p = AG(head);
|
||||
t = AG(head);
|
||||
while (t) {
|
||||
if (!t->cached) {
|
||||
#if ZEND_DEBUG
|
||||
if (!t->cached && !t->reported) {
|
||||
zend_mem_header *iterator;
|
||||
int total_leak=0, total_leak_count=0;
|
||||
|
||||
had_leaks = 1;
|
||||
if (!silent) {
|
||||
zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, t);
|
||||
}
|
||||
t->reported = 1;
|
||||
for (iterator=t->pNext; iterator; iterator=iterator->pNext) {
|
||||
if (!iterator->cached
|
||||
&& iterator->filename==t->filename
|
||||
&& iterator->lineno==t->lineno) {
|
||||
total_leak += iterator->size;
|
||||
total_leak_count++;
|
||||
iterator->reported = 1;
|
||||
}
|
||||
}
|
||||
if (!silent && total_leak_count>0) {
|
||||
zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *) (long) (total_leak_count));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if MEMORY_LIMIT
|
||||
AG(allocated_memory) -= t->size;
|
||||
#endif
|
||||
p = t->pNext;
|
||||
REMOVE_POINTER_FROM_LIST(t);
|
||||
ZEND_DO_FREE(t);
|
||||
t = p;
|
||||
} else {
|
||||
t = t->pNext;
|
||||
}
|
||||
}
|
||||
|
||||
#if MEMORY_LIMIT
|
||||
AG(memory_exhausted)=0;
|
||||
AG(allocated_memory_peak) = 0;
|
||||
#endif
|
||||
|
||||
|
||||
#if (ZEND_DEBUG)
|
||||
do {
|
||||
zval display_memory_cache_stats;
|
||||
int i, j;
|
||||
|
||||
if (clean_cache) {
|
||||
/* we're shutting down completely, don't even touch the INI subsystem */
|
||||
break;
|
||||
}
|
||||
if (zend_get_configuration_directive("display_memory_cache_stats", sizeof("display_memory_cache_stats"), &display_memory_cache_stats)==FAILURE) {
|
||||
break;
|
||||
}
|
||||
if (!atoi(display_memory_cache_stats.value.str.val)) {
|
||||
break;
|
||||
}
|
||||
fprintf(stderr, "Memory cache statistics\n"
|
||||
"-----------------------\n\n"
|
||||
"[zval, %2ld]\t\t%d / %d (%.2f%%)\n"
|
||||
"[hash, %2ld]\t\t%d / %d (%.2f%%)\n",
|
||||
(long) sizeof(zval),
|
||||
AG(fast_cache_stats)[ZVAL_CACHE_LIST][1], AG(fast_cache_stats)[ZVAL_CACHE_LIST][0]+AG(fast_cache_stats)[ZVAL_CACHE_LIST][1],
|
||||
((double) AG(fast_cache_stats)[ZVAL_CACHE_LIST][1] / (AG(fast_cache_stats)[ZVAL_CACHE_LIST][0]+AG(fast_cache_stats)[ZVAL_CACHE_LIST][1]))*100,
|
||||
(long) sizeof(HashTable),
|
||||
AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][1], AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][0]+AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][1],
|
||||
((double) AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][1] / (AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][0]+AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][1]))*100);
|
||||
|
||||
|
||||
for (i=0; i<MAX_CACHED_MEMORY; i+=2) {
|
||||
fprintf(stderr, "[%2d, %2d]\t\t", i, i+1);
|
||||
for (j=0; j<2; j++) {
|
||||
fprintf(stderr, "%d / %d (%.2f%%)\t\t",
|
||||
AG(cache_stats)[i+j][1], AG(cache_stats)[i+j][0]+AG(cache_stats)[i+j][1],
|
||||
((double) AG(cache_stats)[i+j][1] / (AG(cache_stats)[i+j][0]+AG(cache_stats)[i+j][1]))*100);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
} while (0);
|
||||
|
||||
#if defined(ZEND_WIN32) && ZEND_DEBUG
|
||||
if (clean_cache && AG(memory_heap)) {
|
||||
HeapDestroy(AG(memory_heap));
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if ZEND_DEBUG
|
||||
void zend_debug_alloc_output(char *format, ...)
|
||||
{
|
||||
char output_buf[256];
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
vsprintf(output_buf, format, args);
|
||||
va_end(args);
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
OutputDebugString(output_buf);
|
||||
#else
|
||||
fprintf(stderr, "%s", output_buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
{
|
||||
zend_mem_header *p = (zend_mem_header *) ((char *)ptr - sizeof(zend_mem_header) - MEM_HEADER_PADDING);
|
||||
int no_cache_notice=0;
|
||||
int valid_beginning=1;
|
||||
int had_problems=0;
|
||||
long end_magic;
|
||||
|
||||
if (silent==2) {
|
||||
silent = 1;
|
||||
no_cache_notice = 1;
|
||||
}
|
||||
if (silent==3) {
|
||||
silent = 0;
|
||||
no_cache_notice = 1;
|
||||
}
|
||||
if (!silent) {
|
||||
zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL);
|
||||
zend_debug_alloc_output("---------------------------------------\n");
|
||||
zend_debug_alloc_output("%s(%d) : Block 0x%0.8lX status:\n" ZEND_FILE_LINE_RELAY_CC, (long) p);
|
||||
if (__zend_orig_filename) {
|
||||
zend_debug_alloc_output("%s(%d) : Actual location (location was relayed)\n" ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
}
|
||||
zend_debug_alloc_output("%10s\t","Beginning: ");
|
||||
}
|
||||
|
||||
switch (p->magic) {
|
||||
case MEM_BLOCK_START_MAGIC:
|
||||
if (!silent) {
|
||||
zend_debug_alloc_output("OK (allocated on %s:%d, %d bytes)\n", p->filename, p->lineno, p->size);
|
||||
}
|
||||
break; /* ok */
|
||||
case MEM_BLOCK_FREED_MAGIC:
|
||||
if (!silent) {
|
||||
zend_debug_alloc_output("Freed\n");
|
||||
had_problems = 1;
|
||||
} else {
|
||||
return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
}
|
||||
break;
|
||||
case MEM_BLOCK_CACHED_MAGIC:
|
||||
if (!silent) {
|
||||
if (!no_cache_notice) {
|
||||
zend_debug_alloc_output("Cached (allocated on %s:%d, %d bytes)\n", p->filename, p->lineno, p->size);
|
||||
had_problems = 1;
|
||||
}
|
||||
} else {
|
||||
if (!no_cache_notice) {
|
||||
return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (!silent) {
|
||||
zend_debug_alloc_output("Overrun (magic=0x%0.8lX, expected=0x%0.8lX)\n", p->magic, MEM_BLOCK_START_MAGIC);
|
||||
} else {
|
||||
return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
}
|
||||
had_problems = 1;
|
||||
valid_beginning = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
memcpy(&end_magic, (((char *) p)+sizeof(zend_mem_header)+MEM_HEADER_PADDING+p->size), sizeof(long));
|
||||
|
||||
if (valid_beginning && (end_magic != MEM_BLOCK_END_MAGIC)) {
|
||||
char *overflow_ptr, *magic_ptr=(char *) &mem_block_end_magic;
|
||||
int overflows=0;
|
||||
int i;
|
||||
|
||||
if (silent) {
|
||||
return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
}
|
||||
had_problems = 1;
|
||||
overflow_ptr = (char *) &end_magic;
|
||||
|
||||
for (i=0; i<sizeof(long); i++) {
|
||||
if (overflow_ptr[i]!=magic_ptr[i]) {
|
||||
overflows++;
|
||||
}
|
||||
}
|
||||
|
||||
zend_debug_alloc_output("%10s\t", "End:");
|
||||
zend_debug_alloc_output("Overflown (magic=0x%0.8lX instead of 0x%0.8lX)\n", end_magic, MEM_BLOCK_END_MAGIC);
|
||||
zend_debug_alloc_output("%10s\t","");
|
||||
if (overflows>=sizeof(long)) {
|
||||
zend_debug_alloc_output("At least %d bytes overflown\n", sizeof(long));
|
||||
} else {
|
||||
zend_debug_alloc_output("%d byte(s) overflown\n", overflows);
|
||||
}
|
||||
} else if (!silent) {
|
||||
zend_debug_alloc_output("%10s\t", "End:");
|
||||
if (valid_beginning) {
|
||||
zend_debug_alloc_output("OK\n");
|
||||
} else {
|
||||
zend_debug_alloc_output("Unknown\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (had_problems) {
|
||||
int foo = 5;
|
||||
|
||||
foo += 1;
|
||||
}
|
||||
|
||||
if (!silent) {
|
||||
zend_debug_alloc_output("---------------------------------------\n");
|
||||
}
|
||||
return ((!had_problems) ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void _full_mem_check(int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
{
|
||||
zend_mem_header *p;
|
||||
int errors=0;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
p = AG(head);
|
||||
|
||||
|
||||
zend_debug_alloc_output("------------------------------------------------\n");
|
||||
zend_debug_alloc_output("Full Memory Check at %s:%d\n" ZEND_FILE_LINE_RELAY_CC);
|
||||
|
||||
while (p) {
|
||||
if (!_mem_block_check((void *)((char *)p + sizeof(zend_mem_header) + MEM_HEADER_PADDING), (silent?2:3) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC)) {
|
||||
errors++;
|
||||
}
|
||||
p = p->pNext;
|
||||
}
|
||||
zend_debug_alloc_output("End of full memory check %s:%d (%d errors)\n" ZEND_FILE_LINE_RELAY_CC, errors);
|
||||
zend_debug_alloc_output("------------------------------------------------\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
ZEND_API int _persist_alloc(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
{
|
||||
zend_mem_header *p = (zend_mem_header *) ((char *)ptr-sizeof(zend_mem_header)-MEM_HEADER_PADDING);
|
||||
TSRMLS_FETCH();
|
||||
|
||||
#if ZEND_DEBUG
|
||||
_mem_block_check(ptr, 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
#endif
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
/* remove the block from the non persistent list */
|
||||
REMOVE_POINTER_FROM_LIST(p);
|
||||
|
||||
p->persistent = 1;
|
||||
|
||||
/* add the block to the persistent list */
|
||||
ADD_POINTER_TO_LIST(p);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return REAL_SIZE(p->size)+sizeof(zend_mem_header)+MEM_HEADER_PADDING;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -1,141 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ZEND_ALLOC_H
|
||||
#define ZEND_ALLOC_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../TSRM/TSRM.h"
|
||||
#include "zend_globals_macros.h"
|
||||
|
||||
#define MEM_BLOCK_START_MAGIC 0x7312F8DCL
|
||||
#define MEM_BLOCK_END_MAGIC 0x2A8FCC84L
|
||||
#define MEM_BLOCK_FREED_MAGIC 0x99954317L
|
||||
#define MEM_BLOCK_CACHED_MAGIC 0xFB8277DCL
|
||||
|
||||
typedef struct _zend_mem_header {
|
||||
#if ZEND_DEBUG
|
||||
long magic;
|
||||
char *filename;
|
||||
uint lineno;
|
||||
int reported;
|
||||
char *orig_filename;
|
||||
uint orig_lineno;
|
||||
# ifdef ZTS
|
||||
THREAD_T thread_id;
|
||||
# endif
|
||||
#endif
|
||||
struct _zend_mem_header *pNext;
|
||||
struct _zend_mem_header *pLast;
|
||||
unsigned int size:30;
|
||||
unsigned int persistent:1;
|
||||
unsigned int cached:1;
|
||||
} zend_mem_header;
|
||||
|
||||
typedef union _align_test {
|
||||
void *ptr;
|
||||
double dbl;
|
||||
long lng;
|
||||
} align_test;
|
||||
|
||||
#define MAX_CACHED_MEMORY 11
|
||||
#define MAX_CACHED_ENTRIES 256
|
||||
#define PRE_INIT_CACHE_ENTRIES 32
|
||||
|
||||
#if (defined (__GNUC__) && __GNUC__ >= 2)
|
||||
#define PLATFORM_ALIGNMENT (__alignof__ (align_test))
|
||||
#else
|
||||
#define PLATFORM_ALIGNMENT (sizeof(align_test))
|
||||
#endif
|
||||
|
||||
#define MEM_HEADER_PADDING (((PLATFORM_ALIGNMENT-sizeof(zend_mem_header))%PLATFORM_ALIGNMENT+PLATFORM_ALIGNMENT)%PLATFORM_ALIGNMENT)
|
||||
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
|
||||
ZEND_API char *zend_strndup(const char *s, unsigned int length);
|
||||
|
||||
ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
|
||||
ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
|
||||
ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
|
||||
ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
|
||||
ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
|
||||
ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
|
||||
ZEND_API int _persist_alloc(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
|
||||
|
||||
/* Standard wrapper macros */
|
||||
#define emalloc(size) _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
|
||||
#define efree(ptr) _efree((ptr) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
|
||||
#define ecalloc(nmemb, size) _ecalloc((nmemb), (size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
|
||||
#define erealloc(ptr, size) _erealloc((ptr), (size), 0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
|
||||
#define erealloc_recoverable(ptr, size) _erealloc((ptr), (size), 1 ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
|
||||
#define estrdup(s) _estrdup((s) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
|
||||
#define estrndup(s, length) _estrndup((s), (length) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
|
||||
#define persist_alloc(p) _persist_alloc((p) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
|
||||
|
||||
/* Relay wrapper macros */
|
||||
#define emalloc_rel(size) _emalloc((size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
|
||||
#define efree_rel(ptr) _efree((ptr) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
|
||||
#define ecalloc_rel(nmemb, size) _ecalloc((nmemb), (size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
|
||||
#define erealloc_rel(ptr, size) _erealloc((ptr), (size), 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
|
||||
#define erealloc_recoverable_rel(ptr, size) _erealloc((ptr), (size), 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
|
||||
#define estrdup_rel(s) _estrdup((s) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
|
||||
#define estrndup_rel(s, length) _estrndup((s), (length) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
|
||||
#define persist_alloc_rel(p) _persist_alloc((p) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
|
||||
|
||||
/* Selective persistent/non persistent allocation macros */
|
||||
#define pemalloc(size, persistent) ((persistent)?malloc(size):emalloc(size))
|
||||
#define pefree(ptr, persistent) ((persistent)?free(ptr):efree(ptr))
|
||||
#define pecalloc(nmemb, size, persistent) ((persistent)?calloc((nmemb), (size)):ecalloc((nmemb), (size)))
|
||||
#define perealloc(ptr, size, persistent) ((persistent)?realloc((ptr), (size)):erealloc((ptr), (size)))
|
||||
#define perealloc_recoverable(ptr, size, persistent) ((persistent)?realloc((ptr), (size)):erealloc_recoverable((ptr), (size)))
|
||||
#define pestrdup(s, persistent) ((persistent)?strdup(s):estrdup(s))
|
||||
|
||||
#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):(empty_string))
|
||||
#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):(empty_string))
|
||||
|
||||
ZEND_API int zend_set_memory_limit(unsigned int memory_limit);
|
||||
|
||||
ZEND_API void start_memory_manager(TSRMLS_D);
|
||||
ZEND_API void shutdown_memory_manager(int silent, int clean_cache);
|
||||
|
||||
#if ZEND_DEBUG
|
||||
ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
|
||||
ZEND_API void _full_mem_check(int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
|
||||
void zend_debug_alloc_output(char *format, ...);
|
||||
#define mem_block_check(ptr, silent) _mem_block_check(ptr, silent ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
|
||||
#define full_mem_check(silent) _full_mem_check(silent ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
|
||||
#else
|
||||
#define mem_block_check(type, ptr, silent)
|
||||
#define full_mem_check(silent)
|
||||
#endif
|
||||
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ZEND_BUILTIN_FUNCTIONS_H
|
||||
#define ZEND_BUILTIN_FUNCTIONS_H
|
||||
|
||||
int zend_startup_builtin_functions(TSRMLS_D);
|
||||
|
||||
#endif /* ZEND_BUILTIN_FUNCTIONS_H */
|
||||
-2585
File diff suppressed because it is too large.
Load diff
@@ -1,635 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ZEND_COMPILE_H
|
||||
#define ZEND_COMPILE_H
|
||||
|
||||
#include "zend.h"
|
||||
|
||||
#ifdef HAVE_STDARG_H
|
||||
# include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#include "zend_llist.h"
|
||||
|
||||
#define DEBUG_ZEND 0
|
||||
|
||||
#define FREE_PNODE(znode) zval_dtor(&znode->u.constant);
|
||||
#define FREE_OP(Ts, op, should_free) if (should_free) zval_dtor(&Ts[(op)->u.var].tmp_var);
|
||||
|
||||
#define SET_UNUSED(op) (op).op_type = IS_UNUSED
|
||||
|
||||
#define INC_BPC(op_array) if (CG(interactive)) { ((op_array)->backpatch_count++); }
|
||||
#define DEC_BPC(op_array) if (CG(interactive)) { ((op_array)->backpatch_count--); }
|
||||
#define HANDLE_INTERACTIVE() if (CG(interactive)) { execute_new_code(TSRMLS_C); }
|
||||
|
||||
typedef struct _zend_op_array zend_op_array;
|
||||
|
||||
typedef struct _znode {
|
||||
int op_type;
|
||||
zend_llist *throw_list; /* Try and save this space later on */
|
||||
union {
|
||||
zval constant;
|
||||
|
||||
zend_uint var;
|
||||
zend_uint opline_num; /* Needs to be signed */
|
||||
zend_uint fetch_type;
|
||||
zend_op_array *op_array;
|
||||
struct {
|
||||
zend_uint var; /* dummy */
|
||||
zend_uint type;
|
||||
} EA;
|
||||
} u;
|
||||
} znode;
|
||||
|
||||
|
||||
typedef struct _zend_op {
|
||||
zend_uchar opcode;
|
||||
znode result;
|
||||
znode op1;
|
||||
znode op2;
|
||||
ulong extended_value;
|
||||
uint lineno;
|
||||
} zend_op;
|
||||
|
||||
|
||||
typedef struct _zend_brk_cont_element {
|
||||
int cont;
|
||||
int brk;
|
||||
int parent;
|
||||
} zend_brk_cont_element;
|
||||
|
||||
|
||||
struct _zend_op_array {
|
||||
zend_uchar type; /* MUST be the first element of this struct! */
|
||||
|
||||
zend_uchar *arg_types; /* MUST be the second element of this struct! */
|
||||
char *function_name; /* MUST be the third element of this struct! */
|
||||
|
||||
zend_uint *refcount;
|
||||
|
||||
zend_op *opcodes;
|
||||
zend_uint last, size;
|
||||
|
||||
zend_uint T;
|
||||
|
||||
zend_brk_cont_element *brk_cont_array;
|
||||
zend_uint last_brk_cont;
|
||||
zend_uint current_brk_cont;
|
||||
zend_bool uses_globals;
|
||||
|
||||
/* static variables support */
|
||||
HashTable *static_variables;
|
||||
|
||||
zend_op *start_op;
|
||||
int backpatch_count;
|
||||
|
||||
zend_bool return_reference;
|
||||
zend_bool done_pass_two;
|
||||
|
||||
char *filename;
|
||||
|
||||
void *reserved[ZEND_MAX_RESERVED_RESOURCES];
|
||||
};
|
||||
|
||||
|
||||
typedef struct _zend_internal_function {
|
||||
zend_uchar type; /* MUST be the first element of this struct! */
|
||||
|
||||
zend_uchar *arg_types; /* MUST be the second element of this struct */
|
||||
char *function_name; /* MUST be the third element of this struct */
|
||||
|
||||
void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
|
||||
} zend_internal_function;
|
||||
|
||||
|
||||
typedef struct _zend_overloaded_function {
|
||||
zend_uchar type; /* MUST be the first element of this struct! */
|
||||
|
||||
zend_uchar *arg_types; /* MUST be the second element of this struct */
|
||||
char *function_name; /* MUST be the third element of this struct */
|
||||
|
||||
zend_uint var;
|
||||
} zend_overloaded_function;
|
||||
|
||||
|
||||
typedef union _zend_function {
|
||||
zend_uchar type; /* MUST be the first element of this struct! */
|
||||
struct {
|
||||
zend_uchar type; /* never used */
|
||||
zend_uchar *arg_types;
|
||||
char *function_name;
|
||||
} common;
|
||||
|
||||
zend_op_array op_array;
|
||||
zend_internal_function internal_function;
|
||||
zend_overloaded_function overloaded_function;
|
||||
} zend_function;
|
||||
|
||||
|
||||
typedef struct _zend_function_state {
|
||||
HashTable *function_symbol_table;
|
||||
zend_function *function;
|
||||
void *reserved[ZEND_MAX_RESERVED_RESOURCES];
|
||||
} zend_function_state;
|
||||
|
||||
|
||||
typedef struct _zend_switch_entry {
|
||||
znode cond;
|
||||
int default_case;
|
||||
int control_var;
|
||||
} zend_switch_entry;
|
||||
|
||||
|
||||
typedef struct _list_llist_element {
|
||||
znode var;
|
||||
zend_llist dimensions;
|
||||
znode value;
|
||||
} list_llist_element;
|
||||
|
||||
|
||||
typedef struct _zend_file_handle {
|
||||
zend_uchar type;
|
||||
char *filename;
|
||||
char *opened_path;
|
||||
union {
|
||||
int fd;
|
||||
FILE *fp;
|
||||
} handle;
|
||||
zend_bool free_filename;
|
||||
} zend_file_handle;
|
||||
|
||||
|
||||
|
||||
#define IS_CONST (1<<0)
|
||||
#define IS_TMP_VAR (1<<1)
|
||||
#define IS_VAR (1<<2)
|
||||
#define IS_UNUSED (1<<3) /* Unused variable */
|
||||
|
||||
|
||||
#define EXT_TYPE_UNUSED (1<<0)
|
||||
|
||||
#include "zend_globals.h"
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
|
||||
void init_compiler(TSRMLS_D);
|
||||
void shutdown_compiler(TSRMLS_D);
|
||||
void zend_init_compiler_data_structures(TSRMLS_D);
|
||||
|
||||
extern ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC);
|
||||
|
||||
void zend_activate(TSRMLS_D);
|
||||
void zend_deactivate(TSRMLS_D);
|
||||
void zend_activate_modules(TSRMLS_D);
|
||||
void zend_deactivate_modules(TSRMLS_D);
|
||||
|
||||
|
||||
int lex_scan(zval *zendlval TSRMLS_DC);
|
||||
void startup_scanner(TSRMLS_D);
|
||||
void shutdown_scanner(TSRMLS_D);
|
||||
|
||||
ZEND_API char *zend_set_compiled_filename(char *new_compiled_filename TSRMLS_DC);
|
||||
ZEND_API void zend_restore_compiled_filename(char *original_compiled_filename TSRMLS_DC);
|
||||
ZEND_API char *zend_get_compiled_filename(TSRMLS_D);
|
||||
ZEND_API int zend_get_compiled_lineno(TSRMLS_D);
|
||||
|
||||
#ifdef ZTS
|
||||
const char *zend_get_zendtext(TSRMLS_D);
|
||||
int zend_get_zendleng(TSRMLS_D);
|
||||
#endif
|
||||
|
||||
|
||||
/* parser-driven code generators */
|
||||
void zend_do_binary_op(int op, znode *result, znode *op1, znode *op2 TSRMLS_DC);
|
||||
void zend_do_unary_op(int op, znode *result, znode *op1 TSRMLS_DC);
|
||||
void zend_do_binary_assign_op(int op, znode *result, znode *op1, znode *op2 TSRMLS_DC);
|
||||
void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC);
|
||||
void zend_do_assign_ref(znode *result, znode *lvar, znode *rvar TSRMLS_DC);
|
||||
void fetch_simple_variable(znode *result, znode *varname, int bp TSRMLS_DC);
|
||||
void fetch_simple_variable_ex(znode *result, znode *varname, int bp, int op TSRMLS_DC);
|
||||
void zend_do_indirect_references(znode *result, znode *num_references, znode *variable TSRMLS_DC);
|
||||
void zend_do_fetch_global_or_static_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC);
|
||||
void zend_do_fetch_globals(znode *varname TSRMLS_DC);
|
||||
|
||||
void fetch_array_begin(znode *result, znode *varname, znode *first_dim TSRMLS_DC);
|
||||
void fetch_array_dim(znode *result, znode *parent, znode *dim TSRMLS_DC);
|
||||
void fetch_string_offset(znode *result, znode *parent, znode *offset TSRMLS_DC);
|
||||
void zend_do_print(znode *result, znode *arg TSRMLS_DC);
|
||||
void zend_do_echo(znode *arg TSRMLS_DC);
|
||||
typedef int (*unary_op_type)(zval *, zval *);
|
||||
ZEND_API unary_op_type get_unary_op(int opcode);
|
||||
ZEND_API void *get_binary_op(int opcode);
|
||||
|
||||
void zend_do_while_cond(znode *expr, znode *close_bracket_token TSRMLS_DC);
|
||||
void zend_do_while_end(znode *while_token, znode *close_bracket_token TSRMLS_DC);
|
||||
void zend_do_do_while_begin(TSRMLS_D);
|
||||
void zend_do_do_while_end(znode *do_token, znode *expr_open_bracket, znode *expr TSRMLS_DC);
|
||||
|
||||
|
||||
void zend_do_if_cond(znode *cond, znode *closing_bracket_token TSRMLS_DC);
|
||||
void zend_do_if_after_statement(znode *closing_bracket_token, unsigned char initialize TSRMLS_DC);
|
||||
void zend_do_if_end(TSRMLS_D);
|
||||
|
||||
void zend_do_for_cond(znode *expr, znode *second_semicolon_token TSRMLS_DC);
|
||||
void zend_do_for_before_statement(znode *cond_start, znode *second_semicolon_token TSRMLS_DC);
|
||||
void zend_do_for_end(znode *second_semicolon_token TSRMLS_DC);
|
||||
|
||||
void zend_do_pre_incdec(znode *result, znode *op1, int op TSRMLS_DC);
|
||||
void zend_do_post_incdec(znode *result, znode *op1, int op TSRMLS_DC);
|
||||
|
||||
void zend_do_begin_variable_parse(TSRMLS_D);
|
||||
void zend_do_end_variable_parse(int type, int arg_offset TSRMLS_DC);
|
||||
|
||||
void zend_do_free(znode *op1 TSRMLS_DC);
|
||||
|
||||
void zend_do_init_string(znode *result TSRMLS_DC);
|
||||
void zend_do_add_char(znode *result, znode *op1, znode *op2 TSRMLS_DC);
|
||||
void zend_do_add_string(znode *result, znode *op1, znode *op2 TSRMLS_DC);
|
||||
void zend_do_add_variable(znode *result, znode *op1, znode *op2 TSRMLS_DC);
|
||||
|
||||
void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int return_reference TSRMLS_DC);
|
||||
void zend_do_end_function_declaration(znode *function_token TSRMLS_DC);
|
||||
void zend_do_receive_arg(int op, znode *var, znode *offset, znode *initialization, unsigned char pass_type TSRMLS_DC);
|
||||
int zend_do_begin_function_call(znode *function_name TSRMLS_DC);
|
||||
void zend_do_begin_method_call(znode *object, znode *function_name TSRMLS_DC);
|
||||
void zend_do_begin_dynamic_function_call(znode *function_name TSRMLS_DC);
|
||||
void zend_do_begin_class_member_function_call(znode *class_name, znode *function_name TSRMLS_DC);
|
||||
void zend_do_end_function_call(znode *function_name, znode *result, znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC);
|
||||
void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC);
|
||||
|
||||
void zend_do_try(znode *try_token TSRMLS_DC);
|
||||
void zend_do_begin_catch(znode *try_token, znode *catch_var TSRMLS_DC);
|
||||
void zend_do_end_catch(znode *try_token TSRMLS_DC);
|
||||
void zend_do_throw(znode *expr TSRMLS_DC);
|
||||
|
||||
ZEND_API int do_bind_function_or_class(zend_op *opline, HashTable *function_table, HashTable *class_table, int compile_time);
|
||||
void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce);
|
||||
void zend_do_early_binding(TSRMLS_D);
|
||||
|
||||
void zend_do_pass_param(znode *param, int op, int offset TSRMLS_DC);
|
||||
|
||||
|
||||
void zend_do_boolean_or_begin(znode *expr1, znode *op_token TSRMLS_DC);
|
||||
void zend_do_boolean_or_end(znode *result, znode *expr1, znode *expr2, znode *op_token TSRMLS_DC);
|
||||
void zend_do_boolean_and_begin(znode *expr1, znode *op_token TSRMLS_DC);
|
||||
void zend_do_boolean_and_end(znode *result, znode *expr1, znode *expr2, znode *op_token TSRMLS_DC);
|
||||
|
||||
void zend_do_brk_cont(int op, znode *expr TSRMLS_DC);
|
||||
|
||||
void zend_do_switch_cond(znode *cond TSRMLS_DC);
|
||||
void zend_do_switch_end(znode *case_list TSRMLS_DC);
|
||||
void zend_do_case_before_statement(znode *case_list, znode *case_token, znode *case_expr TSRMLS_DC);
|
||||
void zend_do_case_after_statement(znode *result, znode *case_token TSRMLS_DC);
|
||||
void zend_do_default_before_statement(znode *case_list, znode *default_token TSRMLS_DC);
|
||||
|
||||
void zend_do_begin_class_declaration(znode *class_name, znode *parent_class_name TSRMLS_DC);
|
||||
void zend_do_end_class_declaration(TSRMLS_D);
|
||||
void zend_do_declare_property(znode *var_name, znode *value TSRMLS_DC);
|
||||
|
||||
void zend_do_fetch_property(znode *result, znode *object, znode *property TSRMLS_DC);
|
||||
|
||||
|
||||
void zend_do_push_object(znode *object TSRMLS_DC);
|
||||
void zend_do_pop_object(znode *object TSRMLS_DC);
|
||||
|
||||
|
||||
void zend_do_begin_new_object(znode *new_token, znode *class_name TSRMLS_DC);
|
||||
void zend_do_end_new_object(znode *result, znode *class_name, znode *new_token, znode *argument_list TSRMLS_DC);
|
||||
|
||||
void zend_do_fetch_constant(znode *result, znode *constant_name, int mode TSRMLS_DC);
|
||||
|
||||
void zend_do_shell_exec(znode *result, znode *cmd TSRMLS_DC);
|
||||
|
||||
void zend_do_init_array(znode *result, znode *expr, znode *offset, int is_ref TSRMLS_DC);
|
||||
void zend_do_add_array_element(znode *result, znode *expr, znode *offset, int is_ref TSRMLS_DC);
|
||||
void zend_do_add_static_array_element(znode *result, znode *offset, znode *expr);
|
||||
void zend_do_list_init(TSRMLS_D);
|
||||
void zend_do_list_end(znode *result, znode *expr TSRMLS_DC);
|
||||
void zend_do_add_list_element(znode *element TSRMLS_DC);
|
||||
void zend_do_new_list_begin(TSRMLS_D);
|
||||
void zend_do_new_list_end(TSRMLS_D);
|
||||
|
||||
void zend_do_cast(znode *result, znode *expr, int type TSRMLS_DC);
|
||||
void zend_do_include_or_eval(int type, znode *result, znode *op1 TSRMLS_DC);
|
||||
|
||||
void zend_do_unset(znode *variable, int type TSRMLS_DC);
|
||||
void zend_do_isset_or_isempty(int type, znode *result, znode *variable TSRMLS_DC);
|
||||
|
||||
void zend_do_foreach_begin(znode *foreach_token, znode *array, znode *open_brackets_token, znode *as_token, int variable TSRMLS_DC);
|
||||
void zend_do_foreach_cont(znode *value, znode *key, znode *as_token TSRMLS_DC);
|
||||
void zend_do_foreach_end(znode *foreach_token, znode *open_brackets_token TSRMLS_DC);
|
||||
|
||||
void zend_do_declare_begin(TSRMLS_D);
|
||||
void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC);
|
||||
void zend_do_declare_end(TSRMLS_D);
|
||||
|
||||
void zend_do_end_heredoc(TSRMLS_D);
|
||||
|
||||
void do_namespace(znode *namespace TSRMLS_DC);
|
||||
|
||||
void zend_do_exit(znode *result, znode *message TSRMLS_DC);
|
||||
|
||||
void zend_do_begin_silence(znode *strudel_token TSRMLS_DC);
|
||||
void zend_do_end_silence(znode *strudel_token TSRMLS_DC);
|
||||
|
||||
void zend_do_begin_qm_op(znode *cond, znode *qm_token TSRMLS_DC);
|
||||
void zend_do_qm_true(znode *true_value, znode *qm_token, znode *colon_token TSRMLS_DC);
|
||||
void zend_do_qm_false(znode *result, znode *false_value, znode *qm_token, znode *colon_token TSRMLS_DC);
|
||||
|
||||
void zend_do_extended_info(TSRMLS_D);
|
||||
void zend_do_extended_fcall_begin(TSRMLS_D);
|
||||
void zend_do_extended_fcall_end(TSRMLS_D);
|
||||
|
||||
void zend_do_ticks(TSRMLS_D);
|
||||
|
||||
ZEND_API void function_add_ref(zend_function *function);
|
||||
|
||||
#define INITIAL_OP_ARRAY_SIZE 64
|
||||
|
||||
|
||||
/* helper functions in zend_language_scanner.l */
|
||||
ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSRMLS_DC);
|
||||
ZEND_API zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC);
|
||||
ZEND_API zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC);
|
||||
ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_count, ...);
|
||||
ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC);
|
||||
ZEND_API void init_op_array(zend_op_array *op_array, int type, int initial_ops_size TSRMLS_DC);
|
||||
ZEND_API void destroy_op_array(zend_op_array *op_array);
|
||||
ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC);
|
||||
ZEND_API void zend_file_handle_dtor(zend_file_handle *fh);
|
||||
|
||||
ZEND_API void destroy_zend_function(zend_function *function);
|
||||
ZEND_API void destroy_zend_class(zend_class_entry *ce);
|
||||
void zend_class_add_ref(zend_class_entry *ce);
|
||||
|
||||
#define ZEND_FUNCTION_DTOR (void (*)(void *)) destroy_zend_function
|
||||
#define ZEND_CLASS_DTOR (void (*)(void *)) destroy_zend_class
|
||||
|
||||
zend_op *get_next_op(zend_op_array *op_array TSRMLS_DC);
|
||||
void init_op(zend_op *op TSRMLS_DC);
|
||||
int get_next_op_number(zend_op_array *op_array);
|
||||
int print_class(zend_class_entry *class_entry TSRMLS_DC);
|
||||
void print_op_array(zend_op_array *op_array, int optimizations);
|
||||
int pass_two(zend_op_array *op_array TSRMLS_DC);
|
||||
zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array);
|
||||
ZEND_API zend_bool zend_is_compiling(TSRMLS_D);
|
||||
ZEND_API char *zend_make_compiled_string_description(char *name TSRMLS_DC);
|
||||
|
||||
int zend_register_auto_global(char *name, uint name_len TSRMLS_DC);
|
||||
|
||||
int zendlex(znode *zendlval TSRMLS_DC);
|
||||
|
||||
#define ZEND_NOP 0
|
||||
|
||||
#define ZEND_ADD 1
|
||||
#define ZEND_SUB 2
|
||||
#define ZEND_MUL 3
|
||||
#define ZEND_DIV 4
|
||||
#define ZEND_MOD 5
|
||||
#define ZEND_SL 6
|
||||
#define ZEND_SR 7
|
||||
#define ZEND_CONCAT 8
|
||||
#define ZEND_BW_OR 9
|
||||
#define ZEND_BW_AND 10
|
||||
#define ZEND_BW_XOR 11
|
||||
#define ZEND_BW_NOT 12
|
||||
#define ZEND_BOOL_NOT 13
|
||||
#define ZEND_BOOL_XOR 14
|
||||
#define ZEND_IS_IDENTICAL 15
|
||||
#define ZEND_IS_NOT_IDENTICAL 16
|
||||
#define ZEND_IS_EQUAL 17
|
||||
#define ZEND_IS_NOT_EQUAL 18
|
||||
#define ZEND_IS_SMALLER 19
|
||||
#define ZEND_IS_SMALLER_OR_EQUAL 20
|
||||
#define ZEND_CAST 21
|
||||
#define ZEND_QM_ASSIGN 22
|
||||
|
||||
#define ZEND_ASSIGN_ADD 23
|
||||
#define ZEND_ASSIGN_SUB 24
|
||||
#define ZEND_ASSIGN_MUL 25
|
||||
#define ZEND_ASSIGN_DIV 26
|
||||
#define ZEND_ASSIGN_MOD 27
|
||||
#define ZEND_ASSIGN_SL 28
|
||||
#define ZEND_ASSIGN_SR 29
|
||||
#define ZEND_ASSIGN_CONCAT 30
|
||||
#define ZEND_ASSIGN_BW_OR 31
|
||||
#define ZEND_ASSIGN_BW_AND 32
|
||||
#define ZEND_ASSIGN_BW_XOR 33
|
||||
|
||||
#define ZEND_PRE_INC 34
|
||||
#define ZEND_PRE_DEC 35
|
||||
#define ZEND_POST_INC 36
|
||||
#define ZEND_POST_DEC 37
|
||||
|
||||
#define ZEND_ASSIGN 38
|
||||
#define ZEND_ASSIGN_REF 39
|
||||
|
||||
#define ZEND_ECHO 40
|
||||
#define ZEND_PRINT 41
|
||||
|
||||
#define ZEND_JMP 42
|
||||
#define ZEND_JMPZ 43
|
||||
#define ZEND_JMPNZ 44
|
||||
#define ZEND_JMPZNZ 45
|
||||
#define ZEND_JMPZ_EX 46
|
||||
#define ZEND_JMPNZ_EX 47
|
||||
#define ZEND_CASE 48
|
||||
#define ZEND_SWITCH_FREE 49
|
||||
#define ZEND_BRK 50
|
||||
#define ZEND_CONT 51
|
||||
#define ZEND_BOOL 52
|
||||
|
||||
#define ZEND_INIT_STRING 53
|
||||
#define ZEND_ADD_CHAR 54
|
||||
#define ZEND_ADD_STRING 55
|
||||
#define ZEND_ADD_VAR 56
|
||||
|
||||
#define ZEND_BEGIN_SILENCE 57
|
||||
#define ZEND_END_SILENCE 58
|
||||
|
||||
#define ZEND_INIT_FCALL_BY_NAME 59
|
||||
#define ZEND_DO_FCALL 60
|
||||
#define ZEND_DO_FCALL_BY_NAME 61
|
||||
#define ZEND_RETURN 62
|
||||
|
||||
#define ZEND_RECV 63
|
||||
#define ZEND_RECV_INIT 64
|
||||
|
||||
#define ZEND_SEND_VAL 65
|
||||
#define ZEND_SEND_VAR 66
|
||||
#define ZEND_SEND_REF 67
|
||||
|
||||
#define ZEND_NEW 68
|
||||
#define ZEND_JMP_NO_CTOR 69
|
||||
#define ZEND_FREE 70
|
||||
|
||||
#define ZEND_INIT_ARRAY 71
|
||||
#define ZEND_ADD_ARRAY_ELEMENT 72
|
||||
|
||||
#define ZEND_INCLUDE_OR_EVAL 73
|
||||
|
||||
#define ZEND_UNSET_VAR 74
|
||||
#define ZEND_UNSET_DIM_OBJ 75
|
||||
#define ZEND_ISSET_ISEMPTY 76
|
||||
|
||||
#define ZEND_FE_RESET 77
|
||||
#define ZEND_FE_FETCH 78
|
||||
|
||||
#define ZEND_EXIT 79
|
||||
|
||||
|
||||
/* the following 18 opcodes are 6 groups of 3 opcodes each, and must
|
||||
* remain in that order!
|
||||
*/
|
||||
#define ZEND_FETCH_R 80
|
||||
#define ZEND_FETCH_DIM_R 81
|
||||
#define ZEND_FETCH_OBJ_R 82
|
||||
#define ZEND_FETCH_W 83
|
||||
#define ZEND_FETCH_DIM_W 84
|
||||
#define ZEND_FETCH_OBJ_W 85
|
||||
#define ZEND_FETCH_RW 86
|
||||
#define ZEND_FETCH_DIM_RW 87
|
||||
#define ZEND_FETCH_OBJ_RW 88
|
||||
#define ZEND_FETCH_IS 89
|
||||
#define ZEND_FETCH_DIM_IS 90
|
||||
#define ZEND_FETCH_OBJ_IS 91
|
||||
#define ZEND_FETCH_FUNC_ARG 92
|
||||
#define ZEND_FETCH_DIM_FUNC_ARG 93
|
||||
#define ZEND_FETCH_OBJ_FUNC_ARG 94
|
||||
#define ZEND_FETCH_UNSET 95
|
||||
#define ZEND_FETCH_DIM_UNSET 96
|
||||
#define ZEND_FETCH_OBJ_UNSET 97
|
||||
|
||||
#define ZEND_FETCH_DIM_TMP_VAR 98
|
||||
#define ZEND_FETCH_CONSTANT 99
|
||||
|
||||
#define ZEND_DECLARE_FUNCTION_OR_CLASS 100
|
||||
|
||||
#define ZEND_EXT_STMT 101
|
||||
#define ZEND_EXT_FCALL_BEGIN 102
|
||||
#define ZEND_EXT_FCALL_END 103
|
||||
#define ZEND_EXT_NOP 104
|
||||
|
||||
#define ZEND_TICKS 105
|
||||
|
||||
#define ZEND_SEND_VAR_NO_REF 106
|
||||
|
||||
#define ZEND_CATCH 107
|
||||
#define ZEND_THROW 108
|
||||
|
||||
#define ZEND_NAMESPACE 109
|
||||
|
||||
/* end of block */
|
||||
|
||||
|
||||
|
||||
|
||||
/* global/local fetches */
|
||||
#define ZEND_FETCH_GLOBAL 0
|
||||
#define ZEND_FETCH_LOCAL 1
|
||||
#define ZEND_FETCH_STATIC 2
|
||||
|
||||
/* unset types */
|
||||
#define ZEND_UNSET_REG 0
|
||||
#define ZEND_UNSET_OBJ 1
|
||||
|
||||
/* var status for backpatching */
|
||||
#define BP_VAR_R 0
|
||||
#define BP_VAR_W 1
|
||||
#define BP_VAR_RW 2
|
||||
#define BP_VAR_IS 3
|
||||
#define BP_VAR_NA 4 /* if not applicable */
|
||||
#define BP_VAR_FUNC_ARG 5
|
||||
#define BP_VAR_UNSET 6
|
||||
|
||||
|
||||
#define ZEND_INTERNAL_FUNCTION 1
|
||||
#define ZEND_USER_FUNCTION 2
|
||||
#define ZEND_OVERLOADED_FUNCTION 3
|
||||
#define ZEND_EVAL_CODE 4
|
||||
|
||||
#define ZEND_INTERNAL_CLASS 1
|
||||
#define ZEND_USER_CLASS 2
|
||||
|
||||
#define ZEND_EVAL (1<<0)
|
||||
#define ZEND_INCLUDE (1<<1)
|
||||
#define ZEND_INCLUDE_ONCE (1<<2)
|
||||
#define ZEND_REQUIRE (1<<3)
|
||||
#define ZEND_REQUIRE_ONCE (1<<4)
|
||||
|
||||
#define ZEND_ISSET (1<<0)
|
||||
#define ZEND_ISEMPTY (1<<1)
|
||||
|
||||
#define ZEND_CT (1<<0)
|
||||
#define ZEND_RT (1<<1)
|
||||
|
||||
|
||||
#define ZEND_HANDLE_FILENAME 0
|
||||
#define ZEND_HANDLE_FD 1
|
||||
#define ZEND_HANDLE_FP 2
|
||||
#define ZEND_HANDLE_STDIOSTREAM 3
|
||||
#define ZEND_HANDLE_FSTREAM 4
|
||||
|
||||
#define ZEND_DECLARE_CLASS 1
|
||||
#define ZEND_DECLARE_FUNCTION 2
|
||||
#define ZEND_DECLARE_INHERITED_CLASS 3
|
||||
|
||||
#define ZEND_FETCH_STANDARD 0
|
||||
#define ZEND_FETCH_ADD_LOCK 1
|
||||
|
||||
#define ZEND_MEMBER_FUNC_CALL 1<<0
|
||||
#define ZEND_CTOR_CALL 1<<1
|
||||
|
||||
#define ZEND_ARG_SEND_BY_REF (1<<0)
|
||||
#define ZEND_ARG_COMPILE_TIME_BOUND (1<<1)
|
||||
|
||||
#define AI_USE_PTR(ai) \
|
||||
if ((ai).ptr_ptr) { \
|
||||
(ai).ptr = *((ai).ptr_ptr); \
|
||||
(ai).ptr_ptr = &((ai).ptr); \
|
||||
} else { \
|
||||
(ai).ptr = NULL; \
|
||||
}
|
||||
|
||||
/* Lost In Stupid Parentheses */
|
||||
#define ARG_SHOULD_BE_SENT_BY_REF(offset, conduct_check, arg_types) \
|
||||
( \
|
||||
conduct_check \
|
||||
&& arg_types \
|
||||
&& \
|
||||
( \
|
||||
( \
|
||||
offset<=arg_types[0] \
|
||||
&& arg_types[offset]==BYREF_FORCE \
|
||||
) \
|
||||
|| ( \
|
||||
offset>=arg_types[0] \
|
||||
&& arg_types[arg_types[0]]==BYREF_FORCE_REST \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
#define ZEND_RETURN_VAL 0
|
||||
#define ZEND_RETURN_REF 1
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
#endif /* ZEND_COMPILE_H */
|
||||
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ZEND_CONFIG_W32_H
|
||||
#define ZEND_CONFIG_W32_H
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
#include <float.h>
|
||||
|
||||
typedef unsigned long ulong;
|
||||
typedef unsigned int uint;
|
||||
|
||||
#define HAVE_ALLOCA 1
|
||||
#define HAVE_LIMITS_H 1
|
||||
#include <malloc.h>
|
||||
|
||||
#undef HAVE_KILL
|
||||
#define HAVE_GETPID 1
|
||||
/* #define HAVE_ALLOCA_H 1 */
|
||||
#define HAVE_MEMCPY 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_STDIOSTR_H 1
|
||||
#define HAVE_CLASS_ISTDIOSTREAM
|
||||
#define istdiostream stdiostream
|
||||
#define HAVE_STDARG_H 1
|
||||
#define HAVE_SNPRINTF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
|
||||
#define vsnprintf _vsnprintf
|
||||
#define zend_isinf(a) 0
|
||||
|
||||
#define zend_sprintf sprintf
|
||||
|
||||
/* This will cause the compilation process to be MUCH longer, but will generate
|
||||
* a much quicker PHP binary
|
||||
*/
|
||||
#undef inline
|
||||
#ifdef ZEND_WIN32_FORCE_INLINE
|
||||
# define inline __forceinline
|
||||
#else
|
||||
# define inline
|
||||
#endif
|
||||
|
||||
#define zend_finite(A) _finite(A)
|
||||
#define zend_isnan(A) _isnan(A)
|
||||
|
||||
#ifdef LIBZEND_EXPORTS
|
||||
# define ZEND_API __declspec(dllexport)
|
||||
#else
|
||||
# define ZEND_API __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#define ZEND_DLEXPORT __declspec(dllexport)
|
||||
|
||||
/* 0x00200000L is MB_SERVICE_NOTIFICATION, which is only supported under Windows NT
|
||||
* (and requires _WIN32_WINNT to be defined, which prevents the resulting executable
|
||||
* from running under Windows 9x
|
||||
* Windows 9x should silently ignore it, so it's being used here directly
|
||||
*/
|
||||
#ifndef MB_SERVICE_NOTIFICATION
|
||||
#define MB_SERVICE_NOTIFICATION 0x00200000L
|
||||
#endif
|
||||
|
||||
#define ZEND_SERVICE_MB_STYLE (MB_TOPMOST|MB_SERVICE_NOTIFICATION)
|
||||
|
||||
#endif /* ZEND_CONFIG_W32_H */
|
||||
@@ -1,270 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_constants.h"
|
||||
#include "zend_variables.h"
|
||||
#include "zend_operators.h"
|
||||
#include "zend_globals.h"
|
||||
|
||||
|
||||
void free_zend_constant(zend_constant *c)
|
||||
{
|
||||
if (!(c->flags & CONST_PERSISTENT)
|
||||
|| (c->flags & CONST_EFREE_PERSISTENT)) {
|
||||
zval_dtor(&c->value);
|
||||
}
|
||||
free(c->name);
|
||||
}
|
||||
|
||||
|
||||
void copy_zend_constant(zend_constant *c)
|
||||
{
|
||||
c->name = zend_strndup(c->name, c->name_len);
|
||||
if (!(c->flags & CONST_PERSISTENT)) {
|
||||
zval_copy_ctor(&c->value);
|
||||
if (c->flags & CONST_EFREE_PERSISTENT) { /* persist_alloc()'d data */
|
||||
persist_alloc(&c->value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void zend_copy_constants(HashTable *target, HashTable *source)
|
||||
{
|
||||
zend_constant tmp_constant;
|
||||
|
||||
zend_hash_copy(target, source, (copy_ctor_func_t) copy_zend_constant, &tmp_constant, sizeof(zend_constant));
|
||||
}
|
||||
|
||||
|
||||
static int clean_non_persistent_constant(zend_constant *c TSRMLS_DC)
|
||||
{
|
||||
if (c->flags & CONST_PERSISTENT) {
|
||||
return ZEND_HASH_APPLY_STOP;
|
||||
} else {
|
||||
return ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int clean_module_constant(zend_constant *c, int *module_number TSRMLS_DC)
|
||||
{
|
||||
if (c->module_number == *module_number) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void clean_module_constants(int module_number TSRMLS_DC)
|
||||
{
|
||||
zend_hash_apply_with_argument(EG(zend_constants), (apply_func_arg_t) clean_module_constant, (void *) &module_number TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
int zend_startup_constants(TSRMLS_D)
|
||||
{
|
||||
#ifdef ZEND_WIN32
|
||||
DWORD dwBuild=0;
|
||||
DWORD dwVersion = GetVersion();
|
||||
DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
|
||||
DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
|
||||
#endif
|
||||
|
||||
EG(zend_constants) = (HashTable *) malloc(sizeof(HashTable));
|
||||
|
||||
if (zend_hash_init(EG(zend_constants), 20, NULL, ZEND_CONSTANT_DTOR, 1)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void zend_register_standard_constants(TSRMLS_D)
|
||||
{
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_ERROR", E_ERROR, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_WARNING", E_WARNING, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_PARSE", E_PARSE, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_NOTICE", E_NOTICE, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_CORE_ERROR", E_CORE_ERROR, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_CORE_WARNING", E_CORE_WARNING, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_ERROR", E_COMPILE_ERROR, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_WARNING", E_COMPILE_WARNING, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_USER_ERROR", E_USER_ERROR, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_USER_WARNING", E_USER_WARNING, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_USER_NOTICE", E_USER_NOTICE, CONST_PERSISTENT | CONST_CS);
|
||||
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS);
|
||||
|
||||
/* true/false constants */
|
||||
{
|
||||
zend_constant c;
|
||||
|
||||
c.value.type = IS_BOOL;
|
||||
c.flags = CONST_PERSISTENT;
|
||||
c.module_number = 0;
|
||||
|
||||
c.name = zend_strndup(ZEND_STRL("TRUE"));
|
||||
c.name_len = sizeof("TRUE");
|
||||
c.value.value.lval = 1;
|
||||
c.value.type = IS_BOOL;
|
||||
zend_register_constant(&c TSRMLS_CC);
|
||||
|
||||
c.name = zend_strndup(ZEND_STRL("FALSE"));
|
||||
c.name_len = sizeof("FALSE");
|
||||
c.value.value.lval = 0;
|
||||
c.value.type = IS_BOOL;
|
||||
zend_register_constant(&c TSRMLS_CC);
|
||||
|
||||
c.name = zend_strndup(ZEND_STRL("ZEND_THREAD_SAFE"));
|
||||
c.name_len = sizeof("ZEND_THREAD_SAFE");
|
||||
c.value.value.lval = ZTS_V;
|
||||
c.value.type = IS_BOOL;
|
||||
zend_register_constant(&c TSRMLS_CC);
|
||||
|
||||
c.name = zend_strndup(ZEND_STRL("NULL"));
|
||||
c.name_len = sizeof("NULL");
|
||||
c.value.type = IS_NULL;
|
||||
zend_register_constant(&c TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int zend_shutdown_constants(TSRMLS_D)
|
||||
{
|
||||
zend_hash_destroy(EG(zend_constants));
|
||||
free(EG(zend_constants));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
void clean_non_persistent_constants(TSRMLS_D)
|
||||
{
|
||||
zend_hash_reverse_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC)
|
||||
{
|
||||
zend_constant c;
|
||||
|
||||
c.value.type = IS_LONG;
|
||||
c.value.value.lval = lval;
|
||||
c.flags = flags;
|
||||
c.name = zend_strndup(name, name_len);
|
||||
c.name_len = name_len;
|
||||
c.module_number = module_number;
|
||||
zend_register_constant(&c TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC)
|
||||
{
|
||||
zend_constant c;
|
||||
|
||||
c.value.type = IS_DOUBLE;
|
||||
c.value.value.dval = dval;
|
||||
c.flags = flags;
|
||||
c.name = zend_strndup(name, name_len);
|
||||
c.name_len = name_len;
|
||||
c.module_number = module_number;
|
||||
zend_register_constant(&c TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC)
|
||||
{
|
||||
zend_constant c;
|
||||
|
||||
c.value.type = IS_STRING;
|
||||
c.value.value.str.val = strval;
|
||||
c.value.value.str.len = strlen;
|
||||
c.flags = flags;
|
||||
c.name = zend_strndup(name, name_len);
|
||||
c.name_len = name_len;
|
||||
c.module_number = module_number;
|
||||
zend_register_constant(&c TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC)
|
||||
{
|
||||
zend_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC)
|
||||
{
|
||||
zend_constant *c;
|
||||
char *lookup_name = estrndup(name, name_len);
|
||||
int retval;
|
||||
|
||||
zend_str_tolower(lookup_name, name_len);
|
||||
|
||||
if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, (void **) &c)==SUCCESS) {
|
||||
if ((c->flags & CONST_CS) && memcmp(c->name, name, name_len)!=0) {
|
||||
retval=0;
|
||||
} else {
|
||||
retval=1;
|
||||
*result = c->value;
|
||||
zval_copy_ctor(result);
|
||||
}
|
||||
} else {
|
||||
retval=0;
|
||||
}
|
||||
|
||||
efree(lookup_name);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
|
||||
{
|
||||
char *lowercase_name = zend_strndup(c->name, c->name_len);
|
||||
int ret = SUCCESS;
|
||||
|
||||
#if 0
|
||||
printf("Registering constant for module %d\n", c->module_number);
|
||||
#endif
|
||||
|
||||
zend_str_tolower(lowercase_name, c->name_len);
|
||||
if (zend_hash_add(EG(zend_constants), lowercase_name, c->name_len, (void *) c, sizeof(zend_constant), NULL)==FAILURE) {
|
||||
free(c->name);
|
||||
if (!(c->flags & CONST_PERSISTENT)
|
||||
|| (c->flags & CONST_EFREE_PERSISTENT)) {
|
||||
zval_dtor(&c->value);
|
||||
}
|
||||
zend_error(E_NOTICE,"Constant %s already defined", lowercase_name);
|
||||
ret = FAILURE;
|
||||
}
|
||||
free(lowercase_name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ZEND_CONSTANTS_H
|
||||
#define ZEND_CONSTANTS_H
|
||||
|
||||
#include "zend_globals.h"
|
||||
|
||||
#define CONST_CS (1<<0) /* Case Sensitive */
|
||||
#define CONST_PERSISTENT (1<<1) /* Persistent */
|
||||
#define CONST_EFREE_PERSISTENT (1<<2) /* In conjunction with CONST_PERSISTENT,
|
||||
* means that the constant should be freed
|
||||
* using zval_dtor() on shutdown.
|
||||
*/
|
||||
|
||||
typedef struct _zend_constant {
|
||||
zval value;
|
||||
int flags;
|
||||
char *name;
|
||||
uint name_len;
|
||||
int module_number;
|
||||
} zend_constant;
|
||||
|
||||
#define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name), (lval), (flags), module_number TSRMLS_CC)
|
||||
#define REGISTER_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name), (dval), (flags), module_number TSRMLS_CC)
|
||||
#define REGISTER_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name), (str), (flags), module_number TSRMLS_CC)
|
||||
#define REGISTER_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name), (str), (len), (flags), module_number TSRMLS_CC)
|
||||
|
||||
#define REGISTER_MAIN_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name), (lval), (flags), 0 TSRMLS_CC)
|
||||
#define REGISTER_MAIN_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name), (dval), (flags), 0 TSRMLS_CC)
|
||||
#define REGISTER_MAIN_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name), (str), (flags), 0 TSRMLS_CC)
|
||||
#define REGISTER_MAIN_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name), (str), (len), (flags), 0 TSRMLS_CC)
|
||||
|
||||
void clean_module_constants(int module_number TSRMLS_DC);
|
||||
void free_zend_constant(zend_constant *c);
|
||||
int zend_startup_constants(TSRMLS_D);
|
||||
int zend_shutdown_constants(TSRMLS_D);
|
||||
void zend_register_standard_constants(TSRMLS_D);
|
||||
void clean_non_persistent_constants(TSRMLS_D);
|
||||
ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC);
|
||||
ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC);
|
||||
ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC);
|
||||
ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC);
|
||||
ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC);
|
||||
ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC);
|
||||
void zend_copy_constants(HashTable *target, HashTable *sourc);
|
||||
void copy_zend_constant(zend_constant *c);
|
||||
|
||||
#define ZEND_CONSTANT_DTOR (void (*)(void *)) free_zend_constant
|
||||
|
||||
#endif
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "zend.h"
|
||||
|
||||
typedef struct _dynamic_array {
|
||||
char *array;
|
||||
unsigned int element_size;
|
||||
unsigned int current;
|
||||
unsigned int allocated;
|
||||
} dynamic_array;
|
||||
|
||||
ZEND_API int zend_dynamic_array_init(dynamic_array *da, unsigned int element_size, unsigned int size)
|
||||
{
|
||||
da->element_size = element_size;
|
||||
da->allocated = size;
|
||||
da->current = 0;
|
||||
da->array = (char *) emalloc(size*element_size);
|
||||
if (da->array == NULL) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
ZEND_API void *zend_dynamic_array_push(dynamic_array *da)
|
||||
{
|
||||
if (da->current == da->allocated) {
|
||||
da->allocated *= 2;
|
||||
da->array = (char *) erealloc(da->array, da->allocated*da->element_size);
|
||||
}
|
||||
return (void *)(da->array+(da->current++)*da->element_size);
|
||||
}
|
||||
|
||||
ZEND_API void *zend_dynamic_array_pop(dynamic_array *da)
|
||||
{
|
||||
return (void *)(da->array+(--(da->current))*da->element_size);
|
||||
|
||||
}
|
||||
|
||||
ZEND_API void *zend_dynamic_array_get_element(dynamic_array *da, unsigned int index)
|
||||
{
|
||||
if (index >= da->current) {
|
||||
return NULL;
|
||||
}
|
||||
return (void *)(da->array+index*da->element_size);
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ZEND_DYNAMIC_ARRAY_H
|
||||
#define ZEND_DYNAMIC_ARRAY_H
|
||||
|
||||
typedef struct _dynamic_array {
|
||||
char *array;
|
||||
unsigned int element_size;
|
||||
unsigned int last_used;
|
||||
unsigned int allocated;
|
||||
} dynamic_array;
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API int zend_dynamic_array_init(dynamic_array *da);
|
||||
ZEND_API void *zend_dynamic_array_push(dynamic_array *da);
|
||||
ZEND_API void *zend_dynamic_array_pop(dynamic_array *da);
|
||||
ZEND_API void *zend_dynamic_array_get_element(dynamic_array *da, unsigned int index);
|
||||
END_EXTERN_C()
|
||||
|
||||
#endif /* ZEND_DYNAMIC_ARRAY_H */
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ZEND_ERRORS_H
|
||||
#define ZEND_ERRORS_H
|
||||
|
||||
#define E_ERROR (1<<0L)
|
||||
#define E_WARNING (1<<1L)
|
||||
#define E_PARSE (1<<2L)
|
||||
#define E_NOTICE (1<<3L)
|
||||
#define E_CORE_ERROR (1<<4L)
|
||||
#define E_CORE_WARNING (1<<5L)
|
||||
#define E_COMPILE_ERROR (1<<6L)
|
||||
#define E_COMPILE_WARNING (1<<7L)
|
||||
#define E_USER_ERROR (1<<8L)
|
||||
#define E_USER_WARNING (1<<9L)
|
||||
#define E_USER_NOTICE (1<<10L)
|
||||
|
||||
#define E_ALL (E_ERROR | E_WARNING | E_PARSE | E_NOTICE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE)
|
||||
#define E_CORE (E_CORE_ERROR | E_CORE_WARNING)
|
||||
|
||||
#endif /* ZEND_ERRORS_H */
|
||||
|
||||
-2564
File diff suppressed because it is too large.
Load diff
@@ -1,161 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ZEND_EXECUTE_H
|
||||
#define ZEND_EXECUTE_H
|
||||
|
||||
#include "zend_compile.h"
|
||||
#include "zend_hash.h"
|
||||
#include "zend_variables.h"
|
||||
#include "zend_operators.h"
|
||||
|
||||
typedef union _temp_variable {
|
||||
zval tmp_var;
|
||||
struct {
|
||||
zval **ptr_ptr;
|
||||
zval *ptr;
|
||||
} var;
|
||||
struct {
|
||||
zval tmp_var; /* a dummy */
|
||||
|
||||
union {
|
||||
struct {
|
||||
zval *str;
|
||||
int offset;
|
||||
} str_offset;
|
||||
zend_property_reference overloaded_element;
|
||||
} data;
|
||||
|
||||
unsigned char type;
|
||||
} EA;
|
||||
} temp_variable;
|
||||
|
||||
|
||||
ZEND_API extern void (*zend_execute)(zend_op_array *op_array TSRMLS_DC);
|
||||
|
||||
void init_executor(TSRMLS_D);
|
||||
void shutdown_executor(TSRMLS_D);
|
||||
ZEND_API void execute(zend_op_array *op_array TSRMLS_DC);
|
||||
ZEND_API int zend_is_true(zval *op);
|
||||
static inline void safe_free_zval_ptr(zval *p)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (p!=EG(uninitialized_zval_ptr)) {
|
||||
FREE_ZVAL(p);
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
|
||||
static inline int i_zend_is_true(zval *op)
|
||||
{
|
||||
int result;
|
||||
|
||||
switch (op->type) {
|
||||
case IS_NULL:
|
||||
result = 0;
|
||||
break;
|
||||
case IS_LONG:
|
||||
case IS_BOOL:
|
||||
case IS_RESOURCE:
|
||||
result = (op->value.lval?1:0);
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
result = (op->value.dval ? 1 : 0);
|
||||
break;
|
||||
case IS_STRING:
|
||||
if (op->value.str.len == 0
|
||||
|| (op->value.str.len==1 && op->value.str.val[0]=='0')) {
|
||||
result = 0;
|
||||
} else {
|
||||
result = 1;
|
||||
}
|
||||
break;
|
||||
case IS_ARRAY:
|
||||
result = (zend_hash_num_elements(op->value.ht)?1:0);
|
||||
break;
|
||||
case IS_OBJECT:
|
||||
result = (zend_hash_num_elements(Z_OBJPROP_P(op))?1:0);
|
||||
break;
|
||||
default:
|
||||
result = 0;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC);
|
||||
|
||||
/* dedicated Zend executor functions - do not use! */
|
||||
static inline void zend_ptr_stack_clear_multiple(TSRMLS_D)
|
||||
{
|
||||
void **p = EG(argument_stack).top_element-2;
|
||||
int delete_count = (ulong) *p;
|
||||
|
||||
EG(argument_stack).top -= (delete_count+2);
|
||||
while (--delete_count>=0) {
|
||||
zval_ptr_dtor((zval **) --p);
|
||||
}
|
||||
EG(argument_stack).top_element = p;
|
||||
}
|
||||
|
||||
static inline int zend_ptr_stack_get_arg(int requested_arg, void **data TSRMLS_DC)
|
||||
{
|
||||
void **p = EG(argument_stack).top_element-2;
|
||||
int arg_count = (ulong) *p;
|
||||
|
||||
if (requested_arg>arg_count) {
|
||||
return FAILURE;
|
||||
}
|
||||
*data = (p-arg_count+requested_arg-1);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
void execute_new_code(TSRMLS_D);
|
||||
|
||||
|
||||
/* services */
|
||||
ZEND_API char *get_active_function_name(TSRMLS_D);
|
||||
ZEND_API char *zend_get_executed_filename(TSRMLS_D);
|
||||
ZEND_API uint zend_get_executed_lineno(TSRMLS_D);
|
||||
ZEND_API zend_bool zend_is_executing(TSRMLS_D);
|
||||
|
||||
ZEND_API void zend_set_timeout(long seconds);
|
||||
ZEND_API void zend_unset_timeout(TSRMLS_D);
|
||||
ZEND_API void zend_timeout(int dummy);
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
void zend_init_timeout_thread();
|
||||
void zend_shutdown_timeout_thread();
|
||||
#define WM_REGISTER_ZEND_TIMEOUT (WM_USER+1)
|
||||
#define WM_UNREGISTER_ZEND_TIMEOUT (WM_USER+2)
|
||||
#endif
|
||||
|
||||
#define zendi_zval_copy_ctor(p) zval_copy_ctor(&(p))
|
||||
#define zendi_zval_dtor(p) zval_dtor(&(p))
|
||||
|
||||
#define active_opline (*EG(opline_ptr))
|
||||
|
||||
void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, zval **value_ptr_ptr, temp_variable *Ts TSRMLS_DC);
|
||||
|
||||
#define IS_OVERLOADED_OBJECT 1
|
||||
#define IS_STRING_OFFSET 2
|
||||
|
||||
#endif /* ZEND_EXECUTE_H */
|
||||
@@ -1,812 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_compile.h"
|
||||
#include "zend_execute.h"
|
||||
#include "zend_API.h"
|
||||
#include "zend_ptr_stack.h"
|
||||
#include "zend_constants.h"
|
||||
#include "zend_extensions.h"
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
|
||||
ZEND_API void (*zend_execute)(zend_op_array *op_array TSRMLS_DC);
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
#include <process.h>
|
||||
/* true global */
|
||||
static WNDCLASS wc;
|
||||
static HWND timeout_window;
|
||||
static HANDLE timeout_thread_event;
|
||||
static DWORD timeout_thread_id;
|
||||
static int timeout_thread_initialized=0;
|
||||
#endif
|
||||
|
||||
|
||||
#if ZEND_DEBUG
|
||||
static void (*original_sigsegv_handler)(int);
|
||||
static void zend_handle_sigsegv(int dummy)
|
||||
{
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
if (original_sigsegv_handler==zend_handle_sigsegv) {
|
||||
signal(SIGSEGV, original_sigsegv_handler);
|
||||
} else {
|
||||
signal(SIGSEGV, SIG_DFL);
|
||||
}
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
fprintf(stderr, "SIGSEGV caught on opcode %d on opline %d of %s() at %s:%d\n\n",
|
||||
active_opline->opcode,
|
||||
active_opline-EG(active_op_array)->opcodes,
|
||||
get_active_function_name(TSRMLS_C),
|
||||
zend_get_executed_filename(TSRMLS_C),
|
||||
zend_get_executed_lineno(TSRMLS_C));
|
||||
}
|
||||
if (original_sigsegv_handler!=zend_handle_sigsegv) {
|
||||
original_sigsegv_handler(dummy);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void zend_extension_activator(zend_extension *extension TSRMLS_DC)
|
||||
{
|
||||
if (extension->activate) {
|
||||
extension->activate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void zend_extension_deactivator(zend_extension *extension TSRMLS_DC)
|
||||
{
|
||||
if (extension->deactivate) {
|
||||
extension->deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int is_not_internal_function(zend_function *function TSRMLS_DC)
|
||||
{
|
||||
if (function->type == ZEND_INTERNAL_FUNCTION) {
|
||||
return ZEND_HASH_APPLY_STOP;
|
||||
} else {
|
||||
return ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int is_not_internal_class(zend_class_entry *ce TSRMLS_DC)
|
||||
{
|
||||
if (ce->type == ZEND_INTERNAL_CLASS) {
|
||||
return ZEND_HASH_APPLY_STOP;
|
||||
} else {
|
||||
return ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_executor(TSRMLS_D)
|
||||
{
|
||||
INIT_ZVAL(EG(uninitialized_zval));
|
||||
INIT_ZVAL(EG(error_zval));
|
||||
EG(uninitialized_zval_ptr)=&EG(uninitialized_zval);
|
||||
EG(error_zval_ptr)=&EG(error_zval);
|
||||
zend_ptr_stack_init(&EG(arg_types_stack));
|
||||
/* destroys stack frame, therefore makes core dumps worthless */
|
||||
#if 0&&ZEND_DEBUG
|
||||
original_sigsegv_handler = signal(SIGSEGV, zend_handle_sigsegv);
|
||||
#endif
|
||||
EG(return_value_ptr_ptr) = NULL;
|
||||
|
||||
EG(symtable_cache_ptr) = EG(symtable_cache)-1;
|
||||
EG(symtable_cache_limit)=EG(symtable_cache)+SYMTABLE_CACHE_SIZE-1;
|
||||
EG(no_extensions)=0;
|
||||
|
||||
EG(function_table) = CG(function_table);
|
||||
EG(class_table) = CG(class_table);
|
||||
EG(namespaces) = CG(namespaces);
|
||||
|
||||
EG(in_execution) = 0;
|
||||
|
||||
zend_ptr_stack_init(&EG(argument_stack));
|
||||
|
||||
zend_hash_init(&EG(symbol_table), 50, NULL, ZVAL_PTR_DTOR, 0);
|
||||
EG(active_symbol_table) = &EG(symbol_table);
|
||||
|
||||
zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_activator TSRMLS_CC);
|
||||
EG(opline_ptr) = NULL;
|
||||
EG(garbage_ptr) = 0;
|
||||
|
||||
zend_hash_init(&EG(included_files), 5, NULL, NULL, 0);
|
||||
|
||||
EG(ticks_count) = 0;
|
||||
|
||||
EG(user_error_handler) = NULL;
|
||||
|
||||
zend_ptr_stack_init(&EG(user_error_handlers));
|
||||
|
||||
EG(orig_error_reporting) = EG(error_reporting);
|
||||
zend_objects_init(&EG(objects), 1024);
|
||||
#ifdef ZEND_WIN32
|
||||
EG(timed_out) = 0;
|
||||
#endif
|
||||
|
||||
EG(exception) = NULL;
|
||||
}
|
||||
|
||||
|
||||
void shutdown_executor(TSRMLS_D)
|
||||
{
|
||||
zend_try {
|
||||
zend_ptr_stack_destroy(&EG(arg_types_stack));
|
||||
|
||||
while (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
|
||||
zend_hash_destroy(*EG(symtable_cache_ptr));
|
||||
efree(*EG(symtable_cache_ptr));
|
||||
EG(symtable_cache_ptr)--;
|
||||
}
|
||||
zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_deactivator TSRMLS_CC);
|
||||
|
||||
zend_hash_destroy(&EG(symbol_table));
|
||||
|
||||
while (EG(garbage_ptr)--) {
|
||||
if (EG(garbage)[EG(garbage_ptr)]->refcount==1) {
|
||||
zval_ptr_dtor(&EG(garbage)[EG(garbage_ptr)]);
|
||||
}
|
||||
}
|
||||
|
||||
zend_ptr_stack_destroy(&EG(argument_stack));
|
||||
|
||||
/* Destroy all op arrays */
|
||||
zend_hash_reverse_apply(EG(function_table), (apply_func_t) is_not_internal_function TSRMLS_CC);
|
||||
zend_hash_reverse_apply(EG(class_table), (apply_func_t) is_not_internal_class TSRMLS_CC);
|
||||
} zend_end_try();
|
||||
|
||||
/* The regular list must be destroyed after the main symbol table and
|
||||
* op arrays are destroyed.
|
||||
*/
|
||||
zend_destroy_rsrc_list(&EG(regular_list) TSRMLS_CC);
|
||||
|
||||
zend_try {
|
||||
clean_non_persistent_constants(TSRMLS_C);
|
||||
#if ZEND_DEBUG
|
||||
signal(SIGSEGV, original_sigsegv_handler);
|
||||
#endif
|
||||
|
||||
zend_hash_destroy(&EG(included_files));
|
||||
|
||||
if (EG(user_error_handler)) {
|
||||
zval_dtor(EG(user_error_handler));
|
||||
FREE_ZVAL(EG(user_error_handler));
|
||||
}
|
||||
|
||||
zend_ptr_stack_clean(&EG(user_error_handlers), ZVAL_DESTRUCTOR, 1);
|
||||
zend_ptr_stack_destroy(&EG(user_error_handlers));
|
||||
|
||||
EG(error_reporting) = EG(orig_error_reporting);
|
||||
zend_objects_destroy(&EG(objects));
|
||||
} zend_end_try();
|
||||
}
|
||||
|
||||
|
||||
ZEND_API char *get_active_function_name(TSRMLS_D)
|
||||
{
|
||||
switch(EG(function_state_ptr)->function->type) {
|
||||
case ZEND_USER_FUNCTION: {
|
||||
char *function_name = ((zend_op_array *) EG(function_state_ptr)->function)->function_name;
|
||||
|
||||
if (function_name) {
|
||||
return function_name;
|
||||
} else {
|
||||
return "main";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ZEND_INTERNAL_FUNCTION:
|
||||
return ((zend_internal_function *) EG(function_state_ptr)->function)->function_name;
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API char *zend_get_executed_filename(TSRMLS_D)
|
||||
{
|
||||
if (EG(active_op_array)) {
|
||||
return EG(active_op_array)->filename;
|
||||
} else {
|
||||
return "[no active file]";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API uint zend_get_executed_lineno(TSRMLS_D)
|
||||
{
|
||||
if (EG(opline_ptr)) {
|
||||
return active_opline->lineno;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API zend_bool zend_is_executing(TSRMLS_D)
|
||||
{
|
||||
return EG(in_execution);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC)
|
||||
{
|
||||
#if DEBUG_ZEND>=2
|
||||
printf("Reducing refcount for %x (%x): %d->%d\n", *zval_ptr, zval_ptr, (*zval_ptr)->refcount, (*zval_ptr)->refcount-1);
|
||||
#endif
|
||||
(*zval_ptr)->refcount--;
|
||||
if ((*zval_ptr)->refcount==0) {
|
||||
zval_dtor(*zval_ptr);
|
||||
safe_free_zval_ptr(*zval_ptr);
|
||||
} else if ((*zval_ptr)->refcount == 1) {
|
||||
(*zval_ptr)->is_ref = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_is_true(zval *op)
|
||||
{
|
||||
return i_zend_is_true(op);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
|
||||
{
|
||||
zval *p = *pp;
|
||||
zend_bool inline_change = (zend_bool) (unsigned long) arg;
|
||||
zval const_value;
|
||||
|
||||
if (p->type == IS_CONSTANT) {
|
||||
int refcount;
|
||||
|
||||
SEPARATE_ZVAL(pp);
|
||||
p = *pp;
|
||||
|
||||
refcount = p->refcount;
|
||||
|
||||
if (!zend_get_constant(p->value.str.val, p->value.str.len, &const_value TSRMLS_CC)) {
|
||||
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'",
|
||||
p->value.str.val,
|
||||
p->value.str.val);
|
||||
p->type = IS_STRING;
|
||||
if (!inline_change) {
|
||||
zval_copy_ctor(p);
|
||||
}
|
||||
} else {
|
||||
if (inline_change) {
|
||||
STR_FREE(p->value.str.val);
|
||||
}
|
||||
*p = const_value;
|
||||
}
|
||||
INIT_PZVAL(p);
|
||||
p->refcount = refcount;
|
||||
} else if (p->type == IS_CONSTANT_ARRAY) {
|
||||
zval **element;
|
||||
char *str_index;
|
||||
uint str_index_len;
|
||||
ulong num_index;
|
||||
|
||||
SEPARATE_ZVAL(pp);
|
||||
p = *pp;
|
||||
p->type = IS_ARRAY;
|
||||
|
||||
/* First go over the array and see if there are any constant indices */
|
||||
zend_hash_internal_pointer_reset(p->value.ht);
|
||||
while (zend_hash_get_current_data(p->value.ht, (void **) &element)==SUCCESS) {
|
||||
if (!(Z_TYPE_PP(element) & IS_CONSTANT_INDEX)) {
|
||||
zend_hash_move_forward(p->value.ht);
|
||||
continue;
|
||||
}
|
||||
Z_TYPE_PP(element) &= ~IS_CONSTANT_INDEX;
|
||||
if (zend_hash_get_current_key_ex(p->value.ht, &str_index, &str_index_len, &num_index, 0, NULL)!=HASH_KEY_IS_STRING) {
|
||||
zend_hash_move_forward(p->value.ht);
|
||||
continue;
|
||||
}
|
||||
if (!zend_get_constant(str_index, str_index_len-1, &const_value TSRMLS_CC)) {
|
||||
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", str_index, str_index);
|
||||
zend_hash_move_forward(p->value.ht);
|
||||
continue;
|
||||
}
|
||||
switch (const_value.type) {
|
||||
case IS_STRING:
|
||||
zend_hash_update(p->value.ht, const_value.value.str.val, const_value.value.str.len+1, element, sizeof(zval *), NULL);
|
||||
(*element)->refcount++;
|
||||
break;
|
||||
case IS_LONG:
|
||||
zend_hash_index_update(p->value.ht, const_value.value.lval, element, sizeof(zval *), NULL);
|
||||
(*element)->refcount++;
|
||||
break;
|
||||
}
|
||||
zend_hash_del(p->value.ht, str_index, str_index_len);
|
||||
}
|
||||
zend_hash_apply_with_argument(p->value.ht, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, int param_count, zval *params[] TSRMLS_DC)
|
||||
{
|
||||
zval ***params_array = (zval ***) emalloc(sizeof(zval **)*param_count);
|
||||
int i;
|
||||
int ex_retval;
|
||||
zval *local_retval_ptr;
|
||||
|
||||
for (i=0; i<param_count; i++) {
|
||||
params_array[i] = ¶ms[i];
|
||||
}
|
||||
ex_retval = call_user_function_ex(function_table, object_pp, function_name, &local_retval_ptr, param_count, params_array, 1, NULL TSRMLS_CC);
|
||||
if (local_retval_ptr) {
|
||||
COPY_PZVAL_TO_ZVAL(*retval_ptr, local_retval_ptr);
|
||||
} else {
|
||||
INIT_ZVAL(*retval_ptr);
|
||||
}
|
||||
efree(params_array);
|
||||
return ex_retval;
|
||||
}
|
||||
|
||||
|
||||
int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, int param_count, zval **params[], int no_separation, HashTable *symbol_table TSRMLS_DC)
|
||||
{
|
||||
int i;
|
||||
zval **original_return_value;
|
||||
HashTable *calling_symbol_table;
|
||||
zend_function_state function_state;
|
||||
zend_function_state *original_function_state_ptr;
|
||||
zend_op_array *original_op_array;
|
||||
zend_op **original_opline_ptr;
|
||||
int orig_free_op1, orig_free_op2;
|
||||
int (*orig_unary_op)(zval *result, zval *op1);
|
||||
int (*orig_binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
zval function_name_copy;
|
||||
|
||||
*retval_ptr_ptr = NULL;
|
||||
|
||||
if (function_name->type==IS_ARRAY) { /* assume array($obj, $name) couple */
|
||||
zval **tmp_object_ptr, **tmp_real_function_name;
|
||||
|
||||
if (zend_hash_index_find(function_name->value.ht, 0, (void **) &tmp_object_ptr)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (zend_hash_index_find(function_name->value.ht, 1, (void **) &tmp_real_function_name)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
function_name = *tmp_real_function_name;
|
||||
SEPARATE_ZVAL_IF_NOT_REF(tmp_object_ptr);
|
||||
object_pp = tmp_object_ptr;
|
||||
(*object_pp)->is_ref = 1;
|
||||
}
|
||||
|
||||
if (object_pp && !*object_pp) {
|
||||
object_pp = NULL;
|
||||
}
|
||||
if (object_pp) {
|
||||
if (Z_TYPE_PP(object_pp) == IS_OBJECT) {
|
||||
function_table = &Z_OBJCE_PP(object_pp)->function_table;
|
||||
} else if (Z_TYPE_PP(object_pp) == IS_STRING) {
|
||||
zend_class_entry *ce;
|
||||
char *lc_class;
|
||||
int found;
|
||||
|
||||
lc_class = estrndup(Z_STRVAL_PP(object_pp), Z_STRLEN_PP(object_pp));
|
||||
zend_str_tolower(lc_class, Z_STRLEN_PP(object_pp));
|
||||
found = zend_hash_find(EG(class_table), lc_class, Z_STRLEN_PP(object_pp) + 1, (void **) &ce);
|
||||
efree(lc_class);
|
||||
if (found == FAILURE)
|
||||
return FAILURE;
|
||||
|
||||
function_table = &ce->function_table;
|
||||
object_pp = NULL;
|
||||
} else
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (function_name->type!=IS_STRING) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
function_name_copy = *function_name;
|
||||
zval_copy_ctor(&function_name_copy);
|
||||
zend_str_tolower(function_name_copy.value.str.val, function_name_copy.value.str.len);
|
||||
|
||||
original_function_state_ptr = EG(function_state_ptr);
|
||||
if (zend_hash_find(function_table, function_name_copy.value.str.val, function_name_copy.value.str.len+1, (void **) &function_state.function)==FAILURE) {
|
||||
zval_dtor(&function_name_copy);
|
||||
return FAILURE;
|
||||
}
|
||||
zval_dtor(&function_name_copy);
|
||||
|
||||
for (i=0; i<param_count; i++) {
|
||||
zval *param;
|
||||
|
||||
if (function_state.function->common.arg_types
|
||||
&& i<function_state.function->common.arg_types[0]
|
||||
&& function_state.function->common.arg_types[i+1]==BYREF_FORCE
|
||||
&& !PZVAL_IS_REF(*params[i])) {
|
||||
if ((*params[i])->refcount>1) {
|
||||
zval *new_zval;
|
||||
|
||||
if (no_separation) {
|
||||
return FAILURE;
|
||||
}
|
||||
ALLOC_ZVAL(new_zval);
|
||||
*new_zval = **params[i];
|
||||
zval_copy_ctor(new_zval);
|
||||
new_zval->refcount = 1;
|
||||
(*params[i])->refcount--;
|
||||
*params[i] = new_zval;
|
||||
}
|
||||
(*params[i])->refcount++;
|
||||
(*params[i])->is_ref = 1;
|
||||
param = *params[i];
|
||||
} else if (*params[i] != &EG(uninitialized_zval)) {
|
||||
(*params[i])->refcount++;
|
||||
param = *params[i];
|
||||
} else {
|
||||
ALLOC_ZVAL(param);
|
||||
*param = **(params[i]);
|
||||
INIT_PZVAL(param);
|
||||
}
|
||||
zend_ptr_stack_push(&EG(argument_stack), param);
|
||||
}
|
||||
|
||||
zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *) (long) param_count, NULL);
|
||||
|
||||
EG(function_state_ptr) = &function_state;
|
||||
|
||||
if (function_state.function->type == ZEND_USER_FUNCTION) {
|
||||
calling_symbol_table = EG(active_symbol_table);
|
||||
if (symbol_table) {
|
||||
EG(active_symbol_table) = symbol_table;
|
||||
} else {
|
||||
ALLOC_HASHTABLE(EG(active_symbol_table));
|
||||
zend_hash_init(EG(active_symbol_table), 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
}
|
||||
if (object_pp) {
|
||||
zval *dummy, **this_ptr;
|
||||
|
||||
ALLOC_ZVAL(dummy);
|
||||
INIT_ZVAL(*dummy);
|
||||
zend_hash_update(EG(active_symbol_table), "this", sizeof("this"), &dummy, sizeof(zval *), (void **) &this_ptr);
|
||||
zend_assign_to_variable_reference(NULL, this_ptr, object_pp, NULL TSRMLS_CC);
|
||||
}
|
||||
original_return_value = EG(return_value_ptr_ptr);
|
||||
original_op_array = EG(active_op_array);
|
||||
EG(return_value_ptr_ptr) = retval_ptr_ptr;
|
||||
EG(active_op_array) = (zend_op_array *) function_state.function;
|
||||
original_opline_ptr = EG(opline_ptr);
|
||||
orig_free_op1 = EG(free_op1);
|
||||
orig_free_op2 = EG(free_op2);
|
||||
orig_unary_op = EG(unary_op);
|
||||
orig_binary_op = EG(binary_op);
|
||||
zend_execute(EG(active_op_array) TSRMLS_CC);
|
||||
if (!symbol_table) {
|
||||
zend_hash_destroy(EG(active_symbol_table));
|
||||
FREE_HASHTABLE(EG(active_symbol_table));
|
||||
}
|
||||
EG(active_symbol_table) = calling_symbol_table;
|
||||
EG(active_op_array) = original_op_array;
|
||||
EG(return_value_ptr_ptr)=original_return_value;
|
||||
EG(opline_ptr) = original_opline_ptr;
|
||||
EG(free_op1) = orig_free_op1;
|
||||
EG(free_op2) = orig_free_op2;
|
||||
EG(unary_op) = orig_unary_op;
|
||||
EG(binary_op) = orig_binary_op;
|
||||
} else {
|
||||
ALLOC_INIT_ZVAL(*retval_ptr_ptr);
|
||||
((zend_internal_function *) function_state.function)->handler(param_count, *retval_ptr_ptr, (object_pp?*object_pp:NULL), 1 TSRMLS_CC);
|
||||
INIT_PZVAL(*retval_ptr_ptr);
|
||||
}
|
||||
zend_ptr_stack_clear_multiple(TSRMLS_C);
|
||||
EG(function_state_ptr) = original_function_state_ptr;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC)
|
||||
{
|
||||
zval pv;
|
||||
zend_op_array *new_op_array;
|
||||
zend_op_array *original_active_op_array = EG(active_op_array);
|
||||
zend_function_state *original_function_state_ptr = EG(function_state_ptr);
|
||||
int original_handle_op_arrays;
|
||||
int retval;
|
||||
|
||||
if (retval_ptr) {
|
||||
pv.value.str.len = strlen(str)+sizeof("return ;")-1;
|
||||
pv.value.str.val = emalloc(pv.value.str.len+1);
|
||||
strcpy(pv.value.str.val, "return ");
|
||||
strcat(pv.value.str.val, str);
|
||||
strcat(pv.value.str.val, " ;");
|
||||
} else {
|
||||
pv.value.str.len = strlen(str);
|
||||
pv.value.str.val = estrndup(str, pv.value.str.len);
|
||||
}
|
||||
pv.type = IS_STRING;
|
||||
|
||||
/*printf("Evaluating '%s'\n", pv.value.str.val);*/
|
||||
|
||||
original_handle_op_arrays = CG(handle_op_arrays);
|
||||
CG(handle_op_arrays) = 0;
|
||||
new_op_array = compile_string(&pv, string_name TSRMLS_CC);
|
||||
CG(handle_op_arrays) = original_handle_op_arrays;
|
||||
|
||||
if (new_op_array) {
|
||||
zval *local_retval_ptr=NULL;
|
||||
zval **original_return_value_ptr_ptr = EG(return_value_ptr_ptr);
|
||||
zend_op **original_opline_ptr = EG(opline_ptr);
|
||||
|
||||
EG(return_value_ptr_ptr) = &local_retval_ptr;
|
||||
EG(active_op_array) = new_op_array;
|
||||
EG(no_extensions)=1;
|
||||
|
||||
zend_execute(new_op_array TSRMLS_CC);
|
||||
|
||||
if (local_retval_ptr) {
|
||||
if (retval_ptr) {
|
||||
COPY_PZVAL_TO_ZVAL(*retval_ptr, local_retval_ptr);
|
||||
} else {
|
||||
zval_ptr_dtor(&local_retval_ptr);
|
||||
}
|
||||
} else {
|
||||
if (retval_ptr) {
|
||||
INIT_ZVAL(*retval_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
EG(no_extensions)=0;
|
||||
EG(opline_ptr) = original_opline_ptr;
|
||||
EG(active_op_array) = original_active_op_array;
|
||||
EG(function_state_ptr) = original_function_state_ptr;
|
||||
destroy_op_array(new_op_array);
|
||||
efree(new_op_array);
|
||||
EG(return_value_ptr_ptr) = original_return_value_ptr_ptr;
|
||||
retval = SUCCESS;
|
||||
} else {
|
||||
retval = FAILURE;
|
||||
}
|
||||
zval_dtor(&pv);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
void execute_new_code(TSRMLS_D)
|
||||
{
|
||||
zend_op *opline, *end;
|
||||
zend_op *ret_opline;
|
||||
zval *local_retval=NULL;
|
||||
|
||||
if (!CG(interactive)
|
||||
|| CG(active_op_array)->backpatch_count>0
|
||||
|| CG(active_op_array)->function_name
|
||||
|| CG(active_op_array)->type!=ZEND_USER_FUNCTION) {
|
||||
return;
|
||||
}
|
||||
|
||||
ret_opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
ret_opline->opcode = ZEND_RETURN;
|
||||
ret_opline->op1.op_type = IS_CONST;
|
||||
INIT_ZVAL(ret_opline->op1.u.constant);
|
||||
SET_UNUSED(ret_opline->op2);
|
||||
|
||||
if (!CG(active_op_array)->start_op) {
|
||||
CG(active_op_array)->start_op = CG(active_op_array)->opcodes;
|
||||
}
|
||||
|
||||
opline=CG(active_op_array)->start_op;
|
||||
end=CG(active_op_array)->opcodes+CG(active_op_array)->last;
|
||||
|
||||
while (opline<end) {
|
||||
if (opline->op1.op_type==IS_CONST) {
|
||||
opline->op1.u.constant.is_ref = 1;
|
||||
opline->op1.u.constant.refcount = 2; /* Make sure is_ref won't be reset */
|
||||
}
|
||||
if (opline->op2.op_type==IS_CONST) {
|
||||
opline->op2.u.constant.is_ref = 1;
|
||||
opline->op2.u.constant.refcount = 2;
|
||||
}
|
||||
opline++;
|
||||
}
|
||||
|
||||
EG(return_value_ptr_ptr) = &local_retval;
|
||||
EG(active_op_array) = CG(active_op_array);
|
||||
zend_execute(CG(active_op_array) TSRMLS_CC);
|
||||
if (local_retval) {
|
||||
zval_ptr_dtor(&local_retval);
|
||||
}
|
||||
|
||||
CG(active_op_array)->last--; /* get rid of that ZEND_RETURN */
|
||||
CG(active_op_array)->start_op = CG(active_op_array)->opcodes+CG(active_op_array)->last;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_timeout(int dummy)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
/* is there any point in this? we're terminating the request anyway...
|
||||
PG(connection_status) |= PHP_CONNECTION_TIMEOUT;
|
||||
*/
|
||||
zend_error(E_ERROR, "Maximum execution time of %d second%s exceeded",
|
||||
EG(timeout_seconds), EG(timeout_seconds) == 1 ? "" : "s");
|
||||
}
|
||||
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
static LRESULT CALLBACK zend_timeout_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (message) {
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
case WM_REGISTER_ZEND_TIMEOUT:
|
||||
/* wParam is the thread id pointer, lParam is the timeout amount in seconds */
|
||||
if (lParam==0) {
|
||||
KillTimer(timeout_window, wParam);
|
||||
} else {
|
||||
SetTimer(timeout_window, wParam, lParam*1000, NULL);
|
||||
}
|
||||
break;
|
||||
case WM_UNREGISTER_ZEND_TIMEOUT:
|
||||
/* wParam is the thread id pointer */
|
||||
KillTimer(timeout_window, wParam);
|
||||
break;
|
||||
case WM_TIMER: {
|
||||
#ifdef ZTS
|
||||
void ***tsrm_ls;
|
||||
|
||||
tsrm_ls = ts_resource_ex(0, &wParam);
|
||||
if (!tsrm_ls) {
|
||||
/* Thread died before receiving its timeout? */
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
KillTimer(timeout_window, wParam);
|
||||
EG(timed_out) = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static unsigned __stdcall timeout_thread_proc(void *pArgs)
|
||||
{
|
||||
MSG message;
|
||||
|
||||
wc.style=0;
|
||||
wc.lpfnWndProc = zend_timeout_WndProc;
|
||||
wc.cbClsExtra=0;
|
||||
wc.cbWndExtra=0;
|
||||
wc.hInstance=NULL;
|
||||
wc.hIcon=NULL;
|
||||
wc.hCursor=NULL;
|
||||
wc.hbrBackground=(HBRUSH)(COLOR_BACKGROUND + 5);
|
||||
wc.lpszMenuName=NULL;
|
||||
wc.lpszClassName = "Zend Timeout Window";
|
||||
if (!RegisterClass(&wc)) {
|
||||
return -1;
|
||||
}
|
||||
timeout_window = CreateWindow(wc.lpszClassName, wc.lpszClassName, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, NULL);
|
||||
SetEvent(timeout_thread_event);
|
||||
while (GetMessage(&message, NULL, 0, 0)) {
|
||||
SendMessage(timeout_window, message.message, message.wParam, message.lParam);
|
||||
if (message.message == WM_QUIT) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
DestroyWindow(timeout_window);
|
||||
UnregisterClass(wc.lpszClassName, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void zend_init_timeout_thread()
|
||||
{
|
||||
timeout_thread_event = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
_beginthreadex(NULL, 0, timeout_thread_proc, NULL, 0, &timeout_thread_id);
|
||||
WaitForSingleObject(timeout_thread_event, INFINITE);
|
||||
}
|
||||
|
||||
|
||||
void zend_shutdown_timeout_thread()
|
||||
{
|
||||
if (!timeout_thread_initialized) {
|
||||
return;
|
||||
}
|
||||
PostThreadMessage(timeout_thread_id, WM_QUIT, 0, 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* This one doesn't exists on QNX */
|
||||
#ifndef SIGPROF
|
||||
#define SIGPROF 27
|
||||
#endif
|
||||
|
||||
void zend_set_timeout(long seconds)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
EG(timeout_seconds) = seconds;
|
||||
#ifdef ZEND_WIN32
|
||||
if (timeout_thread_initialized==0 && InterlockedIncrement(&timeout_thread_initialized)==1) {
|
||||
/* We start up this process-wide thread here and not in zend_startup(), because if Zend
|
||||
* is initialized inside a DllMain(), you're not supposed to start threads from it.
|
||||
*/
|
||||
zend_init_timeout_thread();
|
||||
}
|
||||
PostThreadMessage(timeout_thread_id, WM_REGISTER_ZEND_TIMEOUT, (WPARAM) GetCurrentThreadId(), (LPARAM) seconds);
|
||||
#else
|
||||
# ifdef HAVE_SETITIMER
|
||||
{
|
||||
struct itimerval t_r; /* timeout requested */
|
||||
sigset_t sigset;
|
||||
|
||||
t_r.it_value.tv_sec = seconds;
|
||||
t_r.it_value.tv_usec = t_r.it_interval.tv_sec = t_r.it_interval.tv_usec = 0;
|
||||
|
||||
setitimer(ITIMER_PROF, &t_r, NULL);
|
||||
signal(SIGPROF, zend_timeout);
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGPROF);
|
||||
sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void zend_unset_timeout(TSRMLS_D)
|
||||
{
|
||||
#ifdef ZEND_WIN32
|
||||
PostThreadMessage(timeout_thread_id, WM_UNREGISTER_ZEND_TIMEOUT, (WPARAM) GetCurrentThreadId(), (LPARAM) 0);
|
||||
#else
|
||||
# ifdef HAVE_SETITIMER
|
||||
{
|
||||
struct itimerval no_timeout;
|
||||
|
||||
no_timeout.it_value.tv_sec = no_timeout.it_value.tv_usec = no_timeout.it_interval.tv_sec = no_timeout.it_interval.tv_usec = 0;
|
||||
|
||||
setitimer(ITIMER_PROF, &no_timeout, NULL);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
#ifndef ZEND_EXECUTE_LOCKS_H
|
||||
#define ZEND_EXECUTE_LOCKS_H
|
||||
|
||||
#define PZVAL_LOCK(z) zend_pzval_lock_func(z)
|
||||
|
||||
static inline void zend_pzval_lock_func(zval *z)
|
||||
{
|
||||
z->refcount++;
|
||||
}
|
||||
|
||||
#define PZVAL_UNLOCK(z) zend_pzval_unlock_func(z TSRMLS_CC)
|
||||
|
||||
static inline void zend_pzval_unlock_func(zval *z TSRMLS_DC)
|
||||
{
|
||||
z->refcount--;
|
||||
if (!z->refcount) {
|
||||
z->refcount = 1;
|
||||
z->is_ref = 0;
|
||||
EG(garbage)[EG(garbage_ptr)++] = z;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void zend_clean_garbage(TSRMLS_D)
|
||||
{
|
||||
while (EG(garbage_ptr)) {
|
||||
zval_ptr_dtor(&EG(garbage)[--EG(garbage_ptr)]);
|
||||
}
|
||||
}
|
||||
|
||||
#define SELECTIVE_PZVAL_LOCK(pzv, pzn) if (!((pzn)->u.EA.type & EXT_TYPE_UNUSED)) { PZVAL_LOCK(pzv); }
|
||||
|
||||
#endif /* ZEND_EXECUTE_LOCKS_H */
|
||||
@@ -1,218 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include "zend_extensions.h"
|
||||
|
||||
ZEND_API zend_llist zend_extensions;
|
||||
static int last_resource_number;
|
||||
|
||||
int zend_load_extension(char *path)
|
||||
{
|
||||
#if ZEND_EXTENSIONS_SUPPORT
|
||||
DL_HANDLE handle;
|
||||
zend_extension *new_extension;
|
||||
zend_extension_version_info *extension_version_info;
|
||||
|
||||
handle = DL_LOAD(path);
|
||||
if (!handle) {
|
||||
#ifndef ZEND_WIN32
|
||||
fprintf(stderr, "Failed loading %s: %s\n", path, dlerror());
|
||||
#else
|
||||
fprintf(stderr, "Failed loading %s\n", path);
|
||||
#endif
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
extension_version_info = (zend_extension_version_info *) DL_FETCH_SYMBOL(handle, "extension_version_info");
|
||||
new_extension = (zend_extension *) DL_FETCH_SYMBOL(handle, "zend_extension_entry");
|
||||
if (!extension_version_info || !new_extension) {
|
||||
fprintf(stderr, "%s doesn't appear to be a valid Zend extension\n", path);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
|
||||
/* allow extension to proclaim compatibility with any Zend version */
|
||||
if (extension_version_info->zend_extension_api_no != ZEND_EXTENSION_API_NO &&(!new_extension->api_no_check || new_extension->api_no_check(ZEND_EXTENSION_API_NO) != SUCCESS)) {
|
||||
if (extension_version_info->zend_extension_api_no > ZEND_EXTENSION_API_NO) {
|
||||
fprintf(stderr, "%s requires Zend Engine API version %d.\n"
|
||||
"The Zend Engine API version %d which is installed, is outdated.\n\n",
|
||||
new_extension->name,
|
||||
extension_version_info->zend_extension_api_no,
|
||||
ZEND_EXTENSION_API_NO);
|
||||
DL_UNLOAD(handle);
|
||||
return FAILURE;
|
||||
} else if (extension_version_info->zend_extension_api_no < ZEND_EXTENSION_API_NO) {
|
||||
fprintf(stderr, "%s requires Zend Engine API version %d.\n"
|
||||
"The Zend Engine API version %d which is installed, is newer.\n"
|
||||
"Contact %s at %s for a later version of %s.\n\n",
|
||||
new_extension->name,
|
||||
extension_version_info->zend_extension_api_no,
|
||||
ZEND_EXTENSION_API_NO,
|
||||
new_extension->author,
|
||||
new_extension->URL,
|
||||
new_extension->name);
|
||||
DL_UNLOAD(handle);
|
||||
return FAILURE;
|
||||
}
|
||||
} else if (ZTS_V!=extension_version_info->thread_safe) {
|
||||
fprintf(stderr, "Cannot load %s - it %s thread safe, whereas Zend %s\n",
|
||||
new_extension->name,
|
||||
(extension_version_info->thread_safe?"is":"isn't"),
|
||||
(ZTS_V?"is":"isn't"));
|
||||
DL_UNLOAD(handle);
|
||||
return FAILURE;
|
||||
} else if (ZEND_DEBUG!=extension_version_info->debug) {
|
||||
fprintf(stderr, "Cannot load %s - it %s debug information, whereas Zend %s\n",
|
||||
new_extension->name,
|
||||
(extension_version_info->debug?"contains":"does not contain"),
|
||||
(ZEND_DEBUG?"does":"does not"));
|
||||
DL_UNLOAD(handle);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
return zend_register_extension(new_extension, handle);
|
||||
#else
|
||||
fprintf(stderr, "Extensions are not supported on this platform.\n");
|
||||
return FAILURE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle)
|
||||
{
|
||||
#if ZEND_EXTENSIONS_SUPPORT
|
||||
zend_extension extension;
|
||||
|
||||
extension = *new_extension;
|
||||
extension.handle = handle;
|
||||
|
||||
zend_extension_dispatch_message(ZEND_EXTMSG_NEW_EXTENSION, &extension);
|
||||
|
||||
zend_llist_add_element(&zend_extensions, &extension);
|
||||
|
||||
/*fprintf(stderr, "Loaded %s, version %s\n", extension.name, extension.version);*/
|
||||
#endif
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static void zend_extension_shutdown(zend_extension *extension TSRMLS_DC)
|
||||
{
|
||||
#if ZEND_EXTENSIONS_SUPPORT
|
||||
if (extension->shutdown) {
|
||||
extension->shutdown(extension);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static int zend_extension_startup(zend_extension *extension)
|
||||
{
|
||||
#if ZEND_EXTENSIONS_SUPPORT
|
||||
if (extension->startup) {
|
||||
if (extension->startup(extension)!=SUCCESS) {
|
||||
return 1;
|
||||
}
|
||||
zend_append_version_info(extension);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int zend_startup_extensions_mechanism()
|
||||
{
|
||||
/* Startup extensions mechanism */
|
||||
zend_llist_init(&zend_extensions, sizeof(zend_extension), (void (*)(void *)) zend_extension_dtor, 1);
|
||||
last_resource_number = 0;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int zend_startup_extensions()
|
||||
{
|
||||
zend_llist_apply_with_del(&zend_extensions, (int (*)(void *)) zend_extension_startup);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
void zend_shutdown_extensions(TSRMLS_D)
|
||||
{
|
||||
zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_shutdown TSRMLS_CC);
|
||||
zend_llist_destroy(&zend_extensions);
|
||||
}
|
||||
|
||||
|
||||
void zend_extension_dtor(zend_extension *extension)
|
||||
{
|
||||
#if ZEND_EXTENSIONS_SUPPORT && !ZEND_DEBUG
|
||||
if (extension->handle) {
|
||||
DL_UNLOAD(extension->handle);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void zend_extension_message_dispatcher(zend_extension *extension, int num_args, va_list args TSRMLS_DC)
|
||||
{
|
||||
int message;
|
||||
void *arg;
|
||||
|
||||
if (!extension->message_handler || num_args!=2) {
|
||||
return;
|
||||
}
|
||||
message = va_arg(args, int);
|
||||
arg = va_arg(args, void *);
|
||||
extension->message_handler(message, arg);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_extension_dispatch_message(int message, void *arg)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
zend_llist_apply_with_arguments(&zend_extensions, (llist_apply_with_args_func_t) zend_extension_message_dispatcher TSRMLS_CC, 2, message, arg);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_get_resource_handle(zend_extension *extension)
|
||||
{
|
||||
if (last_resource_number<ZEND_MAX_RESERVED_RESOURCES) {
|
||||
extension->resource_number = last_resource_number;
|
||||
return last_resource_number++;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API zend_extension *zend_get_extension(char *extension_name)
|
||||
{
|
||||
zend_llist_element *element;
|
||||
|
||||
for (element = zend_extensions.head; element; element = element->next) {
|
||||
zend_extension *extension = (zend_extension *) element->data;
|
||||
|
||||
if (!strcmp(extension->name, extension_name)) {
|
||||
return extension;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ZEND_EXTENSIONS_H
|
||||
#define ZEND_EXTENSIONS_H
|
||||
|
||||
#include "zend_compile.h"
|
||||
|
||||
#define ZEND_EXTENSION_API_NO 20010710
|
||||
|
||||
typedef struct _zend_extension_version_info {
|
||||
int zend_extension_api_no;
|
||||
char *required_zend_version;
|
||||
unsigned char thread_safe;
|
||||
unsigned char debug;
|
||||
} zend_extension_version_info;
|
||||
|
||||
|
||||
typedef struct _zend_extension zend_extension;
|
||||
|
||||
/* Typedef's for zend_extension function pointers */
|
||||
typedef int (*startup_func_t)(zend_extension *extension);
|
||||
typedef void (*shutdown_func_t)(zend_extension *extension);
|
||||
typedef void (*activate_func_t)(void);
|
||||
typedef void (*deactivate_func_t)(void);
|
||||
|
||||
typedef void (*message_handler_func_t)(int message, void *arg);
|
||||
|
||||
typedef void (*op_array_handler_func_t)(zend_op_array *op_array);
|
||||
|
||||
typedef void (*statement_handler_func_t)(zend_op_array *op_array);
|
||||
typedef void (*fcall_begin_handler_func_t)(zend_op_array *op_array);
|
||||
typedef void (*fcall_end_handler_func_t)(zend_op_array *op_array);
|
||||
|
||||
typedef void (*op_array_ctor_func_t)(zend_op_array *op_array);
|
||||
typedef void (*op_array_dtor_func_t)(zend_op_array *op_array);
|
||||
|
||||
struct _zend_extension {
|
||||
char *name;
|
||||
char *version;
|
||||
char *author;
|
||||
char *URL;
|
||||
char *copyright;
|
||||
|
||||
startup_func_t startup;
|
||||
shutdown_func_t shutdown;
|
||||
activate_func_t activate;
|
||||
deactivate_func_t deactivate;
|
||||
|
||||
message_handler_func_t message_handler;
|
||||
|
||||
op_array_handler_func_t op_array_handler;
|
||||
|
||||
statement_handler_func_t statement_handler;
|
||||
fcall_begin_handler_func_t fcall_begin_handler;
|
||||
fcall_end_handler_func_t fcall_end_handler;
|
||||
|
||||
op_array_ctor_func_t op_array_ctor;
|
||||
op_array_dtor_func_t op_array_dtor;
|
||||
|
||||
int (*api_no_check)(int api_no);
|
||||
void *reserved2;
|
||||
void *reserved3;
|
||||
void *reserved4;
|
||||
void *reserved5;
|
||||
void *reserved6;
|
||||
void *reserved7;
|
||||
void *reserved8;
|
||||
|
||||
DL_HANDLE handle;
|
||||
int resource_number;
|
||||
};
|
||||
|
||||
|
||||
ZEND_API int zend_get_resource_handle(zend_extension *extension);
|
||||
ZEND_API void zend_extension_dispatch_message(int message, void *arg);
|
||||
|
||||
#define ZEND_EXTMSG_NEW_EXTENSION 1
|
||||
|
||||
|
||||
#define ZEND_EXTENSION() \
|
||||
ZEND_EXT_API zend_extension_version_info extension_version_info = { ZEND_EXTENSION_API_NO, ZEND_VERSION, ZTS_V, ZEND_DEBUG }
|
||||
|
||||
#define STANDARD_ZEND_EXTENSION_PROPERTIES NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1
|
||||
#define COMPAT_ZEND_EXTENSION_PROPERTIES NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1
|
||||
|
||||
|
||||
ZEND_API extern zend_llist zend_extensions;
|
||||
|
||||
void zend_extension_dtor(zend_extension *extension);
|
||||
ZEND_API int zend_load_extension(char *path);
|
||||
ZEND_API int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle);
|
||||
void zend_append_version_info(zend_extension *extension);
|
||||
int zend_startup_extensions_mechanism(void);
|
||||
int zend_startup_extensions(void);
|
||||
void zend_shutdown_extensions(TSRMLS_D);
|
||||
ZEND_API zend_extension *zend_get_extension(char *extension_name);
|
||||
|
||||
#endif /* ZEND_EXTENSIONS_H */
|
||||
@@ -1,140 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ZEND_FAST_CACHE_H
|
||||
#define ZEND_FAST_CACHE_H
|
||||
|
||||
#ifndef ZEND_ENABLE_FAST_CACHE
|
||||
# if ZEND_DEBUG
|
||||
# define ZEND_ENABLE_FAST_CACHE 0
|
||||
# else
|
||||
# define ZEND_ENABLE_FAST_CACHE 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
typedef struct _zend_fast_cache_list_entry {
|
||||
struct _zend_fast_cache_list_entry *next;
|
||||
} zend_fast_cache_list_entry;
|
||||
|
||||
#define MAX_FAST_CACHE_TYPES 4
|
||||
|
||||
|
||||
#define ZVAL_CACHE_LIST 0
|
||||
#define HASHTABLE_CACHE_LIST 1
|
||||
|
||||
#if ZEND_ENABLE_FAST_CACHE
|
||||
|
||||
|
||||
#include "zend_globals.h"
|
||||
#include "zend_globals_macros.h"
|
||||
#include "zend_alloc.h"
|
||||
|
||||
|
||||
#if ZEND_DEBUG
|
||||
# define RECORD_ZVAL_CACHE_HIT(fc_type) AG(fast_cache_stats)[fc_type][1]++;
|
||||
# define RECORD_ZVAL_CACHE_MISS(fc_type) AG(fast_cache_stats)[fc_type][0]++;
|
||||
#else
|
||||
# define RECORD_ZVAL_CACHE_HIT(fc_type)
|
||||
# define RECORD_ZVAL_CACHE_MISS(fc_type)
|
||||
#endif
|
||||
|
||||
|
||||
#define ZEND_FAST_ALLOC(p, type, fc_type) \
|
||||
{ \
|
||||
TSRMLS_FETCH(); \
|
||||
\
|
||||
if (((p) = (type *) AG(fast_cache_list_head)[fc_type])) { \
|
||||
AG(fast_cache_list_head)[fc_type] = ((zend_fast_cache_list_entry *) AG(fast_cache_list_head)[fc_type])->next; \
|
||||
RECORD_ZVAL_CACHE_HIT(fc_type); \
|
||||
} else { \
|
||||
(p) = (type *) emalloc(sizeof(type)); \
|
||||
RECORD_ZVAL_CACHE_MISS(fc_type); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#define ZEND_FAST_FREE(p, fc_type) \
|
||||
{ \
|
||||
TSRMLS_FETCH(); \
|
||||
\
|
||||
((zend_fast_cache_list_entry *) (p))->next = (zend_fast_cache_list_entry *) AG(fast_cache_list_head)[fc_type]; \
|
||||
AG(fast_cache_list_head)[fc_type] = (zend_fast_cache_list_entry *) (p); \
|
||||
}
|
||||
|
||||
#define ZEND_FAST_ALLOC_REL(p, type, fc_type) \
|
||||
ZEND_FAST_ALLOC(p, type, fc_type)
|
||||
|
||||
#define ZEND_FAST_FREE_REL(p, fc_type) \
|
||||
ZEND_FAST_FREE(p, fc_type)
|
||||
|
||||
|
||||
#else /* !ZEND_ENABLE_FAST_CACHE */
|
||||
|
||||
#define ZEND_FAST_ALLOC(p, type, fc_type) \
|
||||
(p) = (type *) emalloc(sizeof(type))
|
||||
|
||||
#define ZEND_FAST_FREE(p, fc_type) \
|
||||
efree(p)
|
||||
|
||||
#define ZEND_FAST_ALLOC_REL(p, type, fc_type) \
|
||||
(p) = (type *) emalloc_rel(sizeof(type))
|
||||
|
||||
#define ZEND_FAST_FREE_REL(p, fc_type) \
|
||||
efree_rel(p)
|
||||
|
||||
#endif /* ZEND_ENABLE_FAST_CACHE */
|
||||
|
||||
|
||||
|
||||
|
||||
/* fast cache for zval's */
|
||||
#define ALLOC_ZVAL(z) \
|
||||
ZEND_FAST_ALLOC(z, zval, ZVAL_CACHE_LIST)
|
||||
|
||||
#define FREE_ZVAL(z) \
|
||||
ZEND_FAST_FREE(z, ZVAL_CACHE_LIST)
|
||||
|
||||
#define ALLOC_ZVAL_REL(z) \
|
||||
ZEND_FAST_ALLOC_REL(z, zval, ZVAL_CACHE_LIST)
|
||||
|
||||
#define FREE_ZVAL_REL(z) \
|
||||
ZEND_FAST_FREE_REL(z, ZVAL_CACHE_LIST)
|
||||
|
||||
/* fast cache for HashTables */
|
||||
#define ALLOC_HASHTABLE(ht) \
|
||||
ZEND_FAST_ALLOC(ht, HashTable, HASHTABLE_CACHE_LIST)
|
||||
|
||||
#define FREE_HASHTABLE(ht) \
|
||||
ZEND_FAST_FREE(ht, HASHTABLE_CACHE_LIST)
|
||||
|
||||
#define ALLOC_HASHTABLE_REL(ht) \
|
||||
ZEND_FAST_ALLOC_REL(ht, HashTable, HASHTABLE_CACHE_LIST)
|
||||
|
||||
#define FREE_HASHTABLE_REL(ht) \
|
||||
ZEND_FAST_FREE_REL(ht, HASHTABLE_CACHE_LIST)
|
||||
|
||||
#endif /* ZEND_FAST_CACHE_H */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -1,248 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ZEND_GLOBALS_H
|
||||
#define ZEND_GLOBALS_H
|
||||
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#include "zend_globals_macros.h"
|
||||
|
||||
#include "zend_stack.h"
|
||||
#include "zend_ptr_stack.h"
|
||||
#include "zend_hash.h"
|
||||
#include "zend_llist.h"
|
||||
#include "zend_fast_cache.h"
|
||||
|
||||
/* Define ZTS if you want a thread-safe Zend */
|
||||
/*#undef ZTS*/
|
||||
|
||||
#ifdef ZTS
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API extern int compiler_globals_id;
|
||||
ZEND_API extern int executor_globals_id;
|
||||
ZEND_API extern int alloc_globals_id;
|
||||
END_EXTERN_C()
|
||||
|
||||
#endif
|
||||
|
||||
#define SYMTABLE_CACHE_SIZE 32
|
||||
|
||||
|
||||
#include "zend_compile.h"
|
||||
|
||||
/* excpt.h on Digital Unix 4.0 defines function_table */
|
||||
#undef function_table
|
||||
|
||||
|
||||
typedef struct _zend_declarables {
|
||||
zval ticks;
|
||||
} zend_declarables;
|
||||
|
||||
|
||||
struct _zend_compiler_globals {
|
||||
zend_stack bp_stack;
|
||||
zend_stack switch_cond_stack;
|
||||
zend_stack foreach_copy_stack;
|
||||
zend_stack object_stack;
|
||||
zend_stack declare_stack;
|
||||
|
||||
zend_class_entry class_entry, *active_class_entry;
|
||||
zval active_ce_parent_class_name;
|
||||
|
||||
/* variables for list() compilation */
|
||||
zend_llist list_llist;
|
||||
zend_llist dimension_llist;
|
||||
zend_stack list_stack;
|
||||
|
||||
zend_stack function_call_stack;
|
||||
|
||||
char *compiled_filename;
|
||||
|
||||
int zend_lineno;
|
||||
int comment_start_line;
|
||||
char *heredoc;
|
||||
int heredoc_len;
|
||||
|
||||
zend_op_array *active_op_array;
|
||||
|
||||
HashTable *function_table; /* function symbol table */
|
||||
HashTable *class_table; /* class table */
|
||||
HashTable *namespaces;
|
||||
|
||||
HashTable filenames_table;
|
||||
|
||||
HashTable *auto_globals;
|
||||
|
||||
zend_bool in_compilation;
|
||||
zend_bool short_tags;
|
||||
zend_bool asp_tags;
|
||||
zend_bool allow_call_time_pass_reference;
|
||||
|
||||
zend_declarables declarables;
|
||||
|
||||
/* For extensions support */
|
||||
zend_bool extended_info; /* generate extension information for debugger/profiler */
|
||||
zend_bool handle_op_arrays; /* run op_arrays through op_array handlers */
|
||||
|
||||
zend_bool unclean_shutdown;
|
||||
|
||||
zend_bool ini_parser_unbuffered_errors;
|
||||
|
||||
zend_llist open_files;
|
||||
|
||||
zend_llist *throw_list;
|
||||
|
||||
struct _zend_ini_parser_param *ini_parser_param;
|
||||
|
||||
int interactive;
|
||||
|
||||
zend_bool increment_lineno;
|
||||
|
||||
char *namespace;
|
||||
int namespace_len;
|
||||
};
|
||||
|
||||
|
||||
struct _zend_executor_globals {
|
||||
zval **return_value_ptr_ptr;
|
||||
|
||||
zval uninitialized_zval;
|
||||
zval *uninitialized_zval_ptr;
|
||||
|
||||
zval error_zval;
|
||||
zval *error_zval_ptr;
|
||||
|
||||
zend_function_state *function_state_ptr;
|
||||
zend_ptr_stack arg_types_stack;
|
||||
|
||||
/* symbol table cache */
|
||||
HashTable *symtable_cache[SYMTABLE_CACHE_SIZE];
|
||||
HashTable **symtable_cache_limit;
|
||||
HashTable **symtable_cache_ptr;
|
||||
|
||||
zend_op **opline_ptr;
|
||||
|
||||
HashTable *active_symbol_table;
|
||||
HashTable symbol_table; /* main symbol table */
|
||||
|
||||
HashTable included_files; /* files already included */
|
||||
|
||||
jmp_buf bailout;
|
||||
|
||||
int error_reporting;
|
||||
int orig_error_reporting;
|
||||
int exit_status;
|
||||
|
||||
zend_op_array *active_op_array;
|
||||
|
||||
HashTable *function_table; /* function symbol table */
|
||||
HashTable *class_table; /* class table */
|
||||
HashTable *zend_constants; /* constants table */
|
||||
HashTable *namespaces;
|
||||
|
||||
long precision;
|
||||
|
||||
int ticks_count;
|
||||
|
||||
zend_bool in_execution;
|
||||
zend_bool bailout_set;
|
||||
|
||||
/* for extended information support */
|
||||
zend_bool no_extensions;
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
zend_bool timed_out;
|
||||
#endif
|
||||
|
||||
HashTable regular_list;
|
||||
HashTable persistent_list;
|
||||
|
||||
zend_ptr_stack argument_stack;
|
||||
int free_op1, free_op2;
|
||||
int (*unary_op)(zval *result, zval *op1);
|
||||
int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
|
||||
zval *garbage[2];
|
||||
int garbage_ptr;
|
||||
|
||||
zval *user_error_handler;
|
||||
zend_ptr_stack user_error_handlers;
|
||||
|
||||
/* timeout support */
|
||||
int timeout_seconds;
|
||||
|
||||
int lambda_count;
|
||||
|
||||
HashTable ini_directives;
|
||||
zend_objects objects;
|
||||
zval *exception;
|
||||
|
||||
void *reserved[ZEND_MAX_RESERVED_RESOURCES];
|
||||
};
|
||||
|
||||
|
||||
struct _zend_alloc_globals {
|
||||
zend_mem_header *head; /* standard list */
|
||||
zend_mem_header *phead; /* persistent list */
|
||||
void *cache[MAX_CACHED_MEMORY][MAX_CACHED_ENTRIES];
|
||||
unsigned int cache_count[MAX_CACHED_MEMORY];
|
||||
void *fast_cache_list_head[MAX_FAST_CACHE_TYPES];
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
HANDLE memory_heap;
|
||||
#endif
|
||||
|
||||
#if ZEND_DEBUG
|
||||
/* for performance tuning */
|
||||
int cache_stats[MAX_CACHED_MEMORY][2];
|
||||
int fast_cache_stats[MAX_FAST_CACHE_TYPES][2];
|
||||
#endif
|
||||
#if MEMORY_LIMIT
|
||||
unsigned int memory_limit;
|
||||
unsigned int allocated_memory;
|
||||
unsigned int allocated_memory_peak;
|
||||
unsigned char memory_exhausted;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _zend_scanner_globals {
|
||||
FILE *yy_in;
|
||||
FILE *yy_out;
|
||||
int yy_leng;
|
||||
char *yy_text;
|
||||
struct yy_buffer_state *current_buffer;
|
||||
char *c_buf_p;
|
||||
int init;
|
||||
int start;
|
||||
char _yy_hold_char;
|
||||
int yy_n_chars;
|
||||
int _yy_did_buffer_switch_on_eof;
|
||||
int _yy_last_accepting_state; /* Must be of the same type as yy_state_type,
|
||||
* if for whatever reason it's no longer int!
|
||||
*/
|
||||
char *_yy_last_accepting_cpos;
|
||||
int _yy_more_flag;
|
||||
int _yy_more_len;
|
||||
};
|
||||
|
||||
#endif /* ZEND_GLOBALS_H */
|
||||
@@ -1,109 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ZEND_GLOBALS_MACROS_H
|
||||
#define ZEND_GLOBALS_MACROS_H
|
||||
|
||||
typedef struct _zend_compiler_globals zend_compiler_globals;
|
||||
typedef struct _zend_executor_globals zend_executor_globals;
|
||||
typedef struct _zend_alloc_globals zend_alloc_globals;
|
||||
typedef struct _zend_scanner_globals zend_scanner_globals;
|
||||
|
||||
/* Compiler */
|
||||
#ifdef ZTS
|
||||
# define CG(v) TSRMG(compiler_globals_id, zend_compiler_globals *, v)
|
||||
BEGIN_EXTERN_C()
|
||||
int zendparse(void *compiler_globals);
|
||||
END_EXTERN_C()
|
||||
#else
|
||||
# define CG(v) (compiler_globals.v)
|
||||
extern ZEND_API struct _zend_compiler_globals compiler_globals;
|
||||
int zendparse(void);
|
||||
#endif
|
||||
|
||||
|
||||
/* Executor */
|
||||
#ifdef ZTS
|
||||
# define EG(v) TSRMG(executor_globals_id, zend_executor_globals *, v)
|
||||
#else
|
||||
# define EG(v) (executor_globals.v)
|
||||
extern ZEND_API zend_executor_globals executor_globals;
|
||||
#endif
|
||||
|
||||
|
||||
/* Memory Manager */
|
||||
#ifdef ZTS
|
||||
# define AG(v) TSRMG(alloc_globals_id, zend_alloc_globals *, v)
|
||||
#else
|
||||
# define AG(v) (alloc_globals.v)
|
||||
extern ZEND_API zend_alloc_globals alloc_globals;
|
||||
#endif
|
||||
|
||||
|
||||
/* Language Scanner */
|
||||
#ifdef ZTS
|
||||
# define LANG_SCNG(v) TSRMG(language_scanner_globals_id, zend_scanner_globals *, v)
|
||||
extern ZEND_API ts_rsrc_id language_scanner_globals_id;
|
||||
#else
|
||||
# define LANG_SCNG(v) (language_scanner_globals.v)
|
||||
extern ZEND_API zend_scanner_globals language_scanner_globals;
|
||||
#endif
|
||||
|
||||
|
||||
/* INI Scanner */
|
||||
#ifdef ZTS
|
||||
# define INI_SCNG(v) TSRMG(ini_scanner_globals_id, zend_scanner_globals *, v)
|
||||
extern ZEND_API ts_rsrc_id ini_scanner_globals_id;
|
||||
#else
|
||||
# define INI_SCNG(v) (ini_scanner_globals.v)
|
||||
extern ZEND_API zend_scanner_globals ini_scanner_globals;
|
||||
#endif
|
||||
|
||||
|
||||
/* For limited downwards source compatibility */
|
||||
#define CLS_FETCH()
|
||||
#define ELS_FETCH()
|
||||
#define ALS_FETCH()
|
||||
#define PLS_FETCH()
|
||||
#define SLS_FETCH()
|
||||
#define CLS_D
|
||||
#define ELS_D
|
||||
#define ALS_D
|
||||
#define PLS_D
|
||||
#define SLS_D
|
||||
#define CLS_DC
|
||||
#define ELS_DC
|
||||
#define ALS_DC
|
||||
#define PLS_DC
|
||||
#define SLS_DC
|
||||
#define CLS_C
|
||||
#define ELS_C
|
||||
#define ALS_C
|
||||
#define PLS_C
|
||||
#define SLS_C
|
||||
#define CLS_CC
|
||||
#define ELS_CC
|
||||
#define ALS_CC
|
||||
#define PLS_CC
|
||||
#define SLS_CC
|
||||
|
||||
|
||||
#endif /* ZEND_GLOBALS_MACROS_H */
|
||||
|
||||
-1307
File diff suppressed because it is too large.
Load diff
@@ -1,219 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef ZEND_HASH_H
|
||||
#define ZEND_HASH_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define HASH_KEY_IS_STRING 1
|
||||
#define HASH_KEY_IS_LONG 2
|
||||
#define HASH_KEY_NON_EXISTANT 3
|
||||
|
||||
#define HASH_UPDATE (1<<0)
|
||||
#define HASH_ADD (1<<1)
|
||||
#define HASH_NEXT_INSERT (1<<2)
|
||||
|
||||
#define HASH_DEL_KEY 0
|
||||
#define HASH_DEL_INDEX 1
|
||||
|
||||
typedef ulong (*hash_func_t)(char *arKey, uint nKeyLength);
|
||||
typedef int (*compare_func_t)(const void *, const void * TSRMLS_DC);
|
||||
typedef void (*sort_func_t)(void *, size_t, register size_t, compare_func_t TSRMLS_DC);
|
||||
typedef void (*dtor_func_t)(void *pDest);
|
||||
typedef void (*copy_ctor_func_t)(void *pElement);
|
||||
|
||||
struct _hashtable;
|
||||
|
||||
typedef struct bucket {
|
||||
ulong h; /* Used for numeric indexing */
|
||||
uint nKeyLength;
|
||||
void *pData;
|
||||
void *pDataPtr;
|
||||
struct bucket *pListNext;
|
||||
struct bucket *pListLast;
|
||||
struct bucket *pNext;
|
||||
struct bucket *pLast;
|
||||
char arKey[1]; /* Must be last element */
|
||||
} Bucket;
|
||||
|
||||
typedef struct _hashtable {
|
||||
uint nTableSize;
|
||||
uint nTableMask;
|
||||
uint nNumOfElements;
|
||||
ulong nNextFreeElement;
|
||||
Bucket *pInternalPointer; /* Used for element traversal */
|
||||
Bucket *pListHead;
|
||||
Bucket *pListTail;
|
||||
Bucket **arBuckets;
|
||||
dtor_func_t pDestructor;
|
||||
zend_bool persistent;
|
||||
unsigned char nApplyCount;
|
||||
zend_bool bApplyProtection;
|
||||
#if ZEND_DEBUG
|
||||
int inconsistent;
|
||||
#endif
|
||||
} HashTable;
|
||||
|
||||
typedef Bucket* HashPosition;
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
|
||||
/* startup/shutdown */
|
||||
ZEND_API int zend_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, int persistent);
|
||||
ZEND_API int zend_hash_init_ex(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, int persistent, zend_bool bApplyProtection);
|
||||
ZEND_API void zend_hash_destroy(HashTable *ht);
|
||||
ZEND_API void zend_hash_clean(HashTable *ht);
|
||||
|
||||
/* additions/updates/changes */
|
||||
ZEND_API int zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag);
|
||||
#define zend_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest) \
|
||||
zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_UPDATE)
|
||||
#define zend_hash_add(ht, arKey, nKeyLength, pData, nDataSize, pDest) \
|
||||
zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_ADD)
|
||||
|
||||
ZEND_API int zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag);
|
||||
#define zend_hash_quick_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \
|
||||
zend_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_UPDATE)
|
||||
#define zend_hash_quick_add(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \
|
||||
zend_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_ADD)
|
||||
|
||||
ZEND_API int zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag);
|
||||
#define zend_hash_index_update(ht, h, pData, nDataSize, pDest) \
|
||||
zend_hash_index_update_or_next_insert(ht, h, pData, nDataSize, pDest, HASH_UPDATE)
|
||||
#define zend_hash_next_index_insert(ht, pData, nDataSize, pDest) \
|
||||
zend_hash_index_update_or_next_insert(ht, 0, pData, nDataSize, pDest, HASH_NEXT_INSERT)
|
||||
|
||||
ZEND_API int zend_hash_add_empty_element(HashTable *ht, char *arKey, uint nKeyLength);
|
||||
|
||||
|
||||
#define ZEND_HASH_APPLY_KEEP 0
|
||||
#define ZEND_HASH_APPLY_REMOVE 1<<0
|
||||
#define ZEND_HASH_APPLY_STOP 1<<1
|
||||
|
||||
typedef struct _zend_hash_key {
|
||||
char *arKey;
|
||||
uint nKeyLength;
|
||||
ulong h;
|
||||
} zend_hash_key;
|
||||
|
||||
|
||||
typedef int (*apply_func_t)(void *pDest TSRMLS_DC);
|
||||
typedef int (*apply_func_arg_t)(void *pDest, void *argument TSRMLS_DC);
|
||||
typedef int (*apply_func_args_t)(void *pDest, int num_args, va_list args, zend_hash_key *hash_key);
|
||||
|
||||
ZEND_API void zend_hash_graceful_destroy(HashTable *ht);
|
||||
ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC);
|
||||
ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void * TSRMLS_DC);
|
||||
ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t apply_func, int, ...);
|
||||
|
||||
/* This function should be used with special care (in other words,
|
||||
* it should usually not be used). When used with the ZEND_HASH_APPLY_STOP
|
||||
* return value, it assumes things about the order of the elements in the hash.
|
||||
* Also, it does not provide the same kind of reentrancy protection that
|
||||
* the standard apply functions do.
|
||||
*/
|
||||
ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC);
|
||||
|
||||
|
||||
/* Deletes */
|
||||
ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag);
|
||||
#define zend_hash_del(ht, arKey, nKeyLength) \
|
||||
zend_hash_del_key_or_index(ht, arKey, nKeyLength, 0, HASH_DEL_KEY)
|
||||
#define zend_hash_index_del(ht, h) \
|
||||
zend_hash_del_key_or_index(ht, NULL, 0, h, HASH_DEL_INDEX)
|
||||
|
||||
ZEND_API ulong zend_get_hash_value(HashTable *ht, char *arKey, uint nKeyLength);
|
||||
|
||||
/* Data retreival */
|
||||
ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData);
|
||||
ZEND_API int zend_hash_quick_find(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData);
|
||||
ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData);
|
||||
|
||||
/* Misc */
|
||||
ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength);
|
||||
ZEND_API int zend_hash_index_exists(HashTable *ht, ulong h);
|
||||
ZEND_API ulong zend_hash_next_free_element(HashTable *ht);
|
||||
|
||||
/* traversing */
|
||||
ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos);
|
||||
ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos);
|
||||
ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos);
|
||||
ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos);
|
||||
ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosition *pos);
|
||||
ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos);
|
||||
ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos);
|
||||
|
||||
#define zend_hash_move_forward(ht) \
|
||||
zend_hash_move_forward_ex(ht, NULL)
|
||||
#define zend_hash_move_backwards(ht) \
|
||||
zend_hash_move_backwards_ex(ht, NULL)
|
||||
#define zend_hash_get_current_key(ht, str_index, num_index, duplicate) \
|
||||
zend_hash_get_current_key_ex(ht, str_index, NULL, num_index, duplicate, NULL)
|
||||
#define zend_hash_get_current_key_type(ht) \
|
||||
zend_hash_get_current_key_type_ex(ht, NULL)
|
||||
#define zend_hash_get_current_data(ht, pData) \
|
||||
zend_hash_get_current_data_ex(ht, pData, NULL)
|
||||
#define zend_hash_internal_pointer_reset(ht) \
|
||||
zend_hash_internal_pointer_reset_ex(ht, NULL)
|
||||
#define zend_hash_internal_pointer_end(ht) \
|
||||
zend_hash_internal_pointer_end_ex(ht, NULL)
|
||||
|
||||
/* Copying, merging and sorting */
|
||||
ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size);
|
||||
ZEND_API void zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite);
|
||||
ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, uint size, zend_bool (*pReplaceOrig)(void *orig, void *p_new));
|
||||
ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber TSRMLS_DC);
|
||||
ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC);
|
||||
ZEND_API int zend_hash_minmax(HashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC);
|
||||
|
||||
ZEND_API int zend_hash_num_elements(HashTable *ht);
|
||||
|
||||
ZEND_API int zend_hash_rehash(HashTable *ht);
|
||||
|
||||
static inline ulong zend_inline_hash_func(char *arKey, uint nKeyLength)
|
||||
{
|
||||
ulong h = 5381;
|
||||
char *arEnd = arKey + nKeyLength;
|
||||
|
||||
while (arKey < arEnd) {
|
||||
h += (h << 5);
|
||||
h ^= (ulong) *arKey++;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength);
|
||||
|
||||
#if ZEND_DEBUG
|
||||
/* debug */
|
||||
void zend_hash_display_pListTail(HashTable *ht);
|
||||
void zend_hash_display(HashTable *ht);
|
||||
#endif
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
#define ZEND_INIT_SYMTABLE(ht) \
|
||||
ZEND_INIT_SYMTABLE_EX(ht, 2, 0)
|
||||
|
||||
#define ZEND_INIT_SYMTABLE_EX(ht, n, persistent) \
|
||||
zend_hash_init(ht, n, NULL, ZVAL_PTR_DTOR, persistent)
|
||||
|
||||
|
||||
#endif /* ZEND_HASH_H */
|
||||
@@ -1,181 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_language_parser.h"
|
||||
#include "zend_compile.h"
|
||||
#include "zend_highlight.h"
|
||||
#include "zend_ptr_stack.h"
|
||||
#include "zend_globals.h"
|
||||
|
||||
ZEND_API void zend_html_putc(char c)
|
||||
{
|
||||
switch (c) {
|
||||
case '\n':
|
||||
ZEND_PUTS("<br />");
|
||||
break;
|
||||
case '<':
|
||||
ZEND_PUTS("<");
|
||||
break;
|
||||
case '>':
|
||||
ZEND_PUTS(">");
|
||||
break;
|
||||
case '&':
|
||||
ZEND_PUTS("&");
|
||||
break;
|
||||
case ' ':
|
||||
ZEND_PUTS(" ");
|
||||
break;
|
||||
case '\t':
|
||||
ZEND_PUTS(" ");
|
||||
break;
|
||||
default:
|
||||
ZEND_PUTC(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_html_puts(char *s, uint len)
|
||||
{
|
||||
register char *ptr=s, *end=s+len;
|
||||
|
||||
while (ptr<end) {
|
||||
if (*ptr==' '
|
||||
&& len>1
|
||||
&& !(((ptr+1)>=end) || (*(ptr+1)==' ')) /* next is not a space */
|
||||
&& !((ptr==s) || (*(ptr-1)==' '))) /* last is not a space */ {
|
||||
char c = *ptr++;
|
||||
|
||||
ZEND_PUTC(c);
|
||||
continue;
|
||||
}
|
||||
zend_html_putc(*ptr++);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC)
|
||||
{
|
||||
zval token;
|
||||
int token_type;
|
||||
char *last_color = syntax_highlighter_ini->highlight_html;
|
||||
char *next_color;
|
||||
int in_string=0;
|
||||
|
||||
zend_printf("<code>");
|
||||
zend_printf("<font color=\"%s\">\n", last_color);
|
||||
/* highlight stuff coming back from zendlex() */
|
||||
token.type = 0;
|
||||
while ((token_type=lex_scan(&token TSRMLS_CC))) {
|
||||
switch (token_type) {
|
||||
case T_INLINE_HTML:
|
||||
next_color = syntax_highlighter_ini->highlight_html;
|
||||
break;
|
||||
case T_COMMENT:
|
||||
next_color = syntax_highlighter_ini->highlight_comment;
|
||||
break;
|
||||
case T_OPEN_TAG:
|
||||
case T_OPEN_TAG_WITH_ECHO:
|
||||
next_color = syntax_highlighter_ini->highlight_default;
|
||||
break;
|
||||
case T_CLOSE_TAG:
|
||||
next_color = syntax_highlighter_ini->highlight_default;
|
||||
break;
|
||||
case T_CONSTANT_ENCAPSED_STRING:
|
||||
next_color = syntax_highlighter_ini->highlight_string;
|
||||
break;
|
||||
case '"':
|
||||
next_color = syntax_highlighter_ini->highlight_string;
|
||||
in_string = !in_string;
|
||||
break;
|
||||
case T_WHITESPACE:
|
||||
zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(yy_leng)); /* no color needed */
|
||||
token.type = 0;
|
||||
continue;
|
||||
break;
|
||||
default:
|
||||
if (token.type==0) {
|
||||
next_color = syntax_highlighter_ini->highlight_keyword;
|
||||
} else {
|
||||
if (in_string) {
|
||||
next_color = syntax_highlighter_ini->highlight_string;
|
||||
} else {
|
||||
next_color = syntax_highlighter_ini->highlight_default;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (last_color != next_color) {
|
||||
if (last_color != syntax_highlighter_ini->highlight_html) {
|
||||
zend_printf("</font>");
|
||||
}
|
||||
last_color = next_color;
|
||||
if (last_color != syntax_highlighter_ini->highlight_html) {
|
||||
zend_printf("<font color=\"%s\">", last_color);
|
||||
}
|
||||
}
|
||||
switch (token_type) {
|
||||
case T_END_HEREDOC:
|
||||
zend_html_puts(token.value.str.val, token.value.str.len);
|
||||
break;
|
||||
default:
|
||||
zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
|
||||
break;
|
||||
}
|
||||
|
||||
if (token.type == IS_STRING) {
|
||||
switch (token_type) {
|
||||
case T_OPEN_TAG:
|
||||
case T_OPEN_TAG_WITH_ECHO:
|
||||
case T_CLOSE_TAG:
|
||||
case T_WHITESPACE:
|
||||
case T_COMMENT:
|
||||
break;
|
||||
default:
|
||||
efree(token.value.str.val);
|
||||
break;
|
||||
}
|
||||
} else if (token_type == T_END_HEREDOC) {
|
||||
zend_bool has_semicolon=(strchr(token.value.str.val, ';')?1:0);
|
||||
|
||||
efree(token.value.str.val);
|
||||
if (has_semicolon) {
|
||||
/* the following semicolon was unput(), ignore it */
|
||||
lex_scan(&token TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
token.type = 0;
|
||||
}
|
||||
if (last_color != syntax_highlighter_ini->highlight_html) {
|
||||
zend_printf("</font>\n");
|
||||
}
|
||||
zend_printf("</font>\n");
|
||||
zend_printf("</code>");
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ZEND_HIGHLIGHT_H
|
||||
#define ZEND_HIGHLIGHT_H
|
||||
|
||||
#define HL_COMMENT_COLOR "#FF8000" /* orange */
|
||||
#define HL_DEFAULT_COLOR "#0000BB" /* blue */
|
||||
#define HL_HTML_COLOR "#000000" /* black */
|
||||
#define HL_STRING_COLOR "#DD0000" /* red */
|
||||
#define HL_BG_COLOR "#FFFFFF" /* white */
|
||||
#define HL_KEYWORD_COLOR "#007700" /* green */
|
||||
|
||||
|
||||
typedef struct _zend_syntax_highlighter_ini {
|
||||
char *highlight_html;
|
||||
char *highlight_comment;
|
||||
char *highlight_default;
|
||||
char *highlight_string;
|
||||
char *highlight_keyword;
|
||||
} zend_syntax_highlighter_ini;
|
||||
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC);
|
||||
ZEND_API int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC);
|
||||
ZEND_API int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name TSRMLS_DC);
|
||||
ZEND_API void zend_html_putc(char c);
|
||||
ZEND_API void zend_html_puts(char *s, uint len);
|
||||
END_EXTERN_C()
|
||||
|
||||
extern zend_syntax_highlighter_ini syntax_highlighter_ini;
|
||||
|
||||
#endif
|
||||
@@ -1,147 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
/* This indenter doesn't really work, it's here for no particular reason. */
|
||||
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_language_parser.h"
|
||||
#include "zend_compile.h"
|
||||
#include "zend_indent.h"
|
||||
|
||||
#define zendtext LANG_SCNG(yy_text)
|
||||
#define zendleng LANG_SCNG(yy_leng)
|
||||
|
||||
|
||||
static void handle_whitespace(int *emit_whitespace)
|
||||
{
|
||||
unsigned char c;
|
||||
int i;
|
||||
|
||||
for (c=0; c<128; c++) {
|
||||
if (emit_whitespace[c]>0) {
|
||||
for (i=0; i<emit_whitespace[c]; i++) {
|
||||
zend_write((char *) &c, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
memset(emit_whitespace, 0, sizeof(int)*256);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_indent()
|
||||
{
|
||||
zval token;
|
||||
int token_type;
|
||||
int in_string=0;
|
||||
int nest_level=0;
|
||||
int emit_whitespace[256];
|
||||
int i;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
memset(emit_whitespace, 0, sizeof(int)*256);
|
||||
|
||||
/* highlight stuff coming back from zendlex() */
|
||||
token.type = 0;
|
||||
while ((token_type=lex_scan(&token TSRMLS_CC))) {
|
||||
switch (token_type) {
|
||||
case T_INLINE_HTML:
|
||||
zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
|
||||
break;
|
||||
case T_WHITESPACE: {
|
||||
token.type = 0;
|
||||
/* eat whitespace, emit newlines */
|
||||
for (i=0; i<LANG_SCNG(yy_leng); i++) {
|
||||
emit_whitespace[(unsigned char) LANG_SCNG(yy_text)[i]]++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case '"':
|
||||
in_string = !in_string;
|
||||
/* break missing intentionally */
|
||||
default:
|
||||
if (token.type==0) {
|
||||
/* keyword */
|
||||
switch(token_type) {
|
||||
case ',':
|
||||
ZEND_PUTS(", ");
|
||||
goto dflt_printout;
|
||||
break;
|
||||
case '{':
|
||||
nest_level++;
|
||||
if (emit_whitespace['\n']>0) {
|
||||
ZEND_PUTS(" {\n");
|
||||
memset(emit_whitespace, 0, sizeof(int)*256);
|
||||
} else {
|
||||
ZEND_PUTS("{");
|
||||
}
|
||||
break;
|
||||
case '}':
|
||||
nest_level--;
|
||||
if (emit_whitespace['\n']==0) {
|
||||
ZEND_PUTS("\n");
|
||||
}
|
||||
for (i=0; i<nest_level; i++) {
|
||||
ZEND_PUTS(" ");
|
||||
}
|
||||
goto dflt_printout;
|
||||
break;
|
||||
dflt_printout:
|
||||
default:
|
||||
if (emit_whitespace['\n']>0) {
|
||||
for (i=0; i<emit_whitespace['\n']; i++) {
|
||||
ZEND_PUTS("\n");
|
||||
}
|
||||
memset(emit_whitespace, 0, sizeof(int)*256);
|
||||
for (i=0; i<nest_level; i++) {
|
||||
ZEND_PUTS(" ");
|
||||
}
|
||||
} else {
|
||||
handle_whitespace(emit_whitespace);
|
||||
}
|
||||
zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
handle_whitespace(emit_whitespace);
|
||||
if (in_string) {
|
||||
zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
|
||||
/* a part of a string */
|
||||
} else {
|
||||
zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (token.type == IS_STRING) {
|
||||
switch (token_type) {
|
||||
case T_OPEN_TAG:
|
||||
case T_CLOSE_TAG:
|
||||
case T_WHITESPACE:
|
||||
break;
|
||||
default:
|
||||
efree(token.value.str.val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
token.type = 0;
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ZEND_INDENT_H
|
||||
#define ZEND_INDENT_H
|
||||
|
||||
ZEND_API void zend_indent(void);
|
||||
|
||||
#endif /* ZEND_INDENT_H */
|
||||
-487
@@ -1,487 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_qsort.h"
|
||||
#include "zend_API.h"
|
||||
#include "zend_ini.h"
|
||||
#include "zend_alloc.h"
|
||||
#include "zend_operators.h"
|
||||
|
||||
static HashTable *registered_zend_ini_directives;
|
||||
|
||||
|
||||
/*
|
||||
* hash_apply functions
|
||||
*/
|
||||
static int zend_remove_ini_entries(zend_ini_entry *ini_entry, int *module_number TSRMLS_DC)
|
||||
{
|
||||
if (ini_entry->module_number == *module_number) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS_DC)
|
||||
{
|
||||
if (ini_entry->modified) {
|
||||
if (ini_entry->on_modify) {
|
||||
ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->orig_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC);
|
||||
}
|
||||
efree(ini_entry->value);
|
||||
ini_entry->value = ini_entry->orig_value;
|
||||
ini_entry->value_length = ini_entry->orig_value_length;
|
||||
ini_entry->modified = 0;
|
||||
ini_entry->orig_value = NULL;
|
||||
ini_entry->orig_value_length = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Startup / shutdown
|
||||
*/
|
||||
ZEND_API int zend_ini_startup(TSRMLS_D)
|
||||
{
|
||||
registered_zend_ini_directives = &EG(ini_directives);
|
||||
if (zend_hash_init_ex(registered_zend_ini_directives, 100, NULL, NULL, 1, 0)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_ini_shutdown(TSRMLS_D)
|
||||
{
|
||||
zend_hash_destroy(&EG(ini_directives));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_ini_deactivate(TSRMLS_D)
|
||||
{
|
||||
zend_hash_apply_with_argument(&EG(ini_directives), (apply_func_arg_t) zend_restore_ini_entry_cb, (void *) ZEND_INI_STAGE_DEACTIVATE TSRMLS_CC);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_copy_ini_directives(TSRMLS_D)
|
||||
{
|
||||
zend_ini_entry ini_entry;
|
||||
|
||||
if (zend_hash_init_ex(&EG(ini_directives), registered_zend_ini_directives->nNumOfElements, NULL, NULL, 1, 0)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
zend_hash_copy(&EG(ini_directives), registered_zend_ini_directives, NULL, &ini_entry, sizeof(zend_ini_entry));
|
||||
zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP TSRMLS_CC);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static int ini_key_compare(const void *a, const void *b TSRMLS_DC)
|
||||
{
|
||||
Bucket *f;
|
||||
Bucket *s;
|
||||
|
||||
f = *((Bucket **) a);
|
||||
s = *((Bucket **) b);
|
||||
|
||||
if (f->nKeyLength==0 && s->nKeyLength==0) { /* both numeric */
|
||||
return ZEND_NORMALIZE_BOOL(f->nKeyLength - s->nKeyLength);
|
||||
} else if (f->nKeyLength==0) { /* f is numeric, s is not */
|
||||
return -1;
|
||||
} else if (s->nKeyLength==0) { /* s is numeric, f is not */
|
||||
return 1;
|
||||
} else { /* both strings */
|
||||
return zend_binary_strcasecmp(f->arKey, f->nKeyLength, s->arKey, s->nKeyLength);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_ini_sort_entries(TSRMLS_D)
|
||||
{
|
||||
zend_hash_sort(&EG(ini_directives), zend_qsort, ini_key_compare, 0 TSRMLS_CC);
|
||||
}
|
||||
|
||||
/*
|
||||
* Registration / unregistration
|
||||
*/
|
||||
|
||||
ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_number TSRMLS_DC)
|
||||
{
|
||||
zend_ini_entry *p = ini_entry;
|
||||
zend_ini_entry *hashed_ini_entry;
|
||||
zval default_value;
|
||||
|
||||
while (p->name) {
|
||||
p->module_number = module_number;
|
||||
if (zend_hash_add(registered_zend_ini_directives, p->name, p->name_length, p, sizeof(zend_ini_entry), (void **) &hashed_ini_entry)==FAILURE) {
|
||||
zend_unregister_ini_entries(module_number TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
if ((zend_get_configuration_directive(p->name, p->name_length, &default_value))==SUCCESS) {
|
||||
if (!hashed_ini_entry->on_modify
|
||||
|| hashed_ini_entry->on_modify(hashed_ini_entry, default_value.value.str.val, default_value.value.str.len, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC)==SUCCESS) {
|
||||
hashed_ini_entry->value = default_value.value.str.val;
|
||||
hashed_ini_entry->value_length = default_value.value.str.len;
|
||||
}
|
||||
} else {
|
||||
if (hashed_ini_entry->on_modify) {
|
||||
hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
p++;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC)
|
||||
{
|
||||
zend_hash_apply_with_argument(registered_zend_ini_directives, (apply_func_arg_t) zend_remove_ini_entries, (void *) &module_number TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
static int zend_ini_refresh_cache(zend_ini_entry *p, int stage TSRMLS_DC)
|
||||
{
|
||||
if (p->on_modify) {
|
||||
p->on_modify(p, p->value, p->value_length, p->mh_arg1, p->mh_arg2, p->mh_arg3, stage TSRMLS_CC);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC)
|
||||
{
|
||||
zend_hash_apply_with_argument(&EG(ini_directives), (apply_func_arg_t) zend_ini_refresh_cache, (void *)(long) stage TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage)
|
||||
{
|
||||
zend_ini_entry *ini_entry;
|
||||
char *duplicate;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (zend_hash_find(&EG(ini_directives), name, name_length, (void **) &ini_entry)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (!(ini_entry->modifyable & modify_type)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
duplicate = estrndup(new_value, new_value_length);
|
||||
|
||||
if (!ini_entry->on_modify
|
||||
|| ini_entry->on_modify(ini_entry, duplicate, new_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC)==SUCCESS) {
|
||||
if (!ini_entry->modified) {
|
||||
ini_entry->orig_value = ini_entry->value;
|
||||
ini_entry->orig_value_length = ini_entry->value_length;
|
||||
} else { /* we already changed the value, free the changed value */
|
||||
efree(ini_entry->value);
|
||||
}
|
||||
ini_entry->value = duplicate;
|
||||
ini_entry->value_length = new_value_length;
|
||||
ini_entry->modified = 1;
|
||||
} else {
|
||||
efree(duplicate);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage)
|
||||
{
|
||||
zend_ini_entry *ini_entry;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (zend_hash_find(&EG(ini_directives), name, name_length, (void **) &ini_entry)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
zend_restore_ini_entry_cb(ini_entry, stage TSRMLS_CC);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type))
|
||||
{
|
||||
zend_ini_entry *ini_entry;
|
||||
|
||||
if (zend_hash_find(registered_zend_ini_directives, name, name_length, (void **) &ini_entry)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ini_entry->displayer = displayer;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Data retrieval
|
||||
*/
|
||||
|
||||
ZEND_API long zend_ini_long(char *name, uint name_length, int orig)
|
||||
{
|
||||
zend_ini_entry *ini_entry;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (zend_hash_find(&EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) {
|
||||
if (orig && ini_entry->modified) {
|
||||
return (ini_entry->orig_value ? strtol(ini_entry->orig_value, NULL, 0) : 0);
|
||||
} else if (ini_entry->value) {
|
||||
return strtol(ini_entry->value, NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API double zend_ini_double(char *name, uint name_length, int orig)
|
||||
{
|
||||
zend_ini_entry *ini_entry;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (zend_hash_find(&EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) {
|
||||
if (orig && ini_entry->modified) {
|
||||
return (double) (ini_entry->orig_value ? strtod(ini_entry->orig_value, NULL) : 0.0);
|
||||
} else if (ini_entry->value) {
|
||||
return (double) strtod(ini_entry->value, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API char *zend_ini_string(char *name, uint name_length, int orig)
|
||||
{
|
||||
zend_ini_entry *ini_entry;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (zend_hash_find(&EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) {
|
||||
if (orig && ini_entry->modified) {
|
||||
return ini_entry->orig_value;
|
||||
} else {
|
||||
return ini_entry->value;
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type)
|
||||
{
|
||||
if (ini_entry->displayer) {
|
||||
ini_entry->displayer(ini_entry, type);
|
||||
} else {
|
||||
char *display_string;
|
||||
uint display_string_length;
|
||||
|
||||
if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
|
||||
if (ini_entry->orig_value) {
|
||||
display_string = ini_entry->orig_value;
|
||||
display_string_length = ini_entry->orig_value_length;
|
||||
} else {
|
||||
display_string = "<i>no value</i>";
|
||||
display_string_length = sizeof("<i>no value</i>")-1;
|
||||
}
|
||||
} else if (ini_entry->value && ini_entry->value[0]) {
|
||||
display_string = ini_entry->value;
|
||||
display_string_length = ini_entry->value_length;
|
||||
} else {
|
||||
display_string = "<i>no value</i>";
|
||||
display_string_length = sizeof("<i>no value</i>")-1;
|
||||
}
|
||||
ZEND_WRITE(display_string, display_string_length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_INI_DISP(zend_ini_boolean_displayer_cb)
|
||||
{
|
||||
int value;
|
||||
|
||||
if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
|
||||
value = (ini_entry->orig_value ? atoi(ini_entry->orig_value) : 0);
|
||||
} else if (ini_entry->value) {
|
||||
value = atoi(ini_entry->value);
|
||||
} else {
|
||||
value = 0;
|
||||
}
|
||||
if (value) {
|
||||
ZEND_PUTS("On");
|
||||
} else {
|
||||
ZEND_PUTS("Off");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_INI_DISP(zend_ini_color_displayer_cb)
|
||||
{
|
||||
char *value;
|
||||
|
||||
if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
|
||||
value = ini_entry->orig_value;
|
||||
} else if (ini_entry->value) {
|
||||
value = ini_entry->value;
|
||||
} else {
|
||||
value = NULL;
|
||||
}
|
||||
if (value) {
|
||||
zend_printf("<font color=\"%s\">%s</font>", value, value);
|
||||
} else {
|
||||
ZEND_PUTS("<i>no value</i>;");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_INI_DISP(display_link_numbers)
|
||||
{
|
||||
char *value;
|
||||
|
||||
if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
|
||||
value = ini_entry->orig_value;
|
||||
} else if (ini_entry->value) {
|
||||
value = ini_entry->value;
|
||||
} else {
|
||||
value = NULL;
|
||||
}
|
||||
|
||||
if (value) {
|
||||
if (atoi(value)==-1) {
|
||||
ZEND_PUTS("Unlimited");
|
||||
} else {
|
||||
zend_printf("%s", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Standard message handlers */
|
||||
|
||||
ZEND_API ZEND_INI_MH(OnUpdateBool)
|
||||
{
|
||||
zend_bool *p;
|
||||
#ifndef ZTS
|
||||
char *base = (char *) mh_arg2;
|
||||
#else
|
||||
char *base;
|
||||
|
||||
base = (char *) ts_resource(*((int *) mh_arg2));
|
||||
#endif
|
||||
|
||||
p = (zend_bool *) (base+(size_t) mh_arg1);
|
||||
|
||||
*p = (zend_bool) atoi(new_value);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API ZEND_INI_MH(OnUpdateInt)
|
||||
{
|
||||
long *p;
|
||||
#ifndef ZTS
|
||||
char *base = (char *) mh_arg2;
|
||||
#else
|
||||
char *base;
|
||||
|
||||
base = (char *) ts_resource(*((int *) mh_arg2));
|
||||
#endif
|
||||
|
||||
p = (long *) (base+(size_t) mh_arg1);
|
||||
|
||||
*p = zend_atoi(new_value, new_value_length);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API ZEND_INI_MH(OnUpdateReal)
|
||||
{
|
||||
double *p;
|
||||
#ifndef ZTS
|
||||
char *base = (char *) mh_arg2;
|
||||
#else
|
||||
char *base;
|
||||
|
||||
base = (char *) ts_resource(*((int *) mh_arg2));
|
||||
#endif
|
||||
|
||||
p = (double *) (base+(size_t) mh_arg1);
|
||||
|
||||
*p = strtod(new_value, NULL);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API ZEND_INI_MH(OnUpdateString)
|
||||
{
|
||||
char **p;
|
||||
#ifndef ZTS
|
||||
char *base = (char *) mh_arg2;
|
||||
#else
|
||||
char *base;
|
||||
|
||||
base = (char *) ts_resource(*((int *) mh_arg2));
|
||||
#endif
|
||||
|
||||
p = (char **) (base+(size_t) mh_arg1);
|
||||
|
||||
*p = new_value;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API ZEND_INI_MH(OnUpdateStringUnempty)
|
||||
{
|
||||
char **p;
|
||||
#ifndef ZTS
|
||||
char *base = (char *) mh_arg2;
|
||||
#else
|
||||
char *base;
|
||||
|
||||
base = (char *) ts_resource(*((int *) mh_arg2));
|
||||
#endif
|
||||
|
||||
if (new_value && !new_value[0]) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
p = (char **) (base+(size_t) mh_arg1);
|
||||
|
||||
*p = new_value;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
-199
@@ -1,199 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ZEND_INI_H
|
||||
#define ZEND_INI_H
|
||||
|
||||
#define ZEND_INI_USER (1<<0)
|
||||
#define ZEND_INI_PERDIR (1<<1)
|
||||
#define ZEND_INI_SYSTEM (1<<2)
|
||||
|
||||
#define ZEND_INI_ALL (ZEND_INI_USER|ZEND_INI_PERDIR|ZEND_INI_SYSTEM)
|
||||
|
||||
#ifndef XtOffsetOf
|
||||
# if defined(CRAY) || (defined(__arm) && !defined(LINUX))
|
||||
# ifdef __STDC__
|
||||
# define XtOffset(p_type, field) _Offsetof(p_type, field)
|
||||
# else
|
||||
# ifdef CRAY2
|
||||
# define XtOffset(p_type, field) \
|
||||
(sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
|
||||
|
||||
# else /* !CRAY2 */
|
||||
|
||||
# define XtOffset(p_type, field) ((unsigned int)&(((p_type)NULL)->field))
|
||||
|
||||
# endif /* !CRAY2 */
|
||||
# endif /* __STDC__ */
|
||||
# else /* ! (CRAY || __arm) */
|
||||
|
||||
# define XtOffset(p_type, field) \
|
||||
((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
|
||||
|
||||
# endif /* !CRAY */
|
||||
|
||||
# ifdef offsetof
|
||||
# define XtOffsetOf(s_type, field) offsetof(s_type, field)
|
||||
# else
|
||||
# define XtOffsetOf(s_type, field) XtOffset(s_type*, field)
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct _zend_ini_entry zend_ini_entry;
|
||||
|
||||
#define ZEND_INI_MH(name) int name(zend_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage TSRMLS_DC)
|
||||
#define ZEND_INI_DISP(name) void name(zend_ini_entry *ini_entry, int type)
|
||||
|
||||
struct _zend_ini_entry {
|
||||
int module_number;
|
||||
int modifyable;
|
||||
char *name;
|
||||
uint name_length;
|
||||
ZEND_INI_MH((*on_modify));
|
||||
void *mh_arg1;
|
||||
void *mh_arg2;
|
||||
void *mh_arg3;
|
||||
|
||||
char *value;
|
||||
uint value_length;
|
||||
|
||||
char *orig_value;
|
||||
uint orig_value_length;
|
||||
int modified;
|
||||
|
||||
void (*displayer)(zend_ini_entry *ini_entry, int type);
|
||||
};
|
||||
|
||||
|
||||
ZEND_API int zend_ini_startup(TSRMLS_D);
|
||||
ZEND_API int zend_ini_shutdown(TSRMLS_D);
|
||||
ZEND_API int zend_ini_deactivate(TSRMLS_D);
|
||||
|
||||
ZEND_API int zend_copy_ini_directives(TSRMLS_D);
|
||||
|
||||
ZEND_API void zend_ini_sort_entries(TSRMLS_D);
|
||||
|
||||
ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_number TSRMLS_DC);
|
||||
ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC);
|
||||
ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC);
|
||||
ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage);
|
||||
ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage);
|
||||
ZEND_API void display_ini_entries(zend_module_entry *module);
|
||||
|
||||
ZEND_API long zend_ini_long(char *name, uint name_length, int orig);
|
||||
ZEND_API double zend_ini_double(char *name, uint name_length, int orig);
|
||||
ZEND_API char *zend_ini_string(char *name, uint name_length, int orig);
|
||||
|
||||
ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type));
|
||||
|
||||
ZEND_API ZEND_INI_DISP(zend_ini_boolean_displayer_cb);
|
||||
ZEND_API ZEND_INI_DISP(zend_ini_color_displayer_cb);
|
||||
ZEND_API ZEND_INI_DISP(display_link_numbers);
|
||||
|
||||
#define ZEND_INI_BEGIN() static zend_ini_entry ini_entries[] = {
|
||||
#define ZEND_INI_END() { 0, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, NULL } };
|
||||
|
||||
#define ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, arg3, displayer) \
|
||||
{ 0, modifyable, name, sizeof(name), on_modify, arg1, arg2, arg3, default_value, sizeof(default_value)-1, NULL, 0, 0, displayer },
|
||||
|
||||
#define ZEND_INI_ENTRY3(name, default_value, modifyable, on_modify, arg1, arg2, arg3) \
|
||||
ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, arg3, NULL)
|
||||
|
||||
#define ZEND_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, arg1, arg2, displayer) \
|
||||
ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, NULL, displayer)
|
||||
|
||||
#define ZEND_INI_ENTRY2(name, default_value, modifyable, on_modify, arg1, arg2) \
|
||||
ZEND_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, arg1, arg2, NULL)
|
||||
|
||||
#define ZEND_INI_ENTRY1_EX(name, default_value, modifyable, on_modify, arg1, displayer) \
|
||||
ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, NULL, NULL, displayer)
|
||||
|
||||
#define ZEND_INI_ENTRY1(name, default_value, modifyable, on_modify, arg1) \
|
||||
ZEND_INI_ENTRY1_EX(name, default_value, modifyable, on_modify, arg1, NULL)
|
||||
|
||||
#define ZEND_INI_ENTRY_EX(name, default_value, modifyable, on_modify, displayer) \
|
||||
ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, NULL, NULL, NULL, displayer)
|
||||
|
||||
#define ZEND_INI_ENTRY(name, default_value, modifyable, on_modify) \
|
||||
ZEND_INI_ENTRY_EX(name, default_value, modifyable, on_modify, NULL)
|
||||
|
||||
#ifdef ZTS
|
||||
#define STD_ZEND_INI_ENTRY(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
|
||||
ZEND_INI_ENTRY2(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id)
|
||||
#define STD_ZEND_INI_ENTRY_EX(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr, displayer) \
|
||||
ZEND_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, displayer)
|
||||
#define STD_ZEND_INI_BOOLEAN(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
|
||||
ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, NULL, zend_ini_boolean_displayer_cb)
|
||||
#else
|
||||
#define STD_ZEND_INI_ENTRY(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
|
||||
ZEND_INI_ENTRY2(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr)
|
||||
#define STD_ZEND_INI_ENTRY_EX(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr, displayer) \
|
||||
ZEND_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, displayer)
|
||||
#define STD_ZEND_INI_BOOLEAN(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
|
||||
ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, NULL, zend_ini_boolean_displayer_cb)
|
||||
#endif
|
||||
|
||||
#define INI_INT(name) zend_ini_long((name), sizeof(name), 0)
|
||||
#define INI_FLT(name) zend_ini_double((name), sizeof(name), 0)
|
||||
#define INI_STR(name) zend_ini_string((name), sizeof(name), 0)
|
||||
#define INI_BOOL(name) ((zend_bool) INI_INT(name))
|
||||
|
||||
#define INI_ORIG_INT(name) zend_ini_long((name), sizeof(name), 1)
|
||||
#define INI_ORIG_FLT(name) zend_ini_double((name), sizeof(name), 1)
|
||||
#define INI_ORIG_STR(name) zend_ini_string((name), sizeof(name), 1)
|
||||
#define INI_ORIG_BOOL(name) ((zend_bool) INI_ORIG_INT(name))
|
||||
|
||||
|
||||
#define REGISTER_INI_ENTRIES() zend_register_ini_entries(ini_entries, module_number TSRMLS_CC)
|
||||
#define UNREGISTER_INI_ENTRIES() zend_unregister_ini_entries(module_number TSRMLS_CC)
|
||||
#define DISPLAY_INI_ENTRIES() display_ini_entries(zend_module)
|
||||
|
||||
#define REGISTER_INI_DISPLAYER(name, displayer) zend_ini_register_displayer((name), sizeof(name), displayer)
|
||||
#define REGISTER_INI_BOOLEAN(name) REGISTER_INI_DISPLAYER(name, zend_ini_boolean_displayer_cb)
|
||||
|
||||
/* Standard message handlers */
|
||||
ZEND_API ZEND_INI_MH(OnUpdateBool);
|
||||
ZEND_API ZEND_INI_MH(OnUpdateInt);
|
||||
ZEND_API ZEND_INI_MH(OnUpdateReal);
|
||||
ZEND_API ZEND_INI_MH(OnUpdateString);
|
||||
ZEND_API ZEND_INI_MH(OnUpdateStringUnempty);
|
||||
|
||||
|
||||
#define ZEND_INI_DISPLAY_ORIG 1
|
||||
#define ZEND_INI_DISPLAY_ACTIVE 2
|
||||
|
||||
#define ZEND_INI_STAGE_STARTUP (1<<0)
|
||||
#define ZEND_INI_STAGE_SHUTDOWN (1<<1)
|
||||
#define ZEND_INI_STAGE_ACTIVATE (1<<2)
|
||||
#define ZEND_INI_STAGE_DEACTIVATE (1<<3)
|
||||
#define ZEND_INI_STAGE_RUNTIME (1<<4)
|
||||
|
||||
/* INI parsing engine */
|
||||
typedef void (*zend_ini_parser_cb_t)(zval *arg1, zval *arg2, int callback_type, void *arg);
|
||||
int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg);
|
||||
#define ZEND_INI_PARSER_ENTRY 1
|
||||
#define ZEND_INI_PARSER_SECTION 2
|
||||
|
||||
typedef struct _zend_ini_parser_param {
|
||||
zend_ini_parser_cb_t ini_parser_cb;
|
||||
void *arg;
|
||||
} zend_ini_parser_param;
|
||||
|
||||
#endif /* ZEND_INI_H */
|
||||
@@ -1,236 +0,0 @@
|
||||
%{
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#define DEBUG_CFG_PARSER 0
|
||||
#include "zend.h"
|
||||
#include "zend_API.h"
|
||||
#include "zend_ini.h"
|
||||
#include "zend_constants.h"
|
||||
#include "zend_ini_scanner.h"
|
||||
#include "zend_extensions.h"
|
||||
|
||||
|
||||
#if WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <winbase.h>
|
||||
#endif
|
||||
|
||||
#define YYSTYPE zval
|
||||
|
||||
#ifdef ZTS
|
||||
#define YYPARSE_PARAM tsrm_ls
|
||||
#define YYLEX_PARAM tsrm_ls
|
||||
#endif
|
||||
|
||||
#define ZEND_INI_PARSER_CB (CG(ini_parser_param))->ini_parser_cb
|
||||
#define ZEND_INI_PARSER_ARG (CG(ini_parser_param))->arg
|
||||
|
||||
int ini_lex(zval *ini_lval TSRMLS_DC);
|
||||
#ifdef ZTS
|
||||
int ini_parse(void *arg);
|
||||
#else
|
||||
int ini_parse(void);
|
||||
#endif
|
||||
|
||||
zval yylval;
|
||||
|
||||
#ifndef ZTS
|
||||
extern int ini_lex(zval *ini_lval TSRMLS_DC);
|
||||
extern FILE *ini_in;
|
||||
extern int ini_lineno;
|
||||
extern void init_cfg_scanner(void);
|
||||
#endif
|
||||
|
||||
void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2)
|
||||
{
|
||||
int i_result;
|
||||
int i_op1, i_op2;
|
||||
char str_result[MAX_LENGTH_OF_LONG];
|
||||
|
||||
i_op1 = atoi(op1->value.str.val);
|
||||
free(op1->value.str.val);
|
||||
if (op2) {
|
||||
i_op2 = atoi(op2->value.str.val);
|
||||
free(op2->value.str.val);
|
||||
} else {
|
||||
i_op2 = 0;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case '|':
|
||||
i_result = i_op1 | i_op2;
|
||||
break;
|
||||
case '&':
|
||||
i_result = i_op1 & i_op2;
|
||||
break;
|
||||
case '~':
|
||||
i_result = ~i_op1;
|
||||
break;
|
||||
case '!':
|
||||
i_result = !i_op1;
|
||||
break;
|
||||
default:
|
||||
i_result = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
result->value.str.len = zend_sprintf(str_result, "%d", i_result);
|
||||
result->value.str.val = (char *) malloc(result->value.str.len+1);
|
||||
memcpy(result->value.str.val, str_result, result->value.str.len);
|
||||
result->value.str.val[result->value.str.len] = 0;
|
||||
result->type = IS_STRING;
|
||||
}
|
||||
|
||||
|
||||
void zend_ini_get_constant(zval *result, zval *name)
|
||||
{
|
||||
zval z_constant;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (zend_get_constant(name->value.str.val, name->value.str.len, &z_constant TSRMLS_CC)) {
|
||||
/* z_constant is emalloc()'d */
|
||||
convert_to_string(&z_constant);
|
||||
result->value.str.val = zend_strndup(z_constant.value.str.val, z_constant.value.str.len);
|
||||
result->value.str.len = z_constant.value.str.len;
|
||||
result->type = z_constant.type;
|
||||
zval_dtor(&z_constant);
|
||||
free(name->value.str.val);
|
||||
} else {
|
||||
*result = *name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void ini_error(char *str)
|
||||
{
|
||||
char *error_buf;
|
||||
int error_buf_len;
|
||||
char *currently_parsed_filename;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
currently_parsed_filename = zend_ini_scanner_get_filename(TSRMLS_C);
|
||||
error_buf_len = 128+strlen(currently_parsed_filename); /* should be more than enough */
|
||||
error_buf = (char *) emalloc(error_buf_len);
|
||||
|
||||
sprintf(error_buf, "Error parsing %s on line %d\n", currently_parsed_filename, zend_ini_scanner_get_lineno(TSRMLS_C));
|
||||
|
||||
if (CG(ini_parser_unbuffered_errors)) {
|
||||
#ifdef PHP_WIN32
|
||||
MessageBox(NULL, error_buf, "PHP Error", MB_OK|MB_TOPMOST|0x00200000L);
|
||||
#else
|
||||
fprintf(stderr, "PHP: %s", error_buf);
|
||||
#endif
|
||||
} else {
|
||||
zend_error(E_CORE_WARNING, error_buf);
|
||||
}
|
||||
efree(error_buf);
|
||||
}
|
||||
|
||||
|
||||
int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg)
|
||||
{
|
||||
int retval;
|
||||
zend_ini_parser_param ini_parser_param;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
ini_parser_param.ini_parser_cb = ini_parser_cb;
|
||||
ini_parser_param.arg = arg;
|
||||
|
||||
CG(ini_parser_param) = &ini_parser_param;
|
||||
if (zend_ini_open_file_for_scanning(fh TSRMLS_CC)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
CG(ini_parser_unbuffered_errors) = unbuffered_errors;
|
||||
retval = ini_parse(TSRMLS_C);
|
||||
|
||||
zend_ini_close_file(fh TSRMLS_CC);
|
||||
|
||||
if (retval==0) {
|
||||
return SUCCESS;
|
||||
} else {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
%pure_parser
|
||||
%token TC_STRING
|
||||
%token TC_ENCAPSULATED_STRING
|
||||
%token SECTION
|
||||
%token CFG_TRUE
|
||||
%token CFG_FALSE
|
||||
%left '|' '&'
|
||||
%right '~' '!'
|
||||
|
||||
%%
|
||||
|
||||
statement_list:
|
||||
statement_list statement
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
statement:
|
||||
TC_STRING '=' string_or_value {
|
||||
#if DEBUG_CFG_PARSER
|
||||
printf("'%s' = '%s'\n", $1.value.str.val, $3.value.str.val);
|
||||
#endif
|
||||
ZEND_INI_PARSER_CB(&$1, &$3, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG);
|
||||
free($1.value.str.val);
|
||||
free($3.value.str.val);
|
||||
}
|
||||
| TC_STRING { ZEND_INI_PARSER_CB(&$1, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG); free($1.value.str.val); }
|
||||
| SECTION { ZEND_INI_PARSER_CB(&$1, NULL, ZEND_INI_PARSER_SECTION, ZEND_INI_PARSER_ARG); free($1.value.str.val); }
|
||||
| '\n'
|
||||
;
|
||||
|
||||
|
||||
string_or_value:
|
||||
expr { $$ = $1; }
|
||||
| TC_ENCAPSULATED_STRING { $$ = $1; }
|
||||
| CFG_TRUE { $$ = $1; }
|
||||
| CFG_FALSE { $$ = $1; }
|
||||
| '\n' { $$.value.str.val = strdup(""); $$.value.str.len=0; $$.type = IS_STRING; }
|
||||
| '\0' { $$.value.str.val = strdup(""); $$.value.str.len=0; $$.type = IS_STRING; }
|
||||
;
|
||||
|
||||
expr:
|
||||
constant_string { $$ = $1; }
|
||||
| expr '|' expr { zend_ini_do_op('|', &$$, &$1, &$3); }
|
||||
| expr '&' expr { zend_ini_do_op('&', &$$, &$1, &$3); }
|
||||
| '~' expr { zend_ini_do_op('~', &$$, &$2, NULL); }
|
||||
| '!' expr { zend_ini_do_op('!', &$$, &$2, NULL); }
|
||||
| '(' expr ')' { $$ = $2; }
|
||||
;
|
||||
|
||||
constant_string:
|
||||
TC_STRING { zend_ini_get_constant(&$$, &$1); }
|
||||
;
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -1,12 +0,0 @@
|
||||
#ifndef _ZEND_INI_SCANNER_H
|
||||
#define _ZEND_INI_SCANNER_H
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
int zend_ini_scanner_get_lineno(TSRMLS_D);
|
||||
char *zend_ini_scanner_get_filename(TSRMLS_D);
|
||||
int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC);
|
||||
void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC);
|
||||
int ini_lex(zval *ini_lval TSRMLS_DC);
|
||||
END_EXTERN_C()
|
||||
|
||||
#endif /* _ZEND_INI_SCANNER_H */
|
||||
@@ -1,227 +0,0 @@
|
||||
%{
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#define yyleng SCNG(yy_leng)
|
||||
#define yytext SCNG(yy_text)
|
||||
#define yytext_ptr SCNG(yy_text)
|
||||
#define yyin SCNG(yy_in)
|
||||
#define yyout SCNG(yy_out)
|
||||
#define yy_last_accepting_state SCNG(_yy_last_accepting_state)
|
||||
#define yy_last_accepting_cpos SCNG(_yy_last_accepting_cpos)
|
||||
#define yy_more_flag SCNG(_yy_more_flag)
|
||||
#define yy_more_len SCNG(_yy_more_len)
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_globals.h"
|
||||
#include "zend_ini_parser.h"
|
||||
#include "zend_ini_scanner.h"
|
||||
|
||||
#undef YYSTYPE
|
||||
#define YYSTYPE zval
|
||||
|
||||
#define YY_DECL int ini_lex(zval *ini_lval TSRMLS_DC)
|
||||
|
||||
/* Globals Macros */
|
||||
#define SCNG INI_SCNG
|
||||
#ifdef ZTS
|
||||
ZEND_API ts_rsrc_id ini_scanner_globals_id;
|
||||
#else
|
||||
ZEND_API zend_scanner_globals ini_scanner_globals;
|
||||
#endif
|
||||
|
||||
|
||||
static char *ini_filename;
|
||||
|
||||
void init_ini_scanner()
|
||||
{
|
||||
ini_lineno=1;
|
||||
}
|
||||
|
||||
|
||||
int zend_ini_scanner_get_lineno(TSRMLS_D)
|
||||
{
|
||||
return ini_lineno;
|
||||
}
|
||||
|
||||
|
||||
char *zend_ini_scanner_get_filename(TSRMLS_D)
|
||||
{
|
||||
return ini_filename;
|
||||
}
|
||||
|
||||
|
||||
int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
switch (fh->type) {
|
||||
case ZEND_HANDLE_FP:
|
||||
fp = fh->handle.fp;
|
||||
break;
|
||||
case ZEND_HANDLE_FILENAME:
|
||||
fp = zend_fopen(fh->filename, NULL);
|
||||
fh->type = ZEND_HANDLE_FP;
|
||||
break;
|
||||
default:
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
init_ini_scanner();
|
||||
yyin = fp;
|
||||
yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE TSRMLS_CC) TSRMLS_CC);
|
||||
ini_filename = fh->filename;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC)
|
||||
{
|
||||
switch (fh->type) {
|
||||
case ZEND_HANDLE_FP:
|
||||
fclose(fh->handle.fp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
NEWLINE ("\r"|"\n"|"\r\n")
|
||||
|
||||
%option noyywrap
|
||||
%option yylineno
|
||||
|
||||
%%
|
||||
|
||||
|
||||
<INITIAL>[ ]*("true"|"on"|"yes")[ ]* {
|
||||
ini_lval->value.str.val = zend_strndup("1", 1);
|
||||
ini_lval->value.str.len = 1;
|
||||
ini_lval->type = IS_STRING;
|
||||
return CFG_TRUE;
|
||||
}
|
||||
|
||||
|
||||
<INITIAL>[ ]*("false"|"off"|"no"|"none")[ ]* {
|
||||
ini_lval->value.str.val = zend_strndup("", 0);
|
||||
ini_lval->value.str.len = 0;
|
||||
ini_lval->type = IS_STRING;
|
||||
return CFG_FALSE;
|
||||
}
|
||||
|
||||
<INITIAL>[[][^[]+[\]]{NEWLINE}? {
|
||||
/* SECTION */
|
||||
|
||||
/* eat trailng ] */
|
||||
while (yyleng>0 && (yytext[yyleng-1]=='\n' || yytext[yyleng-1]=='\r' || yytext[yyleng-1]==']')) {
|
||||
yyleng--;
|
||||
yytext[yyleng]=0;
|
||||
}
|
||||
|
||||
/* eat leading [ */
|
||||
yytext++;
|
||||
yyleng--;
|
||||
|
||||
ini_lval->value.str.val = zend_strndup(yytext, yyleng);
|
||||
ini_lval->value.str.len = yyleng;
|
||||
ini_lval->type = IS_STRING;
|
||||
return SECTION;
|
||||
}
|
||||
|
||||
|
||||
<INITIAL>["][^\n\r"]*["] {
|
||||
/* ENCAPSULATED TC_STRING */
|
||||
|
||||
/* eat trailing " */
|
||||
yytext[yyleng-1]=0;
|
||||
|
||||
/* eat leading " */
|
||||
yytext++;
|
||||
|
||||
ini_lval->value.str.val = zend_strndup(yytext, yyleng - 2);
|
||||
ini_lval->value.str.len = yyleng - 2;
|
||||
ini_lval->type = IS_STRING;
|
||||
return TC_ENCAPSULATED_STRING;
|
||||
}
|
||||
|
||||
<INITIAL>[&|~()!] {
|
||||
return yytext[0];
|
||||
}
|
||||
|
||||
|
||||
<INITIAL>[^=\n\r\t;|&~()!"]+ {
|
||||
/* STRING */
|
||||
register int i;
|
||||
|
||||
/* eat trailing whitespace */
|
||||
for (i=yyleng-1; i>=0; i--) {
|
||||
if (yytext[i]==' ' || yytext[i]=='\t') {
|
||||
yytext[i]=0;
|
||||
yyleng--;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* eat leading whitespace */
|
||||
while (yytext[0]) {
|
||||
if (yytext[0]==' ' || yytext[0]=='\t') {
|
||||
yytext++;
|
||||
yyleng--;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (yyleng!=0) {
|
||||
ini_lval->value.str.val = zend_strndup(yytext, yyleng);
|
||||
ini_lval->value.str.len = yyleng;
|
||||
ini_lval->type = IS_STRING;
|
||||
return TC_STRING;
|
||||
} else {
|
||||
/* whitespace */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
<INITIAL>[=\n] {
|
||||
return yytext[0];
|
||||
}
|
||||
|
||||
<INITIAL>{NEWLINE} {
|
||||
return '\n';
|
||||
}
|
||||
|
||||
<INITIAL>[;][^\r\n]*{NEWLINE}? {
|
||||
/* comment */
|
||||
return '\n';
|
||||
}
|
||||
|
||||
<INITIAL>[ \t] {
|
||||
/* eat whitespace */
|
||||
}
|
||||
|
||||
<INITIAL>. {
|
||||
#if DEBUG
|
||||
php_error(E_NOTICE,"Unexpected character on line %d: '%s' (ASCII %d)\n", yylineno, yytext, yytext[0]);
|
||||
#endif
|
||||
}
|
||||
|
||||
<<EOF>> {
|
||||
yy_delete_buffer(YY_CURRENT_BUFFER TSRMLS_CC);
|
||||
yyterminate();
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#ifndef _ZEND_STDIOSTREAM
|
||||
#define _ZEND_STDIOSTREAM
|
||||
|
||||
#if defined(ZTS) && !defined(HAVE_CLASS_ISTDIOSTREAM)
|
||||
class istdiostream : public istream
|
||||
{
|
||||
private:
|
||||
stdiobuf _file;
|
||||
public:
|
||||
istdiostream (FILE* __f) : istream(), _file(__f) { init(&_file); }
|
||||
stdiobuf* rdbuf()/* const */ { return &_file; }
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,737 +0,0 @@
|
||||
%{
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/*
|
||||
* LALR shift/reduce conflicts and how they are resolved:
|
||||
*
|
||||
* - 2 shift/reduce conflicts due to the dangeling elseif/else ambiguity. Solved by shift.
|
||||
* - 1 shift/reduce conflict due to arrays within encapsulated strings. Solved by shift.
|
||||
* - 1 shift/reduce conflict due to objects within encapsulated strings. Solved by shift.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "zend_compile.h"
|
||||
#include "zend.h"
|
||||
#include "zend_list.h"
|
||||
#include "zend_globals.h"
|
||||
#include "zend_API.h"
|
||||
|
||||
#define YYERROR_VERBOSE
|
||||
#define YYSTYPE znode
|
||||
#ifdef ZTS
|
||||
# define YYPARSE_PARAM tsrm_ls
|
||||
# define YYLEX_PARAM tsrm_ls
|
||||
#endif
|
||||
|
||||
|
||||
%}
|
||||
|
||||
%pure_parser
|
||||
%expect 4
|
||||
|
||||
%left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE
|
||||
%left ','
|
||||
%left T_LOGICAL_OR
|
||||
%left T_LOGICAL_XOR
|
||||
%left T_LOGICAL_AND
|
||||
%right T_PRINT
|
||||
%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL
|
||||
%left '?' ':'
|
||||
%left T_BOOLEAN_OR
|
||||
%left T_BOOLEAN_AND
|
||||
%left '|'
|
||||
%left '^'
|
||||
%left '&'
|
||||
%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL
|
||||
%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL
|
||||
%left T_SL T_SR
|
||||
%left '+' '-' '.'
|
||||
%left '*' '/' '%'
|
||||
%right '!' '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@'
|
||||
%right '['
|
||||
%nonassoc T_NEW T_DELETE
|
||||
%token T_EXIT
|
||||
%token T_IF
|
||||
%left T_ELSEIF
|
||||
%left T_ELSE
|
||||
%left T_ENDIF
|
||||
%token T_LNUMBER
|
||||
%token T_DNUMBER
|
||||
%token T_STRING
|
||||
%token T_STRING_VARNAME
|
||||
%token T_VARIABLE
|
||||
%token T_NUM_STRING
|
||||
%token T_INLINE_HTML
|
||||
%token T_CHARACTER
|
||||
%token T_BAD_CHARACTER
|
||||
%token T_ENCAPSED_AND_WHITESPACE
|
||||
%token T_CONSTANT_ENCAPSED_STRING
|
||||
%token T_ECHO
|
||||
%token T_DO
|
||||
%token T_WHILE
|
||||
%token T_ENDWHILE
|
||||
%token T_FOR
|
||||
%token T_ENDFOR
|
||||
%token T_FOREACH
|
||||
%token T_ENDFOREACH
|
||||
%token T_DECLARE
|
||||
%token T_ENDDECLARE
|
||||
%token T_AS
|
||||
%token T_SWITCH
|
||||
%token T_ENDSWITCH
|
||||
%token T_CASE
|
||||
%token T_DEFAULT
|
||||
%token T_BREAK
|
||||
%token T_CONTINUE
|
||||
%token T_OLD_FUNCTION
|
||||
%token T_FUNCTION
|
||||
%token T_CONST
|
||||
%token T_RETURN
|
||||
%token T_TRY
|
||||
%token T_CATCH
|
||||
%token T_THROW
|
||||
%token T_USE
|
||||
%token T_GLOBAL
|
||||
%token T_STATIC
|
||||
%token T_VAR
|
||||
%token T_UNSET
|
||||
%token T_ISSET
|
||||
%token T_EMPTY
|
||||
%token T_NAMESPACE
|
||||
%token T_CLASS
|
||||
%token T_EXTENDS
|
||||
%token T_OBJECT_OPERATOR
|
||||
%token T_DOUBLE_ARROW
|
||||
%token T_LIST
|
||||
%token T_ARRAY
|
||||
%token T_LINE
|
||||
%token T_FILE
|
||||
%token T_COMMENT
|
||||
%token T_ML_COMMENT
|
||||
%token T_OPEN_TAG
|
||||
%token T_OPEN_TAG_WITH_ECHO
|
||||
%token T_CLOSE_TAG
|
||||
%token T_WHITESPACE
|
||||
%token T_START_HEREDOC
|
||||
%token T_END_HEREDOC
|
||||
%token T_DOLLAR_OPEN_CURLY_BRACES
|
||||
%token T_CURLY_OPEN
|
||||
%token T_PAAMAYIM_NEKUDOTAYIM
|
||||
|
||||
%% /* Rules */
|
||||
|
||||
start:
|
||||
top_statement_list
|
||||
;
|
||||
|
||||
top_statement_list:
|
||||
top_statement_list { zend_do_extended_info(TSRMLS_C); } top_statement { HANDLE_INTERACTIVE(); }
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
|
||||
top_statement:
|
||||
statement
|
||||
| declaration_statement { zend_do_early_binding(TSRMLS_C); }
|
||||
;
|
||||
|
||||
|
||||
inner_statement_list:
|
||||
inner_statement_list { zend_do_extended_info(TSRMLS_C); } inner_statement { HANDLE_INTERACTIVE(); }
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
|
||||
inner_statement:
|
||||
statement
|
||||
| declaration_statement
|
||||
;
|
||||
|
||||
|
||||
statement:
|
||||
unticked_statement { zend_do_ticks(TSRMLS_C); }
|
||||
;
|
||||
|
||||
|
||||
unticked_statement:
|
||||
'{' inner_statement_list '}'
|
||||
| T_IF '(' expr ')' { zend_do_if_cond(&$3, &$4 TSRMLS_CC); } statement { zend_do_if_after_statement(&$4, 1 TSRMLS_CC); } elseif_list else_single { zend_do_if_end(TSRMLS_C); }
|
||||
| T_IF '(' expr ')' ':' { zend_do_if_cond(&$3, &$4 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$4, 1 TSRMLS_CC); } new_elseif_list new_else_single T_ENDIF ';' { zend_do_if_end(TSRMLS_C); }
|
||||
| T_WHILE '(' { $1.u.opline_num = get_next_op_number(CG(active_op_array)); } expr ')' { zend_do_while_cond(&$4, &$5 TSRMLS_CC); } while_statement { zend_do_while_end(&$1, &$5 TSRMLS_CC); }
|
||||
| T_DO { $1.u.opline_num = get_next_op_number(CG(active_op_array)); zend_do_do_while_begin(TSRMLS_C); } statement T_WHILE '(' { $5.u.opline_num = get_next_op_number(CG(active_op_array)); } expr ')' ';' { zend_do_do_while_end(&$1, &$5, &$7 TSRMLS_CC); }
|
||||
| T_FOR
|
||||
'('
|
||||
for_expr
|
||||
';' { zend_do_free(&$3 TSRMLS_CC); $4.u.opline_num = get_next_op_number(CG(active_op_array)); }
|
||||
for_expr
|
||||
';' { zend_do_extended_info(TSRMLS_C); zend_do_for_cond(&$6, &$7 TSRMLS_CC); }
|
||||
for_expr
|
||||
')' { zend_do_free(&$9 TSRMLS_CC); zend_do_for_before_statement(&$4, &$7 TSRMLS_CC); }
|
||||
for_statement { zend_do_for_end(&$7 TSRMLS_CC); }
|
||||
| T_SWITCH '(' expr ')' { zend_do_switch_cond(&$3 TSRMLS_CC); } switch_case_list { zend_do_switch_end(&$6 TSRMLS_CC); }
|
||||
| T_BREAK ';' { zend_do_brk_cont(ZEND_BRK, NULL TSRMLS_CC); }
|
||||
| T_BREAK expr ';' { zend_do_brk_cont(ZEND_BRK, &$2 TSRMLS_CC); }
|
||||
| T_CONTINUE ';' { zend_do_brk_cont(ZEND_CONT, NULL TSRMLS_CC); }
|
||||
| T_CONTINUE expr ';' { zend_do_brk_cont(ZEND_CONT, &$2 TSRMLS_CC); }
|
||||
| T_RETURN ';' { zend_do_return(NULL, 0 TSRMLS_CC); }
|
||||
| T_RETURN expr_without_variable ';' { zend_do_return(&$2, 0 TSRMLS_CC); }
|
||||
| T_RETURN cvar ';' { zend_do_return(&$2, 1 TSRMLS_CC); }
|
||||
| T_GLOBAL global_var_list ';'
|
||||
| T_STATIC static_var_list ';'
|
||||
| T_ECHO echo_expr_list ';'
|
||||
| T_INLINE_HTML { zend_do_echo(&$1 TSRMLS_CC); }
|
||||
| expr ';' { zend_do_free(&$1 TSRMLS_CC); }
|
||||
| T_USE use_filename ';' { zend_error(E_COMPILE_ERROR,"use: Not yet supported. Please use include_once() or require_once()"); zval_dtor(&$2.u.constant); }
|
||||
| T_UNSET '(' unset_variables ')' ';'
|
||||
| T_FOREACH '(' cvar T_AS { zend_do_foreach_begin(&$1, &$3, &$2, &$4, 1 TSRMLS_CC); } w_cvar foreach_optional_arg ')' { zend_do_foreach_cont(&$6, &$7, &$4 TSRMLS_CC); } foreach_statement { zend_do_foreach_end(&$1, &$2 TSRMLS_CC); }
|
||||
| T_FOREACH '(' expr_without_variable T_AS { zend_do_foreach_begin(&$1, &$3, &$2, &$4, 0 TSRMLS_CC); } w_cvar foreach_optional_arg ')' { zend_do_foreach_cont(&$6, &$7, &$4 TSRMLS_CC); } foreach_statement { zend_do_foreach_end(&$1, &$2 TSRMLS_CC); }
|
||||
| T_DECLARE { zend_do_declare_begin(TSRMLS_C); } '(' declare_list ')' declare_statement { zend_do_declare_end(TSRMLS_C); }
|
||||
| ';' /* empty statement */
|
||||
| T_TRY { zend_do_try(&$1 TSRMLS_CC); } '{' inner_statement_list '}'
|
||||
T_CATCH '(' T_VARIABLE ')' { zend_do_begin_catch(&$1, &$8 TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); }
|
||||
| T_THROW expr ';' { zend_do_throw(&$2 TSRMLS_CC); }
|
||||
| T_DELETE cvar ';' { zend_do_end_variable_parse(BP_VAR_UNSET, 0 TSRMLS_CC); zend_do_unset(&$1, ZEND_UNSET_OBJ TSRMLS_CC); }
|
||||
| T_NAMESPACE T_STRING { do_namespace(&$2 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
unset_variables:
|
||||
unset_variable
|
||||
| unset_variables ',' unset_variable
|
||||
;
|
||||
|
||||
unset_variable:
|
||||
cvar { zend_do_end_variable_parse(BP_VAR_UNSET, 0 TSRMLS_CC); zend_do_unset(&$1, ZEND_UNSET_REG TSRMLS_CC); }
|
||||
;
|
||||
|
||||
use_filename:
|
||||
T_CONSTANT_ENCAPSED_STRING { $$ = $1; }
|
||||
| '(' T_CONSTANT_ENCAPSED_STRING ')' { $$ = $2; }
|
||||
;
|
||||
|
||||
|
||||
declaration_statement:
|
||||
unticked_declaration_statement { zend_do_ticks(TSRMLS_C); }
|
||||
;
|
||||
|
||||
|
||||
unticked_declaration_statement:
|
||||
T_FUNCTION { $1.u.opline_num = CG(zend_lineno); } is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$4, 0, $3.op_type TSRMLS_CC); }
|
||||
'(' parameter_list ')' '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); }
|
||||
| T_OLD_FUNCTION { $1.u.opline_num = CG(zend_lineno); } is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$4, 0, $3.op_type TSRMLS_CC); }
|
||||
parameter_list '(' inner_statement_list ')' ';' { zend_do_end_function_declaration(&$1 TSRMLS_CC); }
|
||||
| T_CLASS T_STRING { zend_do_begin_class_declaration(&$2, NULL TSRMLS_CC); } '{' class_statement_list '}' { zend_do_end_class_declaration(TSRMLS_C); }
|
||||
| T_CLASS T_STRING T_EXTENDS T_STRING { zend_do_begin_class_declaration(&$2, &$4 TSRMLS_CC); } '{' class_statement_list '}' { zend_do_end_class_declaration(TSRMLS_C); }
|
||||
;
|
||||
|
||||
|
||||
foreach_optional_arg:
|
||||
/* empty */ { $$.op_type = IS_UNUSED; }
|
||||
| T_DOUBLE_ARROW w_cvar { $$ = $2; }
|
||||
;
|
||||
|
||||
|
||||
for_statement:
|
||||
statement
|
||||
| ':' inner_statement_list T_ENDFOR ';'
|
||||
;
|
||||
|
||||
|
||||
foreach_statement:
|
||||
statement
|
||||
| ':' inner_statement_list T_ENDFOREACH ';'
|
||||
;
|
||||
|
||||
|
||||
declare_statement:
|
||||
statement
|
||||
| ':' inner_statement_list T_ENDDECLARE ';'
|
||||
;
|
||||
|
||||
|
||||
declare_list:
|
||||
T_STRING '=' static_scalar { zend_do_declare_stmt(&$1, &$3 TSRMLS_CC); }
|
||||
| declare_list ',' T_STRING '=' static_scalar { zend_do_declare_stmt(&$3, &$5 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
switch_case_list:
|
||||
'{' case_list '}' { $$ = $2; }
|
||||
| '{' ';' case_list '}' { $$ = $3; }
|
||||
| ':' case_list T_ENDSWITCH ';' { $$ = $2; }
|
||||
| ':' ';' case_list T_ENDSWITCH ';' { $$ = $3; }
|
||||
;
|
||||
|
||||
|
||||
case_list:
|
||||
/* empty */ { $$.op_type = IS_UNUSED; }
|
||||
| case_list T_CASE expr case_separator { zend_do_extended_info(TSRMLS_C); zend_do_case_before_statement(&$1, &$2, &$3 TSRMLS_CC); } inner_statement_list { zend_do_case_after_statement(&$$, &$2 TSRMLS_CC); $$.op_type = IS_CONST }
|
||||
| case_list T_DEFAULT case_separator { zend_do_extended_info(TSRMLS_C); zend_do_default_before_statement(&$1, &$2 TSRMLS_CC); } inner_statement_list { zend_do_case_after_statement(&$$, &$2 TSRMLS_CC); $$.op_type = IS_CONST; }
|
||||
;
|
||||
|
||||
|
||||
case_separator:
|
||||
':'
|
||||
| ';'
|
||||
;
|
||||
|
||||
|
||||
while_statement:
|
||||
statement
|
||||
| ':' inner_statement_list T_ENDWHILE ';'
|
||||
;
|
||||
|
||||
|
||||
|
||||
elseif_list:
|
||||
/* empty */
|
||||
| elseif_list T_ELSEIF '(' expr ')' { zend_do_if_cond(&$4, &$5 TSRMLS_CC); } statement { zend_do_if_after_statement(&$5, 0 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
new_elseif_list:
|
||||
/* empty */
|
||||
| new_elseif_list T_ELSEIF '(' expr ')' ':' { zend_do_if_cond(&$4, &$5 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$5, 0 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
else_single:
|
||||
/* empty */
|
||||
| T_ELSE statement
|
||||
;
|
||||
|
||||
|
||||
new_else_single:
|
||||
/* empty */
|
||||
| T_ELSE ':' inner_statement_list
|
||||
;
|
||||
|
||||
|
||||
parameter_list:
|
||||
non_empty_parameter_list
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
|
||||
non_empty_parameter_list:
|
||||
T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$1, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE TSRMLS_CC); }
|
||||
| '&' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$2, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_FORCE TSRMLS_CC); }
|
||||
| T_CONST T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$2, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE TSRMLS_CC); }
|
||||
| T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$1, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$3, BYREF_NONE TSRMLS_CC); }
|
||||
| non_empty_parameter_list ',' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$3, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE TSRMLS_CC); }
|
||||
| non_empty_parameter_list ',' '&' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$4, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_FORCE TSRMLS_CC); }
|
||||
| non_empty_parameter_list ',' T_CONST T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$4, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE TSRMLS_CC); }
|
||||
| non_empty_parameter_list ',' T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$3, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$5, BYREF_NONE TSRMLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
function_call_parameter_list:
|
||||
non_empty_function_call_parameter_list { $$ = $1; }
|
||||
| /* empty */ { $$.u.constant.value.lval = 0; }
|
||||
;
|
||||
|
||||
|
||||
non_empty_function_call_parameter_list:
|
||||
expr_without_variable { $$.u.constant.value.lval = 1; zend_do_pass_param(&$1, ZEND_SEND_VAL, $$.u.constant.value.lval TSRMLS_CC); }
|
||||
| cvar { $$.u.constant.value.lval = 1; zend_do_pass_param(&$1, ZEND_SEND_VAR, $$.u.constant.value.lval TSRMLS_CC); }
|
||||
| '&' w_cvar { $$.u.constant.value.lval = 1; zend_do_pass_param(&$2, ZEND_SEND_REF, $$.u.constant.value.lval TSRMLS_CC); }
|
||||
| non_empty_function_call_parameter_list ',' expr_without_variable { $$.u.constant.value.lval=$1.u.constant.value.lval+1; zend_do_pass_param(&$3, ZEND_SEND_VAL, $$.u.constant.value.lval TSRMLS_CC); }
|
||||
| non_empty_function_call_parameter_list ',' cvar { $$.u.constant.value.lval=$1.u.constant.value.lval+1; zend_do_pass_param(&$3, ZEND_SEND_VAR, $$.u.constant.value.lval TSRMLS_CC); }
|
||||
| non_empty_function_call_parameter_list ',' '&' w_cvar { $$.u.constant.value.lval=$1.u.constant.value.lval+1; zend_do_pass_param(&$4, ZEND_SEND_REF, $$.u.constant.value.lval TSRMLS_CC); }
|
||||
;
|
||||
|
||||
global_var_list:
|
||||
global_var_list ',' global_var { zend_do_fetch_global_or_static_variable(&$3, NULL, ZEND_FETCH_GLOBAL TSRMLS_CC); }
|
||||
| global_var { zend_do_fetch_global_or_static_variable(&$1, NULL, ZEND_FETCH_GLOBAL TSRMLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
global_var:
|
||||
T_VARIABLE { $$ = $1; }
|
||||
| '$' r_cvar { $$ = $2; }
|
||||
| '$' '{' expr '}' { $$ = $3; }
|
||||
;
|
||||
|
||||
|
||||
static_var_list:
|
||||
static_var_list ',' T_VARIABLE { zend_do_fetch_global_or_static_variable(&$3, NULL, ZEND_FETCH_STATIC TSRMLS_CC); }
|
||||
| static_var_list ',' T_VARIABLE '=' static_scalar { zend_do_fetch_global_or_static_variable(&$3, &$5, ZEND_FETCH_STATIC TSRMLS_CC); }
|
||||
| T_VARIABLE { zend_do_fetch_global_or_static_variable(&$1, NULL, ZEND_FETCH_STATIC TSRMLS_CC); }
|
||||
| T_VARIABLE '=' static_scalar { zend_do_fetch_global_or_static_variable(&$1, &$3, ZEND_FETCH_STATIC TSRMLS_CC); }
|
||||
|
||||
;
|
||||
|
||||
|
||||
class_statement_list:
|
||||
class_statement_list class_statement
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
|
||||
class_statement:
|
||||
T_VAR class_variable_decleration ';'
|
||||
| T_FUNCTION { $1.u.opline_num = CG(zend_lineno); } is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$4, 1, $3.op_type TSRMLS_CC); } '('
|
||||
parameter_list ')' '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); }
|
||||
| T_OLD_FUNCTION { $1.u.opline_num = CG(zend_lineno); } is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$4, 1, $3.op_type TSRMLS_CC); }
|
||||
parameter_list '(' inner_statement_list ')' ';' { zend_do_end_function_declaration(&$1 TSRMLS_CC); }
|
||||
|
||||
;
|
||||
|
||||
is_reference:
|
||||
/* empty */ { $$.op_type = ZEND_RETURN_VAL; }
|
||||
| '&' { $$.op_type = ZEND_RETURN_REF; }
|
||||
|
||||
class_variable_decleration:
|
||||
class_variable_decleration ',' T_VARIABLE { zend_do_declare_property(&$3, NULL TSRMLS_CC); }
|
||||
| class_variable_decleration ',' T_VARIABLE '=' static_scalar { zend_do_declare_property(&$3, &$5 TSRMLS_CC); }
|
||||
| T_VARIABLE { zend_do_declare_property(&$1, NULL TSRMLS_CC); }
|
||||
| T_VARIABLE '=' static_scalar { zend_do_declare_property(&$1, &$3 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
echo_expr_list:
|
||||
| echo_expr_list ',' expr { zend_do_echo(&$3 TSRMLS_CC); }
|
||||
| expr { zend_do_echo(&$1 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
for_expr:
|
||||
/* empty */ { $$.op_type = IS_CONST; $$.u.constant.type = IS_BOOL; $$.u.constant.value.lval = 1; }
|
||||
| non_empty_for_expr { $$ = $1; }
|
||||
;
|
||||
|
||||
non_empty_for_expr:
|
||||
non_empty_for_expr ',' { zend_do_free(&$1 TSRMLS_CC); } expr { $$ = $4; }
|
||||
| expr { $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
expr_without_variable:
|
||||
T_LIST '(' { zend_do_list_init(TSRMLS_C); } assignment_list ')' '=' expr { zend_do_list_end(&$$, &$7 TSRMLS_CC); }
|
||||
| cvar '=' expr { zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign(&$$, &$1, &$3 TSRMLS_CC); }
|
||||
| cvar '=' '&' w_cvar { zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$4 TSRMLS_CC); }
|
||||
| cvar '=' '&' function_call { zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$4 TSRMLS_CC); }
|
||||
| cvar '=' '&' T_NEW static_or_variable_string { zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$4, &$5 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$3, &$5, &$4, &$7 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$3 TSRMLS_CC); }
|
||||
| T_NEW static_or_variable_string { zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$1, &$2 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$$, &$2, &$1, &$4 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
| cvar T_PLUS_EQUAL expr { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_ADD, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| cvar T_MINUS_EQUAL expr { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SUB, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| cvar T_MUL_EQUAL expr { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MUL, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| cvar T_DIV_EQUAL expr { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_DIV, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| cvar T_CONCAT_EQUAL expr { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_CONCAT, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| cvar T_MOD_EQUAL expr { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MOD, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| cvar T_AND_EQUAL expr { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_AND, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| cvar T_OR_EQUAL expr { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_OR, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| cvar T_XOR_EQUAL expr { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_XOR, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| cvar T_SL_EQUAL expr { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SL, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| cvar T_SR_EQUAL expr { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SR, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| rw_cvar T_INC { zend_do_post_incdec(&$$, &$1, ZEND_POST_INC TSRMLS_CC); }
|
||||
| T_INC rw_cvar { zend_do_pre_incdec(&$$, &$2, ZEND_PRE_INC TSRMLS_CC); }
|
||||
| rw_cvar T_DEC { zend_do_post_incdec(&$$, &$1, ZEND_POST_DEC TSRMLS_CC); }
|
||||
| T_DEC rw_cvar { zend_do_pre_incdec(&$$, &$2, ZEND_PRE_DEC TSRMLS_CC); }
|
||||
| expr T_BOOLEAN_OR { zend_do_boolean_or_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_or_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
|
||||
| expr T_BOOLEAN_AND { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_and_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
|
||||
| expr T_LOGICAL_OR { zend_do_boolean_or_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_or_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
|
||||
| expr T_LOGICAL_AND { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_and_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
|
||||
| expr T_LOGICAL_XOR expr { zend_do_binary_op(ZEND_BOOL_XOR, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr '|' expr { zend_do_binary_op(ZEND_BW_OR, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr '&' expr { zend_do_binary_op(ZEND_BW_AND, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr '^' expr { zend_do_binary_op(ZEND_BW_XOR, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr '.' expr { zend_do_binary_op(ZEND_CONCAT, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr '+' expr { zend_do_binary_op(ZEND_ADD, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr '-' expr { zend_do_binary_op(ZEND_SUB, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr '*' expr { zend_do_binary_op(ZEND_MUL, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr '/' expr { zend_do_binary_op(ZEND_DIV, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr '%' expr { zend_do_binary_op(ZEND_MOD, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr T_SL expr { zend_do_binary_op(ZEND_SL, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr T_SR expr { zend_do_binary_op(ZEND_SR, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| '+' expr { $1.u.constant.value.lval=0; $1.u.constant.type=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_ADD, &$$, &$1, &$2 TSRMLS_CC); }
|
||||
| '-' expr { $1.u.constant.value.lval=0; $1.u.constant.type=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_SUB, &$$, &$1, &$2 TSRMLS_CC); }
|
||||
| '!' expr { zend_do_unary_op(ZEND_BOOL_NOT, &$$, &$2 TSRMLS_CC); }
|
||||
| '~' expr { zend_do_unary_op(ZEND_BW_NOT, &$$, &$2 TSRMLS_CC); }
|
||||
| expr T_IS_IDENTICAL expr { zend_do_binary_op(ZEND_IS_IDENTICAL, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr T_IS_NOT_IDENTICAL expr { zend_do_binary_op(ZEND_IS_NOT_IDENTICAL, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr T_IS_EQUAL expr { zend_do_binary_op(ZEND_IS_EQUAL, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr T_IS_NOT_EQUAL expr { zend_do_binary_op(ZEND_IS_NOT_EQUAL, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr '<' expr { zend_do_binary_op(ZEND_IS_SMALLER, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr T_IS_SMALLER_OR_EQUAL expr { zend_do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr '>' expr { zend_do_binary_op(ZEND_IS_SMALLER, &$$, &$3, &$1 TSRMLS_CC); }
|
||||
| expr T_IS_GREATER_OR_EQUAL expr { zend_do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &$$, &$3, &$1 TSRMLS_CC); }
|
||||
| '(' expr ')' { $$ = $2; }
|
||||
| expr '?' { zend_do_begin_qm_op(&$1, &$2 TSRMLS_CC); }
|
||||
expr ':' { zend_do_qm_true(&$4, &$2, &$5 TSRMLS_CC); }
|
||||
expr { zend_do_qm_false(&$$, &$7, &$2, &$5 TSRMLS_CC); }
|
||||
| function_call { $$ = $1; }
|
||||
| internal_functions_in_yacc { $$ = $1; }
|
||||
| T_INT_CAST expr { zend_do_cast(&$$, &$2, IS_LONG TSRMLS_CC); }
|
||||
| T_DOUBLE_CAST expr { zend_do_cast(&$$, &$2, IS_DOUBLE TSRMLS_CC); }
|
||||
| T_STRING_CAST expr { zend_do_cast(&$$, &$2, IS_STRING TSRMLS_CC); }
|
||||
| T_ARRAY_CAST expr { zend_do_cast(&$$, &$2, IS_ARRAY TSRMLS_CC); }
|
||||
| T_OBJECT_CAST expr { zend_do_cast(&$$, &$2, IS_OBJECT TSRMLS_CC); }
|
||||
| T_BOOL_CAST expr { zend_do_cast(&$$, &$2, IS_BOOL TSRMLS_CC); }
|
||||
| T_UNSET_CAST expr { zend_do_cast(&$$, &$2, IS_NULL TSRMLS_CC); }
|
||||
| T_EXIT exit_expr { zend_do_exit(&$$, &$2 TSRMLS_CC); }
|
||||
| '@' { zend_do_begin_silence(&$1 TSRMLS_CC); } expr { zend_do_end_silence(&$1 TSRMLS_CC); $$ = $3; }
|
||||
| scalar { $$ = $1; }
|
||||
| T_ARRAY '(' array_pair_list ')' { $$ = $3; }
|
||||
| '`' encaps_list '`' { zend_do_shell_exec(&$$, &$2 TSRMLS_CC); }
|
||||
| T_PRINT expr { zend_do_print(&$$, &$2 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
function_call:
|
||||
T_STRING '(' { $2.u.opline_num = zend_do_begin_function_call(&$1 TSRMLS_CC); }
|
||||
function_call_parameter_list
|
||||
')' { zend_do_end_function_call(&$1, &$$, &$4, 0, $2.u.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
|
||||
| T_STRING T_PAAMAYIM_NEKUDOTAYIM static_or_variable_string '(' { zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
|
||||
function_call_parameter_list
|
||||
')' { zend_do_end_function_call(&$3, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
| cvar_without_objects '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_dynamic_function_call(&$1 TSRMLS_CC); }
|
||||
function_call_parameter_list ')'
|
||||
{ zend_do_end_function_call(&$1, &$$, &$4, 0, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
;
|
||||
|
||||
|
||||
static_or_variable_string:
|
||||
T_STRING { $$ = $1; }
|
||||
| r_cvar { $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
exit_expr:
|
||||
/* empty */ { memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; }
|
||||
| '(' ')' { memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; }
|
||||
| '(' expr ')' { $$ = $2; }
|
||||
;
|
||||
|
||||
|
||||
ctor_arguments:
|
||||
/* empty */ { $$.u.constant.value.lval=0; }
|
||||
| '(' function_call_parameter_list ')' { $$ = $2; }
|
||||
;
|
||||
|
||||
|
||||
common_scalar:
|
||||
T_LNUMBER { $$ = $1; }
|
||||
| T_DNUMBER { $$ = $1; }
|
||||
| T_CONSTANT_ENCAPSED_STRING { $$ = $1; }
|
||||
| T_LINE { $$ = $1; }
|
||||
| T_FILE { $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
static_scalar: /* compile-time evaluated scalars */
|
||||
common_scalar { $$ = $1; }
|
||||
| T_STRING { zend_do_fetch_constant(&$$, &$1, ZEND_CT TSRMLS_CC); }
|
||||
| '+' static_scalar { $$ = $1; }
|
||||
| '-' static_scalar { zval minus_one; minus_one.type = IS_LONG; minus_one.value.lval = -1; mul_function(&$2.u.constant, &$2.u.constant, &minus_one TSRMLS_CC); $$ = $2; }
|
||||
| T_ARRAY '(' static_array_pair_list ')' { $$ = $3; $$.u.constant.type = IS_CONSTANT_ARRAY; }
|
||||
;
|
||||
|
||||
|
||||
scalar:
|
||||
T_STRING { zend_do_fetch_constant(&$$, &$1, ZEND_RT TSRMLS_CC); }
|
||||
| T_STRING_VARNAME { $$ = $1; }
|
||||
| common_scalar { $$ = $1; }
|
||||
| '"' encaps_list '"' { $$ = $2; }
|
||||
| '\'' encaps_list '\'' { $$ = $2; }
|
||||
| T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; zend_do_end_heredoc(TSRMLS_C); }
|
||||
;
|
||||
|
||||
|
||||
static_array_pair_list:
|
||||
/* empty */ { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); }
|
||||
| non_empty_static_array_pair_list possible_comma { $$ = $1; }
|
||||
;
|
||||
|
||||
possible_comma:
|
||||
/* empty */
|
||||
| ','
|
||||
;
|
||||
|
||||
non_empty_static_array_pair_list:
|
||||
non_empty_static_array_pair_list ',' static_scalar T_DOUBLE_ARROW static_scalar { zend_do_add_static_array_element(&$$, &$3, &$5); }
|
||||
| non_empty_static_array_pair_list ',' static_scalar { zend_do_add_static_array_element(&$$, NULL, &$3); }
|
||||
| static_scalar T_DOUBLE_ARROW static_scalar { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); zend_do_add_static_array_element(&$$, &$1, &$3); }
|
||||
| static_scalar { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); zend_do_add_static_array_element(&$$, NULL, &$1); }
|
||||
;
|
||||
|
||||
expr:
|
||||
r_cvar { $$ = $1; }
|
||||
| expr_without_variable { $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
r_cvar:
|
||||
cvar { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
w_cvar:
|
||||
cvar { zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
rw_cvar:
|
||||
cvar { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); $$ = $1; }
|
||||
;
|
||||
|
||||
cvar:
|
||||
variable { $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
variable:
|
||||
variable_property '(' { zend_do_begin_method_call(NULL, &$1 TSRMLS_CC); }
|
||||
function_call_parameter_list ')' { zend_do_end_function_call(&$1, &$$, &$4, 0, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
| variable_property { $$ = $1; }
|
||||
| cvar_without_objects { $$ = $1; }
|
||||
;
|
||||
|
||||
variable_property:
|
||||
variable T_OBJECT_OPERATOR { zend_do_push_object(&$1 TSRMLS_CC); } object_property { $$ = $4; }
|
||||
;
|
||||
|
||||
|
||||
cvar_without_objects:
|
||||
reference_variable { $$ = $1; }
|
||||
| simple_indirect_reference reference_variable { zend_do_indirect_references(&$$, &$1, &$2 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
reference_variable:
|
||||
reference_variable '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
|
||||
| reference_variable '{' expr '}' { fetch_string_offset(&$$, &$1, &$3 TSRMLS_CC); }
|
||||
| compound_variable { zend_do_fetch_globals(&$1 TSRMLS_CC); zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
compound_variable:
|
||||
T_VARIABLE { $$ = $1; }
|
||||
| '$' '{' expr '}' { $$ = $3; }
|
||||
;
|
||||
|
||||
dim_offset:
|
||||
/* empty */ { $$.op_type = IS_UNUSED; }
|
||||
| expr { $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
object_property:
|
||||
object_dim_list { $$ = $1; }
|
||||
| cvar_without_objects { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); } { znode tmp_znode; zend_do_pop_object(&tmp_znode TSRMLS_CC); zend_do_fetch_property(&$$, &tmp_znode, &$1 TSRMLS_CC);}
|
||||
;
|
||||
|
||||
object_dim_list:
|
||||
object_dim_list '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
|
||||
| object_dim_list '{' expr '}' { fetch_string_offset(&$$, &$1, &$3 TSRMLS_CC); }
|
||||
| variable_name { znode tmp_znode; zend_do_pop_object(&tmp_znode TSRMLS_CC); zend_do_fetch_property(&$$, &tmp_znode, &$1 TSRMLS_CC);}
|
||||
;
|
||||
|
||||
variable_name:
|
||||
T_STRING { $$ = $1; }
|
||||
| '{' expr '}' { $$ = $2; }
|
||||
;
|
||||
|
||||
|
||||
simple_indirect_reference:
|
||||
'$' { $$.u.constant.value.lval = 1; }
|
||||
| simple_indirect_reference '$' { $$.u.constant.value.lval++; }
|
||||
;
|
||||
|
||||
assignment_list:
|
||||
assignment_list ',' assignment_list_element
|
||||
| assignment_list_element
|
||||
;
|
||||
|
||||
|
||||
assignment_list_element:
|
||||
cvar { zend_do_add_list_element(&$1 TSRMLS_CC); }
|
||||
| T_LIST '(' { zend_do_new_list_begin(TSRMLS_C); } assignment_list ')' { zend_do_new_list_end(TSRMLS_C); }
|
||||
| /* empty */ { zend_do_add_list_element(NULL TSRMLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
array_pair_list:
|
||||
/* empty */ { zend_do_init_array(&$$, NULL, NULL, 0 TSRMLS_CC); }
|
||||
| non_empty_array_pair_list possible_comma { $$ = $1; }
|
||||
;
|
||||
|
||||
non_empty_array_pair_list:
|
||||
non_empty_array_pair_list ',' expr T_DOUBLE_ARROW expr { zend_do_add_array_element(&$$, &$5, &$3, 0 TSRMLS_CC); }
|
||||
| non_empty_array_pair_list ',' expr { zend_do_add_array_element(&$$, &$3, NULL, 0 TSRMLS_CC); }
|
||||
| expr T_DOUBLE_ARROW expr { zend_do_init_array(&$$, &$3, &$1, 0 TSRMLS_CC); }
|
||||
| expr { zend_do_init_array(&$$, &$1, NULL, 0 TSRMLS_CC); }
|
||||
| non_empty_array_pair_list ',' expr T_DOUBLE_ARROW '&' w_cvar { zend_do_add_array_element(&$$, &$6, &$3, 1 TSRMLS_CC); }
|
||||
| non_empty_array_pair_list ',' '&' w_cvar { zend_do_add_array_element(&$$, &$4, NULL, 1 TSRMLS_CC); }
|
||||
| expr T_DOUBLE_ARROW '&' w_cvar { zend_do_init_array(&$$, &$4, &$1, 1 TSRMLS_CC); }
|
||||
| '&' w_cvar { zend_do_init_array(&$$, &$2, NULL, 1 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
encaps_list:
|
||||
encaps_list encaps_var { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_add_variable(&$$, &$1, &$2 TSRMLS_CC); }
|
||||
| encaps_list T_STRING { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); }
|
||||
| encaps_list T_NUM_STRING { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); }
|
||||
| encaps_list T_ENCAPSED_AND_WHITESPACE { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); }
|
||||
| encaps_list T_CHARACTER { zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); }
|
||||
| encaps_list T_BAD_CHARACTER { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); }
|
||||
| encaps_list '[' { $2.u.constant.value.lval = (long) '['; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); }
|
||||
| encaps_list ']' { $2.u.constant.value.lval = (long) ']'; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); }
|
||||
| encaps_list '{' { $2.u.constant.value.lval = (long) '{'; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); }
|
||||
| encaps_list '}' { $2.u.constant.value.lval = (long) '}'; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); }
|
||||
| encaps_list T_OBJECT_OPERATOR { znode tmp; $2.u.constant.value.lval = (long) '-'; zend_do_add_char(&tmp, &$1, &$2 TSRMLS_CC); $2.u.constant.value.lval = (long) '>'; zend_do_add_char(&$$, &tmp, &$2 TSRMLS_CC); }
|
||||
| /* empty */ { zend_do_init_string(&$$ TSRMLS_CC); }
|
||||
|
||||
;
|
||||
|
||||
|
||||
|
||||
encaps_var:
|
||||
T_VARIABLE { zend_do_fetch_globals(&$1 TSRMLS_CC); zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); }
|
||||
| T_VARIABLE '[' { zend_do_begin_variable_parse(TSRMLS_C); } encaps_var_offset ']' { zend_do_fetch_globals(&$1 TSRMLS_CC); fetch_array_begin(&$$, &$1, &$4 TSRMLS_CC); }
|
||||
| T_VARIABLE T_OBJECT_OPERATOR T_STRING { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$2, &$1, 1 TSRMLS_CC); zend_do_fetch_property(&$$, &$2, &$3 TSRMLS_CC); }
|
||||
| T_DOLLAR_OPEN_CURLY_BRACES expr '}' { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$2, 1 TSRMLS_CC); }
|
||||
| T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' { zend_do_begin_variable_parse(TSRMLS_C); fetch_array_begin(&$$, &$2, &$4 TSRMLS_CC); }
|
||||
| T_CURLY_OPEN cvar '}' { $$ = $2; }
|
||||
;
|
||||
|
||||
|
||||
encaps_var_offset:
|
||||
T_STRING { $$ = $1; }
|
||||
| T_NUM_STRING { $$ = $1; }
|
||||
| T_VARIABLE { fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
internal_functions_in_yacc:
|
||||
T_ISSET '(' isset_variables ')' { $$ = $3; }
|
||||
| T_EMPTY '(' cvar ')' { zend_do_isset_or_isempty(ZEND_ISEMPTY, &$$, &$3 TSRMLS_CC); }
|
||||
| T_INCLUDE expr { zend_do_include_or_eval(ZEND_INCLUDE, &$$, &$2 TSRMLS_CC); }
|
||||
| T_INCLUDE_ONCE expr { zend_do_include_or_eval(ZEND_INCLUDE_ONCE, &$$, &$2 TSRMLS_CC); }
|
||||
| T_EVAL '(' expr ')' { zend_do_include_or_eval(ZEND_EVAL, &$$, &$3 TSRMLS_CC); }
|
||||
| T_REQUIRE expr { zend_do_include_or_eval(ZEND_REQUIRE, &$$, &$2 TSRMLS_CC); }
|
||||
| T_REQUIRE_ONCE expr { zend_do_include_or_eval(ZEND_REQUIRE_ONCE, &$$, &$2 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
isset_variables:
|
||||
cvar { zend_do_isset_or_isempty(ZEND_ISSET, &$$, &$1 TSRMLS_CC); }
|
||||
| isset_variables ',' { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } cvar { znode tmp; zend_do_isset_or_isempty(ZEND_ISSET, &tmp, &$4 TSRMLS_CC); zend_do_boolean_and_end(&$$, &$1, &tmp, &$2 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ZEND_SCANNER_H
|
||||
#define ZEND_SCANNER_H
|
||||
|
||||
typedef struct _zend_lex_state {
|
||||
YY_BUFFER_STATE buffer_state;
|
||||
int state;
|
||||
FILE *in;
|
||||
uint lineno;
|
||||
char *filename;
|
||||
} zend_lex_state;
|
||||
|
||||
|
||||
void zend_fatal_scanner_error(char *);
|
||||
BEGIN_EXTERN_C()
|
||||
int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2);
|
||||
END_EXTERN_C()
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,391 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
/* resource lists */
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_list.h"
|
||||
#include "zend_API.h"
|
||||
#include "zend_globals.h"
|
||||
|
||||
ZEND_API int le_index_ptr;
|
||||
|
||||
/* true global */
|
||||
static HashTable list_destructors;
|
||||
|
||||
|
||||
ZEND_API int zend_list_insert(void *ptr, int type)
|
||||
{
|
||||
int index;
|
||||
zend_rsrc_list_entry le;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
le.ptr=ptr;
|
||||
le.type=type;
|
||||
le.refcount=1;
|
||||
|
||||
index = zend_hash_next_free_element(&EG(regular_list));
|
||||
zend_hash_index_update(&EG(regular_list), index, (void *) &le, sizeof(zend_rsrc_list_entry), NULL);
|
||||
return index;
|
||||
}
|
||||
|
||||
ZEND_API int _zend_list_delete(int id TSRMLS_DC)
|
||||
{
|
||||
zend_rsrc_list_entry *le;
|
||||
|
||||
if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
|
||||
/* printf("del(%d): %d->%d\n", id, le->refcount, le->refcount-1); */
|
||||
if (--le->refcount<=0) {
|
||||
return zend_hash_index_del(&EG(regular_list), id);
|
||||
} else {
|
||||
return SUCCESS;
|
||||
}
|
||||
} else {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC)
|
||||
{
|
||||
zend_rsrc_list_entry *le;
|
||||
|
||||
if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
|
||||
*type = le->type;
|
||||
return le->ptr;
|
||||
} else {
|
||||
*type = -1;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int _zend_list_addref(int id TSRMLS_DC)
|
||||
{
|
||||
zend_rsrc_list_entry *le;
|
||||
|
||||
if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
|
||||
/* printf("add(%d): %d->%d\n", id, le->refcount, le->refcount+1); */
|
||||
le->refcount++;
|
||||
return SUCCESS;
|
||||
} else {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type)
|
||||
{
|
||||
int rsrc_id;
|
||||
|
||||
rsrc_id = zend_list_insert(rsrc_pointer, rsrc_type);
|
||||
|
||||
if (rsrc_result) {
|
||||
rsrc_result->value.lval = rsrc_id;
|
||||
rsrc_result->type = IS_RESOURCE;
|
||||
}
|
||||
|
||||
return rsrc_id;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, char *resource_type_name, int *found_resource_type, int num_resource_types, ...)
|
||||
{
|
||||
int id;
|
||||
int actual_resource_type;
|
||||
void *resource;
|
||||
va_list resource_types;
|
||||
int i;
|
||||
|
||||
if (default_id==-1) { /* use id */
|
||||
if (!passed_id) {
|
||||
if (resource_type_name) {
|
||||
zend_error(E_WARNING, "No %s resource supplied", resource_type_name);
|
||||
}
|
||||
return NULL;
|
||||
} else if ((*passed_id)->type != IS_RESOURCE) {
|
||||
if (resource_type_name) {
|
||||
zend_error(E_WARNING, "Supplied argument is not a valid %s resource", resource_type_name);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
id = (*passed_id)->value.lval;
|
||||
} else {
|
||||
id = default_id;
|
||||
}
|
||||
|
||||
resource = zend_list_find(id, &actual_resource_type);
|
||||
if (!resource) {
|
||||
if (resource_type_name) {
|
||||
zend_error(E_WARNING, "%d is not a valid %s resource", id, resource_type_name);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
va_start(resource_types, num_resource_types);
|
||||
for (i=0; i<num_resource_types; i++) {
|
||||
if (actual_resource_type == va_arg(resource_types, int)) {
|
||||
va_end(resource_types);
|
||||
if (found_resource_type) {
|
||||
*found_resource_type = actual_resource_type;
|
||||
}
|
||||
return resource;
|
||||
}
|
||||
}
|
||||
va_end(resource_types);
|
||||
|
||||
if (resource_type_name) {
|
||||
zend_error(E_WARNING, "Supplied resource is not a valid %s resource", resource_type_name);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void list_entry_destructor(void *ptr)
|
||||
{
|
||||
zend_rsrc_list_entry *le = (zend_rsrc_list_entry *) ptr;
|
||||
zend_rsrc_list_dtors_entry *ld;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (zend_hash_index_find(&list_destructors, le->type, (void **) &ld)==SUCCESS) {
|
||||
switch (ld->type) {
|
||||
case ZEND_RESOURCE_LIST_TYPE_STD:
|
||||
if (ld->list_dtor) {
|
||||
(ld->list_dtor)(le->ptr);
|
||||
}
|
||||
break;
|
||||
case ZEND_RESOURCE_LIST_TYPE_EX:
|
||||
if (ld->list_dtor_ex) {
|
||||
ld->list_dtor_ex(le TSRMLS_CC);
|
||||
}
|
||||
break;
|
||||
EMPTY_SWITCH_DEFAULT_CASE()
|
||||
}
|
||||
} else {
|
||||
zend_error(E_WARNING,"Unknown list entry type in request shutdown (%d)", le->type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void plist_entry_destructor(void *ptr)
|
||||
{
|
||||
zend_rsrc_list_entry *le = (zend_rsrc_list_entry *) ptr;
|
||||
zend_rsrc_list_dtors_entry *ld;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (zend_hash_index_find(&list_destructors, le->type, (void **) &ld)==SUCCESS) {
|
||||
switch (ld->type) {
|
||||
case ZEND_RESOURCE_LIST_TYPE_STD:
|
||||
if (ld->plist_dtor) {
|
||||
(ld->plist_dtor)(le->ptr);
|
||||
}
|
||||
break;
|
||||
case ZEND_RESOURCE_LIST_TYPE_EX:
|
||||
if (ld->plist_dtor_ex) {
|
||||
ld->plist_dtor_ex(le TSRMLS_CC);
|
||||
}
|
||||
break;
|
||||
EMPTY_SWITCH_DEFAULT_CASE()
|
||||
}
|
||||
} else {
|
||||
zend_error(E_WARNING,"Unknown persistent list entry type in module shutdown (%d)", le->type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int zend_init_rsrc_list(TSRMLS_D)
|
||||
{
|
||||
if (zend_hash_init(&EG(regular_list), 0, NULL, list_entry_destructor, 0)==SUCCESS) {
|
||||
EG(regular_list).nNextFreeElement=1; /* we don't want resource id 0 */
|
||||
return SUCCESS;
|
||||
} else {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int zend_init_rsrc_plist(TSRMLS_D)
|
||||
{
|
||||
return zend_hash_init_ex(&EG(persistent_list), 0, NULL, plist_entry_destructor, 1, 0);
|
||||
}
|
||||
|
||||
|
||||
void zend_destroy_rsrc_list(HashTable *ht TSRMLS_DC)
|
||||
{
|
||||
Bucket *p, *q;
|
||||
|
||||
while (1) {
|
||||
p = ht->pListTail;
|
||||
if (!p) {
|
||||
break;
|
||||
}
|
||||
q = p->pListLast;
|
||||
if (q) {
|
||||
q->pListNext = NULL;
|
||||
}
|
||||
ht->pListTail = q;
|
||||
|
||||
if (ht->pDestructor) {
|
||||
zend_try {
|
||||
ht->pDestructor(p->pData);
|
||||
} zend_end_try();
|
||||
}
|
||||
if (!p->pDataPtr && p->pData) {
|
||||
pefree(p->pData, ht->persistent);
|
||||
}
|
||||
pefree(p, ht->persistent);
|
||||
}
|
||||
pefree(ht->arBuckets, ht->persistent);
|
||||
}
|
||||
|
||||
|
||||
static int clean_module_resource(zend_rsrc_list_entry *le, int *resource_id TSRMLS_DC)
|
||||
{
|
||||
if (le->type == *resource_id) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int zend_clean_module_rsrc_dtors_cb(zend_rsrc_list_dtors_entry *ld, int *module_number TSRMLS_DC)
|
||||
{
|
||||
if (ld->module_number == *module_number) {
|
||||
zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) clean_module_resource, (void *) &(ld->resource_id) TSRMLS_CC);
|
||||
zend_hash_apply_with_argument(&EG(persistent_list), (apply_func_arg_t) clean_module_resource, (void *) &(ld->resource_id) TSRMLS_CC);
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void zend_clean_module_rsrc_dtors(int module_number TSRMLS_DC)
|
||||
{
|
||||
zend_hash_apply_with_argument(&list_destructors, (apply_func_arg_t) zend_clean_module_rsrc_dtors_cb, (void *) &module_number TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_register_list_destructors(void (*ld)(void *), void (*pld)(void *), int module_number)
|
||||
{
|
||||
zend_rsrc_list_dtors_entry lde;
|
||||
|
||||
#if 0
|
||||
printf("Registering destructors %d for module %d\n", list_destructors.nNextFreeElement, module_number);
|
||||
#endif
|
||||
|
||||
lde.list_dtor=(void (*)(void *)) ld;
|
||||
lde.plist_dtor=(void (*)(void *)) pld;
|
||||
lde.list_dtor_ex = lde.plist_dtor_ex = NULL;
|
||||
lde.module_number = module_number;
|
||||
lde.resource_id = list_destructors.nNextFreeElement;
|
||||
lde.type = ZEND_RESOURCE_LIST_TYPE_STD;
|
||||
lde.type_name = NULL;
|
||||
|
||||
if (zend_hash_next_index_insert(&list_destructors, (void *) &lde, sizeof(zend_rsrc_list_dtors_entry), NULL)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
return list_destructors.nNextFreeElement-1;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_register_list_destructors_ex(rsrc_dtor_func_t ld, rsrc_dtor_func_t pld, char *type_name, int module_number)
|
||||
{
|
||||
zend_rsrc_list_dtors_entry lde;
|
||||
|
||||
#if 0
|
||||
printf("Registering destructors %d for module %d\n", list_destructors.nNextFreeElement, module_number);
|
||||
#endif
|
||||
|
||||
lde.list_dtor = NULL;
|
||||
lde.plist_dtor = NULL;
|
||||
lde.list_dtor_ex = ld;
|
||||
lde.plist_dtor_ex = pld;
|
||||
lde.module_number = module_number;
|
||||
lde.resource_id = list_destructors.nNextFreeElement;
|
||||
lde.type = ZEND_RESOURCE_LIST_TYPE_EX;
|
||||
lde.type_name = type_name;
|
||||
|
||||
if (zend_hash_next_index_insert(&list_destructors, (void *) &lde, sizeof(zend_rsrc_list_dtors_entry), NULL)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
return list_destructors.nNextFreeElement-1;
|
||||
}
|
||||
|
||||
ZEND_API int zend_fetch_list_dtor_id(char *type_name)
|
||||
{
|
||||
zend_rsrc_list_dtors_entry *lde;
|
||||
HashPosition pos;
|
||||
|
||||
zend_hash_internal_pointer_reset_ex(&list_destructors, &pos);
|
||||
while(zend_hash_get_current_data_ex(&list_destructors, (void **)&lde, &pos) == SUCCESS) {
|
||||
if(strcmp(type_name, lde->type_name) == 0) {
|
||||
#if 0
|
||||
printf("Found resource id %d for resource type %s\n", (*lde).resource_id, type_name);
|
||||
#endif
|
||||
return lde->resource_id;
|
||||
}
|
||||
zend_hash_move_forward_ex(&list_destructors, &pos);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int zend_init_rsrc_list_dtors(void)
|
||||
{
|
||||
int retval;
|
||||
|
||||
retval = zend_hash_init(&list_destructors, 50, NULL, NULL, 1);
|
||||
list_destructors.nNextFreeElement=1; /* we don't want resource type 0 */
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
void zend_destroy_rsrc_list_dtors(void)
|
||||
{
|
||||
zend_hash_destroy(&list_destructors);
|
||||
}
|
||||
|
||||
|
||||
char *zend_rsrc_list_get_rsrc_type(int resource TSRMLS_DC)
|
||||
{
|
||||
zend_rsrc_list_dtors_entry *lde;
|
||||
int rsrc_type;
|
||||
|
||||
if (!zend_list_find(resource, &rsrc_type))
|
||||
return NULL;
|
||||
|
||||
if (zend_hash_index_find(&list_destructors, rsrc_type, (void **) &lde)==SUCCESS) {
|
||||
return lde->type_name;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
Loaded 100 of 1821 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user