mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-08 09:47:30 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e53dfe985 | ||
|
|
a435b7baa9 | ||
|
|
9d92bd6d8e | ||
|
|
29a1772e06 | ||
|
|
e02ef7fe8d | ||
|
|
93f485e7e2 | ||
|
|
49e515d9ba | ||
|
|
fb1b7c9060 | ||
|
|
f39b4a8582 | ||
|
|
06ceb7da90 | ||
|
|
934b4388cb | ||
|
|
055710e95a | ||
|
|
12e6c6d95f | ||
|
|
cd11446263 | ||
|
|
844c90a395 | ||
|
|
f9ee6d3d9e | ||
|
|
2d73699721 | ||
|
|
4caca1d6eb | ||
|
|
64595cc959 | ||
|
|
fb49473192 | ||
|
|
5c6ec3c7bf | ||
|
|
a86833cc06 | ||
|
|
dc1ff44e37 | ||
|
|
ed235cf8b7 | ||
|
|
adb0cb5c01 | ||
|
|
964d412062 | ||
|
|
3cb5d4790a | ||
|
|
a6faca14b7 | ||
|
|
4bbf5a04ed | ||
|
|
99a15a90c7 | ||
|
|
b7e1d6a196 | ||
|
|
7d884d8e7b | ||
|
|
106d6a77ce | ||
|
|
d10a337f00 | ||
|
|
43b21ea95f | ||
|
|
42bb3ed035 | ||
|
|
e88d05b9a5 | ||
|
|
5771743122 | ||
|
|
dbe6bdca91 | ||
|
|
ed101fb57d | ||
|
|
d689414621 | ||
|
|
05729165c3 | ||
|
|
192c93ce8e | ||
|
|
1fbcdd2102 | ||
|
|
474aa9fbdf | ||
|
|
37fb4ddb51 | ||
|
|
242cb5ca83 | ||
|
|
f9f1414172 | ||
|
|
4f005f63d5 | ||
|
|
53584a7dfd | ||
|
|
1784f408bc | ||
|
|
811b353f22 | ||
|
|
a94cc66d1c | ||
|
|
c5f264a8e0 | ||
|
|
e78a9cc5d7 | ||
|
|
eb9ce1f481 | ||
|
|
c0c2b6916e | ||
|
|
57edb51964 | ||
|
|
3d1401d458 | ||
|
|
bd7cb92852 | ||
|
|
18e00ac0a3 | ||
|
|
1bc1289953 | ||
|
|
6adaa2c394 | ||
|
|
ac1f6d72cd | ||
|
|
fe130827b6 | ||
|
|
c43d9ad351 | ||
|
|
568e301e46 | ||
|
|
a47cc80ad9 | ||
|
|
3f12d0f2e7 | ||
|
|
aa431db411 | ||
|
|
f36bc79e87 | ||
|
|
e763001682 | ||
|
|
53da694542 | ||
|
|
3af0eb20a0 | ||
|
|
5c46b61769 | ||
|
|
0752ba8bc9 | ||
|
|
c5790584df | ||
|
|
bc015f22c9 | ||
|
|
f02b9373c0 | ||
|
|
c2ed94ed04 | ||
|
|
86d9796c17 | ||
|
|
21c10baabc | ||
|
|
00f74e44b3 | ||
|
|
43ae28411d | ||
|
|
a69c752d39 | ||
|
|
72cee8e34f | ||
|
|
62a7f935b8 | ||
|
|
be955c576f | ||
|
|
691a5a5314 | ||
|
|
30291f81e3 | ||
|
|
72c4458108 | ||
|
|
71f5acedf9 | ||
|
|
86cb47ea9c | ||
|
|
544a3a93a9 | ||
|
|
d126bace5f | ||
|
|
f5e96952d8 | ||
|
|
eb1ef0b37b | ||
|
|
56b6d7b555 | ||
|
|
dd9ab596d2 | ||
|
|
83f57e0381 | ||
|
|
3fe419e7a2 | ||
|
|
f334499cec | ||
|
|
ed253b36ee | ||
|
|
bb41e69096 | ||
|
|
f193a2ca40 | ||
|
|
a67ba9a314 | ||
|
|
34b94f143e | ||
|
|
23390048f0 | ||
|
|
4d518b1a2e | ||
|
|
41806af161 | ||
|
|
b71a29c587 | ||
|
|
fb9c8f841f | ||
|
|
1d03836951 | ||
|
|
bec22b1ce4 | ||
|
|
dd1cedd5ca | ||
|
|
9c999b3d71 | ||
|
|
1bb515dc2c | ||
|
|
d89eed693b | ||
|
|
fa002563bc | ||
|
|
b605fd9ec6 | ||
|
|
3d77a3087c | ||
|
|
d7f9043378 | ||
|
|
e4c4689c3e | ||
|
|
783a4a7d74 | ||
|
|
2a6153f007 | ||
|
|
9f3f7701f8 | ||
|
|
e70afa0c54 | ||
|
|
c213d9392c | ||
|
|
5985d044b1 | ||
|
|
9905ed2b05 | ||
|
|
0b81ec337c | ||
|
|
e0fb69cfc4 | ||
|
|
58b07a4f2c | ||
|
|
0ed61df9d5 | ||
|
|
de9cf6516f | ||
|
|
24440f1df2 | ||
|
|
fd4fb6bddc | ||
|
|
3bfd4173a2 | ||
|
|
8dc6530c67 | ||
|
|
a032a7e82a | ||
|
|
f44cd6f30e | ||
|
|
3dcb8f933f | ||
|
|
5d2bb8b8d5 | ||
|
|
2721e6afa7 | ||
|
|
77b892c26e | ||
|
|
b89c43519a | ||
|
|
54175c5fe6 | ||
|
|
3df45d6dd8 | ||
|
|
453d7c8e4d | ||
|
|
c959af2365 | ||
|
|
827b7998f9 | ||
|
|
819a2fc1fd | ||
|
|
605682b3c8 | ||
|
|
44a43188a6 | ||
|
|
452e8a0660 | ||
|
|
b5e60437a0 | ||
|
|
be71676a11 | ||
|
|
2ea4681ff1 | ||
|
|
76cde0e16e | ||
|
|
8a06e8c6c7 | ||
|
|
09d7728c0a | ||
|
|
618fe005e6 | ||
|
|
205b621002 | ||
|
|
b866eac68f | ||
|
|
9c65107094 | ||
|
|
d3b47d4b2c | ||
|
|
f1d78e3ef5 | ||
|
|
b1cf064c35 | ||
|
|
590f13da18 | ||
|
|
a30a24dc0b | ||
|
|
d1ded86a63 | ||
|
|
205c2235fa | ||
|
|
0e1a181b47 | ||
|
|
5a673f727c | ||
|
|
32562cac4e | ||
|
|
79100113a7 | ||
|
|
1491b7a07d | ||
|
|
28b6e435bf | ||
|
|
3eec585f05 | ||
|
|
ea0d37a507 | ||
|
|
4f2d14d7da | ||
|
|
14a77654c1 | ||
|
|
254485dbea | ||
|
|
bd30c3c17c | ||
|
|
e4f620f894 | ||
|
|
f096c0ca6f | ||
|
|
fad7db9695 | ||
|
|
aa6046f941 | ||
|
|
401f3711f6 | ||
|
|
e672133aa8 | ||
|
|
c1a5d08fe1 | ||
|
|
20c3de56d5 | ||
|
|
f8113293d3 | ||
|
|
f4166f11e9 | ||
|
|
7f4ff662fe | ||
|
|
37461bd51f | ||
|
|
653273f34f | ||
|
|
361b97226e | ||
|
|
96a9a83f15 | ||
|
|
c622d74952 | ||
|
|
496133babd | ||
|
|
2c7866cf8b | ||
|
|
e00cf495f7 | ||
|
|
c10647f7f0 | ||
|
|
cac350dc27 | ||
|
|
83fa61ef7b | ||
|
|
8fbfb292d0 | ||
|
|
3e13ac26e9 | ||
|
|
8aa98687fa | ||
|
|
131f5cfce2 | ||
|
|
3f9001850e | ||
|
|
4462ee40ec | ||
|
|
eb13b12855 | ||
|
|
1206b0c1e7 | ||
|
|
9e14a25a81 | ||
|
|
ce1bd6d110 | ||
|
|
8c5a1a03db | ||
|
|
0d10b7dead | ||
|
|
231b8e147f | ||
|
|
000eaf4a5a | ||
|
|
20d1c8d5d0 | ||
|
|
ec92b77e22 | ||
|
|
408a8dfead | ||
|
|
9080907ed7 | ||
|
|
3757566d4f | ||
|
|
8b4e565285 | ||
|
|
6277583f69 | ||
|
|
beb3b6b44a | ||
|
|
8b416f0334 | ||
|
|
9d277028e5 | ||
|
|
2b411094db | ||
|
|
a618edb5dd | ||
|
|
5064f0781f | ||
|
|
7ed66b20e5 | ||
|
|
910cb1be81 | ||
|
|
9a78224278 | ||
|
|
718a1eb400 | ||
|
|
c325305a7c | ||
|
|
3c612c6432 | ||
|
|
abd6206fee | ||
|
|
016b308031 | ||
|
|
de30eedb5e | ||
|
|
fe8b66a4fe | ||
|
|
5819639209 | ||
|
|
5ba7dbb89f | ||
|
|
edd5bf9267 | ||
|
|
e3f5063ec2 | ||
|
|
3e348ed92f | ||
|
|
8a0805cd3a | ||
|
|
8a7354d1fd | ||
|
|
9d5d693cf6 | ||
|
|
c808eacefb | ||
|
|
454666e36c | ||
|
|
a0ab5d239e | ||
|
|
5b2f73c7ac | ||
|
|
324eb12388 | ||
|
|
ca6c23c5db | ||
|
|
e5876039bb | ||
|
|
d8a09a7c5b | ||
|
|
4edfec2b6c | ||
|
|
4756d3234b | ||
|
|
29b19d979f | ||
|
|
529a68d134 | ||
|
|
8251af93d9 | ||
|
|
730634bbb4 | ||
|
|
b8ef38a0e2 | ||
|
|
58c70caf41 | ||
|
|
85ca6a5fb7 | ||
|
|
f07d389ef2 | ||
|
|
c3a9018ac4 | ||
|
|
72ff5105ef | ||
|
|
1fd19dc38d | ||
|
|
911042faeb | ||
|
|
9ecbb3cfd1 | ||
|
|
fc7bb77cd5 | ||
|
|
5336747ece | ||
|
|
7662c57e57 | ||
|
|
474f6007e2 | ||
|
|
ea25cdd7b7 | ||
|
|
4d65bfe327 | ||
|
|
e2ecf549e1 | ||
|
|
8daa261b97 | ||
|
|
5065f8bcb8 | ||
|
|
6fa911f091 | ||
|
|
6ac350d1b8 | ||
|
|
c998e8137e | ||
|
|
c104474c3c | ||
|
|
0555ad1f5d | ||
|
|
2671926476 | ||
|
|
30d72b04b5 | ||
|
|
663b247700 | ||
|
|
f2135637e9 | ||
|
|
4f8ae68563 | ||
|
|
5933b60dc0 | ||
|
|
05e13601c9 | ||
|
|
af5e1c0364 | ||
|
|
0b1db2afae | ||
|
|
30c35d4330 | ||
|
|
61aa311e62 | ||
|
|
8a010b513e | ||
|
|
29b1a4e97d | ||
|
|
e57cb388e2 | ||
|
|
fa742989b5 | ||
|
|
72f7116854 | ||
|
|
8c5aad339d | ||
|
|
6cd5cc0fa0 | ||
|
|
33f08d0231 | ||
|
|
20120ecff3 | ||
|
|
53b34e0e34 | ||
|
|
4ac3fdc8d9 | ||
|
|
9363eaae3d | ||
|
|
1c1401787a | ||
|
|
902167c255 | ||
|
|
12cb33af5d | ||
|
|
a810e44570 | ||
|
|
8ec3b47402 | ||
|
|
f893cc65e1 | ||
|
|
98e8dede11 | ||
|
|
c87a849a3e | ||
|
|
3d343076ee | ||
|
|
86733d3b4f | ||
|
|
1b7d024e5c | ||
|
|
cfafb32049 | ||
|
|
c68550c45d | ||
|
|
74d82d0cb7 | ||
|
|
4e98e2d832 | ||
|
|
0d03789fb9 | ||
|
|
a8677aafbc | ||
|
|
4f9949dc2a | ||
|
|
05d1e6d88f | ||
|
|
5fcc8ca854 | ||
|
|
760add1c63 | ||
|
|
35d8b9408e | ||
|
|
e1e8ee1924 | ||
|
|
15c658f21f | ||
|
|
58269f1769 | ||
|
|
b736409e52 | ||
|
|
dd955a3b41 | ||
|
|
c5c68f4d36 |
No files matched your search
@@ -1,542 +0,0 @@
|
||||
define ____executor_globals
|
||||
if basic_functions_module.zts
|
||||
set $tsrm_ls = ts_resource_ex(0, 0)
|
||||
set $eg = ((zend_executor_globals) (*((void ***) $tsrm_ls))[executor_globals_id-1])
|
||||
else
|
||||
set $eg = executor_globals
|
||||
end
|
||||
end
|
||||
|
||||
document ____executor_globals
|
||||
portable way of accessing executor_globals, set $eg
|
||||
ZTS detection is automatically based on ext/standard module struct
|
||||
end
|
||||
|
||||
define dump_bt
|
||||
set $t = $arg0
|
||||
while $t
|
||||
printf "[0x%08x] ", $t
|
||||
if $t->function_state.function->common.function_name
|
||||
printf "%s() ", $t->function_state.function->common.function_name
|
||||
else
|
||||
printf "??? "
|
||||
end
|
||||
if $t->op_array != 0
|
||||
printf "%s:%d ", $t->op_array->filename, $t->opline->lineno
|
||||
end
|
||||
set $t = $t->prev_execute_data
|
||||
printf "\n"
|
||||
end
|
||||
end
|
||||
|
||||
document dump_bt
|
||||
dumps the current execution stack. usage: dump_bt executor_globals.current_execute_data
|
||||
end
|
||||
|
||||
define printzv
|
||||
set $ind = 1
|
||||
____printzv $arg0 0
|
||||
end
|
||||
|
||||
document printzv
|
||||
prints zval contents
|
||||
end
|
||||
|
||||
define ____printzv_contents
|
||||
set $zvalue = $arg0
|
||||
set $type = $zvalue->type
|
||||
|
||||
printf "(refcount=%d", $zvalue->refcount
|
||||
if $zvalue->is_ref
|
||||
printf ",is_ref"
|
||||
end
|
||||
printf ") "
|
||||
if $type == 0
|
||||
printf "NULL"
|
||||
end
|
||||
if $type == 1
|
||||
printf "long: %ld", $zvalue->value.lval
|
||||
end
|
||||
if $type == 2
|
||||
printf "double: %lf", $zvalue->value.dval
|
||||
end
|
||||
if $type == 3
|
||||
printf "bool: "
|
||||
if $zvalue->value.lval
|
||||
printf "true"
|
||||
else
|
||||
printf "false"
|
||||
end
|
||||
end
|
||||
if $type == 4
|
||||
printf "array(%d): ", $zvalue->value.ht->nNumOfElements
|
||||
if ! $arg1
|
||||
printf "{\n"
|
||||
set $ind = $ind + 1
|
||||
____print_ht $zvalue->value.ht 1
|
||||
set $ind = $ind - 1
|
||||
set $i = $ind
|
||||
while $i > 0
|
||||
printf " "
|
||||
set $i = $i - 1
|
||||
end
|
||||
printf "}"
|
||||
end
|
||||
set $type = 0
|
||||
end
|
||||
if $type == 5
|
||||
printf "object"
|
||||
____executor_globals
|
||||
set $handle = $zvalue->value.obj.handle
|
||||
set $handlers = $zvalue->value.obj.handlers
|
||||
if basic_functions_module.zts
|
||||
set $zobj = zend_objects_get_address($zvalue, $tsrm_ls)
|
||||
else
|
||||
set $zobj = zend_objects_get_address($zvalue)
|
||||
end
|
||||
if $handlers->get_class_entry == &zend_std_object_get_class
|
||||
set $cname = $zobj->ce.name
|
||||
else
|
||||
set $cname = "Unknown"
|
||||
end
|
||||
printf "(%s) #%d", $cname, $handle
|
||||
if ! $arg1
|
||||
if $handlers->get_properties == &zend_std_get_properties
|
||||
set $ht = $zobj->properties
|
||||
if $ht
|
||||
printf "(%d): ", $ht->nNumOfElements
|
||||
printf "{\n"
|
||||
set $ind = $ind + 1
|
||||
____print_ht $ht 1
|
||||
set $ind = $ind - 1
|
||||
set $i = $ind
|
||||
while $i > 0
|
||||
printf " "
|
||||
set $i = $i - 1
|
||||
end
|
||||
printf "}"
|
||||
else
|
||||
echo "no properties found"
|
||||
end
|
||||
end
|
||||
end
|
||||
set $type = 0
|
||||
end
|
||||
if $type == 6
|
||||
printf "string(%d): ", $zvalue->value.str.len
|
||||
____print_str $zvalue->value.str.val $zvalue->value.str.len
|
||||
end
|
||||
if $type == 7
|
||||
printf "resource: #%d", $zvalue->value.lval
|
||||
end
|
||||
if $type == 8
|
||||
printf "constant"
|
||||
end
|
||||
if $type == 9
|
||||
printf "const_array"
|
||||
end
|
||||
if $type > 9
|
||||
printf "unknown type %d", $type
|
||||
end
|
||||
printf "\n"
|
||||
end
|
||||
|
||||
define ____printzv
|
||||
____executor_globals
|
||||
set $zvalue = $arg0
|
||||
|
||||
printf "[0x%08x] ", $zvalue
|
||||
|
||||
if $zvalue == $eg.uninitialized_zval_ptr
|
||||
printf "*uninitialized* "
|
||||
end
|
||||
|
||||
set $zcontents = (zval*) $zvalue
|
||||
if $arg1
|
||||
____printzv_contents $zcontents $arg1
|
||||
else
|
||||
____printzv_contents $zcontents 0
|
||||
end
|
||||
end
|
||||
|
||||
define ____print_const_table
|
||||
set $ht = $arg0
|
||||
set $p = $ht->pListHead
|
||||
|
||||
while $p != 0
|
||||
set $const = (zend_constant *) $p->pData
|
||||
|
||||
set $i = $ind
|
||||
while $i > 0
|
||||
printf " "
|
||||
set $i = $i - 1
|
||||
end
|
||||
|
||||
if $p->nKeyLength > 0
|
||||
____print_str $p->arKey $p->nKeyLength
|
||||
printf " => "
|
||||
else
|
||||
printf "%d => ", $p->h
|
||||
end
|
||||
|
||||
____printzv_contents &$const->value 0
|
||||
set $p = $p->pListNext
|
||||
end
|
||||
end
|
||||
|
||||
define print_const_table
|
||||
set $ind = 1
|
||||
printf "[0x%08x] {\n", $arg0
|
||||
____print_const_table $arg0
|
||||
printf "}\n"
|
||||
end
|
||||
|
||||
define ____print_ht
|
||||
set $ht = (HashTable*)$arg0
|
||||
set $p = $ht->pListHead
|
||||
|
||||
while $p != 0
|
||||
set $i = $ind
|
||||
while $i > 0
|
||||
printf " "
|
||||
set $i = $i - 1
|
||||
end
|
||||
|
||||
if $p->nKeyLength > 0
|
||||
____print_str $p->arKey $p->nKeyLength
|
||||
printf " => "
|
||||
else
|
||||
printf "%d => ", $p->h
|
||||
end
|
||||
|
||||
if $arg1 == 0
|
||||
printf "%p\n", (void*)$p->pData
|
||||
end
|
||||
if $arg1 == 1
|
||||
set $zval = *(zval **)$p->pData
|
||||
____printzv $zval 1
|
||||
end
|
||||
if $arg1 == 2
|
||||
printf "%s\n", (char*)$p->pData
|
||||
end
|
||||
|
||||
set $p = $p->pListNext
|
||||
end
|
||||
end
|
||||
|
||||
define print_ht
|
||||
set $ind = 1
|
||||
printf "[0x%08x] {\n", $arg0
|
||||
____print_ht $arg0 1
|
||||
printf "}\n"
|
||||
end
|
||||
|
||||
document print_ht
|
||||
dumps elements of HashTable made of zval
|
||||
end
|
||||
|
||||
define print_htptr
|
||||
set $ind = 1
|
||||
printf "[0x%08x] {\n", $arg0
|
||||
____print_ht $arg0 0
|
||||
printf "}\n"
|
||||
end
|
||||
|
||||
document print_htptr
|
||||
dumps elements of HashTable made of pointers
|
||||
end
|
||||
|
||||
define print_htstr
|
||||
set $ind = 1
|
||||
printf "[0x%08x] {\n", $arg0
|
||||
____print_ht $arg0 2
|
||||
printf "}\n"
|
||||
end
|
||||
|
||||
document print_htstr
|
||||
dumps elements of HashTable made of strings
|
||||
end
|
||||
|
||||
define ____print_ft
|
||||
set $ht = $arg0
|
||||
set $p = $ht->pListHead
|
||||
|
||||
while $p != 0
|
||||
set $func = (zend_function*)$p->pData
|
||||
|
||||
set $i = $ind
|
||||
while $i > 0
|
||||
printf " "
|
||||
set $i = $i - 1
|
||||
end
|
||||
|
||||
if $p->nKeyLength > 0
|
||||
____print_str $p->arKey $p->nKeyLength
|
||||
printf " => "
|
||||
else
|
||||
printf "%d => ", $p->h
|
||||
end
|
||||
|
||||
printf "\"%s\"\n", $func->common.function_name
|
||||
set $p = $p->pListNext
|
||||
end
|
||||
end
|
||||
|
||||
define print_ft
|
||||
set $ind = 1
|
||||
printf "[0x%08x] {\n", $arg0
|
||||
____print_ft $arg0
|
||||
printf "}\n"
|
||||
end
|
||||
|
||||
document print_ft
|
||||
dumps a function table (HashTable)
|
||||
end
|
||||
|
||||
define ____print_inh_class
|
||||
set $ce = $arg0
|
||||
if $ce->ce_flags & 0x10 || $ce->ce_flags & 0x20
|
||||
printf "abstract "
|
||||
else
|
||||
if $ce->ce_flags & 0x40
|
||||
printf "final "
|
||||
end
|
||||
end
|
||||
printf "class %s", $ce->name
|
||||
if $ce->parent != 0
|
||||
printf " extends %s", $ce->parent->name
|
||||
end
|
||||
if $ce->num_interfaces != 0
|
||||
printf " implements"
|
||||
set $tmp = 0
|
||||
while $tmp < $ce->num_interfaces
|
||||
printf " %s", $ce->interfaces[$tmp]->name
|
||||
set $tmp = $tmp + 1
|
||||
if $tmp < $ce->num_interfaces
|
||||
printf ","
|
||||
end
|
||||
end
|
||||
end
|
||||
set $ce = $ce->parent
|
||||
end
|
||||
|
||||
define ____print_inh_iface
|
||||
set $ce = $arg0
|
||||
printf "interface %s", $ce->name
|
||||
if $ce->num_interfaces != 0
|
||||
set $ce = $ce->interfaces[0]
|
||||
printf " extends %s", $ce->name
|
||||
else
|
||||
set $ce = 0
|
||||
end
|
||||
end
|
||||
|
||||
define print_inh
|
||||
set $ce = $arg0
|
||||
set $depth = 0
|
||||
while $ce != 0
|
||||
set $tmp = $depth
|
||||
while $tmp != 0
|
||||
printf " "
|
||||
set $tmp = $tmp - 1
|
||||
end
|
||||
set $depth = $depth + 1
|
||||
if $ce->ce_flags & 0x80
|
||||
____print_inh_iface $ce
|
||||
else
|
||||
____print_inh_class $ce
|
||||
end
|
||||
printf " {\n"
|
||||
end
|
||||
while $depth != 0
|
||||
set $tmp = $depth
|
||||
while $tmp != 1
|
||||
printf " "
|
||||
set $tmp = $tmp - 1
|
||||
end
|
||||
printf "}\n"
|
||||
set $depth = $depth - 1
|
||||
end
|
||||
end
|
||||
|
||||
define print_pi
|
||||
set $pi = $arg0
|
||||
printf "[0x%08x] {\n", $pi
|
||||
printf " h = %lu\n", $pi->h
|
||||
printf " flags = %d (", $pi->flags
|
||||
if $pi->flags & 0x100
|
||||
printf "ZEND_ACC_PUBLIC"
|
||||
else
|
||||
if $pi->flags & 0x200
|
||||
printf "ZEND_ACC_PROTECTED"
|
||||
else
|
||||
if $pi->flags & 0x400
|
||||
printf "ZEND_ACC_PRIVATE"
|
||||
else
|
||||
if $pi->flags & 0x800
|
||||
printf "ZEND_ACC_CHANGED"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
printf ")\n"
|
||||
printf " name = "
|
||||
____print_str $pi->name $pi->name_length
|
||||
printf "\n}\n"
|
||||
end
|
||||
|
||||
define ____print_str
|
||||
set $tmp = 0
|
||||
set $str = $arg0
|
||||
printf "\""
|
||||
while $tmp < $arg1
|
||||
if $str[$tmp] > 32 && $str[$tmp] < 127
|
||||
printf "%c", $str[$tmp]
|
||||
else
|
||||
printf "\\%o", $str[$tmp]
|
||||
end
|
||||
set $tmp = $tmp + 1
|
||||
end
|
||||
printf "\""
|
||||
end
|
||||
|
||||
define printzn
|
||||
____executor_globals
|
||||
set $ind = 0
|
||||
set $znode = $arg0
|
||||
if $znode->op_type == 1
|
||||
set $optype = "IS_CONST"
|
||||
end
|
||||
if $znode->op_type == 2
|
||||
set $optype = "IS_TMP_VAR"
|
||||
end
|
||||
if $znode->op_type == 4
|
||||
set $optype = "IS_VAR"
|
||||
end
|
||||
if $znode->op_type == 8
|
||||
set $optype = "IS_UNUSED"
|
||||
end
|
||||
|
||||
printf "[0x%08x] %s", $znode, $optype
|
||||
|
||||
if $znode->op_type == 1
|
||||
printf ": "
|
||||
____printzv &$znode->u.constant 0
|
||||
end
|
||||
if $znode->op_type == 2
|
||||
printf ": "
|
||||
set $tvar = (union _temp_variable *)((char *)$eg.current_execute_data->Ts + $znode->u.var)
|
||||
____printzv ((union _temp_variable *)$tvar)->tmp_var 0
|
||||
end
|
||||
if $znode->op_type == 4
|
||||
printf ": "
|
||||
set $tvar = (union _temp_variable *)((char *)$eg.current_execute_data->Ts + $znode->u.var)
|
||||
____printzv *$tvar->var.ptr_ptr 0
|
||||
end
|
||||
if $znode->op_type == 8
|
||||
printf "\n"
|
||||
end
|
||||
end
|
||||
|
||||
document printzn
|
||||
print type and content of znode.
|
||||
usage: printzn &opline->op1
|
||||
end
|
||||
|
||||
define printzops
|
||||
printf "op1 => "
|
||||
printzn &execute_data->opline.op1
|
||||
printf "op2 => "
|
||||
printzn &execute_data->opline.op2
|
||||
printf "result => "
|
||||
printzn &execute_data->opline.result
|
||||
end
|
||||
|
||||
document printzops
|
||||
dump operands of the current opline
|
||||
end
|
||||
|
||||
define zbacktrace
|
||||
____executor_globals
|
||||
dump_bt $eg.current_execute_data
|
||||
end
|
||||
|
||||
document zbacktrace
|
||||
prints backtrace.
|
||||
This command is almost a short cut for
|
||||
> (gdb) ____executor_globals
|
||||
> (gdb) dump_bt $eg.current_execute_data
|
||||
end
|
||||
|
||||
define zmemcheck
|
||||
set $p = alloc_globals.head
|
||||
set $stat = "?"
|
||||
set $total_size = 0
|
||||
if $arg0 != 0
|
||||
set $not_found = 1
|
||||
else
|
||||
set $not_found = 0
|
||||
end
|
||||
printf " block size status file:line\n"
|
||||
printf "-------------------------------------------------------------------------------\n"
|
||||
while $p
|
||||
set $aptr = $p + sizeof(struct _zend_mem_header) + sizeof(align_test)
|
||||
if $arg0 == 0 || (void *)$aptr == (void *)$arg0
|
||||
if $p->magic == 0x7312f8dc
|
||||
set $stat = "OK"
|
||||
end
|
||||
if $p->magic == 0x99954317
|
||||
set $stat = "FREED"
|
||||
end
|
||||
if $p->magic == 0xfb8277dc
|
||||
set $stat = "CACHED"
|
||||
end
|
||||
set $filename = strrchr($p->filename, '/')
|
||||
if !$filename
|
||||
set $filename = $p->filename
|
||||
else
|
||||
set $filename = $filename + 1
|
||||
end
|
||||
printf " 0x%08x ", $aptr
|
||||
if $p->size == sizeof(struct _zval_struct) && ((struct _zval_struct *)$aptr)->type >= 0 && ((struct _zval_struct *)$aptr)->type < 10
|
||||
printf "ZVAL?(%-2d) ", $p->size
|
||||
else
|
||||
printf "%-9d ", $p->size
|
||||
end
|
||||
set $total_size = $total_size + $p->size
|
||||
printf "%-06s %s:%d", $stat, $filename, $p->lineno
|
||||
if $p->orig_filename
|
||||
set $orig_filename = strrchr($p->orig_filename, '/')
|
||||
if !$orig_filename
|
||||
set $orig_filename = $p->orig_filename
|
||||
else
|
||||
set $orig_filename = $orig_filename + 1
|
||||
end
|
||||
printf " <= %s:%d\n", $orig_filename, $p->orig_lineno
|
||||
else
|
||||
printf "\n"
|
||||
end
|
||||
if $arg0 != 0
|
||||
set $p = 0
|
||||
set $not_found = 0
|
||||
else
|
||||
set $p = $p->pNext
|
||||
end
|
||||
else
|
||||
set $p = $p->pNext
|
||||
end
|
||||
end
|
||||
if $not_found
|
||||
printf "no such block that begins at 0x%08x.\n", $aptr
|
||||
end
|
||||
if $arg0 == 0
|
||||
printf "-------------------------------------------------------------------------------\n"
|
||||
printf " total: %d bytes\n", $total_size
|
||||
end
|
||||
end
|
||||
|
||||
document zmemcheck
|
||||
show status of a memory block.
|
||||
usage: zmemcheck [ptr].
|
||||
if ptr is 0, all blocks will be listed.
|
||||
end
|
||||
+24
-78
@@ -13,8 +13,6 @@ these rules.
|
||||
Code Implementation
|
||||
-------------------
|
||||
|
||||
[0] Document your code in source files and the manual. [tm]
|
||||
|
||||
[1] Functions that are given pointers to resources should not free them
|
||||
|
||||
For instance, function int mail(char *to, char *from) should NOT free
|
||||
@@ -48,38 +46,23 @@ Exceptions:
|
||||
doing so, should return that new length, so it doesn't have to be
|
||||
recalculated with strlen() (e.g. php_addslashes())
|
||||
|
||||
[5] NEVER USE strncat(). If you're absolutely sure you know what you're doing,
|
||||
[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.
|
||||
|
||||
[6] Use PHP_* macros in the PHP source, and ZEND_* macros in the Zend
|
||||
part of the source. Although the PHP_* macro's are mostly aliased to the
|
||||
ZEND_* macros it gives a better understanding on what kind of macro you're
|
||||
calling.
|
||||
|
||||
[7] When commenting out code using a #if statement, do NOT use 0 only. Instead
|
||||
use "<cvs username here>_0". For example, #if FOO_0, where FOO is your
|
||||
cvs user foo. This allows easier tracking of why code was commented out,
|
||||
especially in bundled libraries.
|
||||
|
||||
[8] Do not define functions that are not available. For instance, if a
|
||||
library is missing a function, do not define the PHP version of the
|
||||
function, and do not raise a run-time error about the function not
|
||||
existing. End users should use function_exists() to test for the
|
||||
existence of a function
|
||||
|
||||
[9] Prefer emalloc(), efree(), estrdup(), etc. to their standard C library
|
||||
counterparts. These functions implement an internal "safety-net"
|
||||
mechanism that ensures the deallocation of any unfreed memory at the
|
||||
end of a request. They also provide useful allocation and overflow
|
||||
information while running in debug mode.
|
||||
|
||||
In almost all cases, memory returned to the engine must be allocated
|
||||
using emalloc().
|
||||
|
||||
The use of malloc() should be limited to cases where a third-party
|
||||
library may need to control or free the memory, or when the memory in
|
||||
question needs to survive between multiple requests.
|
||||
[7] Use ZEND_* macro instead of PHP_* macro. Use of PHP_* macros are
|
||||
not recommended. Since most of PHP_* macros are ZEND_* macro alias, use of
|
||||
PHP_* macro makes browsing source with tag search harder.
|
||||
|
||||
Naming Conventions
|
||||
------------------
|
||||
@@ -104,7 +87,8 @@ Naming Conventions
|
||||
'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
|
||||
@@ -125,7 +109,7 @@ Naming Conventions
|
||||
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++) ...).
|
||||
@@ -133,34 +117,6 @@ Naming Conventions
|
||||
[5] Variable names should be in lowercase. Use underscores to separate
|
||||
between words.
|
||||
|
||||
[6] Method names follow the 'studlyCaps' (also referred to as 'bumpy case'
|
||||
or 'camel caps') naming convention, with care taken to minimize the
|
||||
letter count. The initial letter of the name is lowercase, and each
|
||||
letter that starts a new 'word' is capitalized.
|
||||
|
||||
Good:
|
||||
'connect()'
|
||||
'getData()'
|
||||
'buildSomeWidget()'
|
||||
|
||||
Bad:
|
||||
'get_Data()'
|
||||
'buildsomewidget'
|
||||
'getI()'
|
||||
|
||||
[7] Classes should be given descriptive names. Avoid using abbreviations where
|
||||
possible. Each word in the class name should start with a capital letter,
|
||||
without underscore delimiters (CampelCaps starting with a capital letter).
|
||||
The class name should be prefixed with the name of the 'parent set' (e.g.
|
||||
the name of the extension).
|
||||
|
||||
Good:
|
||||
'Curl'
|
||||
'FooBar'
|
||||
|
||||
Bad:
|
||||
'foobar'
|
||||
'foo_bar'
|
||||
|
||||
Syntax and indentation
|
||||
----------------------
|
||||
@@ -182,17 +138,17 @@ Syntax and indentation
|
||||
indentation and comment styles and up to function declaration
|
||||
syntax.
|
||||
|
||||
(see also http://www.catb.org/~esr/jargon/html/I/indent-style.html)
|
||||
(see also http://www.tuxedo.org/~esr/jargon/html/entry/indent-style.html)
|
||||
|
||||
[3] Be generous with whitespace and braces. Always prefer:
|
||||
|
||||
if (foo) {
|
||||
bar;
|
||||
}
|
||||
if (foo) {
|
||||
bar;
|
||||
}
|
||||
|
||||
to:
|
||||
to:
|
||||
|
||||
if(foo)bar;
|
||||
if(foo)bar;
|
||||
|
||||
Keep one empty line between the variable declaration section and
|
||||
the statements in a block, as well as between logical statement
|
||||
@@ -203,16 +159,6 @@ Syntax and indentation
|
||||
four spaces. It is important to maintain consistency in indenture so
|
||||
that definitions, comments, and control structures line up correctly.
|
||||
|
||||
[5] Preprocessor statements (#if and such) MUST start at column one. To
|
||||
indent preprocessor directives you should put the # at the beginning
|
||||
of a line, followed by any number of whitespace.
|
||||
|
||||
Testing
|
||||
-------
|
||||
|
||||
[1] Extensions should be well tested using *.phpt tests. Read about that
|
||||
in README.TESTING.
|
||||
|
||||
Documentation and Folding Hooks
|
||||
-------------------------------
|
||||
|
||||
@@ -256,7 +202,7 @@ 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 labeled 'EXPERIMENTAL' should include the following
|
||||
The file labelled 'EXPERIMENTAL' should include the following
|
||||
information:
|
||||
Any authoring information (known bugs, future directions of the module).
|
||||
Ongoing status notes which may not be appropriate for CVS comments.
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
For the list of people who've put work into PHP, please see
|
||||
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.
Binary file not shown.
+198
-254
@@ -36,56 +36,22 @@ PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: apache_hooks
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: apache2filter
|
||||
PRIMARY MAINTAINER: Aaron Bannert <aaron@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: apache2handler
|
||||
PRIMARY MAINTAINER: Aaron Bannert <aaron@php.net>, Ilia Alshanetsky <iliaa@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: caudium
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: cgi
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: cli
|
||||
MAINTENANCE: Marcus Boerger <helly@php.net>, Edin Kadribasic <edink@php.net>
|
||||
STATUS: Working
|
||||
SINCE: 4.3.0
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: continuity
|
||||
PRIMARY MAINTAINER: Alex Leigh <aleigh@php.net>
|
||||
EXTENSION: fhttpd
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: embed
|
||||
PRIMARY MAINTAINER: Edin Kadribasic <edink@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: isapi
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: milter
|
||||
EXTENSION: nsapi
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: nsapi
|
||||
PRIMARY MAINTAINER: Uwe Schindler <thetaphi@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: phttpd
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
@@ -98,12 +64,12 @@ EXTENSION: roxen
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: thttpd
|
||||
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
|
||||
MAINTENANCE: Odd fixes
|
||||
EXTENSION: servlet
|
||||
PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: tux
|
||||
EXTENSION: thttpd
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -118,29 +84,57 @@ STATUS: Experimental
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: dba
|
||||
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>
|
||||
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
COMMENT: DBM abstraction for db2, db3, db4, dbm, ndbm, gdbm, ini
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: dbase
|
||||
MAINTENANCE: Orphaned
|
||||
PRIMARY MAINTAINER: Jim Winstead <jimw@php.net>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: fbsql
|
||||
PRIMARY MAINTAINER: Frank M. Kromann <fmk@swwwing.com>
|
||||
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 and more, see documentation
|
||||
-------------------------------------------------------------------------------
|
||||
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: Ard Biesheuvel <ard@ard.nu>, Jouni Ahto <jouni.ahto@exdec.fi>
|
||||
MAINTENANCE: Odd fixes
|
||||
PRIMARY MAINTAINER: Jouni Ahto <jouni.ahto@exdec.fi>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: msql
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: msession
|
||||
PRIMARY MAINTAINER Mark L. Woodward mlwmohawk@mohawksoft.com
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working/Experimental
|
||||
COMMENT: Tested on Linux, should work on other UNIX platforms. Backend server code can compile under Windows.
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mssql
|
||||
PRIMARY MAINTAINER: Frank M. Kromann <fmk@swwwing.com>
|
||||
MAINTENANCE: Maintained
|
||||
@@ -148,88 +142,15 @@ STATUS: Working
|
||||
COMMENT: Tested on phpts and isapi versions
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mysql
|
||||
PRIMARY MAINTAINER: Zak Greant <zak@mysql.com>, Georg Richter <georg@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mysqli
|
||||
PRIMARY MAINTAINER: Georg Richter <georg@php.net>, Andrey Hristov <andrey@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 5.0
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: oci8
|
||||
PRIMARY MAINTAINER: Christopher Jones <sixd@php.net>, Antony Dovgal <tony2001@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: odbc
|
||||
PRIMARY MAINTAINER: Daniel R. Kalowsky <kalowsky@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
COMMENT: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pdo
|
||||
PRIMARY MAINTAINER: Unknown
|
||||
MAINTENANCE: Odd fixes
|
||||
STATUS: Working
|
||||
SINCE: 5.1
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pdo_dblib
|
||||
PRIMARY MAINTAINER: Unknown
|
||||
MAINTENANCE: Odd fixes
|
||||
STATUS: Working
|
||||
SINCE: 5.1
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pdo_firebird
|
||||
PRIMARY MAINTAINER: Unknown
|
||||
MAINTENANCE: Odd fixes
|
||||
STATUS: Working
|
||||
SINCE: 5.1
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pdo_mysql
|
||||
PRIMARY MAINTAINER: Unknown
|
||||
MAINTENANCE: Odd fixes
|
||||
STATUS: Working
|
||||
SINCE: 5.1
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pdo_odbc
|
||||
PRIMARY MAINTAINER: Unknown
|
||||
MAINTENANCE: Odd fixes
|
||||
STATUS: Working
|
||||
SINCE: 5.1
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pdo_oci
|
||||
PRIMARY MAINTAINER: Unknown
|
||||
MAINTENANCE: Odd fixes
|
||||
STATUS: Working
|
||||
SINCE: 5.1
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pdo_pgsql
|
||||
PRIMARY MAINTAINER: Unknown
|
||||
MAINTENANCE: Odd fixes
|
||||
STATUS: Working
|
||||
SINCE: 5.1
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pdo_sqlite
|
||||
PRIMARY MAINTAINER: Unknown
|
||||
MAINTENANCE: Odd fixes
|
||||
STATUS: Working
|
||||
SINCE: 5.1
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pgsql
|
||||
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>, Yasuo Ohgaki <yohgaki@php.net>
|
||||
PRIMARY MAINTAINER: Yasuo Ohgaki <yohgaki@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
COMMENT: Use PostgreSQL 7.0.x or later. PostgreSQL 6.5.3 or less have fatal bug.
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sqlite
|
||||
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>, Wez Furlong <wez@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 5.0 (Since 4.3.2 in PECL)
|
||||
COMMENT: Integrates SQLite embeddable SQL database engine.
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sybase
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Not Working
|
||||
@@ -238,100 +159,83 @@ EXTENSION: sybase_ct
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
== XML extensions ==
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: dom
|
||||
PRIMARY MAINTAINER: Christian Stocker <chregu@php.net>, Rob Richards <rrichards@php.net>, Marcus Boerger <helly@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 5.0
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: simplexml
|
||||
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 5.0
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: soap
|
||||
PRIMARY MAINTAINER: Dmitry Stogov <dmitry@zend.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: wddx
|
||||
PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net>
|
||||
MAINTENANCE: Orphaned
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: xml
|
||||
EXTENSION: oci8
|
||||
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: xmlreader
|
||||
PRIMARY MAINTAINER: Rob Richards <rrichards@php.net>, Christian Stocker <chregu@php.net>
|
||||
EXTENSION: odbc
|
||||
PRIMARY MAINTAINER: Daniel R. Kalowsky <kalowsky@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
COMMENT: Working except for persistent connections
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: xmlrpc
|
||||
PRIMARY MAINTAINER: Dan Libby
|
||||
MAINTENANCE: Orphaned
|
||||
STATUS: Experimental
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: xmlwriter
|
||||
PRIMARY MAINTAINER: Rob Richards <rrichards@php.net>, Pierre-Alain Joye <pajoye@php.net>
|
||||
EXTENSION: oracle
|
||||
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: xsl
|
||||
PRIMARY MAINTAINER: Christian Stocker <chregu@php.net>, Rob Richards <rrichards@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 5.0
|
||||
COMMENT: Using the new OCI8 driver is encouraged where possible.
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
== Other extensions ==
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: bcmath
|
||||
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: Hartmut Holzgraefe <hholzgra@php.net>
|
||||
MAINTENANCE: Odd Fixes
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.3
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: calendar
|
||||
PRIMARY MAINTAINER: Hartmut Holzgraefe <hholzgra@php.net>
|
||||
PRIMARY MAINTAINER: Hartmut Holzgraefe <hartmut@six.de>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: com_dotnet
|
||||
PRIMARY MAINTAINER: Wez Furlong <wez@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Windows
|
||||
SINCE: 5.0
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: ctype
|
||||
PRIMARY MAINTAINER: Hartmut Holzgraefe <hholzgra@php.net>
|
||||
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>,Ilia Alshanetsky <iliaa@php.net>
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: date
|
||||
PRIMARY MAINTAINER: Derick Rethans <derick@php.net>
|
||||
EXTENSION: cybercash
|
||||
PRIMARY MAINTAINER: Evan Klinger <evan715@sirius.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
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
|
||||
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>
|
||||
@@ -339,19 +243,17 @@ MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: filter
|
||||
PRIMARY MAINTAINER: Derick Rethans <derick@php.net>, Pierre-Alain Joye <pajoye@php.net>, Ilia Alshanetsky <iliaa@php.net>
|
||||
EXTENSION: fdf
|
||||
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 5.2
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: ftp
|
||||
PRIMARY MAINTAINER: Stefan Esser <sesser@php.net>
|
||||
MAINTENANCE: Odd fixes
|
||||
STATUS: Working
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: gd
|
||||
PRIMARY MAINTAINER: Pierre-Alain Joye <pajoye@php.net>
|
||||
PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -360,29 +262,26 @@ MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: gmp
|
||||
PRIMARY MAINTAINER: Stanislav Malyshev <stas@php.net>, Antony Dovgal <tony2001@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
SINCE: 4.0.4
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: iconv
|
||||
PRIMARY MAINTAINER: Moriyoshi Koizumi <moriyoshi@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
EXTENSION: icap
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Obsolete
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: imap
|
||||
PRIMARY MAINTAINER: Chuck Hagenbuch <chuck@horde.org>, Ilia Alshanetsky <iliaa@php.net>
|
||||
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: json
|
||||
PRIMARY MAINTAINER: Unknown
|
||||
MAINTENANCE: Odd fixes
|
||||
STATUS: Working
|
||||
SINCE: 5.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: ldap
|
||||
PRIMARY MAINTAINER: Stig Venaas <venaas@php.net>, Douglas Goldstein <cardoe@php.net>
|
||||
PRIMARY MAINTAINER: Stig Venaas <venaas@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -391,58 +290,78 @@ PRIMARY MAINTAINER: Rui Hirokawa <hirokawa@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mcal
|
||||
PRIMARY MAINTAINER: Chuck Hagenbuch <chuck@horde.org>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mcrypt
|
||||
PRIMARY MAINTAINER: Derick Rethans <derick@derickrethans.nl>
|
||||
PRIMARY MAINTAINER: Derick Rethans <d.rethans@jdimedia.nl>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mhash
|
||||
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
|
||||
MAINTENANCE: Unknown
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mime_magic
|
||||
PRIMARY MAINTAINER: Unknown
|
||||
MAINTENANCE: Deprecated
|
||||
STATUS: Experimental
|
||||
COMMENT: Use PECL's fileinfo extension instead
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: ming
|
||||
PRIMARY MAINTAINER: Frank M. Kromann
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Experimental
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: ncurses
|
||||
PRIMARY MAINTAINER Ilia Alshanetsky <iliaa@php.net>, Wez Furlong <wez@php.net>, Hartmut Holzgraefe <hholzgra@php.net>, Georg Richter <georg@php.net>
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Experimental
|
||||
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>, Pierre-Alain Joye <pajoye@php.net>
|
||||
PRIMARY MAINTAINER: Wez Furlong <wez@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.4
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pcntl
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
EXTENSION: overload
|
||||
PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pcre
|
||||
PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net>, Nuno Lopes <nlopess@php.net>
|
||||
PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.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: Working
|
||||
STATUS: Unknown
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: qtdom
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.4
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: readline
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
@@ -452,20 +371,27 @@ PRIMARY MAINTAINER: Kristian K
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: reflection
|
||||
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>, Johannes Schlüter <johannes@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
EXTENSION: sablot
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Obsolete
|
||||
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>, Ilia Alshanetsky <iliaa@php.net>
|
||||
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: shmop
|
||||
PRIMARY MAINTAINER: Ilia Alshanetsky <iliaa@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.3
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: snmp
|
||||
@@ -476,44 +402,62 @@ STATUS: Working
|
||||
EXTENSION: sockets
|
||||
PRIMARY MAINTAINER: Chris Vandomelen <chrisv@b0rked.dhs.org>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: spl
|
||||
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>
|
||||
EXTENSION: swf
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 5.0.0
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sysvmsg
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
STATUS: Depreciated (Use the ming swf extension instead)
|
||||
COMMENT: Only for Unix (won't change)
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sysvsem
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sysvshm
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: tidy
|
||||
PRIMARY MAINTAINER: John Coggeshall <john@php.net>, Ilia Alshanetsky <iliaa@php.net>, Nuno Lopes <nlopess@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: tokenizer
|
||||
PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net>
|
||||
EXTENSION: vpopmail
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.5
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: zip
|
||||
PRIMARY MAINTAINER: Pierre-Alain Joye <pajoye@php.net>
|
||||
EXTENSION: wddx
|
||||
PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: xml
|
||||
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: xslt
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANC: 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,6 +1,6 @@
|
||||
--------------------------------------------------------------------
|
||||
The PHP License, version 3.01
|
||||
Copyright (c) 1999 - 2006 The PHP Group. All rights reserved.
|
||||
The PHP License, version 2.02
|
||||
Copyright (c) 1999 - 2002 The PHP Group. All rights reserved.
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -8,38 +8,48 @@ 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.
|
||||
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.
|
||||
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 written permission. For
|
||||
written permission, please contact group@php.net.
|
||||
|
||||
4. Products derived from this software may not be called "PHP", nor
|
||||
may "PHP" appear in their name, without prior written permission
|
||||
from group@php.net. You may indicate that your software works in
|
||||
conjunction with PHP by saying "Foo for PHP" instead of calling
|
||||
it "PHP Foo" or "phpfoo"
|
||||
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.
|
||||
|
||||
5. The PHP Group may publish revised and/or new versions of the
|
||||
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
|
||||
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.
|
||||
|
||||
6. Redistributions of any form whatsoever must retain the following
|
||||
5. Redistributions of any form whatsoever must retain the following
|
||||
acknowledgment:
|
||||
"This product includes PHP software, freely available from
|
||||
<http://www.php.net/software/>".
|
||||
"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,
|
||||
@@ -63,6 +73,3 @@ 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>.
|
||||
|
||||
PHP includes the Zend Engine, freely available at
|
||||
<http://www.zend.com>.
|
||||
@@ -1,23 +0,0 @@
|
||||
|
||||
#
|
||||
# Zend
|
||||
#
|
||||
|
||||
$(builddir)/zend_language_scanner.lo: $(srcdir)/zend_language_parser.h
|
||||
$(builddir)/zend_ini_scanner.lo: $(srcdir)/zend_ini_parser.h
|
||||
|
||||
$(srcdir)/zend_language_scanner.c: $(srcdir)/zend_language_scanner.l
|
||||
@$(LEX) -Pzend -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_language_scanner.l
|
||||
|
||||
$(srcdir)/zend_language_parser.h: $(srcdir)/zend_language_parser.c
|
||||
$(srcdir)/zend_language_parser.c: $(srcdir)/zend_language_parser.y
|
||||
@$(YACC) -p zend -v -d $(srcdir)/zend_language_parser.y -o $@
|
||||
|
||||
$(srcdir)/zend_ini_parser.h: $(srcdir)/zend_ini_parser.c
|
||||
$(srcdir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
|
||||
@$(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o $@
|
||||
|
||||
$(srcdir)/zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
|
||||
@$(LEX) -Pini_ -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_ini_scanner.l
|
||||
|
||||
$(builddir)/zend_indent.lo $(builddir)/zend_highlight.lo $(builddir)/zend_compile.lo: $(srcdir)/zend_language_parser.h
|
||||
@@ -1,76 +0,0 @@
|
||||
|
||||
#
|
||||
# LCOV
|
||||
#
|
||||
|
||||
lcov: lcov-html
|
||||
|
||||
lcov-test: all
|
||||
@echo "Running test suite"
|
||||
@find . -name \*.gcda -o -name \*.da -o -name \*.bbg? | xargs rm -f
|
||||
-@if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
|
||||
NO_INTERACTION=1 \
|
||||
TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \
|
||||
TEST_PHP_SRCDIR=$(top_srcdir) \
|
||||
CC="$(CC)" \
|
||||
$(PHP_EXECUTABLE) -d 'open_basedir=' -d 'safe_mode=0' -d 'output_buffering=0' -d 'memory_limit=-1' $(top_srcdir)/run-tests.php -d 'extension_dir=modules/' -d `( . $(PHP_MODULES) ; echo extension=$$dlname)` tests/; \
|
||||
elif test ! -z "$(SAPI_CLI_PATH)" && test -x "$(SAPI_CLI_PATH)"; then \
|
||||
NO_INTERACTION=1 \
|
||||
TEST_PHP_EXECUTABLE=$(top_builddir)/$(SAPI_CLI_PATH) \
|
||||
TEST_PHP_SRCDIR=$(top_srcdir) \
|
||||
CC="$(CC)" \
|
||||
$(top_builddir)/$(SAPI_CLI_PATH) -d 'open_basedir=' -d 'safe_mode=0' -d 'output_buffering=0' -d 'memory_limit=-1' $(top_srcdir)/run-tests.php $(TESTS); \
|
||||
else \
|
||||
echo "ERROR: Cannot run tests without CLI sapi."; \
|
||||
fi
|
||||
|
||||
php_lcov.info: lcov-test
|
||||
@echo "Generating data for $@"
|
||||
@rm -rf lcov_data/
|
||||
@$(mkinstalldirs) lcov_data/
|
||||
@echo
|
||||
-@find . -name \*.gcda -o -name \*.gcno -o -name \*.da -o -name \*.h | sed -e 's/^\.\///' | sed -e 's/\.gcda//g' -e 's/\.gcno//g' -e 's/\.da//g' | uniq | while read x; do \
|
||||
echo -n . ;\
|
||||
y=`echo $$x | sed -e 's!\.libs/!!'`; \
|
||||
dir=lcov_data/`dirname $$x`; \
|
||||
test -d "$$dir" || $(mkinstalldirs) "$$dir"; \
|
||||
if test -f "$(top_srcdir)/$$y.c"; then \
|
||||
ln -f -s $(top_srcdir)/$$y.c lcov_data/$$y.c; \
|
||||
fi; \
|
||||
if test -f "$(top_srcdir)/$$y.h"; then \
|
||||
ln -f -s $(top_srcdir)/$$y.h lcov_data/$$y.h; \
|
||||
fi; \
|
||||
if test -f "$(top_srcdir)/$$y.re"; then \
|
||||
ln -f -s $(top_srcdir)/$$y.re lcov_data/$$y.re; \
|
||||
fi; \
|
||||
if test -f "$(top_srcdir)/$$y.y"; then \
|
||||
ln -f -s $(top_srcdir)/$$y.y lcov_data/$$y.y; \
|
||||
fi; \
|
||||
if test -f "$(top_srcdir)/$$y.l"; then \
|
||||
ln -f -s $(top_srcdir)/$$y.l lcov_data/$$y.l; \
|
||||
fi; \
|
||||
if test -f "$(top_srcdir)/$$y"; then \
|
||||
ln -f -s $(top_srcdir)/$$y lcov_data/$$y; \
|
||||
fi; \
|
||||
if test -f "$(top_builddir)/$$y.c"; then \
|
||||
ln -f -s $(top_builddir)/$$y.c lcov_data/$$y.c; \
|
||||
fi; \
|
||||
test -f "$$x.gcno" && cp $$x.gcno lcov_data/$$y.gcno ; \
|
||||
test -f "$$x.gcda" && cp $$x.gcda lcov_data/$$y.gcda ; \
|
||||
test -f "$$x.da" && cp $$x.da lcov_data/$$y.da ; \
|
||||
test -f "$$x.bb" && cp $$x.bb lcov_data/$$y.bb ; \
|
||||
test -f "$$x.bbg" && cp $$x.bbg lcov_data/$$y.bbg ; \
|
||||
done
|
||||
@echo
|
||||
@echo "Generating $@"
|
||||
@$(LTP) --directory lcov_data/ --capture --base-directory=lcov_data --output-file $@
|
||||
|
||||
lcov-html: php_lcov.info
|
||||
@echo "Generating lcov HTML"
|
||||
@$(LTP_GENHTML) --legend --output-directory lcov_html/ --title "PHP Code Coverage" php_lcov.info
|
||||
|
||||
lcov-clean:
|
||||
rm -f php_lcov.info
|
||||
rm -rf lcov_data/
|
||||
rm -rf lcov_html/
|
||||
|
||||
-123
@@ -1,123 +0,0 @@
|
||||
mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p
|
||||
INSTALL = $(top_srcdir)/build/shtool install -c
|
||||
INSTALL_DATA = $(INSTALL) -m 644
|
||||
|
||||
DEFS = -DPHP_ATOM_INC -I$(top_builddir)/include -I$(top_builddir)/main -I$(top_srcdir)
|
||||
COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) $(PHP_FRAMEWORKPATH)
|
||||
|
||||
all: $(all_targets)
|
||||
@echo
|
||||
@echo "Build complete."
|
||||
@echo "Don't forget to run 'make test'."
|
||||
@echo
|
||||
|
||||
build-modules: $(PHP_MODULES) $(PHP_ZEND_EX)
|
||||
|
||||
libphp$(PHP_MAJOR_VERSION).la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
|
||||
-@$(LIBTOOL) --silent --mode=install cp $@ $(phptempdir)/$@ >/dev/null 2>&1
|
||||
|
||||
libs/libphp$(PHP_MAJOR_VERSION).bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
|
||||
$(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@ libs/libphp$(PHP_MAJOR_VERSION).so
|
||||
|
||||
install: $(all_targets) $(install_targets)
|
||||
|
||||
install-sapi: $(OVERALL_TARGET)
|
||||
@echo "Installing PHP SAPI module: $(PHP_SAPI)"
|
||||
-@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
|
||||
-@if test ! -r $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME); then \
|
||||
for i in 0.0.0 0.0 0; do \
|
||||
if test -r $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME).$$i; then \
|
||||
$(LN_S) $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME).$$i $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME); \
|
||||
break; \
|
||||
fi; \
|
||||
done; \
|
||||
fi
|
||||
@$(INSTALL_IT)
|
||||
|
||||
install-modules: build-modules
|
||||
@test -d modules && \
|
||||
$(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR)
|
||||
@echo "Installing shared extensions: $(INSTALL_ROOT)$(EXTENSION_DIR)/"
|
||||
@rm -f modules/*.la >/dev/null 2>&1
|
||||
@$(INSTALL) modules/* $(INSTALL_ROOT)$(EXTENSION_DIR)
|
||||
|
||||
install-headers:
|
||||
-@if test "$(INSTALL_HEADERS)"; then \
|
||||
for i in `echo $(INSTALL_HEADERS)`; do \
|
||||
i=`$(top_srcdir)/build/shtool path -d $$i`; \
|
||||
paths="$$paths $(INSTALL_ROOT)$(phpincludedir)/$$i"; \
|
||||
done; \
|
||||
$(mkinstalldirs) $$paths && \
|
||||
echo "Installing header files: $(INSTALL_ROOT)$(phpincludedir)/" && \
|
||||
for i in `echo $(INSTALL_HEADERS)`; do \
|
||||
if test "$(PHP_PECL_EXTENSION)"; then \
|
||||
src=`echo $$i | $(SED) -e "s#ext/$(PHP_PECL_EXTENSION)/##g"`; \
|
||||
else \
|
||||
src=$$i; \
|
||||
fi; \
|
||||
if test -f "$(top_srcdir)/$$src"; then \
|
||||
$(INSTALL_DATA) $(top_srcdir)/$$src $(INSTALL_ROOT)$(phpincludedir)/$$i; \
|
||||
elif test -f "$(top_builddir)/$$src"; then \
|
||||
$(INSTALL_DATA) $(top_builddir)/$$src $(INSTALL_ROOT)$(phpincludedir)/$$i; \
|
||||
else \
|
||||
(cd $(top_srcdir)/$$src && $(INSTALL_DATA) *.h $(INSTALL_ROOT)$(phpincludedir)/$$i; \
|
||||
cd $(top_builddir)/$$src && $(INSTALL_DATA) *.h $(INSTALL_ROOT)$(phpincludedir)/$$i) 2>/dev/null || true; \
|
||||
fi \
|
||||
done; \
|
||||
fi
|
||||
|
||||
PHP_TEST_SETTINGS = -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1'
|
||||
PHP_TEST_SHARED_EXTENSIONS = ` \
|
||||
if test "x$(PHP_MODULES)" != "x"; then \
|
||||
for i in $(PHP_MODULES)""; do \
|
||||
. $$i; $(top_srcdir)/build/shtool echo -n -- " -d extension=$$dlname"; \
|
||||
done; \
|
||||
fi; \
|
||||
if test "x$(PHP_ZEND_EX)" != "x"; then \
|
||||
for i in $(PHP_ZEND_EX)""; do \
|
||||
. $$i; $(top_srcdir)/build/shtool echo -n -- " -d $(ZEND_EXT_TYPE)=$(top_builddir)/modules/$$dlname"; \
|
||||
done; \
|
||||
fi`
|
||||
|
||||
test: all
|
||||
-@if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
|
||||
TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \
|
||||
TEST_PHP_SRCDIR=$(top_srcdir) \
|
||||
CC="$(CC)" \
|
||||
$(PHP_EXECUTABLE) $(PHP_TEST_SETTINGS) $(top_srcdir)/run-tests.php -d extension_dir=modules/ $(PHP_TEST_SHARED_EXTENSIONS) tests/; \
|
||||
elif test ! -z "$(SAPI_CLI_PATH)" && test -x "$(SAPI_CLI_PATH)"; then \
|
||||
INI_FILE=`$(top_builddir)/$(SAPI_CLI_PATH) -d 'display_errors=stderr' -r 'echo php_ini_loaded_file();' 2> /dev/null`; \
|
||||
if test "$$INI_FILE"; then \
|
||||
$(EGREP) -v '^(zend_)?extension(_debug)?(_ts)?[\t\ ]*=' "$$INI_FILE" > $(top_builddir)/tmp-php.ini; \
|
||||
else \
|
||||
echo > $(top_builddir)/tmp-php.ini; \
|
||||
fi; \
|
||||
INI_SCANNED_PATH=`$(top_builddir)/$(SAPI_CLI_PATH) -d 'display_errors=stderr' -r '$$a = explode(",\n", trim(php_ini_scanned_files())); echo $$a[0];' 2> /dev/null`; \
|
||||
if test "$$INI_SCANNED_PATH"; then \
|
||||
INI_SCANNED_PATH=`$(top_srcdir)/build/shtool path -d $$INI_SCANNED_PATH`; \
|
||||
$(EGREP) -h -v '^(zend_)?extension(_debug)?(_ts)?[\t\ ]*=' "$$INI_SCANNED_PATH"/*.ini >> $(top_builddir)/tmp-php.ini; \
|
||||
fi; \
|
||||
TEST_PHP_EXECUTABLE=$(top_builddir)/$(SAPI_CLI_PATH) \
|
||||
TEST_PHP_SRCDIR=$(top_srcdir) \
|
||||
CC="$(CC)" \
|
||||
$(top_builddir)/$(SAPI_CLI_PATH) -n -c $(top_builddir)/tmp-php.ini $(PHP_TEST_SETTINGS) $(top_srcdir)/run-tests.php -n -c $(top_builddir)/tmp-php.ini -d extension_dir=$(top_builddir)/modules/ $(PHP_TEST_SHARED_EXTENSIONS) $(TESTS); \
|
||||
else \
|
||||
echo "ERROR: Cannot run tests without CLI sapi."; \
|
||||
fi
|
||||
|
||||
clean:
|
||||
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
|
||||
find . -name \*.lo -o -name \*.o | xargs rm -f
|
||||
find . -name \*.la -o -name \*.a | xargs rm -f
|
||||
find . -name \*.so | xargs rm -f
|
||||
find . -name .libs -a -type d|xargs rm -rf
|
||||
rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/*
|
||||
|
||||
distclean: clean
|
||||
rm -f config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h php5.spec sapi/apache/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp
|
||||
$(EGREP) define'.*include/php' $(top_srcdir)/configure | $(SED) 's/.*>//'|xargs rm -f
|
||||
find . -name Makefile | xargs rm -f
|
||||
|
||||
.PHONY: all clean install distclean test
|
||||
.NOEXPORT:
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
|
||||
ZEND_DIR = $(srcdir)/Zend
|
||||
SUBDIRS = Zend main ext sapi $(TSRM_DIR) $(REGEX_DIR) $(CLI_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) $(ZEND_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
|
||||
|
||||
clean-modules:
|
||||
rm -f modules/*
|
||||
|
||||
.NOEXPORT:
|
||||
+30
-41
@@ -1,7 +1,6 @@
|
||||
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. Please have a look at
|
||||
http://cvsbook.red-bean.com/ for more detailed information on CVS.
|
||||
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
|
||||
@@ -29,20 +28,7 @@ Having said that, here are the organizational rules:
|
||||
5. If you don't know how to do something, ask first!
|
||||
|
||||
6. Test your changes before committing them. We mean it. Really.
|
||||
To do so use "make test".
|
||||
|
||||
7. For development use the --enable-maintainer-zts switch to ensure your
|
||||
code handles TSRM correctly and doesn't break for thos who need that.
|
||||
|
||||
Currently we have the following branches in use:
|
||||
HEAD Will become PHP 6.0. This CVS branch is for active development.
|
||||
PHP_5_2 Is used to release the PHP 5.2.x series. Only minor feature
|
||||
enhancements may go in here, but please keep that as infrequent as
|
||||
possible.
|
||||
PHP_5_1 This branch is closed.
|
||||
PHP_4_4 Is used to release the PHP 4.4.x series. Only bugfixes are permitted
|
||||
on this branch (Consult the releasemaster prior to commit).
|
||||
PHP_4_3 This branch is closed.
|
||||
|
||||
|
||||
The next few rules are more of a technical nature.
|
||||
|
||||
@@ -50,11 +36,8 @@ The next few rules are more of a technical nature.
|
||||
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.
|
||||
|
||||
NB! Lines, starting with @ will go automagically into NEWS file, but
|
||||
this is NOT recommended, though. Please, add news entries directly to
|
||||
NEWS file and don't forget to keep them adjusted and sorted.
|
||||
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
|
||||
@@ -74,45 +57,51 @@ The next few rules are more of a technical nature.
|
||||
|
||||
The format of the commit messages is pretty simple.
|
||||
|
||||
Use a - to start a new item in your commit message.
|
||||
|
||||
If a line begins with #, it is taken to be a comment and will not appear
|
||||
in the ChangeLog. Everything else goes into the ChangeLog.
|
||||
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 # at the beginning of _every_ such line.
|
||||
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 the date() function, and in string.c you fixed a
|
||||
memory leak in php_trim(). Don't commit both of these at once. Commit them
|
||||
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:
|
||||
- Added new 'K' format modifier to date() for printing out number of days until
|
||||
New Year's Eve.
|
||||
|
||||
(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:
|
||||
- Fixed a memory leak in php_trim() resulting from improper use of zval_dtor().
|
||||
#- Man, that thing was leaking all over the place!
|
||||
(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 will be omitted from the ChangeLog automagically.
|
||||
|
||||
Use the [DOC] tag in your log message whenever you feel that your changes
|
||||
imply a documentation modification. The php-doc team will automatically
|
||||
get notified about your commit through the php-doc mailing list.
|
||||
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 fix some bugs, you should note the bug ID numbers in your
|
||||
commit message. Bug ID should be prefixed by "#" for easier access to
|
||||
bug report when developers are browsing CVS via LXR or Bonsai.
|
||||
bug report when developers are browsing CVS via. LXR or Bonsai.
|
||||
|
||||
Example:
|
||||
|
||||
Fixed bug #14016 (pgsql notice handler double free crash bug.)
|
||||
Fixed pgsql notice handler double free crash bug. Bug #14016
|
||||
@ Fixed pgsql notice handler double free crash bug. Bug #14016
|
||||
|
||||
If you don't see your messages in ChangeLog right away, don't worry!
|
||||
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.
|
||||
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.
|
||||
|
||||
+9
-19
@@ -1,7 +1,3 @@
|
||||
(NOTE: you may also want to take a look at the pear package
|
||||
PECL_Gen, a PHP-only alternative for this script that
|
||||
supports way more extension writing tasks and is
|
||||
supposed to replace ext_skel completely in the long run ...)
|
||||
|
||||
WHAT IT IS
|
||||
|
||||
@@ -11,23 +7,17 @@ WHAT IT IS
|
||||
|
||||
HOW TO USE IT
|
||||
|
||||
Very simple. First, change to the ext/ directory of the 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
|
||||
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.
|
||||
|
||||
[ Note that GNU awk is likely required for this script to work. Debian
|
||||
systems seem to default to using mawk, so you may need to change the
|
||||
#! line in skeleton/create_stubs and the cat $proto | awk line in
|
||||
ext_skel to use gawk explicitly. ]
|
||||
|
||||
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,
|
||||
change back up to PHP sources top directory, and do
|
||||
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
|
||||
|
||||
@@ -43,7 +33,7 @@ HOW TO USE IT
|
||||
FORMAT OF FUNCTION DEFINITIONS FILE
|
||||
|
||||
All the definitions must be on one line. In it's simplest form, it's just
|
||||
the function name, e.g.
|
||||
the function name, ie.
|
||||
|
||||
my_function
|
||||
|
||||
|
||||
@@ -26,33 +26,30 @@ and not output any error messages.
|
||||
Both functions return SUCCESS or FAILURE depending on the result.
|
||||
|
||||
The auto-conversions are performed as necessary. Arrays, objects, and
|
||||
resources cannot be auto-converted.
|
||||
resources cannot be autoconverted.
|
||||
|
||||
|
||||
Type specifiers
|
||||
---------------
|
||||
a - array
|
||||
b - boolean, stored in zend_bool
|
||||
d - double
|
||||
f - function or array containing php method call info (returned as
|
||||
zend_fcall_info* and zend_fcall_info_cache*)
|
||||
h - array (returned as HashTable*)
|
||||
l - long
|
||||
d - double
|
||||
s - string (with possible null bytes) and its length
|
||||
b - boolean, stored in zend_bool
|
||||
r - resource (stored in zval)
|
||||
a - array
|
||||
o - object (of any type)
|
||||
O - object (of specific type, specified by class entry)
|
||||
r - resource (stored in zval)
|
||||
s - string (with possible null bytes) and its length
|
||||
z - the actual zval
|
||||
|
||||
The following characters also have a meaning in the specifier string:
|
||||
| - indicates that the remaining parameters are optional, they
|
||||
should be initialized to default values by the extension since they
|
||||
will not be touched by the parsing function if they are not
|
||||
passed to it.
|
||||
/ - use SEPARATE_ZVAL_IF_NOT_REF() on the parameter it follows
|
||||
! - the parameter it follows can be of specified type or NULL (only applies
|
||||
to 's', 'a', 'o', 'O', 'r', 'h', 'C', 'z', and 'Z'). If NULL is passed,
|
||||
the results pointer is set to NULL as well.
|
||||
| - indicates that the remaining parameters are optional, they
|
||||
should be initialized to default values by the extension since they
|
||||
will not be touched by the parsing function if they are not
|
||||
passed to it.
|
||||
/ - use SEPARATE_ZVAL_IF_NOT_REF() on the parameter it follows
|
||||
! - the parameter it follows can be of specified type or NULL (only applies
|
||||
to 'a', 'o', 'O', 'r', and 'z'). If NULL is passed, the results
|
||||
pointer is set to NULL as well.
|
||||
|
||||
Examples
|
||||
--------
|
||||
@@ -70,7 +67,7 @@ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsz",
|
||||
/* Gets an object of class specified by my_ce, and an optional double. */
|
||||
zval *obj;
|
||||
double d = 0.5;
|
||||
zend_class_entry *my_ce;
|
||||
zend_class_entry my_ce;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|d",
|
||||
&obj, my_ce, &d) == FAILURE) {
|
||||
return;
|
||||
@@ -108,20 +105,11 @@ if (zend_parse_parameters(3 TSRMLS_CC, "zbr!",
|
||||
/* Get either a set of 3 longs or a string. */
|
||||
long l1, l2, l3;
|
||||
char *s;
|
||||
/*
|
||||
* The function expects a pointer to a integer in this case, not a long
|
||||
* or any other type. If you specify a type which is larger
|
||||
* than a 'int', the upper bits might not be initialized
|
||||
* properly, leading to random crashes on platforms like
|
||||
* Tru64 or Linux/Alpha.
|
||||
*/
|
||||
int length;
|
||||
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
|
||||
"lll", &l1, &l2, &l3) == SUCCESS) {
|
||||
/* manipulate longs */
|
||||
} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
|
||||
"s", &s, &length) == SUCCESS) {
|
||||
"s", &s) == SUCCESS) {
|
||||
/* manipulate string */
|
||||
} else {
|
||||
/* output error */
|
||||
|
||||
@@ -1,155 +0,0 @@
|
||||
1. strrpos() and strripos() now use the entire string as a needle. Be aware
|
||||
that the existing scripts may no longer work as you expect.
|
||||
|
||||
EX :
|
||||
<?php
|
||||
var_dump(strrpos("ABCDEF","DEF"));
|
||||
var_dump(strrpos("ABCDEF","DAF"));
|
||||
?>
|
||||
|
||||
Will give you different results. The former returns 3 while the latter
|
||||
returns false rather than the position of the last occurrence of 'D'.
|
||||
The same applies to strripos().
|
||||
|
||||
2. Illegal use of string offsets causes E_ERROR instead of E_WARNING.
|
||||
|
||||
EX :
|
||||
<?php
|
||||
$a = "foo";
|
||||
unset($a[0][1][2]);
|
||||
?>
|
||||
|
||||
Fatal error: Cannot use string offset as an array in ... on line 1
|
||||
|
||||
3. array_merge() was changed to accept only arrays. If a non-array variable is
|
||||
passed, a E_WARNING will be thrown for every such parameter. Be careful
|
||||
because your code may start emitting E_WARNING out of the blue.
|
||||
|
||||
4. Be careful when porting from ext/mysql to ext/mysqli. The following
|
||||
functions return NULL when no more data is available in the result set
|
||||
(ext/mysql's functions return FALSE).
|
||||
|
||||
- mysqli_fetch_row()
|
||||
- mysqli_fetch_array()
|
||||
- mysqli_fetch_assoc()
|
||||
|
||||
5. PATH_TRANSLATED server variable is no longer set implicitly under
|
||||
Apache2 SAPI in contrast to the situation in PHP 4, where it is set to the
|
||||
same value as the SCRIPT_FILENAME server variable when it is not populated
|
||||
by Apache. This change was made to comply with the CGI specification.
|
||||
Please refer to bug #23610 for further information.
|
||||
|
||||
6. Starting PHP 5.0.0 the T_ML_CONSTANT constant is no longer defined by the
|
||||
ext/tokenizer extension. If error_reporting is set to E_ALL notices will
|
||||
be produced. Instead of T_ML_CONSTANT for /* */ the T_COMMENT constant
|
||||
is used, thus both // and /* */ are resolved as the T_COMMENT constant.
|
||||
However the PHPDoc style comments /** */ ,which starting PHP 5 are parsed
|
||||
by PHP, are recongnized as T_DOC_COMMENT.
|
||||
|
||||
7. $_SERVER should be populated with argc and argv if variables_order
|
||||
includes "S". If you have specifically configured your system to not
|
||||
create $_SERVER, then of course it shouldn't be there. The change was to
|
||||
always make argc and argv available in the CLI version regardless of the
|
||||
variables_order setting. As in, the CLI version will now always populate
|
||||
the global $argc and $argv variables.
|
||||
|
||||
8. In some cases classes must be declared before used. It only happens only
|
||||
if some of the new features of PHP 5 are used. Otherwise the behaviour is
|
||||
the old.
|
||||
Example 1 (works with no errors):
|
||||
<?php
|
||||
$a = new a();
|
||||
class a {
|
||||
}
|
||||
?>
|
||||
|
||||
Example 2 (throws an error):
|
||||
<?php
|
||||
$a = new a();
|
||||
interface b{
|
||||
}
|
||||
class a implements b {
|
||||
}
|
||||
?>
|
||||
|
||||
Output (example 2) :
|
||||
Fatal error: Class 'a' not found in /tmp/cl.php on line 2
|
||||
|
||||
9. get_class() starting PHP 5 returns the name of the class as it was
|
||||
declared which may lead to problems in older scripts that rely on
|
||||
the previous behaviour - the class name is lowercased. Expect the
|
||||
same behaviour from get_parent_class() when applicable.
|
||||
Example :
|
||||
<?php
|
||||
class FooBar {
|
||||
}
|
||||
class ExtFooBar extends FooBar{}
|
||||
$a = new FooBar();
|
||||
var_dump(get_class($a), get_parent_class($a));
|
||||
?>
|
||||
|
||||
Output (PHP 4):
|
||||
string(6) "foobar"
|
||||
string(9) "extfoobar"
|
||||
|
||||
Output (PHP 5):
|
||||
string(6) "FooBar"
|
||||
string(9) "ExtFooBar"
|
||||
----------------------------------------------------------------------
|
||||
Example code that will break :
|
||||
//....
|
||||
function someMethod($p) {
|
||||
if (get_class($p) != 'helpingclass') {
|
||||
return FALSE;
|
||||
}
|
||||
//...
|
||||
}
|
||||
//...
|
||||
Possible solution is to search for get_class() and get_parent_class() in
|
||||
all your scripts and use strtolower().
|
||||
|
||||
10. get_class_methods() returns the names of the methods of a class as they
|
||||
declared. In PHP4 the names are all lowercased.
|
||||
Example code :
|
||||
<?php
|
||||
class Foo{
|
||||
function doFoo(){}
|
||||
function hasFoo(){}
|
||||
}
|
||||
var_dump(get_class_methods("Foo"));
|
||||
?>
|
||||
Output (PHP4):
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(5) "dofoo"
|
||||
[1]=>
|
||||
string(6) "hasfoo"
|
||||
}
|
||||
Output (PHP5):
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(5) "doFoo"
|
||||
[1]=>
|
||||
string(6) "hasFoo"
|
||||
}
|
||||
|
||||
11. Assignment $this is impossible. Starting PHP 5.0.0 $this has special
|
||||
meaning in class methods and is recognized by the PHP parser. The latter
|
||||
will generate a parse error when assignment to $this is found
|
||||
Example code :
|
||||
<?php
|
||||
class Foo {
|
||||
function assignNew($obj) {
|
||||
$this = $obj;
|
||||
}
|
||||
}
|
||||
$a = new Foo();
|
||||
$b = new Foo();
|
||||
$a->assignNew($b);
|
||||
echo "I was executed\n";
|
||||
?>
|
||||
Output (PHP 4):
|
||||
I was executed
|
||||
Output (PHP 5):
|
||||
PHP Fatal error: Cannot re-assign $this in /tmp/this_ex.php on line 4
|
||||
|
||||
@@ -4,9 +4,10 @@ $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, two things are
|
||||
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
|
||||
|
||||
@@ -73,9 +74,28 @@ DEFINING THE NEW EXTENSION
|
||||
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
|
||||
@@ -87,17 +107,13 @@ PHP_ARG_ENABLE(foobar,whether to enable foobar,
|
||||
[ --enable-foobar Enable foobar])
|
||||
|
||||
if test "$PHP_FOOBAR" != "no"; then
|
||||
PHP_NEW_EXTENSION(foobar, foo.c bar.c, $ext_shared)
|
||||
PHP_EXTENSION(foobar, $ext_shared)
|
||||
fi
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PHP_ARG_ENABLE will automatically set the correct variables, so
|
||||
that the extension will be enabled by PHP_NEW_EXTENSION in shared mode.
|
||||
that the extension will be enabled by PHP_EXTENSION in shared mode.
|
||||
|
||||
The first argument of PHP_NEW_EXTENSION describes the name of the
|
||||
extension. The second names the source-code files. The third passes
|
||||
$ext_shared which is set by PHP_ARG_ENABLE/WITH to PHP_NEW_EXTENSION.
|
||||
|
||||
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.
|
||||
@@ -115,9 +131,8 @@ CREATING SOURCE FILES
|
||||
|
||||
CREATING THE SELF-CONTAINED EXTENSION
|
||||
|
||||
Put config.m4 and the source files into one directory. Then, run phpize
|
||||
(this is installed during make install by PHP 4.0).
|
||||
|
||||
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
|
||||
@@ -142,13 +157,17 @@ ADDING SHARED MODULE SUPPORT TO A 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[,..].
|
||||
automatically be able to use --with-foo=shared or
|
||||
--enable-foo=shared.
|
||||
|
||||
2. In config.m4, use PHP_NEW_EXTENSION(foo,.., $ext_shared) to enable
|
||||
2. In config.m4, use PHP_EXTENSION(foo, $ext_shared) to enable
|
||||
building the extension.
|
||||
|
||||
3. Add the following lines to your C source file:
|
||||
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)
|
||||
|
||||
+61
-197
@@ -2,17 +2,16 @@ An Overview of the PHP Streams abstraction
|
||||
==========================================
|
||||
$Id$
|
||||
|
||||
WARNING: some prototypes in this file are out of date.
|
||||
The information contained here is being integrated into
|
||||
the PHP manual - stay tuned...
|
||||
|
||||
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 every time you need to work with a "user-level"
|
||||
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
|
||||
@@ -27,9 +26,7 @@ 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 size_t php_stream_printf(php_stream * stream TSRMLS_DC,
|
||||
const char * fmt, ...);
|
||||
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);
|
||||
@@ -37,131 +34,22 @@ 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);
|
||||
PHPAPI int php_stream_lock(php_stream * stream, int mode);
|
||||
|
||||
These (should) behave in the same way as the ANSI stdio functions with similar
|
||||
names: fread, fwrite, fprintf, feof, fgetc, fgets, fclose, fflush, fseek, ftell, flock.
|
||||
names: fread, fwrite, feof, fgetc, fgets, fclose, fflush, fseek, ftell.
|
||||
|
||||
Opening Streams
|
||||
===============
|
||||
In most cases, you should use this API:
|
||||
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_open_wrapper(char *path, char *mode,
|
||||
int options, char **opened_path TSRMLS_DC);
|
||||
PHPAPI php_stream * php_stream_fopen(const char * filename, const char *
|
||||
mode);
|
||||
|
||||
Where:
|
||||
path is the file or resource to open.
|
||||
mode is the stdio compatible mode eg: "wb", "rb" etc.
|
||||
options is a combination of the following values:
|
||||
IGNORE_PATH (default) - don't use include path to search for the file
|
||||
USE_PATH - use include path to search for the file
|
||||
IGNORE_URL - do not use plugin wrappers
|
||||
REPORT_ERRORS - show errors in a standard format if something
|
||||
goes wrong.
|
||||
STREAM_MUST_SEEK - If you really need to be able to seek the stream
|
||||
and don't need to be able to write to the original
|
||||
file/URL, use this option to arrange for the stream
|
||||
to be copied (if needed) into a stream that can
|
||||
be seek()ed.
|
||||
|
||||
opened_path is used to return the path of the actual file opened,
|
||||
but if you used STREAM_MUST_SEEK, may not be valid. You are
|
||||
responsible for efree()ing opened_path. opened_path may be (and usually
|
||||
is) NULL.
|
||||
|
||||
If you need to open a specific stream, or convert standard resources into
|
||||
streams there are a range of functions to do this defined in php_streams.h.
|
||||
A brief list of the most commonly used functions:
|
||||
|
||||
PHPAPI php_stream *php_stream_fopen_from_file(FILE *file, const char *mode);
|
||||
Convert a FILE * into a stream.
|
||||
|
||||
PHPAPI php_stream *php_stream_fopen_tmpfile(void);
|
||||
Open a FILE * with tmpfile() and convert into a stream.
|
||||
|
||||
PHPAPI php_stream *php_stream_fopen_temporary_file(const char *dir,
|
||||
const char *pfx, char **opened_path TSRMLS_DC);
|
||||
Generate a temporary file name and open it.
|
||||
|
||||
There are some network enabled relatives in php_network.h:
|
||||
|
||||
PHPAPI php_stream *php_stream_sock_open_from_socket(int socket, int persistent);
|
||||
Convert a socket into a stream.
|
||||
|
||||
PHPAPI php_stream *php_stream_sock_open_host(const char *host, unsigned short port,
|
||||
int socktype, int timeout, int persistent);
|
||||
Open a connection to a host and return a stream.
|
||||
|
||||
PHPAPI php_stream *php_stream_sock_open_unix(const char *path, int persistent,
|
||||
struct timeval *timeout);
|
||||
Open a UNIX domain socket.
|
||||
|
||||
|
||||
Stream Utilities
|
||||
================
|
||||
|
||||
If you need to copy some data from one stream to another, you will be please
|
||||
to know that the streams API provides a standard way to do this:
|
||||
|
||||
PHPAPI size_t php_stream_copy_to_stream(php_stream *src,
|
||||
php_stream *dest, size_t maxlen);
|
||||
|
||||
If you want to copy all remaining data from the src stream, pass
|
||||
PHP_STREAM_COPY_ALL as the maxlen parameter, otherwise maxlen indicates the
|
||||
number of bytes to copy.
|
||||
This function will try to use mmap where available to make the copying more
|
||||
efficient.
|
||||
|
||||
If you want to read the contents of a stream into an allocated memory buffer,
|
||||
you should use:
|
||||
|
||||
PHPAPI size_t php_stream_copy_to_mem(php_stream *src, char **buf,
|
||||
size_t maxlen, int persistent);
|
||||
|
||||
This function will set buf to the address of the buffer that it allocated,
|
||||
which will be maxlen bytes in length, or will be the entire length of the
|
||||
data remaining on the stream if you set maxlen to PHP_STREAM_COPY_ALL.
|
||||
The buffer is allocated using pemalloc(); you need to call pefree() to
|
||||
release the memory when you are done.
|
||||
As with copy_to_stream, this function will try use mmap where it can.
|
||||
|
||||
If you have an existing stream and need to be able to seek() it, you
|
||||
can use this function to copy the contents into a new stream that can
|
||||
be seek()ed:
|
||||
|
||||
PHPAPI int php_stream_make_seekable(php_stream *origstream, php_stream **newstream);
|
||||
|
||||
It returns one of the following values:
|
||||
#define PHP_STREAM_UNCHANGED 0 /* orig stream was seekable anyway */
|
||||
#define PHP_STREAM_RELEASED 1 /* newstream should be used; origstream is no longer valid */
|
||||
#define PHP_STREAM_FAILED 2 /* an error occurred while attempting conversion */
|
||||
#define PHP_STREAM_CRITICAL 3 /* an error occurred; origstream is in an unknown state; you should close origstream */
|
||||
|
||||
make_seekable will always set newstream to be the stream that is valid
|
||||
if the function succeeds.
|
||||
When you have finished, remember to close the stream.
|
||||
|
||||
NOTE: If you only need to seek forward, there is no need to call this
|
||||
function, as the php_stream_seek can emulate forward seeking when the
|
||||
whence parameter is SEEK_CUR.
|
||||
|
||||
NOTE: Writing to the stream may not affect the original source, so it
|
||||
only makes sense to use this for read-only use.
|
||||
|
||||
NOTE: If the origstream is network based, this function will block
|
||||
until the whole contents have been downloaded.
|
||||
|
||||
NOTE: Never call this function with an origstream that is referenced
|
||||
as a resource! It will close the origstream on success, and this
|
||||
can lead to a crash when the resource is later used/released.
|
||||
|
||||
NOTE: If you are opening a stream and need it to be seekable, use the
|
||||
STREAM_MUST_SEEK option to php_stream_open_wrapper();
|
||||
|
||||
PHPAPI int php_stream_supports_lock(php_stream * stream);
|
||||
|
||||
This function will return either 1 (success) or 0 (failure) indicating whether or
|
||||
not a lock can be set on this stream. Typically you can only set locks on stdio streams.
|
||||
This call behaves just like fopen(), except it returns a stream instead of a
|
||||
FILE *
|
||||
|
||||
Casting Streams
|
||||
===============
|
||||
@@ -171,14 +59,14 @@ 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, (void*)&fp, REPORT_ERRORS) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
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);
|
||||
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.
|
||||
@@ -195,14 +83,8 @@ 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.
|
||||
|
||||
In situations where this is not desirable, you should query the stream
|
||||
to see if it naturally supports FILE *. You can use this code snippet
|
||||
for this purpose:
|
||||
|
||||
if (php_stream_is(stream, PHP_STREAM_IS_STDIO)) {
|
||||
/* can safely cast to FILE* with no adverse side effects */
|
||||
}
|
||||
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:
|
||||
|
||||
@@ -211,15 +93,10 @@ 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 can be a socket */
|
||||
if (php_stream_can_cast(stream, PHP_STREAM_AS_SOCKETD) == SUCCESS) {
|
||||
/* it's a socket */
|
||||
}
|
||||
|
||||
Please note the difference between php_stream_is and php_stream_can_cast;
|
||||
stream_is tells you if the stream is a particular type of stream, whereas
|
||||
can_cast tells you if the stream can be forced into the form you request.
|
||||
The former doesn't change anything, while the later *might* change some
|
||||
state in the stream.
|
||||
|
||||
Stream Internals
|
||||
================
|
||||
@@ -232,10 +109,10 @@ 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 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.
|
||||
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.
|
||||
@@ -244,17 +121,17 @@ 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;
|
||||
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;
|
||||
fclose(fp);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
php_stream_stdio_ops is a php_stream_ops structure that can be used to handle
|
||||
@@ -266,7 +143,7 @@ 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)
|
||||
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
|
||||
@@ -287,23 +164,10 @@ into a FILE*, so it should be compatible with the mode parameter of fopen().
|
||||
Writing your own stream implementation
|
||||
======================================
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
RULE #1: when writing your own streams: make sure you have configured PHP with
|
||||
--enable-debug.
|
||||
I've taken some great pains to hook into the Zend memory manager to help track
|
||||
down allocation problems. It will also help you spot incorrect use of the
|
||||
STREAMS_DC, STREAMS_CC and the semi-private STREAMS_REL_CC macros for function
|
||||
definitions.
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
RULE #2: Please use the stdio stream as a reference; it will help you
|
||||
understand the semantics of the stream operations, and it will always
|
||||
be more up to date than these docs :-)
|
||||
|
||||
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.
|
||||
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
|
||||
@@ -312,9 +176,9 @@ 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 {
|
||||
MYSQL conn;
|
||||
MYSQL_RES * result;
|
||||
};
|
||||
|
||||
struct my_state * state = pemalloc(sizeof(struct my_state), persistent);
|
||||
@@ -333,36 +197,36 @@ 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 weird MySQL stream:
|
||||
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;
|
||||
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 */
|
||||
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"
|
||||
php_mysqlop_write, php_mysqlop_read, php_mysqlop_close,
|
||||
php_mysqlop_flush, NULL, NULL, NULL,
|
||||
"Strange mySQL example"
|
||||
}
|
||||
|
||||
Thats it!
|
||||
@@ -376,4 +240,4 @@ 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:et
|
||||
vim:tw=78
|
||||
@@ -1,126 +0,0 @@
|
||||
Submitting Patch for PHP
|
||||
========================
|
||||
|
||||
This document describes how to submit a patch for PHP. Since you are
|
||||
reading this document, you are willing to submit a patch for PHP.
|
||||
Please keep reading! Submitting a patch for PHP is easy. The hard
|
||||
part is making it acceptable for inclusion into our repository. :-)
|
||||
|
||||
How to create patch?
|
||||
--------------------
|
||||
We are working with CVS. You need to get CVS source to create a patch
|
||||
that we accept. Visit http://www.php.net/anoncvs.php to get CVS
|
||||
source. You can check out older versions, but make sure you get
|
||||
the default branch (i.e. Do not use -r option when you check out the
|
||||
CVS source)
|
||||
|
||||
Read CODING_STANDARDS file before you start working.
|
||||
|
||||
Now you are ready to create a patch. Modify source to fix a bug in PHP or
|
||||
add a new feature to PHP. After you finished editing, please test your
|
||||
patch. Read README.TESTING for testing.
|
||||
|
||||
After you finish testing your patch, take diff file using
|
||||
"cvs diff > your.patch" command.
|
||||
|
||||
Read README.TESTING for submitting a test script for your patch. This is
|
||||
not strictly required, but it is preferred to submit a test script along
|
||||
with your patch. Making new test script is very easy. It also helps us
|
||||
to understand what you have been fixed or added to PHP.
|
||||
|
||||
|
||||
Tips for creating patch
|
||||
-----------------------
|
||||
If you would like to fix multiple bugs. It is easier for us if you
|
||||
could create 1 patch for 1 bug, but this is not strictly required.
|
||||
Note though that you might get little response, if your patch is
|
||||
too hard to review.
|
||||
|
||||
If you would like change/add many lines, it is better to ask module
|
||||
maintainer and/or internals@lists.php.net, or pear-dev@lists.php.net if
|
||||
you are patching PEAR. Official module maintainers can be found in
|
||||
EXTENSIONS file in PHP source.
|
||||
|
||||
If you are new to CVS (Concurrent Versions System), visit
|
||||
http://cvshome.org/ for details.
|
||||
|
||||
|
||||
Recommended CVS client settings for creating patch file
|
||||
------------------------------------------------------
|
||||
Recommended ~/.cvsrc file setting is:
|
||||
------
|
||||
cvs -z3
|
||||
update -d -P
|
||||
checkout -P
|
||||
diff -u
|
||||
|
||||
------
|
||||
diff -u means:
|
||||
-u Use the unified output format.
|
||||
|
||||
With this CVS setting, you don't have to worry about adding/deleting
|
||||
newlines and spaces.
|
||||
|
||||
|
||||
Check list for submitting patch
|
||||
-------------------------------
|
||||
- Did you run "make test" to check if your patch didn't break
|
||||
other features?
|
||||
- Did you compile PHP with --enable-debug and check the PHP and
|
||||
web server error logs when you test your patch?
|
||||
- Did you build PHP for multi-threaded web servers. (Optional)
|
||||
- Did you create test script for "make test"? (Recommended)
|
||||
- Did you check your patch is unified format and it does not
|
||||
contain white space changes? (If you are not using recommended
|
||||
cvs setting)
|
||||
- Did you update CVS source before you take final patch?
|
||||
- Did you read the patch again?
|
||||
|
||||
|
||||
Where to send your patch?
|
||||
-------------------------
|
||||
If you are patching C source, send the patch to internals@lists.php.net.
|
||||
If you are patching a module, you should also send the patch to the
|
||||
maintainer. Official module maintainers are listed in EXTENSION file
|
||||
in source.
|
||||
|
||||
If you are patching PEAR, send the patch to pear-dev@lists.php.net.
|
||||
|
||||
Please add the prefix "[PATCH]" to your email subject and make sure
|
||||
to include the patch as a MIME attachment even if it is short.
|
||||
|
||||
NOTE: only MIME attachments of type 'text/*' are accepted. The
|
||||
easiest way to accomplish this, is to make the extension
|
||||
'.txt'.
|
||||
|
||||
Test scripts should be included in the same email.
|
||||
Explain what has been fixed/added/changed by your patch.
|
||||
|
||||
Finally, add the bug Id(s) which can be closed by your patch, if any.
|
||||
|
||||
|
||||
What happens after you submit your patch
|
||||
----------------------------------------
|
||||
If your patch is easy to review and has obviously no side-effects,
|
||||
it might take up to a few hours until someone commits it.
|
||||
|
||||
Because this is a volunteer-driven effort, more complex patches will
|
||||
require more patience on your side.
|
||||
|
||||
If you did not receive any feedback in a few days, please consider
|
||||
resubmitting the description of your patch, along-side with
|
||||
these questions:
|
||||
|
||||
- Is my patch too hard to review? Because of which factors?
|
||||
- Should I split it up in multiple parts?
|
||||
- Are there any unwanted whitespace changes?
|
||||
|
||||
|
||||
What happens when your patch is applied?
|
||||
----------------------------------------
|
||||
Your name will be included together with your email address in the CVS
|
||||
commit log. If your patch affects end-users, a brief description
|
||||
and your name might be added to the NEWS file.
|
||||
|
||||
|
||||
Thank you for submitting patch for PHP!
|
||||
-179
@@ -1,179 +0,0 @@
|
||||
[IMPORTANT NOTICE]
|
||||
------------------
|
||||
Failed tests usualy indicate a problem with your local system setup
|
||||
and not within PHP itself (at least for official PHP release versions).
|
||||
You may decide to automaticaly submit a test summary to our QA workflow
|
||||
at the end of a test run.
|
||||
Please do *not* submit a failed test as a bug or ask for help on why
|
||||
it failed on your system without providing substantial backup information
|
||||
on *why* the test failed on your special setup. Thank you :-)
|
||||
|
||||
|
||||
[Testing Basics]
|
||||
----------------
|
||||
The easiest way to test your PHP build is to run "make test" from the
|
||||
command line after successfully compiling. This will run the complete
|
||||
tests for all enabled functionalities and extensions using the PHP
|
||||
CLI binary.
|
||||
To execute test scripts, you must build PHP with some SAPI, then you
|
||||
type "make test" to execute all or some test scripts saved under
|
||||
"tests" directory under source root directory.
|
||||
|
||||
Usage:
|
||||
make test
|
||||
|
||||
"make test" basically executes "run-tests.php" script
|
||||
under the source root (parallel builds will not work). Therefore you
|
||||
can execute the script as follows:
|
||||
|
||||
TEST_PHP_EXECUTABLE=sapi/cli/php \
|
||||
sapi/cli/php [-c /path/to/php.ini] run-tests.php [ext/foo/tests/GLOB]
|
||||
|
||||
|
||||
[Which "php" executable "make test" look for]
|
||||
---------------------------------------------
|
||||
You must use TEST_PHP_EXECUTABLE environment variable to explicitly
|
||||
select the php executable to be used to run the tests. That can either
|
||||
be the CLI or CGI executable.
|
||||
|
||||
"make test" executes "run-tests.php" script with "php" binary. Some
|
||||
test scripts such as session must be executed by CGI SAPI. Therefore,
|
||||
you must build PHP with CGI SAPI to perform all tests.
|
||||
|
||||
NOTE: PHP binary executing "run-tests.php" and php binary used for
|
||||
executing test scripts may differ. If you use different PHP binary for
|
||||
executing "run-tests.php" script, you may get errors.
|
||||
|
||||
|
||||
[Which php.ini is used]
|
||||
-----------------------
|
||||
"make test" uses the same php.ini file as it would once installed.
|
||||
The tests have been written to be independent of that php.ini file,
|
||||
so if you find a test that is affected by a setting, please report
|
||||
this, so we can address the issue.
|
||||
|
||||
|
||||
[Which test scripts are executed]
|
||||
---------------------------------
|
||||
"run-tests.php" ("make test"), without any arguments executes all
|
||||
test scripts by extracting all directories named "tests"
|
||||
from the source root and any subdirectories below. If there are files,
|
||||
which have a "phpt" extension, "run-tests.php" looks at the sections
|
||||
in these files, determines whether it should run it, by evaluating
|
||||
the 'SKIP' section. If the test is eligible for execution, the 'FILE'
|
||||
section is extracted into a ".php" file (with the same name besides
|
||||
the extension) and gets executed.
|
||||
When an argument is given or TESTS environment variable is set, the
|
||||
GLOB is expanded by the shell and any file with extension "*.phpt" is
|
||||
regarded as a test file.
|
||||
|
||||
Tester can easily execute tests selectively with as follows.
|
||||
|
||||
Examples:
|
||||
./sapi/cli/php run-tests.php ext/mbstring/*
|
||||
./sapi/cli/php run-tests.php ext/mbstring/020.phpt
|
||||
|
||||
|
||||
[Test results]
|
||||
--------------
|
||||
Test results are printed to standard output. If there is a failed test,
|
||||
the "run-tests.php" script saves the result, the expected result and the
|
||||
code executed to the test script directory. For example, if
|
||||
ext/myext/tests/myext.phpt fails to pass, the following files are created:
|
||||
|
||||
ext/myext/tests/myext.php - actual test file executed
|
||||
ext/myext/tests/myext.log - log of test execution (L)
|
||||
ext/myext/tests/myext.exp - expected output (E)
|
||||
ext/myext/tests/myext.out - output from test script (O)
|
||||
ext/myext/tests/myext.diff - diff of .out and .exp (D)
|
||||
|
||||
Failed tests are always bugs. Either the test is bugged or not considering
|
||||
factors applying to the tester's environment, or there is a bug in PHP.
|
||||
If this is a known bug, we strive to provide bug numbers, in either the
|
||||
test name or the file name. You can check the status of such a bug, by
|
||||
going to: http://bugs.php.net/12345 where 12345 is the bug number.
|
||||
For clarity and automated processing, bug numbers are prefixed by a hash
|
||||
sign '#' in test names and/or test cases are named bug12345.phpt.
|
||||
|
||||
NOTE: The files generated by tests can be selected by setting the
|
||||
environment variable TEST_PHP_LOG_FORMAT. For each file you want to be
|
||||
generated use the character in brackets as shown above (default is LEOD).
|
||||
The php file will be generated always.
|
||||
|
||||
NOTE: You can set environment variable TEST_PHP_DETAILED to enable
|
||||
detailed test information.
|
||||
|
||||
[Automated testing]
|
||||
If you like to keep up to speed, with latest developments and quality
|
||||
assurance, setting the environment variable NO_INTERACTION to 1, will not
|
||||
prompt the tester for any user input.
|
||||
|
||||
Normally, the exit status of "make test" is zero, regardless of the results
|
||||
of independent tests. Set the environment variable REPORT_EXIT_STATUS to 1,
|
||||
and "make test" will set the exit status ("$?") to non-zero, when an
|
||||
individual test has failed.
|
||||
|
||||
Example script to be run by cron(1):
|
||||
========== qa-test.sh =============
|
||||
#!/bin/sh
|
||||
|
||||
CO_DIR=$HOME/cvs/php5
|
||||
MYMAIL=qa-test@domain.com
|
||||
TMPDIR=/var/tmp
|
||||
TODAY=`date +"%Y%m%d"`
|
||||
|
||||
# Make sure compilation enviroment is correct
|
||||
CONFIGURE_OPTS='--disable-all --enable-cli --with-pcre'
|
||||
export MAKE=gmake
|
||||
export CC=gcc
|
||||
|
||||
# Set test environment
|
||||
export NO_INTERACTION=1
|
||||
export REPORT_EXIT_STATUS=1
|
||||
|
||||
cd $CO_DIR
|
||||
cvs update . >>$TMPDIR/phpqatest.$TODAY
|
||||
./cvsclean ; ./buildconf ; ./configure $CONFIGURE_OPTS ; $MAKE
|
||||
$MAKE test >>$TMPDIR/phpqatest.$TODAY 2>&1
|
||||
if test $? -gt 0
|
||||
then
|
||||
cat $TMPDIR/phpqatest.$TODAY | mail -s"PHP-QA Test Failed for $TODAY" $MYMAIL
|
||||
fi
|
||||
========== end of qa-test.sh =============
|
||||
|
||||
NOTE: the exit status of run-tests.php will be 1 when
|
||||
REPORT_EXIT_STATUS is set. The result of "make test" may be higher
|
||||
than that. At present, gmake 3.79.1 returns 2, so it is
|
||||
advised to test for non-zero, rather then a specific value.
|
||||
|
||||
|
||||
[Creating new test files]
|
||||
-------------------------
|
||||
Writing test file is very easy if you are used to PHP.
|
||||
See the HOWTO at http://qa.php.net/write-test.php
|
||||
|
||||
|
||||
[How to help us]
|
||||
----------------
|
||||
If you find bug in PHP, you can submit bug report AND test script
|
||||
for us. You don't have to write complete script, just give us test
|
||||
script with following format. Please test the script and make sure
|
||||
you write the correct ACTUAL OUTPUT and EXPECTED OUTPUT before you
|
||||
submit.
|
||||
|
||||
<?php
|
||||
/*
|
||||
Bug #12345
|
||||
substr() bug. Do not return expected string.
|
||||
|
||||
ACTUAL OUTPUT
|
||||
XYXA
|
||||
|
||||
EXPECTED OUTPUT
|
||||
ABCD
|
||||
*/
|
||||
|
||||
$str = "XYZABCD";
|
||||
echo substr($str,3,7);
|
||||
|
||||
?>
|
||||
-137
@@ -1,137 +0,0 @@
|
||||
[IMPORTANT NOTICE]
|
||||
------------------
|
||||
This is an addendum to README.TESTING with additional information
|
||||
specific to server-tests.php.
|
||||
|
||||
server-tests.php is backward compatible with tests developed for
|
||||
the original run-tests.php script. server-tests is *not* used by
|
||||
'make test'. server-tests was developed to provide support for
|
||||
testing PHP under it's primary environment, HTTP, and can run the
|
||||
PHP tests under any of the SAPI modules that are direct executables,
|
||||
or are accessable via HTTP.
|
||||
|
||||
[New features]
|
||||
----------------
|
||||
* Command line interface:
|
||||
You can run 'php server-tests.php -h' to get all the possible options.
|
||||
* Configuration file:
|
||||
the -c argument will allow you to use a configuration file. This is
|
||||
handy if you are testing multiple environments and need various options
|
||||
depending on the environment.
|
||||
see server-tests-config.php for details.
|
||||
* CGI Emulation:
|
||||
Will emulate a CGI environment when testing with the cgi sapi executable.
|
||||
* HTTP testing:
|
||||
can be configured to run test scripts through an HTTP server running
|
||||
on localhost. localhost is required since either the web server must
|
||||
alias a directory to the php source directory, or the test scripts
|
||||
must be copied to a directory under the web server
|
||||
(see config options TEST_WEB_BASE_URL, TEST_BASE_PATH, and TEST_WEB_EXT)
|
||||
* New sections supported for test files (see below)
|
||||
|
||||
When running tests over http, tests that require ini settings different that what
|
||||
the web server runs under will be skipped. Since the test harness defines a number
|
||||
of ini settings by default, the web server may require special configuration to
|
||||
make testing work.
|
||||
|
||||
[Example Usage]
|
||||
----------------
|
||||
Some (but not all!) examples of usage:
|
||||
|
||||
1. run tests from the php source directory
|
||||
php server-tests.php -p /path/to/php-cli
|
||||
|
||||
2. run tests using cgi emulation
|
||||
php server-tests.php -p /path/to/php-cgi
|
||||
|
||||
3. run tests over http, copying test files into document root
|
||||
php server-tests.php -w -u http://localhost/test -m /path/to/htdocs/test
|
||||
|
||||
4. run tests over http, php sources have been aliased in web server
|
||||
php server-tests.php -w -u http://localhost/test
|
||||
|
||||
5. run tests using configuration file
|
||||
php server-tests.php -c /path/to/server-tests-config.php
|
||||
|
||||
6. run tests using configuration file, but overriding some settings:
|
||||
(config file must be first)
|
||||
php server-tests.php -c /path/to/server-tests-config.php -w -t 3 -d /path/to/testdir
|
||||
|
||||
NOTE: configuration as described in README.TESTING still works.
|
||||
|
||||
[New Test Sections]
|
||||
----------------
|
||||
In addition to the traditional test sections
|
||||
(see http://qa.php.net/write-test.php), several new sections are available
|
||||
under server-tests.
|
||||
|
||||
--POST--
|
||||
This is not a new section, but not multipart posts are supported for testing
|
||||
file uploads, or other types of POST data.
|
||||
|
||||
--CGI--
|
||||
This section takes no value. It merely provides a simple marker for tests
|
||||
that MUST be run as CGI, even if there is no --POST-- or --GET-- sections
|
||||
in the test file.
|
||||
|
||||
--DESCRIPTION--
|
||||
Not used for anything, just a section for documenting the test
|
||||
|
||||
--ENV--
|
||||
This section get's eval()'d to help build an environment for the
|
||||
execution of the test. This can be used to change environment
|
||||
vars that are used for CGI emulation, or simply to set env vars
|
||||
for cli testing. A full example looks like:
|
||||
|
||||
--ENV--
|
||||
return <<<END
|
||||
PATH_TRANSLATED=$filename
|
||||
PATH_INFO=$scriptname
|
||||
SCRIPT_NAME=$scriptname
|
||||
END;
|
||||
|
||||
Some variables are made easily available for use in this section, they
|
||||
include:
|
||||
$filename full native path to file, will become PATH_TRANSLATED
|
||||
$filepath =dirname($filename)
|
||||
$scriptname this is what will become SCRIPT_NAME unless you override it
|
||||
$docroot the equivelant of DOCUMENT_ROOT under Apache
|
||||
$cwd the directory that the test is being initiated from
|
||||
$this->conf all server-tests configuration vars
|
||||
$this->env all environment variables that will get passed to the test
|
||||
|
||||
|
||||
--REQUEST--
|
||||
This section is also eval'd, and is similar in nature to --ENV--. However,
|
||||
this section is used to build the url used in an HTTP request. Valid values
|
||||
to set in this section would include:
|
||||
SCRIPT_NAME The inital part of the request url
|
||||
PATH_INFO The pathinfo part of a request url
|
||||
FRAGMENT The fragment section of a url (after #)
|
||||
QUERY_STRING The query part of a url (after ?)
|
||||
|
||||
--REQUEST--
|
||||
return <<<END
|
||||
PATH_INFO=/path/info
|
||||
END;
|
||||
|
||||
--HEADERS--
|
||||
This section is also eval'd. It is used to provide additional headers sent
|
||||
in an HTTP request, such as content type for multipart posts, cookies, etc.
|
||||
|
||||
--HEADERS--
|
||||
return <<<END
|
||||
Content-Type=multipart/form-data; boundary=---------------------------240723202011929
|
||||
Content-Length=100
|
||||
END;
|
||||
|
||||
--EXPECTHEADERS--
|
||||
This section can be used to define what headers are required to be
|
||||
received back from a request, and is checked in addition to the
|
||||
regular expect sections. For example:
|
||||
|
||||
--EXPECTHEADERS--
|
||||
Status: 404
|
||||
|
||||
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
PHP Build System V5 Overview
|
||||
|
||||
- supports Makefile.ins during transition phase
|
||||
- not-really-portable Makefile includes have been eliminated
|
||||
- supports separate build directories without VPATH by using
|
||||
explicit rules only
|
||||
- does not waste disk-space/CPU-time for building temporary libraries
|
||||
=> especially noticeable on slower systems
|
||||
- slow recursive make replaced with one global Makefile
|
||||
- eases integration of proper dependencies
|
||||
- adds PHP_DEFINE(what[, value]) which creates a single include-file
|
||||
per what. This will allow more fine-grained dependencies.
|
||||
- abandoning the "one library per directory" concept
|
||||
- improved integration of the CLI
|
||||
- several new targets
|
||||
build-modules: builds and copies dynamic modules into modules/
|
||||
install-cli: installs the CLI only, so that the install-sapi
|
||||
target does only what its name says
|
||||
- finally abandoned automake (still requires aclocal at this time)
|
||||
- changed some configure-time constructs to run at buildconf-time
|
||||
- upgraded shtool to 1.5.4
|
||||
- removed $(moduledir) (use EXTENSION_DIR)
|
||||
|
||||
The Reason For a New System
|
||||
|
||||
It became more and more apparent that there is a severe need
|
||||
for addressing the portability concerns and improving the chance
|
||||
that your build is correct (how often have you been told to
|
||||
"make clean"? When this is done, you won't need to anymore).
|
||||
|
||||
|
||||
If You Build PHP on a Unix System
|
||||
|
||||
|
||||
You, as a user of PHP, will notice no changes. Of course, the build
|
||||
system will be faster, look better and work smarter.
|
||||
|
||||
|
||||
|
||||
If You Are Developing PHP
|
||||
|
||||
|
||||
|
||||
|
||||
Extension developers:
|
||||
|
||||
Makefile.ins are abandoned. The files which are to be compiled
|
||||
are specified in the config.m4 now using the following macro:
|
||||
|
||||
PHP_NEW_EXTENSION(foo, foo.c bar.c baz.cpp, $ext_shared)
|
||||
|
||||
E.g. this enables the extension foo which consists of three source-code
|
||||
modules, two in C and one in C++. And, depending on the user's wishes,
|
||||
the extension will even be built as a dynamic module.
|
||||
|
||||
The full syntax:
|
||||
|
||||
PHP_NEW_EXTENSION(extname, sources [, shared [,sapi_class[, extra-cflags]]])
|
||||
|
||||
Please have a look at acinclude.m4 for the gory details and meanings
|
||||
of the other parameters.
|
||||
|
||||
And that's basically it for the extension side.
|
||||
|
||||
If you previously built sub-libraries for this module, add
|
||||
the source-code files here as well. If you need to specify
|
||||
separate include directories, do it this way:
|
||||
|
||||
PHP_NEW_EXTENSION(foo, foo.c mylib/bar.c mylib/gregor.c,,,-I@ext_srcdir@/lib)
|
||||
|
||||
E.g. this builds the three files which are located relative to the
|
||||
extension source directory and compiles all three files with the
|
||||
special include directive (@ext_srcdir@ is automatically replaced).
|
||||
|
||||
Now, you need to tell the build system that you want to build files
|
||||
in a directory called $ext_builddir/lib:
|
||||
|
||||
PHP_ADD_BUILD_DIR($ext_builddir/lib)
|
||||
|
||||
Make sure to call this after PHP_NEW_EXTENSION, because $ext_builddir
|
||||
is only set by the latter.
|
||||
|
||||
If you have a complex extension, you might to need add special
|
||||
Make rules. You can do this by calling PHP_ADD_MAKEFILE_FRAGMENT
|
||||
in your config.m4 after PHP_NEW_EXTENSION.
|
||||
|
||||
This will read a file in the source-dir of your extension called
|
||||
Makefile.frag. In this file, $(builddir) and $(srcdir) will be
|
||||
replaced by the values which are correct for your extension
|
||||
and which are again determined by the PHP_NEW_EXTENSION macro.
|
||||
|
||||
Make sure to prefix *all* relative paths correctly with either
|
||||
$(builddir) or $(srcdir). Because the build system does not
|
||||
change the working directory anymore, we must use either
|
||||
absolute paths or relative ones to the top build-directory.
|
||||
Correct prefixing ensures that.
|
||||
|
||||
|
||||
SAPI developers:
|
||||
|
||||
Instead of using PHP_SAPI=foo/PHP_BUILD_XYZ, you will need to type
|
||||
|
||||
PHP_SELECT_SAPI(name, type, sources.c)
|
||||
|
||||
I.e. specify the source-code files as above and also pass the
|
||||
information regarding how PHP is supposed to be built (shared
|
||||
module, program, etc).
|
||||
|
||||
For example for APXS:
|
||||
|
||||
PHP_SELECT_SAPI(apache, shared, sapi_apache.c mod_php5.c php_apache.c)
|
||||
|
||||
|
||||
|
||||
General info
|
||||
|
||||
The foundation for the new system is the flexible handling of
|
||||
sources and their contexts. With the help of macros you
|
||||
can define special flags for each source-file, where it is
|
||||
located, in which target context it can work, etc.
|
||||
|
||||
Have a look at the well documented macros
|
||||
PHP_ADD_SOURCES(_X) in acinclude.m4.
|
||||
-1037
File diff suppressed because it is too large.
Load diff
@@ -1,174 +0,0 @@
|
||||
The Win32 Build System.
|
||||
$Id$
|
||||
Wez Furlong <wez@thebrainroom.com>
|
||||
|
||||
If you need help with the build system, send mail to
|
||||
internals@lists.php.net; please don't email me directly.
|
||||
|
||||
===========================================================
|
||||
Contents:
|
||||
1. How to build PHP under windows
|
||||
a. Requirements
|
||||
b. Opening a command prompt
|
||||
c. Generating configure.js
|
||||
d. Configuring
|
||||
e. Building
|
||||
f. Cleaning up
|
||||
g. Running the test suite
|
||||
h. snapshot building
|
||||
|
||||
2. How to write config.w32 files
|
||||
x. to be written.
|
||||
|
||||
===========================================================
|
||||
1. How to build PHP under windows
|
||||
a. Requirements
|
||||
|
||||
You need:
|
||||
- Windows Scripting Host (cscript.exe)
|
||||
- Microsoft Build Tools from:
|
||||
Microsoft Visual Studio (VC6) or later
|
||||
|
||||
You also need:
|
||||
- bindlib_w32 [http://www.php.net/extra/bindlib_w32.zip]
|
||||
- win32build [http://www.php.net/extra/win32build.zip]
|
||||
|
||||
b. Opening the Build Environment Command Prompt:
|
||||
- Using Visual Studio (VC6)
|
||||
1. Install it
|
||||
2. If you have a VC++ Command Prompt icon on your start menu,
|
||||
click on it to get a Command Prompt with the env vars
|
||||
set up correctly.
|
||||
|
||||
If not, create a new shortcut and set the Target to:
|
||||
|
||||
%comspec% /k "C:\Program Files\Microsoft Visual Studio\VC98\Bin\vcvars32.bat"
|
||||
|
||||
You might also want to set the prompt to start in
|
||||
a convenient location (such as the root of your
|
||||
PHP source checkout).
|
||||
|
||||
- Using Visual Studio .Net
|
||||
1. Install it.
|
||||
2. Under the Visual Studio .Net Tools sub menu of your start
|
||||
menu, you should have a Visual Studio .Net Command Prompt
|
||||
icon. If not, create a new shortcut and set the Target to:
|
||||
|
||||
%comspec% /k "C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\vsvars32.bat"
|
||||
|
||||
You might also want to set the prompt to start in
|
||||
a convenient location (such as the root of your
|
||||
PHP source checkout).
|
||||
|
||||
- Using the Platform SDK tools
|
||||
1. Download the Platform SDK:
|
||||
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
|
||||
|
||||
- You need the Core SDK, which is approx 200MB to download
|
||||
and requires approx 500MB of disk space.
|
||||
- The other components of the SDK are not required by PHP
|
||||
- You might be able to reduce the download size by downloading
|
||||
the installer control component first and then selecting
|
||||
only the Build Environment (around 30MB), but I haven't
|
||||
tried this.
|
||||
|
||||
** Note: it seems that MS don't include the 32 bit
|
||||
build tools in the platform SDK any longer, so
|
||||
you will probably have very limited luck if you
|
||||
don't also have VC++ or VS.Net already installed.
|
||||
|
||||
2. Once installed, you will have an icon on your start menu
|
||||
that will launch the build environment; the latest SDK's
|
||||
install a number of different versions of this; you probably
|
||||
want to choose the Windows 2000 Retail build environment.
|
||||
Clicking on this will open a command prompt with its Path,
|
||||
Include and Lib env vars set to point to the build tools
|
||||
and win32 headers.
|
||||
|
||||
c. Generating configure
|
||||
|
||||
Change directory to where you have your PHP 5 sources.
|
||||
Run buildconf.bat.
|
||||
|
||||
d. Configuring
|
||||
|
||||
cscript /nologo configure.js --help
|
||||
|
||||
Will give you a list of configuration options; these will
|
||||
have the form:
|
||||
|
||||
--enable-foo or --disable-foo or --with-foo or --without-foo.
|
||||
|
||||
--enable-foo will turn something on, and is equivalent to
|
||||
specifying --enable-foo=yes
|
||||
|
||||
--disable-foo will turn something off, and is equivalent to
|
||||
specifying --enable-foo=no
|
||||
|
||||
--enable-foo=shared will attempt to build that feature as
|
||||
a shared, dynamically loadable module.
|
||||
|
||||
Sometimes a configure option needs additional information
|
||||
about where to find headers and libraries; quite often
|
||||
you can specify --enable-foo=option where option could be
|
||||
the path to where to find those files. If you want to
|
||||
specify a parameter and build it as shared, you can use
|
||||
this syntax instead: --enable-foo=shared,option
|
||||
|
||||
The same rules all apply to --with-foo and --without-foo;
|
||||
the only difference is the way the options are named;
|
||||
the convention is that --enable-foo means that you are
|
||||
switching on something that comes with PHP, whereas
|
||||
--with-foo means that you want to build in something
|
||||
external to PHP.
|
||||
|
||||
e. Building
|
||||
|
||||
Once you have successfully configured your build (make
|
||||
sure you read the output from the command to make sure
|
||||
it worked correctly), you can build the code; simply type
|
||||
|
||||
"nmake" at the command prompt, and it will build everthing
|
||||
you asked for.
|
||||
|
||||
Once the build has completed, you will find your binaries
|
||||
in the build dir determined by configure; this is typically
|
||||
Release_TS for release builds or Debug_TS for debug builds.
|
||||
If you build a non-thread-safe build, it will use Release
|
||||
or Debug to store the files. Also in this build dir you
|
||||
will find sub directories for each module that went into
|
||||
your PHP build. The files you'll want to keep are the
|
||||
.exe and .dll files directly in your build dir.
|
||||
|
||||
f. Cleaning Up
|
||||
|
||||
You can automatically delete everything that was built
|
||||
by running "nmake clean". This will delete everything
|
||||
that was put there when you ran nmake, including the
|
||||
.exe and .dll files.
|
||||
|
||||
g. Running the test suite
|
||||
|
||||
You can verify that your build is working well by running
|
||||
the regression test suite. You do this by typing
|
||||
"nmake test". You can specify the tests you want to run
|
||||
by defing the TESTS variable - if you wanted to run the
|
||||
sqlite test suite only, you would type
|
||||
"nmake /D TESTS=ext/sqlite/tests test"
|
||||
|
||||
h. Snapshot Building
|
||||
|
||||
If you want to set up an automated build that will tolerate
|
||||
breakages in some of the modules, you can use the
|
||||
--enable-snapshot-build configure option to generate a
|
||||
makefile optimized for that purpose. A snapshot build will
|
||||
switch the argument parser so that the default option for
|
||||
configure switches that your don't specify will be set
|
||||
to "shared". The effect of this is to turn on all options
|
||||
unless you explicitly disable them. When you have configured
|
||||
your snapshot build, you can use "nmake build-snap" to build
|
||||
everything, ignoring build errors in individual extensions
|
||||
or SAPI.
|
||||
|
||||
vim:tw=78:sw=1:ts=1:et
|
||||
|
||||
+25
-11
@@ -1,4 +1,4 @@
|
||||
Using PHP 5 with the Zeus Web Server
|
||||
Using PHP4 with the Zeus Web Server
|
||||
-----------------------------------
|
||||
|
||||
Zeus fully supports running PHP in combination with our
|
||||
@@ -21,13 +21,29 @@ If you have any problems, please check the support site for more
|
||||
up-to-date information and advice.
|
||||
|
||||
|
||||
Quick guide to installing CGI/FastCGI with Zeus
|
||||
-----------------------------------------------
|
||||
Quick guide to installing FastCGI with Zeus
|
||||
-------------------------------------------
|
||||
|
||||
Step 1 - Compile PHP as FastCGI.
|
||||
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 --enable-fastcgi
|
||||
./configure --with-fastcgi
|
||||
make
|
||||
|
||||
Note that PHP has many options to the configure script -
|
||||
@@ -39,7 +55,7 @@ program called 'php'. Copy this into your document root, under a
|
||||
dedicated FastCGI directory (e.g. $DOCROOT/fcgi-bin/php)
|
||||
|
||||
|
||||
Step 2 - configure Zeus
|
||||
Step 3 - configure Zeus
|
||||
|
||||
Four stages:
|
||||
- enable FastCGI
|
||||
@@ -82,7 +98,7 @@ Click 'update' to commit these changes
|
||||
Finally restart your virtual server for these changes to take effect.
|
||||
|
||||
|
||||
Step 3 - start PHP as a FastCGI runner
|
||||
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
|
||||
@@ -90,10 +106,8 @@ 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. This
|
||||
variable MUST be set, if not then the PHP will not run as a FastCGI.
|
||||
We recommend a value of 8 for a fairly busy site. If you have many,
|
||||
long-running PHP scripts, then you may need to increase this further.
|
||||
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.
|
||||
|
||||
@@ -1,196 +0,0 @@
|
||||
Input Filter Support in PHP 5
|
||||
-----------------------------
|
||||
|
||||
XSS (Cross Site Scripting) hacks are becoming more and more prevalent,
|
||||
and can be quite difficult to prevent. Whenever you accept user data
|
||||
and somehow display this data back to users, you are likely vulnerable
|
||||
to XSS hacks.
|
||||
|
||||
The Input Filter support in PHP 5 is aimed at providing the framework
|
||||
through which a company-wide or site-wide security policy can be
|
||||
enforced. It is implemented as a SAPI hook and is called from the
|
||||
treat_data and post handler functions. To implement your own security
|
||||
policy you will need to write a standard PHP extension. There is also
|
||||
a powerful standard implementation in ext/filter that should suit most
|
||||
peoples' needs. However, if you want to implement your own security
|
||||
policy, read on.
|
||||
|
||||
A simple implementation might look like the following. This stores the
|
||||
original raw user data and adds a my_get_raw() function while the normal
|
||||
$_POST, $_GET and $_COOKIE arrays are only populated with stripped
|
||||
data. In this simple example all I am doing is calling strip_tags() on
|
||||
the data. If register_globals is turned on, the default globals that
|
||||
are created will be stripped ($foo) while a $RAW_foo is created with the
|
||||
original user input.
|
||||
|
||||
ZEND_BEGIN_MODULE_GLOBALS(my_input_filter)
|
||||
zval *post_array;
|
||||
zval *get_array;
|
||||
zval *cookie_array;
|
||||
ZEND_END_MODULE_GLOBALS(my_input_filter)
|
||||
|
||||
#ifdef ZTS
|
||||
#define IF_G(v) TSRMG(my_input_filter_globals_id, zend_my_input_filter_globals *, v)
|
||||
#else
|
||||
#define IF_G(v) (my_input_filter_globals.v)
|
||||
#endif
|
||||
|
||||
ZEND_DECLARE_MODULE_GLOBALS(my_input_filter)
|
||||
|
||||
zend_function_entry my_input_filter_functions[] = {
|
||||
PHP_FE(my_get_raw, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
zend_module_entry my_input_filter_module_entry = {
|
||||
STANDARD_MODULE_HEADER,
|
||||
"my_input_filter",
|
||||
my_input_filter_functions,
|
||||
PHP_MINIT(my_input_filter),
|
||||
PHP_MSHUTDOWN(my_input_filter),
|
||||
NULL,
|
||||
PHP_RSHUTDOWN(my_input_filter),
|
||||
PHP_MINFO(my_input_filter),
|
||||
"0.1",
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
PHP_MINIT_FUNCTION(my_input_filter)
|
||||
{
|
||||
ZEND_INIT_MODULE_GLOBALS(my_input_filter, php_my_input_filter_init_globals, NULL);
|
||||
|
||||
REGISTER_LONG_CONSTANT("POST", PARSE_POST, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GET", PARSE_GET, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("COOKIE", PARSE_COOKIE, CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
sapi_register_input_filter(my_sapi_input_filter);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
PHP_RSHUTDOWN_FUNCTION(my_input_filter)
|
||||
{
|
||||
if(IF_G(get_array)) {
|
||||
zval_ptr_dtor(&IF_G(get_array));
|
||||
IF_G(get_array) = NULL;
|
||||
}
|
||||
if(IF_G(post_array)) {
|
||||
zval_ptr_dtor(&IF_G(post_array));
|
||||
IF_G(post_array) = NULL;
|
||||
}
|
||||
if(IF_G(cookie_array)) {
|
||||
zval_ptr_dtor(&IF_G(cookie_array));
|
||||
IF_G(cookie_array) = NULL;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
PHP_MINFO_FUNCTION(my_input_filter)
|
||||
{
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_row( 2, "My Input Filter Support", "enabled" );
|
||||
php_info_print_table_row( 2, "Revision", "$Revision$");
|
||||
php_info_print_table_end();
|
||||
}
|
||||
|
||||
/* The filter handler. If you return 1 from it, then PHP also registers the
|
||||
* (modified) variable. Returning 0 prevents PHP from registering the variable;
|
||||
* you can use this if your filter already registers the variable under a
|
||||
* different name, or if you just don't want the variable registered at all. */
|
||||
SAPI_INPUT_FILTER_FUNC(my_sapi_input_filter)
|
||||
{
|
||||
zval new_var;
|
||||
zval *array_ptr = NULL;
|
||||
char *raw_var;
|
||||
int var_len;
|
||||
|
||||
assert(*val != NULL);
|
||||
|
||||
switch(arg) {
|
||||
case PARSE_GET:
|
||||
if(!IF_G(get_array)) {
|
||||
ALLOC_ZVAL(array_ptr);
|
||||
array_init(array_ptr);
|
||||
INIT_PZVAL(array_ptr);
|
||||
}
|
||||
IF_G(get_array) = array_ptr;
|
||||
break;
|
||||
case PARSE_POST:
|
||||
if(!IF_G(post_array)) {
|
||||
ALLOC_ZVAL(array_ptr);
|
||||
array_init(array_ptr);
|
||||
INIT_PZVAL(array_ptr);
|
||||
}
|
||||
IF_G(post_array) = array_ptr;
|
||||
break;
|
||||
case PARSE_COOKIE:
|
||||
if(!IF_G(cookie_array)) {
|
||||
ALLOC_ZVAL(array_ptr);
|
||||
array_init(array_ptr);
|
||||
INIT_PZVAL(array_ptr);
|
||||
}
|
||||
IF_G(cookie_array) = array_ptr;
|
||||
break;
|
||||
}
|
||||
Z_STRLEN(new_var) = val_len;
|
||||
Z_STRVAL(new_var) = estrndup(*val, val_len);
|
||||
Z_TYPE(new_var) = IS_STRING;
|
||||
|
||||
var_len = strlen(var);
|
||||
raw_var = emalloc(var_len+5); /* RAW_ and a \0 */
|
||||
strcpy(raw_var, "RAW_");
|
||||
strlcat(raw_var,var,var_len+5);
|
||||
|
||||
php_register_variable_ex(raw_var, &new_var, array_ptr TSRMLS_DC);
|
||||
|
||||
php_strip_tags(*val, val_len, NULL, NULL, 0);
|
||||
|
||||
*new_val_len = strlen(*val);
|
||||
return 1;
|
||||
}
|
||||
|
||||
PHP_FUNCTION(my_get_raw)
|
||||
{
|
||||
long arg;
|
||||
char *var;
|
||||
int var_len;
|
||||
zval **tmp;
|
||||
zval *array_ptr = NULL;
|
||||
HashTable *hash_ptr;
|
||||
char *raw_var;
|
||||
|
||||
if(zend_parse_parameters(2 TSRMLS_CC, "ls", &arg, &var, &var_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch(arg) {
|
||||
case PARSE_GET:
|
||||
array_ptr = IF_G(get_array);
|
||||
break;
|
||||
case PARSE_POST:
|
||||
array_ptr = IF_G(post_array);
|
||||
break;
|
||||
case PARSE_COOKIE:
|
||||
array_ptr = IF_G(post_array);
|
||||
break;
|
||||
}
|
||||
|
||||
if(!array_ptr) RETURN_FALSE;
|
||||
|
||||
/*
|
||||
* I'm changing the variable name here because when running with register_globals on,
|
||||
* the variable will end up in the global symbol table
|
||||
*/
|
||||
raw_var = emalloc(var_len+5); /* RAW_ and a \0 */
|
||||
strcpy(raw_var, "RAW_");
|
||||
strlcat(raw_var,var,var_len+5);
|
||||
hash_ptr = HASH_OF(array_ptr);
|
||||
|
||||
if(zend_hash_find(hash_ptr, raw_var, var_len+5, (void **)&tmp) == SUCCESS) {
|
||||
*return_value = **tmp;
|
||||
zval_copy_ctor(return_value);
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
efree(raw_var);
|
||||
}
|
||||
|
||||
+186
@@ -0,0 +1,186 @@
|
||||
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
|
||||
|
||||
@@ -3,23 +3,59 @@ parenthesis means that person has taken on this project.
|
||||
|
||||
Zend
|
||||
----
|
||||
For PHP 4.3.0:
|
||||
* 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.
|
||||
* Allow to set a default value for call-by-reference-parameters.
|
||||
eg: function hello (&$pallo = NULL) {}
|
||||
* Disallow function(method) redefinition in class.
|
||||
* Add configure test to determine if dlsym() requires underscore and set
|
||||
DLSYM_NEEDS_UNDERSCORE accordingly. Perl and zsh have it in configure,
|
||||
for example. (DONE?)
|
||||
|
||||
For PHP 5.0.0:
|
||||
* 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.
|
||||
* Fix Zend shallow copy issues with objects and arrays.
|
||||
|
||||
|
||||
global
|
||||
------
|
||||
For PHP 4.3.0:
|
||||
* Add aliases to functions to conform to new naming conventions, e.g.
|
||||
str_to_upper().
|
||||
* Make all extensions thread-safe.
|
||||
* Make everything on the language-level independent of your locale
|
||||
settings.
|
||||
* Change PHP error messages, so that they point to pages or sections
|
||||
in the PHP Manual.
|
||||
* 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
|
||||
dependencies. (eg ftp) (DONE?)
|
||||
* on some platforms unimplemented function will just do nothing
|
||||
(e.g. symlink) they should print a warning or not even be defined!
|
||||
(DONE ?)
|
||||
* 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.
|
||||
* Use arg_separator.input to implode args in the CGI sapi extension
|
||||
and arg_separator.input to explode in php_build_argv(). (DONE?)
|
||||
* 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).
|
||||
* Implement flush feature suitable for nested output buffers.
|
||||
|
||||
For PHP 5.0.0
|
||||
* bundle and use curl lib for fopen wrapper.
|
||||
* --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
|
||||
@@ -32,28 +68,15 @@ global
|
||||
* Move most extensions and PEAR packages out of the PHP CVS tree,
|
||||
include them again during release packaging.
|
||||
|
||||
|
||||
Other
|
||||
* use thread-safe resolver functions (either require BIND 8 or adns).
|
||||
* implement javadoc based function docs template system.
|
||||
* provide optional IPv6 support (seems to be done?).
|
||||
* provide optional IPv6 support.
|
||||
* 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.
|
||||
* Implement flush feature suitable for nested output buffers.
|
||||
|
||||
Streams
|
||||
-------
|
||||
* Route filestat.c through the wrapper layer; isolate the statcache code
|
||||
so that it is independent of php functions and can be applied to any
|
||||
stream/path.
|
||||
* Implement generalized connection pool for stated protocols such as
|
||||
ftp and http/1.1 (using keep-alive) to avoid having to negotiate
|
||||
new command/request stream for each subsequent call; Possibly store
|
||||
resources in contexts (creating a default context if necessary) to
|
||||
allow segmentation of connection pools.
|
||||
* Add a method to take ownership of the memory buffer in memory streams so
|
||||
that generating string values for zvals doesn't require an estrdup.
|
||||
* bundle and use curl lib for fopen wrapper.
|
||||
|
||||
documentation
|
||||
-------------
|
||||
@@ -66,6 +89,8 @@ documentation
|
||||
|
||||
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/oci8
|
||||
@@ -76,25 +101,16 @@ ext/oci8
|
||||
* Make allow_call_time_pass_reference=Off working.
|
||||
* For additional todo information, see oci8.c, in ext/oci8
|
||||
|
||||
ext/odbc
|
||||
--------
|
||||
For PHP 4.3.0:
|
||||
* update all php_error calls to php_error_docref where valid
|
||||
* integrate EXPERIMENTAL ODBC update for use in PHP 5.0, use for
|
||||
testing purposes only.
|
||||
|
||||
For PHP 5.0.0
|
||||
* Activate EXPERIMENTAL ODBC codebase update
|
||||
|
||||
ext/pcre
|
||||
--------
|
||||
* Allow user to set PCRE_NOTEMPTY, PCRE_ANCHORED at execution time, maybe
|
||||
|
||||
ext/pcntl
|
||||
ext/pgsql
|
||||
---------
|
||||
* Change internal callback handler to use TICKS
|
||||
* Remove all zend_extension code
|
||||
* Add object callback support to pcntl_signal()
|
||||
For PHP 4.3.0:
|
||||
* Add pg_metadata() with metadata cache feature.
|
||||
* Add pg_convert() to check and convert array value for query.
|
||||
* Add pg_insert/pg_update/pg_delete/pg_select for simple query.
|
||||
|
||||
ext/session
|
||||
-----------
|
||||
@@ -111,17 +127,37 @@ ext/session
|
||||
* Provide a callback facility which is executed upon encountering
|
||||
an unknown class name 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().
|
||||
* 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 usable 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 data types:
|
||||
dateTime
|
||||
binary
|
||||
|
||||
http://www.wddx.org/WDDX_SDK_10a/7__References/WDDX_DTD.htm
|
||||
@@ -132,5 +168,3 @@ ext/wddx
|
||||
other cool stuff
|
||||
----------------
|
||||
* PVM extension
|
||||
|
||||
vim:et:sw=4:ts=4
|
||||
@@ -1,4 +0,0 @@
|
||||
Zend Engine
|
||||
-----------
|
||||
- Look at making zend_constant value member be a zval* instead of zval. (Andi)
|
||||
- Implement inheritance rules for type hints. (Marcus)
|
||||
@@ -1,89 +0,0 @@
|
||||
Component: Zend Engine 2
|
||||
|
||||
Important stuff to finish: PPP members/PPP methods,
|
||||
support of overloaded extensions, possibly differentiate
|
||||
between class and namespace as discussed with Stig in
|
||||
Germany.
|
||||
Responsibility: Zeev, Andi, Stas
|
||||
Time frame: Couple of months for first part and extensions will be
|
||||
ongoing while PHP is being fixed.
|
||||
Things to leave for later versions: Native aggregation
|
||||
support, accessing static members via object and not class.
|
||||
|
||||
|
||||
Component: Aggregation
|
||||
Responsibility: Andi, Stig?
|
||||
Time frame: ?
|
||||
|
||||
|
||||
Component: Redesign of API Versioning
|
||||
Responsibility: ?
|
||||
Time frame: 1 month
|
||||
|
||||
|
||||
Component: Thread Safety
|
||||
Identify the extensions that are not thread safe by design
|
||||
or due to dependant libraries and identify them as such.
|
||||
If possible try to resolve thread safety issue via code
|
||||
improvements (if php code or patches will be accepted by
|
||||
library maintainers). For situations where thread safety
|
||||
cannot easily be acheived a flag in the extension API is
|
||||
set so PHP can identify non-thread safe extensions. These
|
||||
extensions will not be loaded in a ZTS compiled binary
|
||||
(unless it is cli/cgi).
|
||||
|
||||
Responsibility: ?
|
||||
Time frame: ?
|
||||
|
||||
|
||||
Component: SAPI
|
||||
Environment variables defined in the CGI spec need to be
|
||||
verified in each SAPI module that they conform to the CGI
|
||||
spec correctly. If they do not, the SAPI module needs to
|
||||
fix the variable prior to script execution. Having this
|
||||
conformity will aid in having PHP scripts run correctly
|
||||
under different sapi modules.
|
||||
|
||||
Responsibility: Shane Caraveo & each sapi module owner
|
||||
Timeframe: ? (but shouldn't be much effort, most modules are probably ok)
|
||||
|
||||
|
||||
Component: RPC Abstraction Layer
|
||||
Porting java, com, dotnet, xmlrpc, corba, soap and python, srm
|
||||
(are there more ?) to work with the new oo api and preferably
|
||||
by using ext/rpc.
|
||||
Responsibility: Harald
|
||||
Time frame: 2 months (but i have to wait for a few engine features first)
|
||||
|
||||
|
||||
Component: OO Extensions
|
||||
Each OO extension has to be revised and rewritten to fit into
|
||||
the new OO model. We should decide which extensions are a must
|
||||
to have for the release and which can be ported by the maintainer
|
||||
later as a separate pecl release.
|
||||
A list of extensions to be extended that have to be investigated:
|
||||
* browscap
|
||||
* aggregate
|
||||
* all *sql extensions (*_fetch_object)
|
||||
* domxml (seems like christian is rewriting it anyways)
|
||||
* ming
|
||||
Responsibility: Harald (, extension maintainers)
|
||||
|
||||
|
||||
Component: Abstract Data Types (ADT)
|
||||
Responsibility: Sterling, Harald
|
||||
Time frame: ?
|
||||
|
||||
|
||||
Component: Test Suite
|
||||
Extending the test suite with atleast a test for every
|
||||
function in an extension that doesn't require external
|
||||
resources. Also developing an automated test thing which
|
||||
cvs ups's, compiles and tests the build on a daily base on
|
||||
as much platforms/extensions as possible.
|
||||
|
||||
The test suite will also be extended to support threaded
|
||||
testing and testing for differing sapi modules (via http
|
||||
calls or other methods).
|
||||
Reponsibility: Derick (, extension maintainers)
|
||||
Time frame: 3 months
|
||||
@@ -0,0 +1,26 @@
|
||||
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.
|
||||
@@ -0,0 +1,6 @@
|
||||
## 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:
|
||||
@@ -0,0 +1,2 @@
|
||||
- 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
@@ -0,0 +1,588 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| 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
@@ -0,0 +1,186 @@
|
||||
# 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
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| 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 */
|
||||
@@ -0,0 +1 @@
|
||||
#undef PTHREADS
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[
|
||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
|
||||
])
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
# 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
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/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
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
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)
|
||||
@@ -0,0 +1,44 @@
|
||||
#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
@@ -0,0 +1,160 @@
|
||||
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
@@ -0,0 +1,124 @@
|
||||
|
||||
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
|
||||
|
||||
])
|
||||
@@ -0,0 +1,15 @@
|
||||
#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
|
||||
@@ -0,0 +1,58 @@
|
||||
#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
|
||||
|
||||
/* AIX requires this to be the first thing in the file. */
|
||||
#ifndef __GNUC__
|
||||
# if HAVE_ALLOCA_H
|
||||
# include <alloca.h>
|
||||
# else
|
||||
# ifdef _AIX
|
||||
#pragma alloca
|
||||
# else
|
||||
# ifndef alloca /* predefined by HP cc +Olibcalls */
|
||||
char *alloca ();
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#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 */
|
||||
@@ -0,0 +1,63 @@
|
||||
#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
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef TSRM_STRTOK_R
|
||||
#define TSRM_STRTOK_R
|
||||
|
||||
char *tsrm_strtok_r(char *s, const char *delim, char **last);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,775 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2002 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
|
||||
#include <tchar.h>
|
||||
#define tsrm_strtok_r(a,b,c) _tcstok((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]!='/') ||
|
||||
IsDBCSLeadByte(state->cwd[state->cwd_length-2])) {
|
||||
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 = (mode_t) va_arg(arg, int);
|
||||
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:
|
||||
*/
|
||||
@@ -0,0 +1,224 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2002 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 IS_SLASH_P(c) (*(c) == '/' || \
|
||||
(*(c) == '\\' && !IsDBCSLeadByte(*(c-1))))
|
||||
#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 '/'
|
||||
|
||||
#ifdef __riscos__
|
||||
#define DEFAULT_DIR_SEPARATOR ';'
|
||||
#else
|
||||
#define DEFAULT_DIR_SEPARATOR ':'
|
||||
#endif
|
||||
|
||||
#define IS_SLASH(c) ((c) == '/')
|
||||
#define IS_SLASH_P(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 */
|
||||
@@ -0,0 +1,359 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2002 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
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2002 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,548 +0,0 @@
|
||||
$Id$
|
||||
|
||||
UPGRADE NOTES - PHP 5.1
|
||||
|
||||
1. Changes in reference handling
|
||||
a. Overview
|
||||
b. Code that worked under PHP 4.3, but now fails
|
||||
c. Code that was valid under PHP 4.3, but now throws an error
|
||||
d. Code that failed under PHP 4.3, but now works
|
||||
e. Code that 'should have worked' under PHP 5.0
|
||||
f. Warnings that came and went
|
||||
2. Reading []
|
||||
3. instanceof, is_a(), is_subclass_of(), catch
|
||||
4. Integer values in function parameters
|
||||
5. Abstract private methods
|
||||
6. Access modifiers in interfaces
|
||||
7. Changes in inheritance rules
|
||||
8. Class constants
|
||||
9. Extensions
|
||||
a. Extensions that are gone from the PHP core
|
||||
b. Class constants in new PHP 5.1 extensions
|
||||
10. Date/time support
|
||||
11. Changes in database support
|
||||
a. PDO overview
|
||||
b. Changes in MySQL support
|
||||
c. Changes in SQLite support
|
||||
12. Further migration information
|
||||
13. Checking for E_STRICT errors
|
||||
|
||||
===============================================================================
|
||||
|
||||
1. Changes in reference handling
|
||||
================================
|
||||
|
||||
1a. Overview
|
||||
============
|
||||
|
||||
From the PHP script writer's point of view, the change most likely to impact
|
||||
legacy code is in the way that references are handled in all PHP versions
|
||||
post-dating the PHP 4.4.0 release.
|
||||
|
||||
Until and including PHP 4.3, it was possible to send, assign or return variables
|
||||
by reference that should really be returned by value, such as a constant, a
|
||||
temporary value (e.g. the result of an expression), or the result of a function
|
||||
that had itself been returned by value, as here:
|
||||
|
||||
<?php
|
||||
|
||||
$foo = "123";
|
||||
|
||||
function return_value() {
|
||||
global $foo;
|
||||
return $foo;
|
||||
}
|
||||
|
||||
$bar = &return_value();
|
||||
|
||||
?>
|
||||
|
||||
Although this code would usually work as expected under PHP 4.3, in the general
|
||||
case the result is undefined. The Zend Engine could not act correctly on these
|
||||
values as references. This bug could and did lead to various hard-to-reproduce
|
||||
memory corruption problems, particularly where the code base was large.
|
||||
|
||||
In PHP 4.4.0, PHP 5.0.4 and all subsequent PHP releases, the Engine was fixed
|
||||
to 'know' when the reference operation is being used on a value that should
|
||||
not be referenced. The actual value is now used in such cases, and a warning
|
||||
is emitted. The warning takes the form of an E_NOTICE in PHP 4.4.0 and up,
|
||||
and E_STRICT in PHP 5.0.4 and up.
|
||||
|
||||
Code that could potentially produce memory corruption can no longer do so.
|
||||
However, some legacy code might work differently as a result.
|
||||
|
||||
1b. Code that worked under PHP 4.3, but now fails
|
||||
=================================================
|
||||
|
||||
<?php
|
||||
|
||||
function func(&$arraykey) {
|
||||
return $arraykey; // function returns by value!
|
||||
}
|
||||
|
||||
$array = array('a', 'b', 'c');
|
||||
foreach (array_keys($array) as $key) {
|
||||
$y = &func($array[$key]);
|
||||
$z[] =& $y;
|
||||
}
|
||||
|
||||
var_dump($z);
|
||||
|
||||
?>
|
||||
Running the above script under any version of PHP that pre-dates the reference
|
||||
fix would produce this output:
|
||||
|
||||
array(3) {
|
||||
[0]=>
|
||||
&string(1) "a"
|
||||
[1]=>
|
||||
&string(1) "b"
|
||||
[2]=>
|
||||
&string(1) "c"
|
||||
}
|
||||
|
||||
Following the reference fix, the same code would result in:
|
||||
|
||||
array(3) {
|
||||
[0]=>
|
||||
&string(1) "c"
|
||||
[1]=>
|
||||
&string(1) "c"
|
||||
[2]=>
|
||||
&string(1) "c"
|
||||
}
|
||||
|
||||
This is because, following the changes, func() assigns by value. The value
|
||||
of $y is re-assigned, and reference-binding is preserved from $z. Prior
|
||||
to the fix, the value was assigned by reference, leading $y to be
|
||||
re-bound on each assignment. The attempt to bind to a temporary value
|
||||
by reference was the cause of the memory corruption.
|
||||
|
||||
Such code can be made to work identically in both the pre-fix and the
|
||||
post-fix PHP versions. The signature of func() can be altered to return
|
||||
by reference, or the reference assignment can be removed from the result
|
||||
of func().
|
||||
|
||||
<?php
|
||||
|
||||
function func() {
|
||||
return 'function return';
|
||||
}
|
||||
|
||||
$x = 'original value';
|
||||
$y =& $x;
|
||||
$y = &func();
|
||||
echo $x;
|
||||
|
||||
?>
|
||||
|
||||
In PHP 4.3 $x would be 'original value', whereas after the changes it would
|
||||
be 'function return' - remember that where the function does not return by
|
||||
reference, the reference assignment is converted to a regular assignment.
|
||||
Again, this can be brought to a common base, either by forcing func() to
|
||||
return by reference or by eliminating the by-reference assignment.
|
||||
|
||||
1c. Code that was valid under PHP 4.3, but now throws an error
|
||||
==============================================================
|
||||
|
||||
<?php
|
||||
|
||||
class Foo {
|
||||
|
||||
function getThis() {
|
||||
return $this;
|
||||
}
|
||||
|
||||
function destroyThis() {
|
||||
$baz =& $this->getThis();
|
||||
}
|
||||
}
|
||||
|
||||
$bar = new Foo();
|
||||
$bar->destroyThis();
|
||||
var_dump($bar);
|
||||
|
||||
?>
|
||||
|
||||
In PHP 5.0.3, $bar evaluated to NULL instead of returning an object.
|
||||
That happened because getThis() returns by value, but the value here
|
||||
is assigned by reference. Although it now works in the expected way,
|
||||
this is actually invalid code which will throw an E_NOTICE under
|
||||
PHP 4.4 or an E_STRICT under PHP 5.0.4 and up.
|
||||
|
||||
1d. Code that failed under PHP 4.3, but now works
|
||||
=================================================
|
||||
|
||||
<?php
|
||||
|
||||
function &f() {
|
||||
$x = "foo";
|
||||
var_dump($x);
|
||||
print "$x\n";
|
||||
return($a);
|
||||
}
|
||||
|
||||
for ($i = 0; $i < 3; $i++) {
|
||||
$h = &f();
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
In PHP 4.3 the third call to var_dump produces NULL, due to the memory
|
||||
corruption caused by returning an uninitialized value by reference.
|
||||
This is valid code in PHP 5.0.4 and up, but threw errors in earlier
|
||||
releases of PHP.
|
||||
|
||||
<?php
|
||||
|
||||
$arr = array('a1' => array('alfa' => 'ok'));
|
||||
$arr =& $arr['a1'];
|
||||
echo '-'.$arr['alfa']."-\n";
|
||||
|
||||
?>
|
||||
|
||||
Until PHP 5.0.5, it wasn't possible to assign an array element by
|
||||
reference in this way. It now is.
|
||||
|
||||
1e. Code that 'should have worked' under PHP 5.0
|
||||
================================================
|
||||
|
||||
There are a couple of instances of bugs reported under PHP 5.0 prior
|
||||
to the reference fixes which now 'work'. However, in both cases errors
|
||||
are thrown by PHP 5.1, because the code was invalid in the first place.
|
||||
Returning values by reference using self:: now works in the general
|
||||
case but throws an E_STRICT warning, and although your mileage may
|
||||
vary when assigning by reference to an overloaded object, you will
|
||||
still see an E_ERROR when you try it, even where the assignment
|
||||
itself appears to work.
|
||||
|
||||
1f. Warnings that came and went
|
||||
===============================
|
||||
|
||||
<?php
|
||||
|
||||
function & foo() {
|
||||
$var = 'ok';
|
||||
return $var;
|
||||
}
|
||||
|
||||
function & bar() {
|
||||
return foo();
|
||||
}
|
||||
|
||||
$a =& bar();
|
||||
echo "$a\n";
|
||||
|
||||
?>
|
||||
|
||||
Nested calls to functions returning by reference are valid code under both
|
||||
PHP 4.3 and PHP 5.1, but threw an unwarranted E_NOTICE or E_STRICT under
|
||||
the intervening PHP releases.
|
||||
|
||||
2. Reading []
|
||||
=============
|
||||
|
||||
<?php
|
||||
|
||||
class XmlTest {
|
||||
|
||||
function test_ref(&$test) {
|
||||
$test = "ok";
|
||||
}
|
||||
|
||||
function test($test) { }
|
||||
|
||||
function run() {
|
||||
$ar = array();
|
||||
$this->test_ref($ar[]);
|
||||
var_dump($ar);
|
||||
$this->test($ar[]);
|
||||
}
|
||||
}
|
||||
|
||||
$o = new XmlTest();
|
||||
$o->run();
|
||||
|
||||
?>
|
||||
|
||||
This should always have thrown a fatal E_ERROR, because [] cannot be used
|
||||
for reading in PHP. It is invalid code in PHP 4.4.2 and PHP 5.0.5 upward.
|
||||
|
||||
3. instanceof, is_a(), is_subclass_of(), catch
|
||||
==============================================
|
||||
|
||||
In PHP 5.0, is_a() was deprecated and replaced by the "instanceof" operator.
|
||||
There were some issues with the initial implementation of "instanceof", which
|
||||
relied on __autoload() to search for missing classes. If the class was not
|
||||
present, "instanceof" would throw a fatal E_ERROR due to the failure of
|
||||
__autoload() to discover that class. The same behaviour occurred in the
|
||||
"catch" operator and the is_subclass_of() function, for the same reason.
|
||||
|
||||
None of these functions or operators call __autoload() in PHP 5.1, and
|
||||
the class_exists() workarounds used in code written for PHP 5.0, while
|
||||
not problematic in any way, are no longer necessary.
|
||||
|
||||
4. Integer values in function parameters
|
||||
========================================
|
||||
|
||||
With the advent of PHP 5.0, a new parameter parsing API was introduced
|
||||
which is used by a large number of PHP functions. In all versions of
|
||||
PHP between 5.0 and 5.1, the handling of integer values was very strict
|
||||
and would reject non-well formed numeric values when a PHP function
|
||||
expected an integer. These checks have now been relaxed to support
|
||||
non-well formed numeric strings such as " 123" and "123 ", and will
|
||||
no longer fail as they did under PHP 5.0. However, to promote code
|
||||
safety and input validation, PHP functions will now emit an E_NOTICE
|
||||
when such strings are passed as integers.
|
||||
|
||||
5. Abstract private methods
|
||||
===========================
|
||||
|
||||
Abstract private methods were supported between PHP 5.0.0 and PHP 5.0.4,
|
||||
but were then disallowed on the grounds that the behaviours of 'private'
|
||||
and 'abstract' are mutually exclusive.
|
||||
|
||||
6. Access modifiers in interfaces
|
||||
=================================
|
||||
|
||||
Under PHP 5.0, function declarations in interfaces were treated in exactly
|
||||
the same way as function declarations in classes. This has not been the case
|
||||
since October 2004, at which point only the 'public' access modifier was
|
||||
allowed in interface function declarations. Since April 2005 - which pre-dates
|
||||
the PHP 5.0b1 release - the 'static' modifier has also been allowed. However,
|
||||
the 'protected' and 'private' modifiers will now throw an E_ERROR, as will
|
||||
'abstract'. Note that this change should not affect your existing code, as
|
||||
none of these modifiers makes sense in the context of interfaces anyway.
|
||||
|
||||
7. Changes in inheritance rules
|
||||
===============================
|
||||
|
||||
Under PHP 5.0, it was possible to have a function declaration in a derived class
|
||||
that did not match the declaration of the same function in the base class, e.g.
|
||||
|
||||
class Base {
|
||||
function &return_by_ref() {
|
||||
$r = 1;
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
|
||||
class Derived extends Base {
|
||||
function return_by_ref() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
This code will cause an E_STRICT error to be emitted under PHP 5.1.
|
||||
|
||||
8. Class constants
|
||||
==================
|
||||
|
||||
Under PHP 5.0, the following code was valid:
|
||||
|
||||
<?php
|
||||
|
||||
class test {
|
||||
const foobar = 'foo';
|
||||
const foobar = 'bar';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Under PHP 5.1, redefinition of a class constant will throw a fatal E_ERROR.
|
||||
|
||||
9. Extensions
|
||||
=============
|
||||
|
||||
9a. Extensions that are gone from the PHP core
|
||||
==============================================
|
||||
|
||||
One of the first things you're likely to notice when you download PHP 5.1 is that
|
||||
several of the older extensions have disappeared. Those extensions that are still
|
||||
actively maintained are available in the PHP Extension Community Library (PECL),
|
||||
at http://pecl.php.net. Windows binaries are built regularly, and you can obtain
|
||||
the binaries for PECL extensions built against PHP 5.1 from
|
||||
http://pecl4win.php.net/list.php/5_1.
|
||||
|
||||
Extension Alternative/status
|
||||
========= ========================
|
||||
ext/cpdf pecl/pdflib
|
||||
ext/dbx pecl/dbx
|
||||
ext/dio pecl/dio
|
||||
ext/fam not actively maintained
|
||||
ext/ingres_ii pecl/ingres
|
||||
ext/ircg not actively maintained
|
||||
ext/mcve pecl/mcve
|
||||
ext/mnogosearch not actively maintained
|
||||
ext/oracle ext/oci8 or ext/pdo_oci
|
||||
ext/ovrimos not actively maintained
|
||||
ext/pfpro not actively maintained
|
||||
- alternatives at http://pecl.php.net/packages.php?catpid=18&catname=Payment
|
||||
ext/w32api pecl/ffi
|
||||
ext/yp not actively maintained
|
||||
sapi/activescript http://pecl4win.php.net/ext.php/php5activescript.dll (PECL package)
|
||||
or pecl/activescript (CVS)
|
||||
|
||||
Modules in PECL that are not actively maintained (i.e. have not been supported
|
||||
for some time, have no active maintainer working on them currently, and do not
|
||||
have any PECL package releases), are still available in CVS at
|
||||
http://cvs.php.net/pecl/. However, unreleased PHP modules are by their nature
|
||||
unsupported, and your mileage may vary when attempting to install or use them.
|
||||
|
||||
9b. Class constants in new PHP 5.1 extensions
|
||||
=============================================
|
||||
|
||||
The Zend Engine 2.1 API allows extension developers to declare class constants
|
||||
in object oriented extensions. New extensions written for PHP 5.1, including SPL,
|
||||
PDO, ext/XMLReader and ext/date, have their constants in the format
|
||||
|
||||
PDO::CLASS_CONSTANT
|
||||
|
||||
rather than in the C format
|
||||
|
||||
PDO_CLASS_CONSTANT
|
||||
|
||||
in order to minimise pollution of the global namespace in PHP.
|
||||
|
||||
10. Date/time support
|
||||
====================
|
||||
|
||||
Date/time support has been fully rewritten in PHP 5.1, and no longer
|
||||
uses the system settings to 'know' the timezone in operation. It will
|
||||
instead utilize, in the following order:
|
||||
|
||||
* The timezone set using the date_default_timezone_set() function (if any)
|
||||
* The TZ environment variable (if non empty)
|
||||
* The date.timezone ini option (if set)
|
||||
* "magical" guess (if the operating system supports it)
|
||||
* If none of the above options succeeds, UTC
|
||||
|
||||
To ensure accuracy (and avoid an E_STRICT warning), you will need to define
|
||||
your timezone in your php.ini using the following format:
|
||||
|
||||
date.timezone = Europe/London
|
||||
|
||||
The supported timezones are listed, in this format, in the PHP manual at
|
||||
http://www.php.net/manual/en/timezones.php.
|
||||
|
||||
11. Changes in database support
|
||||
==============================
|
||||
|
||||
11a. PDO overview
|
||||
================
|
||||
|
||||
PHP Data Objects (PDO) were introduced as a PECL extension under PHP 5.0,
|
||||
and became part of the core PHP distribution in PHP 5.1. The PDO extension
|
||||
provides a consistent interface for database access, and is used alongside
|
||||
database-specific PDO drivers. Each driver may also have database-specific
|
||||
functions of its own, but basic data access functionality such as issuing
|
||||
queries and fetching data is covered by PDO functions, using the driver
|
||||
named in PDO::__construct().
|
||||
|
||||
Note that the PDO extension, and its drivers, are intended to be built as
|
||||
shared extensions. This will enable straightforward driver upgrades from
|
||||
PECL, without forcing you to rebuild all of PHP.
|
||||
|
||||
At the point of the PHP 5.1 release, PDO is more than ready for widespread
|
||||
testing and could be adopted in most situations. However, it is important
|
||||
to understand that PDO and its drivers are comparatively young and may be
|
||||
missing certain database-specific features; evaluate PDO carefully before
|
||||
you use it in new projects.
|
||||
|
||||
Legacy code will generally rely on the pre-existing database extensions,
|
||||
which are still maintained.
|
||||
|
||||
There is more in-depth information about the PDO extension in the manual
|
||||
at http://www.php.net/manual/ref.pdo.php.
|
||||
|
||||
11b. Changes in MySQL support
|
||||
============================
|
||||
|
||||
In PHP 4, MySQL 3 support was built-in. With the release of PHP 5.0 there
|
||||
were two MySQL extensions, named 'mysql' and 'mysqli', which were designed
|
||||
to support MySQL < 4.1 and MySQL 4.1 and up, respectively. With the
|
||||
introduction of PDO, which provides a very fast interface to all the
|
||||
database APIs supported by PHP, the PDO_MYSQL driver can support any
|
||||
of the current versions (MySQL 3, 4 or 5) in PHP code written for PDO,
|
||||
depending on the MySQL library version used during compilation. The
|
||||
older MySQL extensions remain in place for reasons of back compatibility,
|
||||
but are not enabled by default.
|
||||
|
||||
11c. Changes in SQLite support
|
||||
=============================
|
||||
|
||||
In PHP 5.0, SQLite 2 support was provided by the built-in sqlite
|
||||
extension, which was also available as a PECL extension in PHP 4.3
|
||||
and PHP 4.4. With the introduction of PDO, the sqlite extension doubles
|
||||
up to act as a 'sqlite2' driver for PDO; it is due to this that the
|
||||
sqlite extension in PHP 5.1 has a dependency upon the PDO extension.
|
||||
|
||||
PHP 5.1 ships with a number of alternative interfaces to sqlite:
|
||||
|
||||
The sqlite extension provides the "classic" sqlite procedural/OO API
|
||||
that you may have used in prior versions of PHP. It also provides the
|
||||
PDO 'sqlite2' driver, which allows you to access legacy SQLite 2
|
||||
databases using the PDO API.
|
||||
|
||||
PDO_SQLITE provides the 'sqlite' version 3 driver. SQLite version 3
|
||||
is vastly superior to SQLite version 2, but the file formats of the
|
||||
two versions are not compatible.
|
||||
|
||||
If your SQLite-based project is already written and working against
|
||||
earlier PHP versions, then you can continue to use ext/sqlite without
|
||||
problems, but will need to explicitly enable both PDO and sqlite. New
|
||||
projects should use PDO and the 'sqlite' (version 3) driver, as this is
|
||||
faster than SQLite 2, has improved locking concurrency, and supports
|
||||
both prepared statements and binary columns natively.
|
||||
|
||||
12. Further migration information
|
||||
================================
|
||||
|
||||
For general information about migrating from PHP 4 to PHP 5, please refer to
|
||||
the relevant section in the PHP manual at http://www.php.net/manual/migration5.php.
|
||||
|
||||
13. Checking for E_STRICT errors
|
||||
================================
|
||||
|
||||
If you only have a single script to check, you can pick up E_STRICT
|
||||
errors using PHP's commandline lint facility:
|
||||
|
||||
php -d error_reporting=4095 -l script_to_check.php
|
||||
|
||||
For larger projects, the shell script below will achieve the same task:
|
||||
|
||||
#!/bin/sh
|
||||
|
||||
directory=$1
|
||||
|
||||
shift
|
||||
|
||||
# These extensions are checked
|
||||
extensions="php inc"
|
||||
|
||||
check_file ()
|
||||
{
|
||||
echo -ne "Doing PHP syntax check on $1 ..."
|
||||
|
||||
# Options:
|
||||
ERRORS=`/www/php/bin/php -d display_errors=1 -d html_errors=0 -d error_prepend_string=" " -d error_append_string=" " -d error_reporting=4095 -l $1 | grep -v "No syntax errors detected"`
|
||||
|
||||
if test -z "$ERRORS"; then
|
||||
echo -ne "OK."
|
||||
else
|
||||
echo -e "Errors found!\n$ERRORS"
|
||||
fi
|
||||
|
||||
echo
|
||||
}
|
||||
|
||||
# loop over remaining file args
|
||||
for FILE in "$@" ; do
|
||||
for ext in $extensions; do
|
||||
if echo $FILE | grep "\.$ext$" > /dev/null; then
|
||||
if test -f $FILE; then
|
||||
check_file "$FILE"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
+849
-2439
File diff suppressed because it is too large.
Load diff
+280
@@ -0,0 +1,280 @@
|
||||
Following is a merge of two letters I sent to php4beta@lists.php.net,
|
||||
describing the changes in API between PHP 3.0 and PHP 4.0 (Zend).
|
||||
This file is by no means thorough documentation of the PHP API,
|
||||
and is intended for developers who are familiar with the PHP 3.0 API,
|
||||
and want to port their code to PHP 4.0, or take advantage of its new
|
||||
features. For highlights about the PHP 3.0 API, consult apidoc.txt.
|
||||
|
||||
Zeev
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
I'm going to try to list the important changes in API and programming
|
||||
techniques that are involved in developing modules for PHP4/Zend, as
|
||||
opposed to PHP3. Listing the whole PHP4 API is way beyond my scope here,
|
||||
it's mostly a 'diff' from the apidoc.txt, which you're all pretty familiar
|
||||
with.
|
||||
An important note that I neglected to mention yesterday - the php4 tree is
|
||||
based on the php 3.0.5 tree, plus all 3.0.6 patches hand-patched into it.
|
||||
Notably, it does NOT include any 3.0.7 patches. All of those have to be
|
||||
reapplied, with extreme care - modules should be safe to patch (mostly),
|
||||
but anything that touches the core or main.c will almost definitely require
|
||||
changes in order to work properly.
|
||||
|
||||
[1] Symbol Tables
|
||||
|
||||
One of the major changes in Zend involves changing the way symbols tables
|
||||
work. Zend enforces reference counting on all values and resources. This
|
||||
required changes in the semantics of the hash tables that implement symbol
|
||||
tables. Instead of storing pval in the hashes, we now store pval *. All
|
||||
of the API functions in Zend were changed in a way that this change is
|
||||
completely transparent. However, if you've used 'low level' hash functions
|
||||
to access or update elements in symbol tables, your code will require
|
||||
changes. Following are two simple examples, one demonstrates the
|
||||
difference between PHP3 and Zend when reading a symbol's value, and the
|
||||
other demonstrates the difference when writing a value.
|
||||
|
||||
php3_read()
|
||||
{
|
||||
pval *foo;
|
||||
|
||||
_php3_hash_find(ht, "foo", sizeof("foo"), &foo);
|
||||
/* foo->type is the type and foo->value is the value */
|
||||
}
|
||||
|
||||
|
||||
php4_read()
|
||||
{
|
||||
pval **foo;
|
||||
|
||||
_php3_hash_find(ht, "foo", sizeof("foo"), &foo);
|
||||
/* (*foo)->type is the type and (*foo)->value is the value */
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
php3_write()
|
||||
{
|
||||
pval newval;
|
||||
|
||||
newval.type = ...;
|
||||
newval.value = ...;
|
||||
_php3_hash_update(ht, "bar", sizeof("bar"), &newval, sizeof(pval), NULL);
|
||||
}
|
||||
|
||||
php4_write()
|
||||
{
|
||||
pval *newval = ALLOC_ZVAL();
|
||||
|
||||
newval->refcount=1;
|
||||
newval->is_ref=0;
|
||||
newval->type = ...;
|
||||
newval->value = ...;
|
||||
_php3_hash_update(ht, "bar", sizeof("bar"), &newval, sizeof(pval *), NULL);
|
||||
}
|
||||
|
||||
|
||||
[2] Resources
|
||||
|
||||
One of the 'cute' things about the reference counting support is that it
|
||||
completely eliminates the problem of resource leaking. A simple loop that
|
||||
included '$result = mysql_query(...)' in PHP leaked unless the user
|
||||
remembered to run mysql_free($result) at the end of the loop body, and
|
||||
nobody really did. In order to take advantage of the automatic resource
|
||||
deallocation upon destruction, there's virtually one small change you need
|
||||
to conduct. Change the result type of a resource that you want to destroy
|
||||
itself as soon as its no longer referenced (just about any resource I can
|
||||
think of) as IS_RESOURCE, instead of as IS_LONG. The rest is magic.
|
||||
|
||||
A special treatment is required for SQL modules that follow MySQL's
|
||||
approach for having the link handle as an optional argument. Modules that
|
||||
follow the MySQL module model, store the last opened link in a global
|
||||
variable, that they use in case the user neglects to explicitly specify a
|
||||
link handle. Due to the way referenec counting works, this global
|
||||
reference is just like any other reference, and must increase that SQL link
|
||||
resource's reference count (otherwise, it will be closed prematurely).
|
||||
Simply, when you set the default link to a certain link, increase that
|
||||
link's reference count by calling zend_list_addref().
|
||||
As always, the MySQL module is the one used to demonstrate 'new
|
||||
technology'. You can look around it and look for IS_RESOURCE, as well as
|
||||
zend_list_addref(), to see a clear example of how the new API should be used.
|
||||
|
||||
|
||||
[3] Thread safety issues
|
||||
|
||||
I'm not going to say that Zend was designed with thread safety in mind, but
|
||||
from some point, we've decided upon several guidelines that would make the
|
||||
move to thread safety much, much easier. Generally, we've followed the PHP
|
||||
3.1 approach of moving global variables to a structure, and encapsulating
|
||||
all global variable references within macros. There are three main
|
||||
differences:
|
||||
1. We grouped related globals in a single structure, instead of grouping
|
||||
all globals in one structure.
|
||||
2. We've used much, much shorter macro names to increase the readability
|
||||
of the source code.
|
||||
3. Regardless of whether we're compiling in thread safe mode or not, all
|
||||
global variables are *always* stored in a structure. For example, you
|
||||
would never have a global variable 'foo', instead, it'll be a property of a
|
||||
global structure, for example, compiler_globals.foo. That makes
|
||||
development much, much easier, since your code will simply not compile
|
||||
unless you remember to put the necessary macro around foo.
|
||||
|
||||
To write code that'll be thread safe in the future (when we release our
|
||||
thread safe memory manager and work on integrating it), you can take a look
|
||||
at zend_globals.h. Essentially, two sets of macros are defined, one for
|
||||
thread safe mode, and one for thread unsafe mode. All global references
|
||||
are encapsulated within ???G(varname), where ??? is the appropriate prefix
|
||||
for your structure (for example, so far we have CG(), EG() and AG(), which
|
||||
stand for the compiler, executor and memory allocator, respectively).
|
||||
When compiling with thread safety enabled, each function that makes use of
|
||||
a ???G() macro, must obtain the pointer to its copy of the structure. It
|
||||
can do so in one of two forms:
|
||||
1. It can receive it as an argument.
|
||||
2. It can fetch it.
|
||||
|
||||
Obviously, the first method is preferable since it's much quicker.
|
||||
However, it's not always possible to send the structure all the way to a
|
||||
particular function, or it may simply bloat the code too much in some
|
||||
cases. Functions that receive the globals as an argument, should look like
|
||||
this:
|
||||
|
||||
rettype functioname(???LS_D) <-- a function with no arguments
|
||||
rettype functioname(type arg1, ..., type argn ???LS_DC) <-- a funciton with
|
||||
arguments
|
||||
|
||||
Calls to such functions should look like this:
|
||||
functionname(???LS_C) <-- a function with no arguments
|
||||
functionname(arg1, ..., argn ???LS_CC) <-- a function with arguments
|
||||
|
||||
LS stands for 'Local Storage', _C stands for Call and _CC stands for Call
|
||||
Comma, _D stands for Declaration and _DC stands for Declaration Comma.
|
||||
Note that there's NO comma between the last argument and ???LS_DC or ???LS_CC.
|
||||
|
||||
If you do not pass the structure as an argument you can always fetch it by
|
||||
using the appropriate ???LS_FETCH() macros within a functions variable
|
||||
declarations.
|
||||
|
||||
In general, every module that makes use of globals should use this approach
|
||||
if it plans to be thread safe.
|
||||
|
||||
|
||||
[4] Generalized INI support
|
||||
|
||||
The code comes to solve several issues:
|
||||
|
||||
a. The ugly long block of code in main.c that reads values from the
|
||||
cfg_hash into php3_ini.
|
||||
b. Get rid of php3_ini. The performance penalty of copying it around all
|
||||
the time in the Apache module probably wasn't too high, but
|
||||
psychologically, it annoyed me :)
|
||||
c. Get rid of the ugly code in mod_php4.c, that also reads values from
|
||||
Apache directives and puts them into the php3_ini structure.
|
||||
d. Generalize all the code so that you only have to add an entry in one
|
||||
single place and get it automatically supported in php3.ini, Apache, Win32
|
||||
registry, runtime function ini_get() and ini_alter() and any future method
|
||||
we might have.
|
||||
e. Allow users to easily override *ANY* php3.ini value, except for ones
|
||||
they're not supposed to, of course.
|
||||
|
||||
I'm happy to say that I think I pretty much reached all goals. php_ini.c
|
||||
implements a mechanism that lets you add your INI entry in a single place,
|
||||
with a default value in case there's no php3.ini value. What you get by
|
||||
using this mechanism:
|
||||
|
||||
1. Automatic initialization from php3.ini if available, or from the
|
||||
default value if not.
|
||||
2. Automatic support in ini_alter(). That means a user can change the
|
||||
value for this INI entry at runtime, without you having to add in a single
|
||||
line of code, and definitely no additional function (for example, in PHP3,
|
||||
we had to add in special dedicated functions, like
|
||||
set_magic_quotes_runtime() or the likes - no need for that anymore).
|
||||
3. Automatic support in Apache .conf files.
|
||||
4. No need for a global php3_ini-like variable that'll store all that
|
||||
info. You can directly access each INI entry by name, in runtime. 'Sure,
|
||||
that's not revolutionary, it's just slow' is probably what some of you
|
||||
think - which is true, but, you can also register a callback function that
|
||||
is called each time your INI entry is changed, if you wish to store it in a
|
||||
cached location for intensive use.
|
||||
5. Ability to access the current active value for a given INI entry, and
|
||||
the 'master' value.
|
||||
|
||||
Of course, (2) and (3) are only applicable in some cases. Some entries
|
||||
shouldn't be overriden by users in runtime or through Apache .conf files -
|
||||
you can, of course, mark them as such.
|
||||
|
||||
|
||||
So, enough hype, how does it work.
|
||||
|
||||
Essentially:
|
||||
|
||||
static PHP_INI_MH(OnChangeBar); /* declare a message handler for a change
|
||||
in "bar" */
|
||||
|
||||
PHP_INI_BEGIN()
|
||||
PHP_INI_ENTRY("foo", "1", PHP_INI_ALL, NULL, NULL)
|
||||
PHP_INI_ENTRY("bar", "bah", PHP_INI_SYSTEM, OnChangeBar, NULL)
|
||||
PHP_INI_END()
|
||||
|
||||
static PHP_INI_MH(OnChangeBar)
|
||||
{
|
||||
a_global_var_for_bar = new_value;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
int whatever_minit(INIT_FUNC_ARGS)
|
||||
{
|
||||
...
|
||||
REGISTER_INI_ENTRIES();
|
||||
...
|
||||
}
|
||||
|
||||
|
||||
int whatever_mshutdown(SHUTDOWN_FUNC_ARGS)
|
||||
{
|
||||
...
|
||||
UNREGISTER_INI_ENTRIES();
|
||||
...
|
||||
}
|
||||
|
||||
|
||||
and that's it. Here's what it does. As you can probably guess, this code
|
||||
registers two INI entries - "foo" and "bar". They're given defaults "1"
|
||||
and "bah" respectively - note that all defaults are always given as
|
||||
strings. That doesn't reduce your ability to use integer values, simply
|
||||
specify them as strings. "foo" is marked so that it can be changed by
|
||||
anyone at any time (PHP_INI_ALL), whereas "bar" is marked so it can be
|
||||
changed only at startup in the php3.ini only, presumably, by the system
|
||||
administrator (PHP_INI_SYSTEM).
|
||||
When "foo" changes, no function is called. Access to it is done using the
|
||||
macros INI_INT("foo"), INI_FLT("foo") or INI_STR("foo"), which return a
|
||||
long, double or char * respectively (strings that are returned aren't
|
||||
duplicated - if they're manipulated, you must duplicate them first). You
|
||||
can also access the original value (the 'master' value, in case one of them
|
||||
was overriden by a user) using another pair of macros:
|
||||
INI_ORIG_INT("foo"), INI_ORIG_FLT("foo") and INI_ORIG_STR("foo").
|
||||
|
||||
When "bar" changes, a special message handler is called, OnBarChange().
|
||||
Always declare those message handlers using PHP_INI_MH(), as they might
|
||||
change in the future. Message handlers are called as soon as an ini entry
|
||||
initializes or changes, and allow you to cache a certain INI value in a
|
||||
quick C structure. In this example, whenever "bar" changes, the new value
|
||||
is stored in a_global_var_for_bar, which is a global char * pointer,
|
||||
quickly accessible from other functions. Things get a bit more complicated
|
||||
when you want to implement a thread-safe module, but it's doable as well.
|
||||
Message handlers may return SUCCESS to acknowledge the new value, or
|
||||
FAILURE to reject it. That enables you to reject invalid values for some
|
||||
INI entries if you want. Finally, you can have a pointer passed to your
|
||||
message handler - that's the fifth argument to PHP_INI_ENTRY(). It is
|
||||
passed as mh_arg to the message handler.
|
||||
|
||||
Remember that for certain values, there's really no reason to mess with a
|
||||
callback function. A perfect example for this are the syntax highlight
|
||||
colors, which no longer have a dedicated global C slot that stores them,
|
||||
but instead, are fetched from the php_ini hash on demand.
|
||||
|
||||
"As always", for a perfect working example of this mechanism, consult
|
||||
functions/mysql.c. This module uses the new INI entry mechanism, and was
|
||||
also converted to be thread safe in general, and in its php_ini support in
|
||||
particular. Converting your modules to look like this for thread safety
|
||||
isn't a bad idea (not necessarily now, but in the long run).
|
||||
|
||||
+492
@@ -0,0 +1,492 @@
|
||||
PHP Version 3.0 API Documentation
|
||||
|
||||
Table of Contents
|
||||
-----------------
|
||||
1. Function Prototype
|
||||
2. Function Arguments
|
||||
3. Variable number of function arguments
|
||||
4. Using the function arguments
|
||||
5. Memory management in functions
|
||||
6. Setting variables in the symbol table
|
||||
7. Returning values from functions
|
||||
8. Returning 'complex' values from functions (arrays or objects)
|
||||
9. Using the resource list
|
||||
10. Using the persistent resource table
|
||||
11. Adding runtime configuration directives
|
||||
-----------------
|
||||
|
||||
1. Function Prototype
|
||||
|
||||
All functions look like this:
|
||||
|
||||
PHP_FUNCTION(foo) {
|
||||
|
||||
}
|
||||
|
||||
Even if your function doesn't take any arguments, this is how it is
|
||||
called.
|
||||
|
||||
-----------------
|
||||
|
||||
2. Function Arguments
|
||||
|
||||
Arguments are always of type pval. This type contains a union which
|
||||
has the actual type of the argument. So, if your function takes two
|
||||
arguments, you would do something like the following at the top of your
|
||||
function:
|
||||
|
||||
pval *arg1, *arg2;
|
||||
if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&arg1,&arg2)==FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
NOTE: Arguments can be passed either by value or by reference. In both
|
||||
cases you will need to pass &(pval *) to getParameters. If you want to
|
||||
check if the n'th parameter was sent to you by reference or not, you can
|
||||
use the function, ParameterPassedByReference(ht,n). It will return either
|
||||
1 or 0.
|
||||
|
||||
When you change any of the passed parameters, whether they are sent by
|
||||
reference or by value, you can either start over with the parameter by
|
||||
calling pval_destructor on it, or if it's an ARRAY you want to add to,
|
||||
you can use functions similar to the ones in internal_functions.h which
|
||||
manipulate return_value as an ARRAY.
|
||||
|
||||
Also if you change a parameter to IS_STRING make sure you first assign
|
||||
the new estrdup'ed string and the string length, and only later change the
|
||||
type to IS_STRING. If you change the string of a parameter which already
|
||||
IS_STRING or IS_ARRAY you should run pval_destructor on it first.
|
||||
|
||||
-----------------
|
||||
|
||||
3. Variable number of function arguments
|
||||
|
||||
A function can take a variable number of arguments. If your function can
|
||||
take either 2 or 3 arguments, use the following:
|
||||
|
||||
pval *arg1, *arg2, *arg3;
|
||||
int arg_count = ARG_COUNT(ht);
|
||||
|
||||
if (arg_count<2 || arg_count>3 ||
|
||||
getParameters(ht,arg_count,&arg1,&arg2,&arg3)==FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
------------------
|
||||
|
||||
4. Using the function arguments
|
||||
|
||||
The type of each argument is stored in the pval type field:
|
||||
|
||||
|
||||
This type can be any of the following:
|
||||
|
||||
IS_STRING String
|
||||
IS_DOUBLE Double-precision floating point
|
||||
IS_LONG Long
|
||||
IS_ARRAY Array
|
||||
|
||||
IS_EMPTY ??
|
||||
IS_USER_FUNCTION ??
|
||||
IS_INTERNAL_FUNCTION ?? (if some of these cannot be passed to a
|
||||
function - delete)
|
||||
IS_CLASS ??
|
||||
IS_OBJECT ??
|
||||
|
||||
If you get an argument of one type and would like to use it as another,
|
||||
or if you just want to force the argument to be of a certain type, you
|
||||
can use one of the following conversion functions:
|
||||
|
||||
convert_to_long(arg1);
|
||||
convert_to_double(arg1);
|
||||
convert_to_string(arg1);
|
||||
convert_to_boolean_long(arg1); If the string is "" or "0" it
|
||||
becomes 0, 1 otherwise
|
||||
convert_string_to_number(arg1); Converts string to either LONG or
|
||||
DOUBLE depending on string
|
||||
|
||||
These function all do in-place conversion. They do not return anything.
|
||||
|
||||
The actual argument is stored in a union.
|
||||
|
||||
For type IS_STRING, use arg1->value.str.val
|
||||
IS_LONG arg1->value.lval
|
||||
IS_DOUBLE arg1->value.dval
|
||||
|
||||
-------------------
|
||||
|
||||
5. Memory management in functions
|
||||
|
||||
Any memory needed by a function should be allocated with either emalloc()
|
||||
or estrdup(). These are memory handling abstraction functions that look
|
||||
and smell like the normal malloc() and strdup() functions. Memory should
|
||||
be freed with efree().
|
||||
|
||||
There are two kinds of memory in this program. Memory which is returned
|
||||
to the parser in a variable and memory which you need for temporary
|
||||
storage in your internal function. When you assign a string to a
|
||||
variable which is returned to the parser you need to make sure you first
|
||||
allocate the memory with either emalloc or estrdup. This memory
|
||||
should NEVER be freed by you, unless you later, in the same function
|
||||
overwrite your original assignment (this kind of programming practice is
|
||||
not good though).
|
||||
|
||||
For any temporary/permanent memory you need in your functions/library you
|
||||
should use the three emalloc(), estrdup(), and efree() functions. They
|
||||
behave EXACTLY like their counterpart functions. Anything you emalloc()
|
||||
or estrdup() you have to efree() at some point or another, unless it's
|
||||
supposed to stick around until the end of the program, otherwise there
|
||||
will be a memory leak. The meaning of "the functions behave exactly like
|
||||
their counterparts" is if you efree() something which was not
|
||||
emalloc()'ed nor estrdup()'ed you might get a segmentation fault. So
|
||||
please take care and free all of your wasted memory. One of the biggest
|
||||
improvements in PHP 3.0 will hopefully be the memory management.
|
||||
|
||||
If you compile with "-DDEBUG", PHP3 will print out a list of all
|
||||
memory that was allocated using emalloc() and estrdup() but never
|
||||
freed with efree() when it is done running the specified script.
|
||||
|
||||
-------------------
|
||||
|
||||
6. Setting variables in the symbol table
|
||||
|
||||
A number of macros are available which make it easier to set a variable
|
||||
in the symbol table:
|
||||
|
||||
SET_VAR_STRING(name,value) **
|
||||
SET_VAR_DOUBLE(name,value)
|
||||
SET_VAR_LONG(name,value)
|
||||
|
||||
** Be careful here. The value part must be malloc'ed manually because
|
||||
the memory management code will try to free this pointer later. Do
|
||||
not pass statically allocated memory into a SET_VAR_STRING
|
||||
|
||||
Symbol tables in PHP 3.0 are implemented as hash tables. At any given time,
|
||||
&symbol_table is a pointer to the 'main' symbol table, and active_symbol_table
|
||||
points to the currently active symbol table (these may be identical like in
|
||||
startup, or different, if you're inside a function).
|
||||
|
||||
The following examples use 'active_symbol_table'. You should replace it with
|
||||
&symbol_table if you specifically want to work with the 'main' symbol table.
|
||||
Also, the same funcions may be applied to arrays, as explained below.
|
||||
|
||||
* To check whether a variable named $foo already exists in a symbol table:
|
||||
if (hash_exists(active_symbol_table,"foo",sizeof("foo"))) { exists... }
|
||||
else { doesn't exist }
|
||||
|
||||
* If you also need to get the type of the variable, you can use:
|
||||
hash_find(active_symbol_table,"foo",sizeof("foo"),&pvalue);
|
||||
check(pvalue.type);
|
||||
|
||||
Arrays in PHP 3.0 are implemented using the same hashtables as symbol tables.
|
||||
This means the two above functions can also be used to check variables
|
||||
inside arrays.
|
||||
|
||||
If you want to define a new array in a symbol table, you should do this:
|
||||
|
||||
1. Possibly check it exists and abort, using hash_exists()
|
||||
or hash_find().
|
||||
2. Code:
|
||||
|
||||
pval arr;
|
||||
|
||||
if (array_init(&arr) == FAILURE) { failed... };
|
||||
hash_update(active_symbol_table,"foo",sizeof("foo"),&arr,sizeof(pval),NULL);
|
||||
|
||||
This code declares a new array, named $foo, in the active symbol table.
|
||||
This array is empty.
|
||||
|
||||
Here's how to add new entries to it:
|
||||
|
||||
pval entry;
|
||||
|
||||
entry.type = IS_LONG;
|
||||
entry.value.lval = 5;
|
||||
|
||||
hash_update(arr.value.ht,"bar",sizeof("bar"),&entry,sizeof(pval),NULL); /* defines $foo["bar"] = 5 */
|
||||
hash_index_update(arr.value.ht,7,&entry,sizeof(pval),NULL); /* defines $foo[7] = 5 */
|
||||
hash_next_index_insert(arr.value.ht,&entry,sizeof(pval),NULL); /* defines the next free place in $foo[],
|
||||
* $foo[8], to be 5 (works like php2)
|
||||
*/
|
||||
|
||||
If you'd like to modify a value that you inserted to a hash, you must first retreive it from the hash. To
|
||||
prevent that overhead, you can supply a pval ** to the hash add function, and it'll be updated with the
|
||||
pval * address of the inserted element inside the hash. If that value is NULL (like in all of the
|
||||
above examples) - that parameter is ignored.
|
||||
|
||||
hash_next_index_insert() works more or less using the same logic
|
||||
"$foo[] = bar;" works in PHP 2.0.
|
||||
|
||||
If you are building an array to return from a function, you can initialize
|
||||
the array just like above by doing:
|
||||
|
||||
if (array_init(return_value) == FAILURE) { failed...; }
|
||||
|
||||
and then adding values with the helper functions:
|
||||
|
||||
add_next_index_long(return_value,long_value);
|
||||
add_next_index_double(return_value,double_value);
|
||||
add_next_index_string(return_value,estrdup(string_value));
|
||||
|
||||
Of course, if the adding isn't done right after the array
|
||||
initialization, you'd probably have to look for the array first:
|
||||
|
||||
pval *arr;
|
||||
|
||||
if (hash_find(active_symbol_table,"foo",sizeof("foo"),(void **)&arr)==FAILURE) { can't find... }
|
||||
else { use arr->value.ht... }
|
||||
|
||||
Note that hash_find receives a pointer to a pval pointer, and
|
||||
not a pval pointer.
|
||||
|
||||
Just about any hash function returns SUCCESS or FAILURE (except for
|
||||
hash_exists() that returns a boolean truth value).
|
||||
|
||||
-------------------
|
||||
|
||||
7. Returning 'simple' values from functions (integers, floats or strings)
|
||||
|
||||
A number of macros are available to make it easier to return things from
|
||||
functions:
|
||||
|
||||
These set the return value and return from the function:
|
||||
|
||||
RETURN_FALSE
|
||||
RETURN_TRUE
|
||||
RETURN_LONG(l)
|
||||
RETURN_STRING(s,dup) If dup is true, duplicates the string
|
||||
RETURN_STRINGL(s,l,dup) Return string (s) specifying length (l).
|
||||
RETURN_DOUBLE(d)
|
||||
|
||||
These only set the return value:
|
||||
|
||||
RETVAL_FALSE
|
||||
RETVAL_TRUE
|
||||
RETVAL_LONG(l)
|
||||
RETVAL_STRING(s,dup) If dup is true, duplicates the string
|
||||
RETVAL_STRINGL(s,l,dup) Return string (s) specifying length (l).
|
||||
RETVAL_DOUBLE(d)
|
||||
|
||||
The string macros above will all estrdup() the passed 's' argument,
|
||||
so you can safely free the argument after calling the macro, or
|
||||
alternatively use statically allocated memory.
|
||||
|
||||
If your function returns boolean success/error responses, always use
|
||||
RETURN_TRUE and RETURN_FALSE respectively.
|
||||
|
||||
-------------------
|
||||
|
||||
8. Returning 'complex' values from functions (arrays or objects)
|
||||
|
||||
Your function can also return a complex data type such as an object
|
||||
or an array.
|
||||
|
||||
Returning an object:
|
||||
|
||||
1. Call object_init(return_value).
|
||||
2. Fill it up with values:
|
||||
|
||||
add_property_long(return_value,property_name,l) Add a property named 'property_name', of type long, equals to 'l'
|
||||
add_property_double(return_value,property_name,d) Same, only a double
|
||||
add_property_string(return_value,property_name,str) Same, only a string
|
||||
add_property_stringl(return_value,property_name,str,l) Add a property named 'property_name', of type string, string is 'str' with length 'l'
|
||||
|
||||
3. Possibly, register functions for this object. In order to
|
||||
obtain values from the object, the function would have to fetch
|
||||
"this" from the active_symbol_table. Its type should be IS_OBJECT,
|
||||
and it's basically a regular hash table (i.e., you can use regular
|
||||
hash functions on .value.ht). The actual registration of the
|
||||
function can be done using:
|
||||
|
||||
add_method(return_value,function_name,function_ptr)
|
||||
|
||||
|
||||
Returning an array:
|
||||
|
||||
1. Call array_init(return_value).
|
||||
2. Fill it up with values:
|
||||
|
||||
add_assoc_long(return_value,key,l) add associative entry with key 'key' and long value 'l'
|
||||
add_assoc_double(return_value,key,d)
|
||||
add_assoc_string(return_value,key,str)
|
||||
add_assoc_stringl(return_value,key,str,length) specify the string length
|
||||
|
||||
add_index_long(return_value,index,l) add entry in index 'index' with long value 'l'
|
||||
add_index_double(return_value,index,d)
|
||||
add_index_string(return_value,index,str)
|
||||
add_index_stringl(return_value,index,str,length) specify the string length
|
||||
|
||||
add_next_index_long(return_value,l) add an array entry in the next free offset with long value 'l'
|
||||
add_next_index_double(return_value,d)
|
||||
add_next_index_string(return_value,str)
|
||||
add_next_index_stringl(return_value,str,length) specify the string length
|
||||
|
||||
-------------------
|
||||
|
||||
9. Using the resource list
|
||||
|
||||
PHP 3.0 has a standard way of dealing with various types of resources,
|
||||
that replaces all of the local linked lists in PHP 2.0.
|
||||
|
||||
Available functions:
|
||||
|
||||
php3_list_insert(ptr, type) returns the 'id' of the newly inserted resource
|
||||
php3_list_delete(id) delete the resource with the specified id
|
||||
php3_list_find(id,*type) returns the pointer of the resource with the specified id, updates 'type' to the resource's type
|
||||
|
||||
Typically, these functions are used for SQL drivers but they can be
|
||||
used for anything else, and are used, for instance, for maintaining
|
||||
file descriptors.
|
||||
|
||||
Typical list code would look like this:
|
||||
|
||||
Adding a new resource:
|
||||
|
||||
RESOURCE *resource;
|
||||
|
||||
...allocate memory for resource and acquire resource...
|
||||
/* add a new resource to the list */
|
||||
return_value->value.lval = php3_list_insert((void *) resource, LE_RESOURCE_TYPE);
|
||||
return_value->type = IS_LONG;
|
||||
|
||||
Using an existing resource:
|
||||
|
||||
pval *resource_id;
|
||||
RESOURCE *resource;
|
||||
int type;
|
||||
|
||||
convert_to_long(resource_id);
|
||||
resource = php3_list_find(resource_id->value.lval, &type);
|
||||
if (type != LE_RESOURCE_TYPE) {
|
||||
php3_error(E_WARNING,"resource index %d has the wrong type",resource_id->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
...use resource...
|
||||
|
||||
Deleting an existing resource:
|
||||
|
||||
pval *resource_id;
|
||||
RESOURCE *resource;
|
||||
int type;
|
||||
|
||||
convert_to_long(resource_id);
|
||||
php3_list_delete(resource_id->value.lval);
|
||||
|
||||
|
||||
The resource types should be registered in php3_list.h, in enum
|
||||
list_entry_type. In addition, one should add shutdown code for any
|
||||
new resource type defined, in list.c's list_entry_destructor() (even if
|
||||
you don't have anything to do on shutdown, you must add an empty case).
|
||||
|
||||
-------------------
|
||||
|
||||
10. Using the persistent resource table
|
||||
|
||||
PHP 3.0 has a standard way of storing persistent resources (i.e.,
|
||||
resources that are kept in between hits). The first module to use
|
||||
this feature was the MySQL module, and mSQL followed it, so one can
|
||||
get the general impression of how a persistent resource should be
|
||||
used by reading mysql.c. The functions you should look at are:
|
||||
php3_mysql_do_connect()
|
||||
php3_mysql_connect()
|
||||
php3_mysql_pconnect()
|
||||
|
||||
The general idea of persistence modules is this:
|
||||
1. Code all of your module to work with the regular resource list
|
||||
mentioned in section (9).
|
||||
2. Code extra connect functions that check if the resource already
|
||||
exists in the persistent resource list. If it does, register it
|
||||
as in the regular resource list as a pointer to the persistent
|
||||
resource list (because of 1., the rest of the code
|
||||
should work immediately). If it doesn't, then create it, add it
|
||||
to the persistent resource list AND add a pointer to it from the
|
||||
regular resource list, so all of the code would work since it's
|
||||
in the regular resource list, but on the next connect, the
|
||||
resource would be found in the persistent resource list and be
|
||||
used without having to recreate it.
|
||||
You should register these resources with a different type (e.g.
|
||||
LE_MYSQL_LINK for non-persistent link and LE_MYSQL_PLINK for
|
||||
a persistent link).
|
||||
|
||||
If you read mysql.c, you'll notice that except for the more complex
|
||||
connect function, nothing in the rest of the module has to be changed.
|
||||
|
||||
The very same interface exists for the regular resource list and the
|
||||
persistent resource list, only 'list' is replaced with 'plist':
|
||||
|
||||
php3_plist_insert(ptr, type) returns the 'id' of the newly inserted resource
|
||||
php3_plist_delete(id) delete the resource with the specified id
|
||||
php3_plist_find(id,*type) returns the pointer of the resource with the specified id, updates 'type' to the resource's type
|
||||
|
||||
However, it's more than likely that these functions would prove
|
||||
to be useless for you when trying to implement a persistent module.
|
||||
Typically, one would want to use the fact that the persistent resource
|
||||
list is really a hash table. For instance, in the MySQL/mSQL modules,
|
||||
when there's a pconnect() call (persistent connect), the function
|
||||
builds a string out of the host/user/passwd that were passed to the
|
||||
function, and hashes the SQL link with this string as a key. The next
|
||||
time someone calls a pconnect() with the same host/user/passwd, the
|
||||
same key would be generated, and the function would find the SQL link
|
||||
in the persistent list.
|
||||
|
||||
Until further documented, you should look at mysql.c or msql.c to
|
||||
see how one should use the plist's hash table abilities.
|
||||
|
||||
One important thing to note: resources going into the persistent
|
||||
resource list must *NOT* be allocated with PHP's memory manager, i.e.,
|
||||
they should NOT be created with emalloc(), estrdup(), etc. Rather,
|
||||
one should use the regular malloc(), strdup(), etc. The reason for
|
||||
this is simple - at the end of the request (end of the hit), every
|
||||
memory chunk that was allocated using PHP's memory manager is deleted.
|
||||
Since the persistent list isn't supposed to be erased at the end
|
||||
of a request, one mustn't use PHP's memory manager for allocating
|
||||
resources that go to it.
|
||||
|
||||
Shutting down persistent resources:
|
||||
|
||||
When you register resource that's going to be in the persistent list,
|
||||
you should add destructors to it both in the non-persistent list
|
||||
and in the persistent list.
|
||||
The destructor in the non-persistent list destructor shouldn't do anything.
|
||||
The one in the persistent list destructor should properly free any
|
||||
resources obtained by that type (e.g. memory, SQL links, etc). Just like
|
||||
with the non-persistent resources, you *MUST* add destructors for every
|
||||
resource, even it requires no destructotion and the destructor would
|
||||
be empty.
|
||||
Remember, since emalloc() and friends aren't to be used in conjunction
|
||||
with the persistent list, you mustn't use efree() here either.
|
||||
|
||||
-------------------
|
||||
|
||||
11. Adding runtime configuration directives
|
||||
|
||||
Many of the features of PHP3 can be configured at runtime. These
|
||||
configuration directives can appear in either the designated php3.ini
|
||||
file, or in the case of the Apache module version in the Apache .conf
|
||||
files. The advantage of having them in the Apache .conf files is that
|
||||
they can be configured on a per-directory basis. This means that one
|
||||
directory may have a certain safemodeexecdir for example, while another
|
||||
directory may have another. This configuration granularity is especially
|
||||
handy when a server supports multiple virtual hosts.
|
||||
|
||||
The steps required to add a new directive:
|
||||
|
||||
1. Add directive to php3_ini_structure struct in mod_php4.h.
|
||||
|
||||
2. In main.c, edit the php3_module_startup function and add the
|
||||
appropriate cfg_get_string() or cfg_get_long() call.
|
||||
|
||||
3. Add the directive, restrictions and a comment to the php3_commands
|
||||
structure in mod_php4.c. Note the restrictions part. RSRC_CONF are
|
||||
directives that can only be present in the actual Apache .conf files.
|
||||
Any OR_OPTIONS directives can be present anywhere, include normal
|
||||
.htaccess files.
|
||||
|
||||
4. In either php3take1handler() or php3flaghandler() add the appropriate
|
||||
entry for your directive.
|
||||
|
||||
5. In the configuration section of the _php3_info() function in
|
||||
functions/info.c you need to add your new directive.
|
||||
|
||||
6. And last, you of course have to use your new directive somewhere.
|
||||
It will be addressable as php3_ini.directive
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#! /bin/sh
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP Version 4 |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Copyright (c) 1997-2002 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. |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Author: Sascha Schumann <sascha@schumann.cx> |
|
||||
# +----------------------------------------------------------------------+
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
# cwd must be top_srcdir
|
||||
test -f build/bsd_makefile || exit 2
|
||||
|
||||
test -f bsd_converted && exit 0
|
||||
|
||||
tmpfile=`mktemp /tmp/bsd_makefile.XXXXXX 2>/dev/null` || tmpfile="tmp.$$"
|
||||
for i in build/*.mk; do
|
||||
sed 's/^include \(.*\)/.include "\1"/' $i >$tmpfile \
|
||||
&& cp $tmpfile $i
|
||||
done
|
||||
rm -f $tmpfile
|
||||
|
||||
touch bsd_converted
|
||||
exit 0
|
||||
@@ -0,0 +1,71 @@
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP Version 4 |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Copyright (c) 1997-2002 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. |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Author: Sascha Schumann <sascha@schumann.cx> |
|
||||
# +----------------------------------------------------------------------+
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
#
|
||||
# Makefile to generate build tools
|
||||
#
|
||||
|
||||
SUBDIRS = Zend TSRM
|
||||
|
||||
STAMP = buildmk.stamp
|
||||
|
||||
ALWAYS = generated_lists
|
||||
|
||||
all: $(STAMP) $(ALWAYS)
|
||||
@$(MAKE) AMFLAGS=$(AMFLAGS) -s -f build/build2.mk
|
||||
|
||||
generated_lists:
|
||||
@echo makefile_am_files = Zend/Makefile.am \
|
||||
TSRM/Makefile.am > $@
|
||||
@echo config_h_files = Zend/acconfig.h TSRM/acconfig.h >> $@
|
||||
@echo config_m4_files = Zend/Zend.m4 TSRM/tsrm.m4 TSRM/threads.m4 \
|
||||
Zend/acinclude.m4 ext/*/config*.m4 sapi/*/config.m4 >> $@
|
||||
|
||||
$(STAMP): build/buildcheck.sh
|
||||
@build/buildcheck.sh && touch $(STAMP)
|
||||
|
||||
snapshot:
|
||||
distname='$(DISTNAME)'; \
|
||||
if test -z "$$distname"; then \
|
||||
distname='php4-snapshot'; \
|
||||
fi; \
|
||||
myname=`basename \`pwd\`` ; \
|
||||
cd .. && cp -rp $$myname $$distname; \
|
||||
cd $$distname; \
|
||||
rm -f $(SUBDIRS) 2>/dev/null || true; \
|
||||
for i in $(SUBDIRS); do \
|
||||
test -d $$i || (test -d ../$$i && cp -rp ../$$i $$i); \
|
||||
done; \
|
||||
find . -type l -exec rm {} \; ; \
|
||||
$(MAKE) AMFLAGS=--copy -f build/build.mk; \
|
||||
cd ..; \
|
||||
tar cf $$distname.tar $$distname; \
|
||||
rm -rf $$distname $$distname.tar.*; \
|
||||
bzip2 -9 $$distname.tar; \
|
||||
md5sum $$distname.tar.bz2; \
|
||||
sync; sleep 2; \
|
||||
md5sum $$distname.tar.bz2; \
|
||||
bzip2 -t $$distname.tar.bz2
|
||||
|
||||
cvsclean:
|
||||
@for i in `find . -name .cvsignore`; do \
|
||||
(cd `dirname $$i` 2>/dev/null && rm -rf `cat .cvsignore` *.o *.a || true); \
|
||||
done
|
||||
@rm -f $(SUBDIRS) 2>/dev/null || true
|
||||
|
||||
.PHONY: $(ALWAYS) snapshot cvsclean
|
||||
@@ -0,0 +1,77 @@
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP Version 4 |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Copyright (c) 1997-2002 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. |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Author: Sascha Schumann <sascha@schumann.cx> |
|
||||
# +----------------------------------------------------------------------+
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
include generated_lists
|
||||
|
||||
TOUCH_FILES = mkinstalldirs install-sh missing
|
||||
|
||||
LT_TARGETS = ltmain.sh config.guess config.sub
|
||||
|
||||
makefile_in_files = $(makefile_am_files:.am=.in)
|
||||
makefile_files = $(makefile_am_files:e.am=e)
|
||||
|
||||
config_h_in = main/php_config.h.in
|
||||
|
||||
acconfig_h_SOURCES = acconfig.h.in $(config_h_files)
|
||||
|
||||
targets = $(TOUCH_FILES) $(makefile_in_files) configure $(config_h_in)
|
||||
|
||||
|
||||
all: Zend/Makefile.am TSRM/Makefile.am $(targets)
|
||||
|
||||
Zend/Makefile.am:
|
||||
test -d Zend || (test -d ../Zend && ln -s ../Zend Zend)
|
||||
|
||||
TSRM/Makefile.am:
|
||||
test -d TSRM || (test -d ../TSRM && ln -s ../TSRM TSRM)
|
||||
|
||||
acconfig.h: $(acconfig_h_SOURCES)
|
||||
@echo rebuilding $@
|
||||
cat $(acconfig_h_SOURCES) > $@
|
||||
|
||||
$(makefile_in_files): $(makefile_am_files) aclocal.m4 configure.in $(config_m4_files)
|
||||
@echo rebuilding Makefile templates
|
||||
@for i in $(LT_TARGETS); do \
|
||||
if test -f "$$i"; then \
|
||||
mv $$i $$i.bak; \
|
||||
cp $$i.bak $$i; \
|
||||
fi; \
|
||||
done
|
||||
@test -f want_dependencies || flag=-i; \
|
||||
automake -a $$flag $(AMFLAGS) $(makefile_files) 2>&1 | $(SUPPRESS_WARNINGS)
|
||||
@for i in $(LT_TARGETS); do mv $$i.bak $$i; done
|
||||
|
||||
aclocal.m4: configure.in acinclude.m4 dynlib.m4
|
||||
aclocal 2>&1 | $(SUPPRESS_WARNINGS)
|
||||
|
||||
SUPPRESS_WARNINGS = (egrep -v '(AC_TRY_RUN called without default to allow cross compiling|AC_PROG_CXXCPP was called before AC_PROG_CXX|.*AM_PROG_LEX.*|defined in acinclude.m4 but never used|AC_PROG_LEX invoked multiple times|AC_PROG_CPP was called before)'||true)
|
||||
|
||||
$(config_h_in): configure acconfig.h
|
||||
# explicitly remove target since autoheader does not seem to work
|
||||
# correctly otherwise (timestamps are not updated)
|
||||
@echo rebuilding $@
|
||||
@rm -f $@
|
||||
@autoheader 2>&1 | $(SUPPRESS_WARNINGS)
|
||||
|
||||
$(TOUCH_FILES):
|
||||
touch $(TOUCH_FILES)
|
||||
|
||||
configure: aclocal.m4 configure.in $(config_m4_files)
|
||||
@echo rebuilding $@
|
||||
@autoconf 2>&1 | $(SUPPRESS_WARNINGS)
|
||||
Executable
+93
@@ -0,0 +1,93 @@
|
||||
#! /bin/sh
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP Version 4 |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Copyright (c) 1997-2002 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: Stig Bakken <ssb@fast.no> |
|
||||
# | Sascha Schumann <sascha@schumann.cx> |
|
||||
# +----------------------------------------------------------------------+
|
||||
#
|
||||
# $Id: buildcheck.sh,v 1.16 2002-03-04 08:28:57 sas Exp $
|
||||
#
|
||||
|
||||
echo "buildconf: checking installation..."
|
||||
|
||||
# autoconf 2.13 or newer
|
||||
ac_version=`autoconf --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
|
||||
if test -z "$ac_version"; then
|
||||
echo "buildconf: autoconf not found."
|
||||
echo " You need autoconf version 2.13 or newer installed"
|
||||
echo " to build PHP from CVS."
|
||||
exit 1
|
||||
fi
|
||||
IFS=.; set $ac_version; IFS=' '
|
||||
if test "$1" = "2" -a "$2" -lt "13" || test "$1" -lt "2"; then
|
||||
echo "buildconf: autoconf version $ac_version found."
|
||||
echo " You need autoconf version 2.13 or newer installed"
|
||||
echo " to build PHP from CVS."
|
||||
exit 1
|
||||
else
|
||||
echo "buildconf: autoconf version $ac_version (ok)"
|
||||
fi
|
||||
|
||||
|
||||
# automake 1.4 or newer
|
||||
am_version=`automake --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
|
||||
am_version_clean=`echo $am_version|sed -e 's/-p[0-9]*$//'`
|
||||
if test "$am_version" = ""; then
|
||||
echo "buildconf: automake not found."
|
||||
echo " You need automake version 1.4 or newer installed"
|
||||
echo " to build PHP from CVS."
|
||||
exit 1
|
||||
fi
|
||||
IFS=.; set $am_version_clean; IFS=' '
|
||||
if test "$1" = "1" -a "$2" -lt "4" || test "$1" -lt "1"; then
|
||||
echo "buildconf: automake version $am_version found."
|
||||
echo " You need automake version 1.4 or newer installed"
|
||||
echo " to build PHP from CVS."
|
||||
exit 1
|
||||
else
|
||||
echo "buildconf: automake version $am_version (ok)"
|
||||
fi
|
||||
|
||||
# libtool 1.4 or newer
|
||||
libtool=`which libtool`
|
||||
if test ! -f "$libtool"; then libtool=`which glibtool`; fi
|
||||
lt_pversion=`$libtool --version 2>/dev/null|sed -n -e 's/^[^0-9]*//' -e 1's/[- ].*//p'`
|
||||
if test "$lt_pversion" = ""; then
|
||||
echo "buildconf: libtool not found."
|
||||
echo " You need libtool version 1.4 or newer installed"
|
||||
echo " to build PHP from CVS."
|
||||
exit 1
|
||||
fi
|
||||
lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
|
||||
IFS=.; set $lt_version; IFS=' '
|
||||
|
||||
if test "$1" -gt "1" || test "$2" -ge "4";
|
||||
then
|
||||
echo "buildconf: libtool version $lt_pversion (ok)"
|
||||
else
|
||||
echo "buildconf: libtool version $lt_pversion found."
|
||||
echo " You need libtool version 1.4 or newer installed"
|
||||
echo " to build PHP from CVS."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
am_prefix=`which automake | sed -e 's#/[^/]*/[^/]*$##'`
|
||||
lt_prefix=`echo $libtool | sed -e 's#/[^/]*/[^/]*$##'`
|
||||
if test "$am_prefix" != "$lt_prefix"; then
|
||||
echo "WARNING: automake and libtool are installed in different"
|
||||
echo " directories. This may cause aclocal to fail."
|
||||
echo " continuing anyway"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,24 @@
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP Version 4 |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Copyright (c) 1997-2002 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. |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Author: Sascha Schumann <sascha@schumann.cx> |
|
||||
# +----------------------------------------------------------------------+
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
all: all-recursive
|
||||
|
||||
include $(builddir)/libs.mk
|
||||
|
||||
include $(top_srcdir)/build/rules.mk
|
||||
Executable
+80
@@ -0,0 +1,80 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP Version 4 |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Copyright (c) 1997-2002 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. |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Author: Sascha Schumann <sascha@schumann.cx> |
|
||||
# +----------------------------------------------------------------------+
|
||||
#
|
||||
# $Id: fastgen.sh,v 1.14 2002-02-28 08:25:33 sebastian Exp $
|
||||
#
|
||||
|
||||
if test "$#" = "0"; then
|
||||
echo "Usage: fastgen.sh <srcdir> <mkdir_p> <bsdmakefile_p> <file>"
|
||||
fi
|
||||
|
||||
srcdir=$1
|
||||
shift
|
||||
|
||||
mkdir_p=$1
|
||||
shift
|
||||
|
||||
bsd_makefile=$1
|
||||
shift
|
||||
|
||||
top_srcdir=`(cd $srcdir; pwd)`
|
||||
top_builddir=`pwd`
|
||||
|
||||
if test "$mkdir_p" = "yes"; then
|
||||
mkdir_p="mkdir -p"
|
||||
else
|
||||
mkdir_p="$top_srcdir/build/shtool mkdir -p"
|
||||
fi
|
||||
|
||||
if test "$bsd_makefile" = "yes"; then
|
||||
(cd $top_srcdir; ./build/bsd_makefile)
|
||||
|
||||
for makefile in $@; do
|
||||
echo "fastgen.sh: creating $makefile"
|
||||
dir=`echo $makefile|sed 's%/*[^/][^/]*$%%'`
|
||||
$mkdir_p "$dir/"
|
||||
|
||||
cat - $top_srcdir/$makefile.in <<EOF |sed 's/^include \(.*\)/.include "\1"/' >$makefile
|
||||
top_srcdir = $top_srcdir
|
||||
top_builddir = $top_builddir
|
||||
srcdir = $top_srcdir/$dir
|
||||
builddir = $top_builddir/$dir
|
||||
VPATH = $top_srcdir/$dir
|
||||
EOF
|
||||
|
||||
test -z "$dir" && dir=.
|
||||
touch $dir/.deps
|
||||
done
|
||||
else
|
||||
for makefile in $@; do
|
||||
echo "fastgen.sh: creating $makefile"
|
||||
dir=`echo $makefile|sed 's%/*[^/][^/]*$%%'`
|
||||
$mkdir_p "$dir/"
|
||||
|
||||
cat - $top_srcdir/$makefile.in <<EOF >$makefile
|
||||
top_srcdir = $top_srcdir
|
||||
top_builddir = $top_builddir
|
||||
srcdir = $top_srcdir/$dir
|
||||
builddir = $top_builddir/$dir
|
||||
VPATH = $top_srcdir/$dir
|
||||
EOF
|
||||
|
||||
test -z "$dir" && dir=.
|
||||
touch $dir/.deps
|
||||
done
|
||||
fi
|
||||
@@ -0,0 +1,41 @@
|
||||
#! /bin/sh
|
||||
|
||||
# $Id: genif.sh,v 1.2 2001-03-30 14:02:20 sas Exp $
|
||||
# replacement for genif.pl
|
||||
|
||||
infile="$1"
|
||||
shift
|
||||
srcdir="$1"
|
||||
shift
|
||||
extra_module_ptrs="$1"
|
||||
shift
|
||||
awk="$1"
|
||||
shift
|
||||
|
||||
if test "$infile" = "" -o "$srcdir" = ""; then
|
||||
echo "please supply infile and srcdir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
module_ptrs="$extra_module_ptrs"
|
||||
header_list=""
|
||||
olddir=`pwd`
|
||||
cd $srcdir
|
||||
|
||||
for ext in ${1+"$@"} ; do
|
||||
module_ptrs=" phpext_${ext}_ptr,@NEWLINE@$module_ptrs"
|
||||
header_list="$header_list ext/$ext/*.h"
|
||||
done
|
||||
|
||||
includes=`$awk -f ./build/print_include.awk $header_list`
|
||||
|
||||
cd $olddir
|
||||
|
||||
cat $infile | \
|
||||
sed \
|
||||
-e "s'@EXT_INCLUDE_CODE@'$includes'" \
|
||||
-e "s'@EXT_MODULE_PTRS@'$module_ptrs'" \
|
||||
-e 's/@NEWLINE@/\
|
||||
/g'
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP Version 4 |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Copyright (c) 1997-2002 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. |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Author: Sascha Schumann <sascha@schumann.cx> |
|
||||
# +----------------------------------------------------------------------+
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
LTLIBRARY_OBJECTS = $(LTLIBRARY_SOURCES:.c=.lo) $(LTLIBRARY_OBJECTS_X)
|
||||
|
||||
$(LTLIBRARY_NAME): $(LTLIBRARY_OBJECTS) $(LTLIBRARY_DEPENDENCIES)
|
||||
$(LINK) $(LTLIBRARY_LDFLAGS) $(LTLIBRARY_OBJECTS) $(LTLIBRARY_LIBADD)
|
||||
@@ -0,0 +1,24 @@
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP Version 4 |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Copyright (c) 1997-2002 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. |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Author: Sascha Schumann <sascha@schumann.cx> |
|
||||
# +----------------------------------------------------------------------+
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
targets = $(LTLIBRARY_NAME)
|
||||
|
||||
include $(top_srcdir)/build/rules.mk
|
||||
include $(top_srcdir)/build/library.mk
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP Version 4 |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Copyright (c) 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. |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Author: Sascha Schumann <sascha@schumann.cx> |
|
||||
# +----------------------------------------------------------------------+
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# echo top_srcdir top_builddir srcdir CPP [CPP-ARGS] filenames | \
|
||||
# awk -f mkdep.awk > dependencies
|
||||
|
||||
|
||||
{
|
||||
top_srcdir=$1
|
||||
top_builddir=$2
|
||||
srcdir=$3
|
||||
cmd=$4
|
||||
|
||||
for (i = 5; i <= NF; i++) {
|
||||
if (match($i, "^-[A-Z]") == 0)
|
||||
break;
|
||||
cmd=cmd " " $i
|
||||
}
|
||||
|
||||
dif=i-1
|
||||
|
||||
for (; i <= NF; i++)
|
||||
filenames[i-dif]=$i
|
||||
|
||||
no_files=NF-dif
|
||||
|
||||
for(i = 1; i <= no_files; i++) {
|
||||
if (system("test -r " filenames[i]) != 0)
|
||||
continue
|
||||
|
||||
target=filenames[i]
|
||||
sub(srcdir "/", "", target)
|
||||
target2=target
|
||||
sub("\.(c|cpp)$", ".lo", target);
|
||||
sub("\.(c|cpp)$", ".slo", target2);
|
||||
|
||||
for (e in used)
|
||||
delete used[e]
|
||||
|
||||
cmdx=cmd " " filenames[i]
|
||||
done=0
|
||||
while ((cmdx | getline) > 0) {
|
||||
if (match($0, "^# [0-9]* \".*\.h\"") != 0) {
|
||||
if (sub(top_srcdir, "$(top_srcdir)", $3) == 0)
|
||||
sub(top_builddir, "$(top_builddir)", $3)
|
||||
if (substr($3,2,1) != "/" && used[$3] != 1) {
|
||||
if (done == 0)
|
||||
printf(target " " target2 ":")
|
||||
done=1
|
||||
printf(" \\\n\t" substr($3,2,length($3)-2))
|
||||
used[$3] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (done == 1)
|
||||
print "\n"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/phpext_/ {
|
||||
if (old_filename != FILENAME) {
|
||||
printf "#include \"" FILENAME "\"@NEWLINE@"
|
||||
old_filename = FILENAME
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP Version 4 |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Copyright (c) 1997-2002 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. |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Author: Sascha Schumann <sascha@schumann.cx> |
|
||||
# +----------------------------------------------------------------------+
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
PROGRAM_OBJECTS = $(PROGRAM_SOURCES:.c=.lo)
|
||||
|
||||
$(PROGRAM_NAME): $(PROGRAM_DEPENDENCIES) $(PROGRAM_OBJECTS)
|
||||
$(LINK_CLEAN) $(PROGRAM_LDFLAGS) $(PROGRAM_OBJECTS) $(PROGRAM_LDADD)
|
||||
@@ -0,0 +1,70 @@
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP Version 4 |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Copyright (c) 1997-2002 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. |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Author: Sascha Schumann <sascha@schumann.cx> |
|
||||
# +----------------------------------------------------------------------+
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
include $(top_srcdir)/build/rules_common.mk
|
||||
|
||||
all: all-recursive
|
||||
install: install-recursive
|
||||
|
||||
distclean-recursive depend-recursive clean-recursive all-recursive install-recursive:
|
||||
@otarget=`echo $@|sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for i in $$list; do \
|
||||
target="$$otarget"; \
|
||||
echo "Making $$target in $$i"; \
|
||||
if test "$$i" = "."; then \
|
||||
ok=yes; \
|
||||
target="$$target-p"; \
|
||||
fi; \
|
||||
(cd $$i && $(MAKE) $$target) || exit 1; \
|
||||
done; \
|
||||
if test "$$otarget" = "all" && test -z '$(targets)'; then ok=yes; fi; \
|
||||
if test "$$ok" != "yes"; then $(MAKE) "$$otarget-p" || exit 1; fi
|
||||
|
||||
all-p: $(targets)
|
||||
install-p: $(targets) $(install_targets)
|
||||
distclean-p depend-p clean-p:
|
||||
|
||||
depend: depend-recursive
|
||||
@echo $(top_srcdir) $(top_builddir) $(srcdir) $(CPP) $(INCLUDES) $(EXTRA_INCLUDES) $(DEFS) $(CPPFLAGS) $(srcdir)/*.c *.c | $(AWK) -f $(top_srcdir)/build/mkdep.awk > $(builddir)/.deps || true
|
||||
|
||||
clean: clean-modules clean-recursive clean-x
|
||||
|
||||
clean-modules:
|
||||
|
||||
clean-x:
|
||||
rm -f $(targets) *.lo *.slo *.la *.o $(CLEANFILES)
|
||||
rm -rf .libs libs
|
||||
|
||||
distclean: distclean-recursive clean-x
|
||||
rm -f config.cache config.log config.status config_vars.mk libtool \
|
||||
php_config.h stamp-h Makefile build-defs.h php4.spec libphp4.module
|
||||
|
||||
test: $(top_builddir)/sapi/cli/php
|
||||
@if test "$(TESTS)" = ""; then \
|
||||
TOP_BUILDDIR=$(top_builddir) TOP_SRCDIR=$(top_srcdir) $(top_builddir)/sapi/cli/php -c $(top_srcdir)/php.ini-dist $(top_srcdir)/run-tests.php $(srcdir); \
|
||||
else \
|
||||
TOP_BUILDDIR=$(top_builddir) TOP_SRCDIR=$(top_srcdir) $(top_builddir)/sapi/cli/php -c $(top_srcdir)/php.ini-dist $(top_srcdir)/run-tests.php $(TESTS); \
|
||||
fi
|
||||
|
||||
include $(builddir)/.deps
|
||||
|
||||
.PHONY: all-recursive clean-recursive install-recursive \
|
||||
$(install_targets) install all clean depend depend-recursive shared \
|
||||
distclean-recursive distclean clean-x all-p install-p distclean-p \
|
||||
depend-p clean-p
|
||||
@@ -0,0 +1,77 @@
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP Version 4 |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Copyright (c) 1997-2002 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. |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Author: Sascha Schumann <sascha@schumann.cx> |
|
||||
# +----------------------------------------------------------------------+
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
include $(top_builddir)/config_vars.mk
|
||||
|
||||
COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS)
|
||||
COMPILE = $(CC) $(COMMON_FLAGS) $(CFLAGS) $(EXTRA_CFLAGS)
|
||||
CXX_COMPILE = $(CXX) $(COMMON_FLAGS) $(CXXFLAGS) $(EXTRA_CXXFLAGS)
|
||||
|
||||
SHARED_COMPILE = $(SHARED_LIBTOOL) --mode=compile $(CC) $(COMMON_FLAGS) $(CFLAGS_CLEAN) -prefer-pic $(EXTRA_CFLAGS) -c $< && touch $@
|
||||
CXX_SHARED_COMPILE = $(SHARED_LIBTOOL) --mode=compile $(CXX) $(COMMON_FLAGS) $(CXXFLAGS_CLEAN) -prefer-pic $(EXTRA_CXXFLAGS) -c $< && touch $@
|
||||
|
||||
LINK = $(LIBTOOL) --mode=link $(COMPILE) $(LDFLAGS) -o $@
|
||||
LINK_CLEAN = $(LIBTOOL) --mode=link $(CC) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o $@
|
||||
|
||||
mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p
|
||||
INSTALL = $(top_srcdir)/build/shtool install -c
|
||||
INSTALL_DATA = $(INSTALL) -m 644
|
||||
|
||||
DEFS = -I. -I$(srcdir) -I$(top_builddir)/main -I$(top_srcdir)
|
||||
|
||||
moduledir = $(EXTENSION_DIR)
|
||||
|
||||
CXX_SUFFIX = .cpp
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .slo .c $(CXX_SUFFIX) .lo .o .s .y .l
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
$(CXX_SUFFIX).o:
|
||||
$(CXX_COMPILE) -c $<
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.c.lo:
|
||||
$(PHP_COMPILE)
|
||||
|
||||
$(CXX_SUFFIX).lo:
|
||||
$(CXX_PHP_COMPILE)
|
||||
|
||||
.s.lo:
|
||||
$(PHP_COMPILE)
|
||||
|
||||
.c.slo:
|
||||
$(SHARED_COMPILE)
|
||||
|
||||
$(CXX_SUFFIX).slo:
|
||||
$(CXX_SHARED_COMPILE)
|
||||
|
||||
.y.c:
|
||||
$(YACC) $(YFLAGS) $< && mv y.tab.c $*.c
|
||||
if test -f y.tab.h; then \
|
||||
if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
|
||||
else :; fi
|
||||
|
||||
.l.c:
|
||||
$(LEX) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP Version 4 |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Copyright (c) 1997-2002 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. |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Author: Sascha Schumann <sascha@schumann.cx> |
|
||||
# +----------------------------------------------------------------------+
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
include $(top_srcdir)/build/rules_common.mk
|
||||
|
||||
install_targets = install-modules
|
||||
|
||||
all: all-recursive
|
||||
install: install-recursive
|
||||
|
||||
distclean-recursive depend-recursive clean-recursive all-recursive install-recursive:
|
||||
@otarget=`echo $@|sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for i in $$list; do \
|
||||
target="$$otarget"; \
|
||||
echo "Making $$target in $$i"; \
|
||||
if test "$$i" = "."; then \
|
||||
ok=yes; \
|
||||
target="$$target-p"; \
|
||||
fi; \
|
||||
(cd $$i && $(MAKE) $$target) || exit 1; \
|
||||
done; \
|
||||
if test "$$otarget" = "all" && test -z '$(targets)'; then ok=yes; fi; \
|
||||
if test "$$ok" != "yes"; then $(MAKE) "$$otarget-p" || exit 1; fi
|
||||
|
||||
all-p: $(targets)
|
||||
install-p: $(targets) $(install_targets)
|
||||
distclean-p depend-p clean-p:
|
||||
|
||||
depend: depend-recursive
|
||||
@echo $(top_srcdir) $(top_builddir) $(srcdir) $(CPP) $(INCLUDES) $(EXTRA_INCLUDES) $(DEFS) $(CPPFLAGS) $(srcdir)/*.c *.c | $(AWK) -f $(top_srcdir)/build/mkdep.awk > $(builddir)/.deps || true
|
||||
|
||||
clean: clean-recursive clean-x
|
||||
|
||||
clean-x:
|
||||
rm -f $(targets) *.lo *.slo *.la *.o $(CLEANFILES)
|
||||
rm -rf .libs
|
||||
|
||||
distclean: distclean-recursive clean-x
|
||||
rm -f config.cache config.log config.status config_vars.mk libtool \
|
||||
config.h stamp-h Makefile build-defs.h php4.spec libphp4.module
|
||||
|
||||
cvsclean:
|
||||
@for i in `find . -name .cvsignore`; do \
|
||||
(cd `dirname $$i` 2>/dev/null && rm -rf `cat .cvsignore` *.o *.a || true); \
|
||||
done
|
||||
@rm -f $(SUBDIRS) 2>/dev/null || true
|
||||
|
||||
install-modules:
|
||||
@test -d modules && \
|
||||
$(mkinstalldirs) $(moduledir) && \
|
||||
echo "installing shared modules into $(moduledir)" && \
|
||||
rm -f modules/*.la && \
|
||||
cp modules/* $(moduledir) || true
|
||||
|
||||
include $(builddir)/.deps
|
||||
|
||||
.PHONY: all-recursive clean-recursive install-recursive \
|
||||
$(install_targets) install all clean depend depend-recursive shared \
|
||||
distclean-recursive distclean clean-x all-p install-p distclean-p \
|
||||
depend-p clean-p
|
||||
Executable
+716
@@ -0,0 +1,716 @@
|
||||
#!/bin/sh
|
||||
##
|
||||
## GNU shtool -- The GNU Portable Shell Tool
|
||||
## Copyright (c) 1994-2000 Ralf S. Engelschall <rse@engelschall.com>
|
||||
##
|
||||
## See http://www.gnu.org/software/shtool/ for more information.
|
||||
## See ftp://ftp.gnu.org/gnu/shtool/ for latest version.
|
||||
##
|
||||
## Version 1.4.9 (16-Apr-2000)
|
||||
## Ingredients: 3/17 available modules
|
||||
##
|
||||
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation; either version 2 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
## General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
## USA, or contact Ralf S. Engelschall <rse@engelschall.com>.
|
||||
##
|
||||
## Notice: Given that you include this file verbatim into your own
|
||||
## source tree, you are justified in saying that it remains separate
|
||||
## from your package, and that this way you are simply just using GNU
|
||||
## shtool. So, in this situation, there is no requirement that your
|
||||
## package itself is licensed under the GNU General Public License in
|
||||
## order to take advantage of GNU shtool.
|
||||
##
|
||||
|
||||
##
|
||||
## Usage: shtool [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]
|
||||
##
|
||||
## Available commands:
|
||||
## echo Print string with optional construct expansion
|
||||
## install Install a program, script or datafile
|
||||
## mkdir Make one or more directories
|
||||
##
|
||||
## Not available commands (because module was not built-in):
|
||||
## mdate Pretty-print modification time of a file or dir
|
||||
## table Pretty-print a field-separated list as a table
|
||||
## prop Display progress with a running propeller
|
||||
## move Move files with simultaneous substitution
|
||||
## mkln Make link with calculation of relative paths
|
||||
## mkshadow Make a shadow tree through symbolic links
|
||||
## fixperm Fix file permissions inside a source tree
|
||||
## tarball Roll distribution tarballs
|
||||
## guessos Simple operating system guesser
|
||||
## arx Extended archive command
|
||||
## slo Separate linker options by library class
|
||||
## scpp Sharing C Pre-Processor
|
||||
## version Generate and maintain a version information file
|
||||
## path Deal with program paths
|
||||
##
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "$0:Error: invalid command line" 1>&2
|
||||
echo "$0:Hint: run \`$0 -h' for usage" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
if [ ".$1" = ".-h" -o ".$1" = ".--help" ]; then
|
||||
echo "This is GNU shtool, version 1.4.9 (16-Apr-2000)"
|
||||
echo "Copyright (c) 1994-2000 Ralf S. Engelschall <rse@engelschall.com>"
|
||||
echo "Report bugs to <bug-shtool@gnu.org>"
|
||||
echo ''
|
||||
echo "Usage: shtool [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]"
|
||||
echo ''
|
||||
echo 'Available global <options>:'
|
||||
echo ' -v, --version display shtool version information'
|
||||
echo ' -h, --help display shtool usage help page (this one)'
|
||||
echo ' -d, --debug display shell trace information'
|
||||
echo ''
|
||||
echo 'Available <cmd-name> [<cmd-options>] [<cmd-args>]:'
|
||||
echo ' echo [-n] [-e] [<str> ...]'
|
||||
echo ' install [-v] [-t] [-c] [-C] [-s] [-m<mode>] [-o<owner>] [-g<group>]'
|
||||
echo ' [-e<ext>] <file> <path>'
|
||||
echo ' mkdir [-t] [-f] [-p] [-m<mode>] <dir> [<dir> ...]'
|
||||
echo ''
|
||||
echo 'Not available <cmd-name> (because module was not built-in):'
|
||||
echo ' mdate [-n] [-z] [-s] [-d] [-f<str>] [-o<spec>] <path>'
|
||||
echo ' table [-F<sep>] [-w<width>] [-c<cols>] [-s<strip>] <str><sep><str>...'
|
||||
echo ' prop [-p<str>]'
|
||||
echo ' move [-v] [-t] [-e] [-p] <src-file> <dst-file>'
|
||||
echo ' mkln [-t] [-f] [-s] <src-path> [<src-path> ...] <dst-path>'
|
||||
echo ' mkshadow [-v] [-t] [-a] <src-dir> <dst-dir>'
|
||||
echo ' fixperm [-v] [-t] <path> [<path> ...]'
|
||||
echo ' tarball [-t] [-v] [-o <tarball>] [-c <prog>] [-d <dir>] [-u'
|
||||
echo ' <user>] [-g <group>] [-e <pattern>] <path> [<path> ...]'
|
||||
echo ' guessos '
|
||||
echo ' arx [-t] [-C<cmd>] <op> <archive> [<file> ...]'
|
||||
echo ' slo [-p<str>] -- -L<dir> -l<lib> [-L<dir> -l<lib> ...]'
|
||||
echo ' scpp [-v] [-p] [-f<filter>] [-o<ofile>] [-t<tfile>] [-M<mark>]'
|
||||
echo ' [-D<dname>] [-C<cname>] <file> [<file> ...]'
|
||||
echo ' version [-l<lang>] [-n<name>] [-p<prefix>] [-s<version>] [-i<knob>]'
|
||||
echo ' [-d<type>] <file>'
|
||||
echo ' path [-s] [-r] [-d] [-b] [-m] [-p<path>] <str> [<str> ...]'
|
||||
echo ''
|
||||
exit 0
|
||||
fi
|
||||
if [ ".$1" = ".-v" -o ".$1" = ."--version" ]; then
|
||||
echo "GNU shtool 1.4.9 (16-Apr-2000)"
|
||||
exit 0
|
||||
fi
|
||||
if [ ".$1" = ".-d" -o ".$1" = ."--debug" ]; then
|
||||
shift
|
||||
set -x
|
||||
fi
|
||||
name=`echo "$0" | sed -e 's;.*/\([^/]*\)$;\1;' -e 's;-sh$;;' -e 's;\.sh$;;'`
|
||||
case "$name" in
|
||||
echo|install|mkdir )
|
||||
# implicit tool command selection
|
||||
tool="$name"
|
||||
;;
|
||||
* )
|
||||
# explicit tool command selection
|
||||
tool="$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
arg_spec=""
|
||||
opt_spec=""
|
||||
gen_tmpfile=no
|
||||
|
||||
##
|
||||
## DISPATCH INTO SCRIPT PROLOG
|
||||
##
|
||||
|
||||
case $tool in
|
||||
echo )
|
||||
str_tool="echo"
|
||||
str_usage="[-n] [-e] [<str> ...]"
|
||||
arg_spec="0+"
|
||||
opt_spec="n.e."
|
||||
opt_n=no
|
||||
opt_e=no
|
||||
;;
|
||||
install )
|
||||
str_tool="install"
|
||||
str_usage="[-v] [-t] [-c] [-C] [-s] [-m<mode>] [-o<owner>] [-g<group>] [-e<ext>] <file> <path>"
|
||||
arg_spec="2="
|
||||
opt_spec="v.t.c.C.s.m:o:g:e:"
|
||||
opt_v=no
|
||||
opt_t=no
|
||||
opt_c=no
|
||||
opt_C=no
|
||||
opt_s=no
|
||||
opt_m=""
|
||||
opt_o=""
|
||||
opt_g=""
|
||||
opt_e=""
|
||||
;;
|
||||
mkdir )
|
||||
str_tool="mkdir"
|
||||
str_usage="[-t] [-f] [-p] [-m<mode>] <dir> [<dir> ...]"
|
||||
arg_spec="1+"
|
||||
opt_spec="t.f.p.m:"
|
||||
opt_t=no
|
||||
opt_f=no
|
||||
opt_p=no
|
||||
opt_m=""
|
||||
;;
|
||||
-* )
|
||||
echo "$0:Error: unknown option \`$tool'" 2>&1
|
||||
echo "$0:Hint: run \`$0 -h' for usage" 2>&1
|
||||
exit 1
|
||||
;;
|
||||
* )
|
||||
echo "$0:Error: unknown command \`$tool'" 2>&1
|
||||
echo "$0:Hint: run \`$0 -h' for usage" 2>&1
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
##
|
||||
## COMMON UTILITY CODE
|
||||
##
|
||||
|
||||
# determine name of tool
|
||||
if [ ".$tool" != . ]; then
|
||||
# used inside shtool script
|
||||
toolcmd="$0 $tool"
|
||||
toolcmdhelp="shtool $tool"
|
||||
msgprefix="shtool:$tool"
|
||||
else
|
||||
# used as standalone script
|
||||
toolcmd="$0"
|
||||
toolcmdhelp="sh $0"
|
||||
msgprefix="$str_tool"
|
||||
fi
|
||||
|
||||
# parse argument specification string
|
||||
eval `echo $arg_spec |\
|
||||
sed -e 's/^\([0-9]*\)\([+=]\)/arg_NUMS=\1; arg_MODE=\2/'`
|
||||
|
||||
# parse option specification string
|
||||
eval `echo h.$opt_spec |\
|
||||
sed -e 's/\([a-zA-Z0-9]\)\([.:+]\)/opt_MODE_\1=\2;/g'`
|
||||
|
||||
# interate over argument line
|
||||
opt_PREV=''
|
||||
while [ $# -gt 0 ]; do
|
||||
# special option stops processing
|
||||
if [ ".$1" = ".--" ]; then
|
||||
shift
|
||||
break
|
||||
fi
|
||||
|
||||
# determine option and argument
|
||||
opt_ARG_OK=no
|
||||
if [ ".$opt_PREV" != . ]; then
|
||||
# merge previous seen option with argument
|
||||
opt_OPT="$opt_PREV"
|
||||
opt_ARG="$1"
|
||||
opt_ARG_OK=yes
|
||||
opt_PREV=''
|
||||
else
|
||||
# split argument into option and argument
|
||||
case "$1" in
|
||||
-[a-zA-Z0-9]*)
|
||||
eval `echo "x$1" |\
|
||||
sed -e 's/^x-\([a-zA-Z0-9]\)/opt_OPT="\1";/' \
|
||||
-e 's/";\(.*\)$/"; opt_ARG="\1"/'`
|
||||
;;
|
||||
-[a-zA-Z0-9])
|
||||
opt_OPT=`echo "x$1" | cut -c3-`
|
||||
opt_ARG=''
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# eat up option
|
||||
shift
|
||||
|
||||
# determine whether option needs an argument
|
||||
eval "opt_MODE=\$opt_MODE_${opt_OPT}"
|
||||
if [ ".$opt_ARG" = . -a ".$opt_ARG_OK" != .yes ]; then
|
||||
if [ ".$opt_MODE" = ".:" -o ".$opt_MODE" = ".+" ]; then
|
||||
opt_PREV="$opt_OPT"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
# process option
|
||||
case $opt_MODE in
|
||||
'.' )
|
||||
# boolean option
|
||||
eval "opt_${opt_OPT}=yes"
|
||||
;;
|
||||
':' )
|
||||
# option with argument (multiple occurances override)
|
||||
eval "opt_${opt_OPT}=\"\$opt_ARG\""
|
||||
;;
|
||||
'+' )
|
||||
# option with argument (multiple occurances append)
|
||||
eval "opt_${opt_OPT}=\"\$opt_${opt_OPT} \$opt_ARG\""
|
||||
;;
|
||||
* )
|
||||
echo "$msgprefix:Error: unknown option: \`-$opt_OPT'" 1>&2
|
||||
echo "$msgprefix:Hint: run \`$toolcmdhelp -h' or \`man shtool' for details" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [ ".$opt_PREV" != . ]; then
|
||||
echo "$msgprefix:Error: missing argument to option \`-$opt_PREV'" 1>&2
|
||||
echo "$msgprefix:Hint: run \`$toolcmdhelp -h' or \`man shtool' for details" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# process help option
|
||||
if [ ".$opt_h" = .yes ]; then
|
||||
echo "Usage: $toolcmdhelp $str_usage"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# complain about incorrect number of arguments
|
||||
case $arg_MODE in
|
||||
'=' )
|
||||
if [ $# -ne $arg_NUMS ]; then
|
||||
echo "$msgprefix:Error: invalid number of arguments (exactly $arg_NUMS expected)" 1>&2
|
||||
echo "$msgprefix:Hint: run \`$toolcmd -h' or \`man shtool' for details" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
'+' )
|
||||
if [ $# -lt $arg_NUMS ]; then
|
||||
echo "$msgprefix:Error: invalid number of arguments (at least $arg_NUMS expected)" 1>&2
|
||||
echo "$msgprefix:Hint: run \`$toolcmd -h' or \`man shtool' for details" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# establish a temporary file on request
|
||||
if [ ".$gen_tmpfile" = .yes ]; then
|
||||
if [ ".$TMPDIR" != . ]; then
|
||||
tmpdir="$TMPDIR"
|
||||
elif [ ".$TEMPDIR" != . ]; then
|
||||
tmpdir="$TEMPDIR"
|
||||
else
|
||||
tmpdir="/tmp"
|
||||
fi
|
||||
tmpfile="$tmpdir/.shtool.$$"
|
||||
rm -f $tmpfile >/dev/null 2>&1
|
||||
touch $tmpfile
|
||||
fi
|
||||
|
||||
##
|
||||
## DISPATCH INTO SCRIPT BODY
|
||||
##
|
||||
|
||||
case $tool in
|
||||
|
||||
echo )
|
||||
##
|
||||
## echo -- Print string with optional construct expansion
|
||||
## Copyright (c) 1998-2000 Ralf S. Engelschall <rse@engelschall.com>
|
||||
## Originally written for WML as buildinfo
|
||||
##
|
||||
|
||||
text="$*"
|
||||
|
||||
# check for broken escape sequence expansion
|
||||
seo=''
|
||||
bytes=`echo '\1' | wc -c | awk '{ printf("%s", $1); }'`
|
||||
if [ ".$bytes" != .3 ]; then
|
||||
bytes=`echo -E '\1' | wc -c | awk '{ printf("%s", $1); }'`
|
||||
if [ ".$bytes" = .3 ]; then
|
||||
seo='-E'
|
||||
fi
|
||||
fi
|
||||
|
||||
# check for existing -n option (to suppress newline)
|
||||
minusn=''
|
||||
bytes=`echo -n 123 2>/dev/null | wc -c | awk '{ printf("%s", $1); }'`
|
||||
if [ ".$bytes" = .3 ]; then
|
||||
minusn='-n'
|
||||
fi
|
||||
|
||||
# determine terminal bold sequence
|
||||
term_bold=''
|
||||
term_norm=''
|
||||
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[Bb]'`" != . ]; then
|
||||
case $TERM in
|
||||
# for the most important terminal types we directly know the sequences
|
||||
xterm|xterm*|vt220|vt220*)
|
||||
term_bold=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' </dev/null 2>/dev/null`
|
||||
term_norm=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' </dev/null 2>/dev/null`
|
||||
;;
|
||||
vt100|vt100*)
|
||||
term_bold=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }' </dev/null 2>/dev/null`
|
||||
term_norm=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }' </dev/null 2>/dev/null`
|
||||
;;
|
||||
# for all others, we try to use a possibly existing `tput' or `tcout' utility
|
||||
* )
|
||||
paths=`echo $PATH | sed -e 's/:/ /g'`
|
||||
for tool in tput tcout; do
|
||||
for dir in $paths; do
|
||||
if [ -r "$dir/$tool" ]; then
|
||||
for seq in bold md smso; do # 'smso' is last
|
||||
bold="`$dir/$tool $seq 2>/dev/null`"
|
||||
if [ ".$bold" != . ]; then
|
||||
term_bold="$bold"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ ".$term_bold" != . ]; then
|
||||
for seq in sgr0 me rmso reset; do # 'reset' is last
|
||||
norm="`$dir/$tool $seq 2>/dev/null`"
|
||||
if [ ".$norm" != . ]; then
|
||||
term_norm="$norm"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ ".$term_bold" != . -a ".$term_norm" != . ]; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
if [ ".$term_bold" = . -o ".$term_norm" = . ]; then
|
||||
echo "$msgprefix:Warning: unable to determine terminal sequence for bold mode" 1>&2
|
||||
fi
|
||||
fi
|
||||
|
||||
# determine user name
|
||||
username=''
|
||||
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[uU]'`" != . ]; then
|
||||
username="$LOGNAME"
|
||||
if [ ".$username" = . ]; then
|
||||
username="$USER"
|
||||
if [ ".$username" = . ]; then
|
||||
username="`(whoami) 2>/dev/null |\
|
||||
awk '{ printf("%s", $1); }'`"
|
||||
if [ ".$username" = . ]; then
|
||||
username="`(who am i) 2>/dev/null |\
|
||||
awk '{ printf("%s", $1); }'`"
|
||||
if [ ".$username" = . ]; then
|
||||
username='unknown'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# determine user id
|
||||
userid=''
|
||||
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%U'`" != . ]; then
|
||||
userid="`(id -u) 2>/dev/null`"
|
||||
if [ ".$userid" = . ]; then
|
||||
str="`(id) 2>/dev/null`"
|
||||
if [ ".`echo $str | grep '^uid[ ]*=[ ]*[0-9]*('`" != . ]; then
|
||||
userid=`echo $str | sed -e 's/^uid[ ]*=[ ]*//' -e 's/(.*//'`
|
||||
fi
|
||||
if [ ".$userid" = . ]; then
|
||||
userid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
|
||||
sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
|
||||
if [ ".$userid" = . ]; then
|
||||
userid=`(ypcat passwd) 2>/dev/null |
|
||||
egrep "^${username}:" | \
|
||||
sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
|
||||
if [ ".$userid" = . ]; then
|
||||
userid='?'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# determine host name
|
||||
hostname=''
|
||||
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%h'`" != . ]; then
|
||||
hostname="`(uname -n) 2>/dev/null |\
|
||||
awk '{ printf("%s", $1); }'`"
|
||||
if [ ".$hostname" = . ]; then
|
||||
hostname="`(hostname) 2>/dev/null |\
|
||||
awk '{ printf("%s", $1); }'`"
|
||||
if [ ".$hostname" = . ]; then
|
||||
hostname='unknown'
|
||||
fi
|
||||
fi
|
||||
case $hostname in
|
||||
*.* )
|
||||
domainname=".`echo $hostname | cut -d. -f2-`"
|
||||
hostname="`echo $hostname | cut -d. -f1`"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# determine domain name
|
||||
domainname=''
|
||||
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%d'`" != . ]; then
|
||||
if [ ".$domainname" = . ]; then
|
||||
if [ -f /etc/resolv.conf ]; then
|
||||
domainname="`egrep '^[ ]*domain' /etc/resolv.conf | head -1 |\
|
||||
sed -e 's/.*domain//' \
|
||||
-e 's/^[ ]*//' -e 's/^ *//' -e 's/^ *//' \
|
||||
-e 's/^\.//' -e 's/^/./' |\
|
||||
awk '{ printf("%s", $1); }'`"
|
||||
if [ ".$domainname" = . ]; then
|
||||
domainname="`egrep '^[ ]*search' /etc/resolv.conf | head -1 |\
|
||||
sed -e 's/.*search//' \
|
||||
-e 's/^[ ]*//' -e 's/^ *//' -e 's/^ *//' \
|
||||
-e 's/ .*//' -e 's/ .*//' \
|
||||
-e 's/^\.//' -e 's/^/./' |\
|
||||
awk '{ printf("%s", $1); }'`"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# determine current time
|
||||
time_day=''
|
||||
time_month=''
|
||||
time_year=''
|
||||
time_monthname=''
|
||||
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[DMYm]'`" != . ]; then
|
||||
time_day=`date '+%d'`
|
||||
time_month=`date '+%m'`
|
||||
time_year=`date '+%Y' 2>/dev/null`
|
||||
if [ ".$time_year" = . ]; then
|
||||
time_year=`date '+%y'`
|
||||
case $time_year in
|
||||
[5-9][0-9]) time_year="19$time_year" ;;
|
||||
[0-4][0-9]) time_year="20$time_year" ;;
|
||||
esac
|
||||
fi
|
||||
case $time_month in
|
||||
1|01) time_monthname='Jan' ;;
|
||||
2|02) time_monthname='Feb' ;;
|
||||
3|03) time_monthname='Mar' ;;
|
||||
4|04) time_monthname='Apr' ;;
|
||||
5|05) time_monthname='May' ;;
|
||||
6|06) time_monthname='Jun' ;;
|
||||
7|07) time_monthname='Jul' ;;
|
||||
8|08) time_monthname='Aug' ;;
|
||||
9|09) time_monthname='Sep' ;;
|
||||
10) time_monthname='Oct' ;;
|
||||
11) time_monthname='Nov' ;;
|
||||
12) time_monthname='Dec' ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# expand special ``%x'' constructs
|
||||
if [ ".$opt_e" = .yes ]; then
|
||||
text=`echo $seo "$text" |\
|
||||
sed -e "s/%B/${term_bold}/g" \
|
||||
-e "s/%b/${term_norm}/g" \
|
||||
-e "s/%u/${username}/g" \
|
||||
-e "s/%U/${userid}/g" \
|
||||
-e "s/%h/${hostname}/g" \
|
||||
-e "s/%d/${domainname}/g" \
|
||||
-e "s/%D/${time_day}/g" \
|
||||
-e "s/%M/${time_month}/g" \
|
||||
-e "s/%Y/${time_year}/g" \
|
||||
-e "s/%m/${time_monthname}/g" 2>/dev/null`
|
||||
fi
|
||||
|
||||
# create output
|
||||
if [ .$opt_n = .no ]; then
|
||||
echo $seo "$text"
|
||||
else
|
||||
# the harder part: echo -n is best, because
|
||||
# awk may complain about some \xx sequences.
|
||||
if [ ".$minusn" != . ]; then
|
||||
echo $seo $minusn "$text"
|
||||
else
|
||||
echo dummy | awk '{ printf("%s", TEXT); }' TEXT="$text"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
install )
|
||||
##
|
||||
## install -- Install a program, script or datafile
|
||||
## Copyright (c) 1997-2000 Ralf S. Engelschall <rse@engelschall.com>
|
||||
## Originally written for shtool
|
||||
##
|
||||
|
||||
src="$1"
|
||||
dst="$2"
|
||||
|
||||
# If destination is a directory, append the input filename
|
||||
if [ -d $dst ]; then
|
||||
dst=`echo "$dst" | sed -e 's:/$::'`
|
||||
dstfile=`echo "$src" | sed -e 's;.*/\([^/]*\)$;\1;'`
|
||||
dst="$dst/$dstfile"
|
||||
fi
|
||||
|
||||
# Add a possible extension to src and dst
|
||||
if [ ".$opt_e" != . ]; then
|
||||
src="$src$opt_e"
|
||||
dst="$dst$opt_e"
|
||||
fi
|
||||
|
||||
# Check for correct arguments
|
||||
if [ ".$src" = ".$dst" ]; then
|
||||
echo "$msgprefix:Error: source and destination are the same" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Make a temp file name in the destination directory
|
||||
dstdir=`echo $dst | sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' -e 's;^$;.;'`
|
||||
dsttmp="$dstdir/#INST@$$#"
|
||||
|
||||
# Verbosity
|
||||
if [ ".$opt_v" = .yes ]; then
|
||||
echo "$src -> $dst" 1>&2
|
||||
fi
|
||||
|
||||
# Copy or move the file name to the temp name
|
||||
# (because we might be not allowed to change the source)
|
||||
if [ ".$opt_C" = .yes ]; then
|
||||
opt_c=yes
|
||||
fi
|
||||
if [ ".$opt_c" = .yes ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "cp $src $dsttmp" 1>&2
|
||||
fi
|
||||
cp $src $dsttmp || exit $?
|
||||
else
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "mv $src $dsttmp" 1>&2
|
||||
fi
|
||||
mv $src $dsttmp || exit $?
|
||||
fi
|
||||
|
||||
# Adjust the target file
|
||||
# (we do chmod last to preserve setuid bits)
|
||||
if [ ".$opt_s" = .yes ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "strip $dsttmp" 1>&2
|
||||
fi
|
||||
strip $dsttmp || exit $?
|
||||
fi
|
||||
if [ ".$opt_o" != . ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "chown $opt_o $dsttmp" 1>&2
|
||||
fi
|
||||
chown $opt_o $dsttmp || exit $?
|
||||
fi
|
||||
if [ ".$opt_g" != . ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "chgrp $opt_g $dsttmp" 1>&2
|
||||
fi
|
||||
chgrp $opt_g $dsttmp || exit $?
|
||||
fi
|
||||
if [ ".$opt_m" != . ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "chmod $opt_m $dsttmp" 1>&2
|
||||
fi
|
||||
chmod $opt_m $dsttmp || exit $?
|
||||
fi
|
||||
|
||||
# Determine whether to do a quick install
|
||||
# (has to be done _after_ the strip was already done)
|
||||
quick=no
|
||||
if [ ".$opt_C" = .yes ]; then
|
||||
if [ -r $dst ]; then
|
||||
if cmp -s $src $dst; then
|
||||
quick=yes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Finally install the file to the real destination
|
||||
if [ $quick = yes ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "rm -f $dsttmp" 1>&2
|
||||
fi
|
||||
rm -f $dsttmp
|
||||
else
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "rm -f $dst && mv $dsttmp $dst" 1>&2
|
||||
fi
|
||||
rm -f $dst && mv $dsttmp $dst
|
||||
fi
|
||||
;;
|
||||
|
||||
mkdir )
|
||||
##
|
||||
## mkdir -- Make one or more directories
|
||||
## Copyright (c) 1996-2000 Ralf S. Engelschall <rse@engelschall.com>
|
||||
## Originally written for public domain by Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
## Cleaned up and enhanced for shtool
|
||||
##
|
||||
|
||||
errstatus=0
|
||||
for p in ${1+"$@"}; do
|
||||
# if the directory already exists...
|
||||
if [ -d "$p" ]; then
|
||||
if [ ".$opt_f" = .no ] && [ ".$opt_p" = .no ]; then
|
||||
echo "$msgprefix:Error: directory already exists: $p" 1>&2
|
||||
errstatus=1
|
||||
break
|
||||
else
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
# if the directory has to be created...
|
||||
if [ ".$opt_p" = .no ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "mkdir $p" 1>&2
|
||||
fi
|
||||
mkdir $p || errstatus=$?
|
||||
else
|
||||
# the smart situation
|
||||
set fnord `echo ":$p" |\
|
||||
sed -e 's/^:\//%/' \
|
||||
-e 's/^://' \
|
||||
-e 's/\// /g' \
|
||||
-e 's/^%/\//'`
|
||||
shift
|
||||
pathcomp=''
|
||||
for d in ${1+"$@"}; do
|
||||
pathcomp="$pathcomp$d"
|
||||
case "$pathcomp" in
|
||||
-* ) pathcomp="./$pathcomp" ;;
|
||||
esac
|
||||
if [ ! -d "$pathcomp" ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "mkdir $pathcomp" 1>&2
|
||||
fi
|
||||
mkdir $pathcomp || errstatus=$?
|
||||
if [ ".$opt_m" != . ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "chmod $opt_m $pathcomp" 1>&2
|
||||
fi
|
||||
chmod $opt_m $pathcomp || errstatus=$?
|
||||
fi
|
||||
fi
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
fi
|
||||
done
|
||||
exit $errstatus
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
##EOF##
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#! /bin/sh
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP Version 4 |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Copyright (c) 1997-2002 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. |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Author: Sascha Schumann <sascha@schumann.cx> |
|
||||
# +----------------------------------------------------------------------+
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
# cwd must be top_srcdir
|
||||
test -f build/sysv_makefile || exit 2
|
||||
|
||||
test -f bsd_converted || exit 1
|
||||
|
||||
tmpfile=`mktemp /tmp/sysv_makefile.XXXXXX` || tmpfile="tmp.$$"
|
||||
for i in build/*.mk; do
|
||||
sed 's/^\.include "\(.*\)"/include \1/' $i >$tmpfile \
|
||||
&& cp $tmpfile $i
|
||||
done
|
||||
rm -f $tmpfile
|
||||
|
||||
rm bsd_converted
|
||||
exit 0
|
||||
@@ -1,69 +1,36 @@
|
||||
#!/bin/sh
|
||||
# $Id$
|
||||
|
||||
eval `grep '^PHP_EXTRA_VERSION=' configure.in`
|
||||
case "$PHP_EXTRA_VERSION" in
|
||||
*-dev)
|
||||
dev=1
|
||||
;;
|
||||
*)
|
||||
dev=0
|
||||
;;
|
||||
esac
|
||||
supplied_flag=$1
|
||||
|
||||
devok=0
|
||||
debug=no
|
||||
|
||||
while test $# -gt 0; do
|
||||
if test "$1" = "--force"; then
|
||||
devok=1
|
||||
echo "Forcing buildconf"
|
||||
fi
|
||||
|
||||
if test "$1" = "--debug"; then
|
||||
debug=yes
|
||||
fi
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
if test "$dev" = "0" -a "$devok" = "0"; then
|
||||
echo "You should not run buildconf in a release package."
|
||||
echo "use buildconf --force to override this check."
|
||||
exit 1
|
||||
if test "$supplied_flag" = "--copy"; then
|
||||
automake_flags=--copy
|
||||
fi
|
||||
|
||||
if test -z "$ZENDDIR"; then
|
||||
if grep "PHP_MAJOR_VERSION 5" main/php_version.h >/dev/null; then
|
||||
v=5
|
||||
else
|
||||
v=4
|
||||
fi
|
||||
## build.mk does not check aclocal exit status yet
|
||||
##
|
||||
#mv aclocal.m4 aclocal.m4.old 2>/dev/null
|
||||
#aclocal
|
||||
#if test "$?" != "0" -a "$am_prefix" != "$lt_prefix"; then
|
||||
# echo "buildconf: ERROR: aclocal failed, probably because automake and"
|
||||
# echo " libtool are installed with different prefixes;"
|
||||
# echo " automake is installed in $am_prefix, but libtool in $lt_prefix."
|
||||
# echo " Please re-install automake and/or libtool with a common prefix"
|
||||
# echo " and try again."
|
||||
# exit 1
|
||||
#fi
|
||||
|
||||
if test "$v" = "5"; then
|
||||
if test -r "Zend/OBJECTS2_HOWTO"; then
|
||||
:
|
||||
else
|
||||
mv Zend ZendEngine1 2>/dev/null
|
||||
mv ZendEngine2 Zend
|
||||
fi
|
||||
else
|
||||
if test -r "Zend/zend_execute_globals.h"; then
|
||||
:
|
||||
else
|
||||
mv Zend ZendEngine2 2>/dev/null
|
||||
mv ZendEngine1 Zend
|
||||
fi
|
||||
fi
|
||||
|
||||
ZENDDIR=Zend
|
||||
echo "using default Zend directory"
|
||||
if test "$supplied_flag" = "--local"; then
|
||||
subdirs='SUBDIRS='
|
||||
else
|
||||
subdirs=''
|
||||
fi
|
||||
|
||||
|
||||
rm -f generated_lists
|
||||
|
||||
if test "$debug" = "yes"; then
|
||||
${MAKE:-make} -s -f build/build.mk ZENDDIR="$ZENDDIR" SUPPRESS_WARNINGS=""
|
||||
else
|
||||
${MAKE:-make} -s -f build/build.mk ZENDDIR="$ZENDDIR"
|
||||
fi
|
||||
case "`uname`" in
|
||||
*BSD/OS*)
|
||||
./build/bsd_makefile;;
|
||||
esac
|
||||
|
||||
${MAKE:-make} -s -f build/build.mk AMFLAGS="$automake_flags"
|
||||
@@ -1,5 +0,0 @@
|
||||
@echo off
|
||||
cscript /nologo win32\build\buildconf.js %*
|
||||
SET PHP_BUILDCONF_PATH=%~dp0
|
||||
copy %PHP_BUILDCONF_PATH%\win32\build\configure.bat %PHP_BUILDCONF_PATH%
|
||||
SET PHP_SDK_SCRIPT_PATH=
|
||||
Vendored
+378
-536
File diff suppressed because it is too large.
Load diff
Vendored
+117
-279
@@ -1,9 +1,9 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2005-07-08'
|
||||
timestamp='2001-11-08'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
@@ -21,15 +21,14 @@ timestamp='2005-07-08'
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
#
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
|
||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
||||
# diff and a properly formatted ChangeLog entry.
|
||||
#
|
||||
@@ -71,7 +70,7 @@ Report bugs and patches to <config-patches@gnu.org>."
|
||||
version="\
|
||||
GNU config.sub ($timestamp)
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
@@ -84,11 +83,11 @@ Try \`$me --help' for more information."
|
||||
while test $# -gt 0 ; do
|
||||
case $1 in
|
||||
--time-stamp | --time* | -t )
|
||||
echo "$timestamp" ; exit ;;
|
||||
echo "$timestamp" ; exit 0 ;;
|
||||
--version | -v )
|
||||
echo "$version" ; exit ;;
|
||||
echo "$version" ; exit 0 ;;
|
||||
--help | --h* | -h )
|
||||
echo "$usage"; exit ;;
|
||||
echo "$usage"; exit 0 ;;
|
||||
-- ) # Stop option processing
|
||||
shift; break ;;
|
||||
- ) # Use stdin as input.
|
||||
@@ -100,7 +99,7 @@ while test $# -gt 0 ; do
|
||||
*local*)
|
||||
# First pass through any local machine types.
|
||||
echo $1
|
||||
exit ;;
|
||||
exit 0;;
|
||||
|
||||
* )
|
||||
break ;;
|
||||
@@ -119,8 +118,7 @@ esac
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
|
||||
kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
|
||||
nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
@@ -146,7 +144,7 @@ case $os in
|
||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple | -axis | -knuth | -cray)
|
||||
-apple | -axis)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
@@ -229,56 +227,34 @@ case $basic_machine in
|
||||
1750a | 580 \
|
||||
| a29k \
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||
| am33_2.0 \
|
||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
|
||||
| bfin \
|
||||
| c4x | clipper \
|
||||
| d10v | d30v | dlx | dsp16xx \
|
||||
| fr30 | frv \
|
||||
| d10v | d30v | dsp16xx \
|
||||
| fr30 \
|
||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| i370 | i860 | i960 | ia64 \
|
||||
| ip2k | iq2000 \
|
||||
| m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
|
||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||
| mips16 \
|
||||
| mips64 | mips64el \
|
||||
| mips64vr | mips64vrel \
|
||||
| mips64orion | mips64orionel \
|
||||
| mips64vr4100 | mips64vr4100el \
|
||||
| mips64vr4300 | mips64vr4300el \
|
||||
| mips64vr5000 | mips64vr5000el \
|
||||
| mips64vr5900 | mips64vr5900el \
|
||||
| mipsisa32 | mipsisa32el \
|
||||
| mipsisa32r2 | mipsisa32r2el \
|
||||
| mipsisa64 | mipsisa64el \
|
||||
| mipsisa64r2 | mipsisa64r2el \
|
||||
| mipsisa64sb1 | mipsisa64sb1el \
|
||||
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||
| mipstx39 | mipstx39el \
|
||||
| m32r | m68000 | m68k | m88k | mcore \
|
||||
| mips16 | mips64 | mips64el | mips64orion | mips64orionel \
|
||||
| mips64vr4100 | mips64vr4100el | mips64vr4300 \
|
||||
| mips64vr4300el | mips64vr5000 | mips64vr5000el \
|
||||
| mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \
|
||||
| mipsisa32 \
|
||||
| mn10200 | mn10300 \
|
||||
| ms1 \
|
||||
| msp430 \
|
||||
| ns16k | ns32k \
|
||||
| or32 \
|
||||
| openrisc \
|
||||
| pdp10 | pdp11 | pj | pjl \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
||||
| pyramid \
|
||||
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh64 | sh64le \
|
||||
| sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
|
||||
| sparcv8 | sparcv9 | sparcv9b \
|
||||
| sh | sh[34] | sh[34]eb | shbe | shle \
|
||||
| sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \
|
||||
| strongarm \
|
||||
| tahoe | thumb | tic4x | tic80 | tron \
|
||||
| v850 | v850e \
|
||||
| tahoe | thumb | tic80 | tron \
|
||||
| v850 \
|
||||
| we32k \
|
||||
| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
|
||||
| x86 | xscale | xstormy16 \
|
||||
| z8k)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
m32c)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
m6811 | m68hc11 | m6812 | m68hc12)
|
||||
# Motorola 68HC11/12.
|
||||
basic_machine=$basic_machine-unknown
|
||||
@@ -302,65 +278,41 @@ case $basic_machine in
|
||||
580-* \
|
||||
| a29k-* \
|
||||
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
|
||||
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||
| alphapca5[67]-* | arc-* \
|
||||
| arm-* | armbe-* | armle-* | armv*-* \
|
||||
| avr-* \
|
||||
| bfin-* | bs2000-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
|
||||
| clipper-* | craynv-* | cydra-* \
|
||||
| d10v-* | d30v-* | dlx-* \
|
||||
| bs2000-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c54x-* \
|
||||
| clipper-* | cray2-* | cydra-* \
|
||||
| d10v-* | d30v-* \
|
||||
| elxsi-* \
|
||||
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
|
||||
| f30[01]-* | f700-* | fr30-* | fx80-* \
|
||||
| h8300-* | h8500-* \
|
||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||
| i*86-* | i860-* | i960-* | ia64-* \
|
||||
| ip2k-* | iq2000-* \
|
||||
| m32r-* | m32rle-* \
|
||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||
| m88110-* | m88k-* | maxq-* | mcore-* \
|
||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||
| mips16-* \
|
||||
| mips64-* | mips64el-* \
|
||||
| mips64vr-* | mips64vrel-* \
|
||||
| mips64orion-* | mips64orionel-* \
|
||||
| mips64vr4100-* | mips64vr4100el-* \
|
||||
| mips64vr4300-* | mips64vr4300el-* \
|
||||
| mips64vr5000-* | mips64vr5000el-* \
|
||||
| mips64vr5900-* | mips64vr5900el-* \
|
||||
| mipsisa32-* | mipsisa32el-* \
|
||||
| mipsisa32r2-* | mipsisa32r2el-* \
|
||||
| mipsisa64-* | mipsisa64el-* \
|
||||
| mipsisa64r2-* | mipsisa64r2el-* \
|
||||
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
||||
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
| mmix-* \
|
||||
| ms1-* \
|
||||
| msp430-* \
|
||||
| m32r-* \
|
||||
| m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \
|
||||
| m88110-* | m88k-* | mcore-* \
|
||||
| mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \
|
||||
| mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \
|
||||
| mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \
|
||||
| mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \
|
||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||
| orion-* \
|
||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||
| pyramid-* \
|
||||
| romp-* | rs6000-* \
|
||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
|
||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||
| sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
|
||||
| sparclite-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
|
||||
| tahoe-* | thumb-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||
| tron-* \
|
||||
| v850-* | v850e-* | vax-* \
|
||||
| sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \
|
||||
| sparc-* | sparc64-* | sparc86x-* | sparclite-* \
|
||||
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* \
|
||||
| t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
|
||||
| v850-* | vax-* \
|
||||
| we32k-* \
|
||||
| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
|
||||
| xstormy16-* | xtensa-* \
|
||||
| x86-* | x86_64-* | xmp-* | xps100-* | xscale-* | xstormy16-* \
|
||||
| ymp-* \
|
||||
| z8k-*)
|
||||
;;
|
||||
m32c-*)
|
||||
;;
|
||||
# Recognize the various machine names and aliases which stand
|
||||
# for a CPU type and a company and sometimes even an OS.
|
||||
386bsd)
|
||||
@@ -377,9 +329,6 @@ case $basic_machine in
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
abacus)
|
||||
basic_machine=abacus-unknown
|
||||
;;
|
||||
adobe68k)
|
||||
basic_machine=m68010-adobe
|
||||
os=-scout
|
||||
@@ -394,12 +343,6 @@ case $basic_machine in
|
||||
basic_machine=a29k-none
|
||||
os=-bsd
|
||||
;;
|
||||
amd64)
|
||||
basic_machine=x86_64-pc
|
||||
;;
|
||||
amd64-*)
|
||||
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
amdahl)
|
||||
basic_machine=580-amdahl
|
||||
os=-sysv
|
||||
@@ -431,10 +374,6 @@ case $basic_machine in
|
||||
basic_machine=ns32k-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
c90)
|
||||
basic_machine=c90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
convex-c1)
|
||||
basic_machine=c1-convex
|
||||
os=-bsd
|
||||
@@ -455,45 +394,30 @@ case $basic_machine in
|
||||
basic_machine=c38-convex
|
||||
os=-bsd
|
||||
;;
|
||||
cray | j90)
|
||||
basic_machine=j90-cray
|
||||
cray | ymp)
|
||||
basic_machine=ymp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
craynv)
|
||||
basic_machine=craynv-cray
|
||||
os=-unicosmp
|
||||
cray2)
|
||||
basic_machine=cray2-cray
|
||||
os=-unicos
|
||||
;;
|
||||
cr16c)
|
||||
basic_machine=cr16c-unknown
|
||||
os=-elf
|
||||
[cjt]90)
|
||||
basic_machine=${basic_machine}-cray
|
||||
os=-unicos
|
||||
;;
|
||||
crds | unos)
|
||||
basic_machine=m68k-crds
|
||||
;;
|
||||
crisv32 | crisv32-* | etraxfs*)
|
||||
basic_machine=crisv32-axis
|
||||
;;
|
||||
cris | cris-* | etrax*)
|
||||
basic_machine=cris-axis
|
||||
;;
|
||||
crx)
|
||||
basic_machine=crx-unknown
|
||||
os=-elf
|
||||
;;
|
||||
da30 | da30-*)
|
||||
basic_machine=m68k-da30
|
||||
;;
|
||||
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
|
||||
basic_machine=mips-dec
|
||||
;;
|
||||
decsystem10* | dec10*)
|
||||
basic_machine=pdp10-dec
|
||||
os=-tops10
|
||||
;;
|
||||
decsystem20* | dec20*)
|
||||
basic_machine=pdp10-dec
|
||||
os=-tops20
|
||||
;;
|
||||
delta | 3300 | motorola-3300 | motorola-delta \
|
||||
| 3300-motorola | delta-motorola)
|
||||
basic_machine=m68k-motorola
|
||||
@@ -502,10 +426,6 @@ case $basic_machine in
|
||||
basic_machine=m88k-motorola
|
||||
os=-sysv3
|
||||
;;
|
||||
djgpp)
|
||||
basic_machine=i586-pc
|
||||
os=-msdosdjgpp
|
||||
;;
|
||||
dpx20 | dpx20-*)
|
||||
basic_machine=rs6000-bull
|
||||
os=-bosx
|
||||
@@ -678,20 +598,28 @@ case $basic_machine in
|
||||
basic_machine=m68k-atari
|
||||
os=-mint
|
||||
;;
|
||||
mipsel*-linux*)
|
||||
basic_machine=mipsel-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
mips*-linux*)
|
||||
basic_machine=mips-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
mips3*-*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
|
||||
;;
|
||||
mips3*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
||||
;;
|
||||
mmix*)
|
||||
basic_machine=mmix-knuth
|
||||
os=-mmixware
|
||||
;;
|
||||
monitor)
|
||||
basic_machine=m68k-rom68k
|
||||
os=-coff
|
||||
;;
|
||||
morphos)
|
||||
basic_machine=powerpc-unknown
|
||||
os=-morphos
|
||||
;;
|
||||
msdos)
|
||||
basic_machine=i386-pc
|
||||
os=-msdos
|
||||
@@ -771,13 +699,6 @@ case $basic_machine in
|
||||
basic_machine=hppa1.1-oki
|
||||
os=-proelf
|
||||
;;
|
||||
openrisc | openrisc-*)
|
||||
basic_machine=or32-unknown
|
||||
;;
|
||||
os400)
|
||||
basic_machine=powerpc-ibm
|
||||
os=-os400
|
||||
;;
|
||||
OSE68000 | ose68000)
|
||||
basic_machine=m68000-ericsson
|
||||
os=-ose
|
||||
@@ -800,55 +721,49 @@ case $basic_machine in
|
||||
pbb)
|
||||
basic_machine=m68k-tti
|
||||
;;
|
||||
pc532 | pc532-*)
|
||||
pc532 | pc532-*)
|
||||
basic_machine=ns32k-pc532
|
||||
;;
|
||||
pentium | p5 | k5 | k6 | nexgen | viac3)
|
||||
basic_machine=i586-pc
|
||||
;;
|
||||
pentiumpro | p6 | 6x86 | athlon | athlon_*)
|
||||
pentiumpro | p6 | 6x86 | athlon)
|
||||
basic_machine=i686-pc
|
||||
;;
|
||||
pentiumii | pentium2 | pentiumiii | pentium3)
|
||||
pentiumii | pentium2)
|
||||
basic_machine=i686-pc
|
||||
;;
|
||||
pentium4)
|
||||
basic_machine=i786-pc
|
||||
;;
|
||||
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
|
||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumpro-* | p6-* | 6x86-* | athlon-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
|
||||
pentiumii-* | pentium2-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentium4-*)
|
||||
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pn)
|
||||
basic_machine=pn-gould
|
||||
;;
|
||||
power) basic_machine=power-ibm
|
||||
;;
|
||||
ppc) basic_machine=powerpc-unknown
|
||||
;;
|
||||
;;
|
||||
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppcle | powerpclittle | ppc-le | powerpc-little)
|
||||
basic_machine=powerpcle-unknown
|
||||
;;
|
||||
;;
|
||||
ppcle-* | powerpclittle-*)
|
||||
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppc64) basic_machine=powerpc64-unknown
|
||||
;;
|
||||
;;
|
||||
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
|
||||
basic_machine=powerpc64le-unknown
|
||||
;;
|
||||
;;
|
||||
ppc64le-* | powerpc64little-*)
|
||||
basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
@@ -879,16 +794,6 @@ case $basic_machine in
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
sb1)
|
||||
basic_machine=mipsisa64sb1-unknown
|
||||
;;
|
||||
sb1el)
|
||||
basic_machine=mipsisa64sb1el-unknown
|
||||
;;
|
||||
sei)
|
||||
basic_machine=mips-sei
|
||||
os=-seiux
|
||||
;;
|
||||
sequent)
|
||||
basic_machine=i386-sequent
|
||||
;;
|
||||
@@ -896,9 +801,6 @@ case $basic_machine in
|
||||
basic_machine=sh-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
sh64)
|
||||
basic_machine=sh64-unknown
|
||||
;;
|
||||
sparclite-wrs | simso-wrs)
|
||||
basic_machine=sparclite-wrs
|
||||
os=-vxworks
|
||||
@@ -966,42 +868,22 @@ case $basic_machine in
|
||||
os=-dynix
|
||||
;;
|
||||
t3e)
|
||||
basic_machine=alphaev5-cray
|
||||
os=-unicos
|
||||
;;
|
||||
t90)
|
||||
basic_machine=t90-cray
|
||||
basic_machine=t3e-cray
|
||||
os=-unicos
|
||||
;;
|
||||
tic54x | c54x*)
|
||||
basic_machine=tic54x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tic55x | c55x*)
|
||||
basic_machine=tic55x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tic6x | c6x*)
|
||||
basic_machine=tic6x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tx39)
|
||||
basic_machine=mipstx39-unknown
|
||||
;;
|
||||
tx39el)
|
||||
basic_machine=mipstx39el-unknown
|
||||
;;
|
||||
toad1)
|
||||
basic_machine=pdp10-xkl
|
||||
os=-tops20
|
||||
;;
|
||||
tower | tower-32)
|
||||
basic_machine=m68k-ncr
|
||||
;;
|
||||
tpf)
|
||||
basic_machine=s390x-ibm
|
||||
os=-tpf
|
||||
;;
|
||||
udi29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
@@ -1023,8 +905,8 @@ case $basic_machine in
|
||||
os=-vms
|
||||
;;
|
||||
vpp*|vx|vx-*)
|
||||
basic_machine=f301-fujitsu
|
||||
;;
|
||||
basic_machine=f301-fujitsu
|
||||
;;
|
||||
vxworks960)
|
||||
basic_machine=i960-wrs
|
||||
os=-vxworks
|
||||
@@ -1045,17 +927,17 @@ case $basic_machine in
|
||||
basic_machine=hppa1.1-winbond
|
||||
os=-proelf
|
||||
;;
|
||||
xbox)
|
||||
basic_machine=i686-pc
|
||||
os=-mingw32
|
||||
windows32)
|
||||
basic_machine=i386-pc
|
||||
os=-windows32-msvcrt
|
||||
;;
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
ymp)
|
||||
basic_machine=ymp-cray
|
||||
xmp)
|
||||
basic_machine=xmp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
z8k-*-coff)
|
||||
basic_machine=z8k-unknown
|
||||
os=-sim
|
||||
@@ -1076,12 +958,16 @@ case $basic_machine in
|
||||
op60c)
|
||||
basic_machine=hppa1.1-oki
|
||||
;;
|
||||
mips)
|
||||
if [ x$os = x-linux-gnu ]; then
|
||||
basic_machine=mips-unknown
|
||||
else
|
||||
basic_machine=mips-mips
|
||||
fi
|
||||
;;
|
||||
romp)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
mmix)
|
||||
basic_machine=mmix-knuth
|
||||
;;
|
||||
rs6000)
|
||||
basic_machine=rs6000-ibm
|
||||
;;
|
||||
@@ -1098,13 +984,13 @@ case $basic_machine in
|
||||
we32k)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
|
||||
sh3 | sh4 | sh3eb | sh4eb)
|
||||
basic_machine=sh-unknown
|
||||
;;
|
||||
sparc | sparcv8 | sparcv9 | sparcv9b)
|
||||
sparc | sparcv9 | sparcv9b)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
cydra)
|
||||
cydra)
|
||||
basic_machine=cydra-cydrome
|
||||
;;
|
||||
orion)
|
||||
@@ -1119,6 +1005,10 @@ case $basic_machine in
|
||||
pmac | pmac-mpw)
|
||||
basic_machine=powerpc-apple
|
||||
;;
|
||||
c4x*)
|
||||
basic_machine=c4x-none
|
||||
os=-coff
|
||||
;;
|
||||
*-unknown)
|
||||
# Make sure to match an already-canonicalized machine name.
|
||||
;;
|
||||
@@ -1174,21 +1064,17 @@ case $os in
|
||||
| -aos* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
|
||||
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
||||
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -chorusos* | -chorusrdb* \
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
||||
| -skyos* | -haiku*)
|
||||
| -os2* | -vos* | -palmos* | -uclinux*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
@@ -1200,21 +1086,16 @@ case $os in
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-nto-qnx*)
|
||||
;;
|
||||
-nto*)
|
||||
os=`echo $os | sed -e 's|nto|nto-qnx|'`
|
||||
os=-nto-qnx
|
||||
;;
|
||||
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
|
||||
| -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
|
||||
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
|
||||
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
|
||||
;;
|
||||
-mac*)
|
||||
os=`echo $os | sed -e 's|mac|macos|'`
|
||||
;;
|
||||
-linux-dietlibc)
|
||||
os=-linux-dietlibc
|
||||
;;
|
||||
-linux*)
|
||||
os=`echo $os | sed -e 's|linux|linux-gnu|'`
|
||||
;;
|
||||
@@ -1227,9 +1108,6 @@ case $os in
|
||||
-opened*)
|
||||
os=-openedition
|
||||
;;
|
||||
-os400*)
|
||||
os=-os400
|
||||
;;
|
||||
-wince*)
|
||||
os=-wince
|
||||
;;
|
||||
@@ -1248,23 +1126,14 @@ case $os in
|
||||
-acis*)
|
||||
os=-aos
|
||||
;;
|
||||
-atheos*)
|
||||
os=-atheos
|
||||
;;
|
||||
-syllable*)
|
||||
os=-syllable
|
||||
;;
|
||||
-386bsd)
|
||||
os=-bsd
|
||||
;;
|
||||
-ctix* | -uts*)
|
||||
os=-sysv
|
||||
;;
|
||||
-nova*)
|
||||
os=-rtmk-nova
|
||||
;;
|
||||
-ns2 )
|
||||
os=-nextstep2
|
||||
os=-nextstep2
|
||||
;;
|
||||
-nsk*)
|
||||
os=-nsk
|
||||
@@ -1276,9 +1145,6 @@ case $os in
|
||||
-sinix*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-tpf*)
|
||||
os=-tpf
|
||||
;;
|
||||
-triton*)
|
||||
os=-sysv3
|
||||
;;
|
||||
@@ -1306,17 +1172,8 @@ case $os in
|
||||
-xenix)
|
||||
os=-xenix
|
||||
;;
|
||||
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
|
||||
os=-mint
|
||||
;;
|
||||
-aros*)
|
||||
os=-aros
|
||||
;;
|
||||
-kaos*)
|
||||
os=-kaos
|
||||
;;
|
||||
-zvmoe)
|
||||
os=-zvmoe
|
||||
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
|
||||
os=-mint
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
@@ -1349,14 +1206,10 @@ case $basic_machine in
|
||||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
c4x-* | tic4x-*)
|
||||
os=-coff
|
||||
;;
|
||||
# This must come before the *-dec entry.
|
||||
pdp10-*)
|
||||
os=-tops20
|
||||
;;
|
||||
pdp11-*)
|
||||
pdp11-*)
|
||||
os=-none
|
||||
;;
|
||||
*-dec | vax-*)
|
||||
@@ -1383,9 +1236,6 @@ case $basic_machine in
|
||||
mips*-*)
|
||||
os=-elf
|
||||
;;
|
||||
or32-*)
|
||||
os=-coff
|
||||
;;
|
||||
*-tti) # must be before sparc entry or we get the wrong os.
|
||||
os=-sysv3
|
||||
;;
|
||||
@@ -1395,15 +1245,9 @@ case $basic_machine in
|
||||
*-be)
|
||||
os=-beos
|
||||
;;
|
||||
*-haiku)
|
||||
os=-haiku
|
||||
;;
|
||||
*-ibm)
|
||||
os=-aix
|
||||
;;
|
||||
*-knuth)
|
||||
os=-mmixware
|
||||
;;
|
||||
*-wec)
|
||||
os=-proelf
|
||||
;;
|
||||
@@ -1455,19 +1299,19 @@ case $basic_machine in
|
||||
*-next)
|
||||
os=-nextstep3
|
||||
;;
|
||||
*-gould)
|
||||
*-gould)
|
||||
os=-sysv
|
||||
;;
|
||||
*-highlevel)
|
||||
*-highlevel)
|
||||
os=-bsd
|
||||
;;
|
||||
*-encore)
|
||||
os=-bsd
|
||||
;;
|
||||
*-sgi)
|
||||
*-sgi)
|
||||
os=-irix
|
||||
;;
|
||||
*-siemens)
|
||||
*-siemens)
|
||||
os=-sysv4
|
||||
;;
|
||||
*-masscomp)
|
||||
@@ -1536,16 +1380,10 @@ case $basic_machine in
|
||||
-mvs* | -opened*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-os400*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-ptx*)
|
||||
vendor=sequent
|
||||
;;
|
||||
-tpf*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-vxsim* | -vxworks* | -windiss*)
|
||||
-vxsim* | -vxworks*)
|
||||
vendor=wrs
|
||||
;;
|
||||
-aux*)
|
||||
@@ -1569,7 +1407,7 @@ case $basic_machine in
|
||||
esac
|
||||
|
||||
echo $basic_machine$os
|
||||
exit
|
||||
exit 0
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
|
||||
+508
-816
File diff suppressed because it is too large.
Load diff
@@ -1,3 +1,3 @@
|
||||
#! /bin/sh
|
||||
|
||||
${MAKE:-make} -f build/build.mk cvsclean-work
|
||||
${MAKE:-make} -f build/build.mk cvsclean
|
||||
@@ -1,2 +0,0 @@
|
||||
@echo off
|
||||
cscript /nologo win32\build\cvsclean.js
|
||||
@@ -0,0 +1,88 @@
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP Version 4 |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Copyright (c) 1997-2002 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. |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Author: Sascha Schumann <sascha@schumann.cx> |
|
||||
# +----------------------------------------------------------------------+
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
|
||||
|
||||
AC_DEFUN(LIB_SHARED_CONVENIENCE,[
|
||||
lib_target="\$(LTLIBRARY_NAME)"
|
||||
cat >>$1<<EOF
|
||||
\$(LTLIBRARY_NAME): \$(LTLIBRARY_SHARED_OBJECTS) \$(LTLIBRARY_DEPENDENCIES)
|
||||
\$(SHARED_LIBTOOL) --mode=link \$(COMPILE) \$(LDFLAGS) -o \[$]@ \$(LTLIBRARY_LDFLAGS) \$(LTLIBRARY_OBJECTS) \$(LTLIBRARY_SHARED_LIBADD)
|
||||
|
||||
EOF
|
||||
])
|
||||
|
||||
AC_DEFUN(LIB_SHARED_MODULE,[
|
||||
lib_target="\$(LTLIBRARY_SHARED_NAME)"
|
||||
cat >>$1<<EOF
|
||||
\$(LTLIBRARY_SHARED_NAME): \$(LTLIBRARY_SHARED_OBJECTS) \$(LTLIBRARY_DEPENDENCIES)
|
||||
\$(SHARED_LIBTOOL) --mode=link \$(CC) \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(LDFLAGS) -o \[$]@ -avoid-version -module -rpath \$(phplibdir) \$(LTLIBRARY_LDFLAGS) \$(LTLIBRARY_OBJECTS) \$(LTLIBRARY_SHARED_LIBADD)
|
||||
\$(SHARED_LIBTOOL) --mode=install cp \[$]@ \$(phplibdir)
|
||||
|
||||
EOF
|
||||
])
|
||||
|
||||
AC_DEFUN(LIB_STATIC_CONVENIENCE,[
|
||||
lib_target="\$(LTLIBRARY_NAME)"
|
||||
cat >>$1<<EOF
|
||||
\$(LTLIBRARY_NAME): \$(LTLIBRARY_OBJECTS) \$(LTLIBRARY_DEPENDENCIES)
|
||||
\$(LINK) \$(LTLIBRARY_LDFLAGS) \$(LTLIBRARY_OBJECTS) \$(LTLIBRARY_LIBADD)
|
||||
|
||||
EOF
|
||||
])
|
||||
|
||||
dnl LIB_BUILD(path, shared, convenience)
|
||||
dnl sets up path to build a shared/static convenience/module
|
||||
AC_DEFUN(LIB_BUILD,[
|
||||
lib_makefile="$1/libs.mk"
|
||||
lib_target=""
|
||||
|
||||
$php_shtool mkdir -p $1
|
||||
if test "$BSD_MAKEFILE" = "yes"; then
|
||||
lib_include_conf=".include \"\$(top_builddir)/config_vars.mk\""
|
||||
else
|
||||
lib_include_conf="include \$(top_builddir)/config_vars.mk"
|
||||
fi
|
||||
cat >$lib_makefile<<EOF
|
||||
$lib_include_conf
|
||||
LTLIBRARY_OBJECTS = \$(LTLIBRARY_SOURCES:.c=.lo) \$(LTLIBRARY_OBJECTS_X)
|
||||
LTLIBRARY_SHARED_OBJECTS = \$(LTLIBRARY_OBJECTS:.lo=.slo)
|
||||
EOF
|
||||
|
||||
if test "$2" = "shared" || test "$2" = "yes"; then
|
||||
lib_build_shared=yes
|
||||
if test -n "$3"; then
|
||||
dnl ---------------------------------------- Shared Convenience
|
||||
LIB_SHARED_CONVENIENCE($lib_makefile)
|
||||
else
|
||||
dnl ---------------------------------------- Shared Module
|
||||
LIB_SHARED_MODULE($lib_makefile)
|
||||
fi
|
||||
else
|
||||
dnl ---------------------------------------- Static Convenience = Static Module
|
||||
LIB_STATIC_CONVENIENCE($lib_makefile)
|
||||
fi
|
||||
|
||||
dnl ---------------------------------------- Generate build targets
|
||||
if test -n "$lib_target"; then
|
||||
cat >>$lib_makefile<<EOF
|
||||
targets = $lib_target
|
||||
EOF
|
||||
fi
|
||||
])
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
SUBDIRS = $(EXT_SUBDIRS)
|
||||
|
||||
include $(top_srcdir)/build/rules.mk
|
||||
@@ -0,0 +1,2 @@
|
||||
aspell
|
||||
Rasmus Lerdorf
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
LTLIBRARY_NAME = libaspell.la
|
||||
LTLIBRARY_SOURCES = aspell.c
|
||||
|
||||
include $(top_srcdir)/build/dynlib.mk
|
||||
@@ -0,0 +1,228 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2002 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. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Rasmus Lerdorf <rasmus@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "php.h"
|
||||
|
||||
#ifdef COMPILE_DL_ASPELL
|
||||
#include "phpdl.h"
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if HAVE_ASPELL
|
||||
|
||||
#include "php_aspell.h"
|
||||
#include <aspell-c.h>
|
||||
#include "ext/standard/info.h"
|
||||
|
||||
/* {{{ aspell_functions[]
|
||||
*/
|
||||
function_entry aspell_functions[] = {
|
||||
PHP_FE(aspell_new, NULL)
|
||||
PHP_FE(aspell_check, NULL)
|
||||
PHP_FE(aspell_check_raw, NULL)
|
||||
PHP_FE(aspell_suggest, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
static int le_aspell;
|
||||
|
||||
zend_module_entry aspell_module_entry = {
|
||||
STANDARD_MODULE_HEADER,
|
||||
"aspell", aspell_functions, PHP_MINIT(aspell), NULL, NULL, NULL, PHP_MINFO(aspell), NO_VERSION_YET, STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
#ifdef COMPILE_DL_ASPELL
|
||||
ZEND_GET_MODULE(aspell)
|
||||
#endif
|
||||
|
||||
/* {{{ php_aspell_close
|
||||
*/
|
||||
static void php_aspell_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
{
|
||||
aspell *sc = (aspell *)rsrc->ptr;
|
||||
|
||||
aspell_free(sc);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ PHP_MINIT_FUNCTION
|
||||
*/
|
||||
PHP_MINIT_FUNCTION(aspell)
|
||||
{
|
||||
le_aspell = zend_register_list_destructors_ex(php_aspell_close, NULL, "aspell", module_number);
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int aspell_new(string master [, string personal])
|
||||
Load a dictionary */
|
||||
PHP_FUNCTION(aspell_new)
|
||||
{
|
||||
pval **master, **personal;
|
||||
int argc;
|
||||
aspell *sc;
|
||||
int ind;
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &master, &personal) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_string_ex(master);
|
||||
if(argc==2)
|
||||
{
|
||||
convert_to_string_ex(personal) ;
|
||||
sc=aspell_new(Z_STRVAL_PP(master), Z_STRVAL_PP(personal));
|
||||
}
|
||||
else
|
||||
sc=aspell_new(Z_STRVAL_PP(master), "");
|
||||
|
||||
ind = zend_list_insert(sc, le_aspell);
|
||||
RETURN_LONG(ind);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array aspell_suggest(aspell int, string word)
|
||||
Return array of Suggestions */
|
||||
PHP_FUNCTION(aspell_suggest)
|
||||
{
|
||||
pval **scin, **word;
|
||||
int argc;
|
||||
aspell *sc;
|
||||
int ind, type;
|
||||
aspellSuggestions *sug;
|
||||
size_t i;
|
||||
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
if (argc != 2 || zend_get_parameters_ex(argc, &scin, &word) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(scin);
|
||||
convert_to_string_ex(word);
|
||||
sc = (aspell *)zend_list_find(Z_LVAL_PP(scin), &type);
|
||||
if(!sc)
|
||||
{
|
||||
php_error(E_WARNING, "%d is not an ASPELL result index", Z_LVAL_PP(scin));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (array_init(return_value) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
sug = aspell_suggest(sc, Z_STRVAL_PP(word));
|
||||
for (i = 0; i != sug->size; ++i) {
|
||||
add_next_index_string(return_value, (char *)sug->data[i], 1);
|
||||
}
|
||||
aspell_free_suggestions(sug);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int aspell_check(aspell int, string word)
|
||||
Return if word is valid */
|
||||
PHP_FUNCTION(aspell_check)
|
||||
{
|
||||
int type;
|
||||
pval **scin, **word;
|
||||
aspell *sc;
|
||||
|
||||
int argc;
|
||||
argc = ZEND_NUM_ARGS();
|
||||
if (argc != 2 || zend_get_parameters_ex(argc, &scin, &word) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(scin);
|
||||
convert_to_string_ex(word);
|
||||
sc= (aspell *) zend_list_find(Z_LVAL_PP(scin), &type);
|
||||
if(!sc)
|
||||
{
|
||||
php_error(E_WARNING, "%d is not an ASPELL result index", Z_LVAL_PP(scin));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (aspell_check(sc, Z_STRVAL_PP(word)))
|
||||
{
|
||||
RETURN_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int aspell_check_raw(aspell int, string word)
|
||||
Return if word is valid, ignoring case or trying to trim it in any way */
|
||||
PHP_FUNCTION(aspell_check_raw)
|
||||
{
|
||||
pval **scin, **word;
|
||||
int type;
|
||||
int argc;
|
||||
aspell *sc;
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
if (argc != 2 || zend_get_parameters_ex(argc, &scin, &word) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(scin);
|
||||
convert_to_string_ex(word);
|
||||
sc = (aspell *)zend_list_find(Z_LVAL_PP(scin), &type);
|
||||
if(!sc)
|
||||
{
|
||||
php_error(E_WARNING, "%d is not an ASPELL result index", Z_LVAL_PP(scin));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (aspell_check_raw(sc, Z_STRVAL_PP(word)))
|
||||
{
|
||||
RETURN_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ PHP_MINFO_FUNCTION
|
||||
*/
|
||||
PHP_MINFO_FUNCTION(aspell)
|
||||
{
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_row(2, "ASpell Support", "enabled");
|
||||
php_info_print_table_end();
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
||||
@@ -0,0 +1,30 @@
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
|
||||
AC_MSG_CHECKING(for ASPELL support)
|
||||
AC_ARG_WITH(aspell,
|
||||
[ --with-aspell[=DIR] Include ASPELL support.],
|
||||
[
|
||||
if test "$withval" != "no"; then
|
||||
if test "$withval" = "yes"; then
|
||||
ASPELL_DIR=/usr/local
|
||||
else
|
||||
ASPELL_DIR=$withval
|
||||
fi
|
||||
|
||||
PHP_ADD_INCLUDE($ASPELL_DIR/include)
|
||||
PHP_ADD_LIBRARY_WITH_PATH(aspell, $ASPELL_DIR/lib)
|
||||
|
||||
if test ! -f "$ASPELL_DIR/include/aspell-c.h"; then
|
||||
AC_MSG_ERROR(Could not find aspell-c.h in $ASPELL_DIR/include - please copy it manually from the aspell sources to $ASPELL_DIR/include)
|
||||
fi
|
||||
AC_DEFINE(HAVE_ASPELL,1,[Whether you have aspell])
|
||||
AC_MSG_RESULT(yes)
|
||||
PHP_EXTENSION(aspell)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2002 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. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Rasmus Lerdorf <rasmus@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef PHP_ASPELL_H
|
||||
#define PHP_ASPELL_H
|
||||
#if HAVE_ASPELL
|
||||
extern zend_module_entry aspell_module_entry;
|
||||
#define aspell_module_ptr &aspell_module_entry
|
||||
|
||||
PHP_MINIT_FUNCTION(aspell);
|
||||
PHP_MINFO_FUNCTION(aspell);
|
||||
|
||||
PHP_FUNCTION(aspell_new);
|
||||
PHP_FUNCTION(aspell_check);
|
||||
PHP_FUNCTION(aspell_check_raw);
|
||||
PHP_FUNCTION(aspell_suggest);
|
||||
|
||||
#else
|
||||
#define aspell_module_ptr NULL
|
||||
#endif
|
||||
|
||||
#define phpext_aspell_ptr aspell_module_ptr
|
||||
|
||||
#endif /* PHP_ASPELL_H */
|
||||
@@ -0,0 +1,2 @@
|
||||
BC Math
|
||||
Andi Gutmans
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
LTLIBRARY_NAME = libbcmath.la
|
||||
LTLIBRARY_SOURCES = bcmath.c number.c
|
||||
LTLIBRARY_SHARED_NAME = bcmath.la
|
||||
LTLIBRARY_DEPENDENCIES = libbcmath/libbcmath.la
|
||||
LTLIBRARY_LIBADD = $(LTLIBRARY_DEPENDENCIES)
|
||||
LTLIBRARY_SHARED_LIBADD = $(LTLIBRARY_LIBADD)
|
||||
|
||||
SUBDIRS = libbcmath
|
||||
|
||||
include $(top_srcdir)/build/dynlib.mk
|
||||
@@ -0,0 +1,506 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2002 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. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Andi Gutmans <andi@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "php.h"
|
||||
|
||||
#if WITH_BCMATH
|
||||
|
||||
#include "ext/standard/info.h"
|
||||
#include "php_bcmath.h"
|
||||
#include "ext/bcmath/libbcmath/src/bcmath.h"
|
||||
|
||||
function_entry bcmath_functions[] = {
|
||||
PHP_FE(bcadd, NULL)
|
||||
PHP_FE(bcsub, NULL)
|
||||
PHP_FE(bcmul, NULL)
|
||||
PHP_FE(bcdiv, NULL)
|
||||
PHP_FE(bcmod, NULL)
|
||||
PHP_FE(bcpow, NULL)
|
||||
PHP_FE(bcsqrt, NULL)
|
||||
PHP_FE(bcscale, NULL)
|
||||
PHP_FE(bccomp, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
zend_module_entry bcmath_module_entry = {
|
||||
STANDARD_MODULE_HEADER,
|
||||
"bcmath",
|
||||
bcmath_functions,
|
||||
PHP_MINIT(bcmath),
|
||||
PHP_MSHUTDOWN(bcmath),
|
||||
PHP_RINIT(bcmath),
|
||||
NULL,
|
||||
PHP_MINFO(bcmath),
|
||||
NO_VERSION_YET,
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
#ifdef COMPILE_DL_BCMATH
|
||||
ZEND_GET_MODULE(bcmath)
|
||||
#endif
|
||||
|
||||
#ifndef THREAD_SAFE
|
||||
static long bc_precision;
|
||||
#endif
|
||||
|
||||
/* Storage used for special numbers. */
|
||||
bc_num _zero_;
|
||||
bc_num _one_;
|
||||
bc_num _two_;
|
||||
|
||||
|
||||
/* Make a copy of a number! Just increments the reference count! */
|
||||
bc_num copy_num (bc_num num)
|
||||
{
|
||||
num->n_refs++;
|
||||
return num;
|
||||
}
|
||||
|
||||
|
||||
/* Initialize a number NUM by making it a copy of zero. */
|
||||
void init_num (bc_num *num)
|
||||
{
|
||||
*num = copy_num (_zero_);
|
||||
}
|
||||
|
||||
|
||||
PHP_MINIT_FUNCTION(bcmath)
|
||||
{
|
||||
extern bc_num _zero_;
|
||||
extern bc_num _one_;
|
||||
extern bc_num _two_;
|
||||
|
||||
_zero_ = bc_new_num (1, 0);
|
||||
_one_ = bc_new_num (1, 0);
|
||||
_one_->n_value[0] = 1;
|
||||
_two_ = bc_new_num (1, 0);
|
||||
_two_->n_value[0] = 2;
|
||||
persist_alloc(_zero_);
|
||||
persist_alloc(_one_);
|
||||
persist_alloc(_two_);
|
||||
persist_alloc(_zero_->n_ptr);
|
||||
persist_alloc(_one_->n_ptr);
|
||||
persist_alloc(_two_->n_ptr);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
PHP_MSHUTDOWN_FUNCTION(bcmath)
|
||||
{
|
||||
bc_free_num(&_zero_);
|
||||
bc_free_num(&_one_);
|
||||
bc_free_num(&_two_);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
PHP_RINIT_FUNCTION(bcmath)
|
||||
{
|
||||
if (cfg_get_long("bcmath.scale", &bc_precision)==FAILURE) {
|
||||
bc_precision=0;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
PHP_MINFO_FUNCTION(bcmath)
|
||||
{
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_row(2, "BCMath support", "enabled");
|
||||
php_info_print_table_end();
|
||||
}
|
||||
|
||||
/* {{{ proto string bcadd(string left_operand, string right_operand [, int scale])
|
||||
Returns the sum of two arbitrary precision numbers */
|
||||
PHP_FUNCTION(bcadd)
|
||||
{
|
||||
pval **left, **right, **scale_param;
|
||||
bc_num first, second, result;
|
||||
int scale=bc_precision;
|
||||
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
case 2:
|
||||
if (zend_get_parameters_ex(2, &left, &right) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (zend_get_parameters_ex(3, &left, &right, &scale_param) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(scale_param);
|
||||
scale = (int) Z_LVAL_PP(scale_param);
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
convert_to_string_ex(left);
|
||||
convert_to_string_ex(right);
|
||||
bc_init_num(&first);
|
||||
bc_init_num(&second);
|
||||
bc_init_num(&result);
|
||||
bc_str2num(&first, Z_STRVAL_PP(left), scale);
|
||||
bc_str2num(&second, Z_STRVAL_PP(right), scale);
|
||||
bc_add (first, second, &result, scale);
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
return;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string bcsub(string left_operand, string right_operand [, int scale])
|
||||
Returns the difference between two arbitrary precision numbers */
|
||||
PHP_FUNCTION(bcsub)
|
||||
{
|
||||
pval **left, **right, **scale_param;
|
||||
bc_num first, second, result;
|
||||
int scale=bc_precision;
|
||||
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
case 2:
|
||||
if (zend_get_parameters_ex(2, &left, &right) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (zend_get_parameters_ex(3, &left, &right, &scale_param) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(scale_param);
|
||||
scale = (int) Z_LVAL_PP(scale_param);
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
convert_to_string_ex(left);
|
||||
convert_to_string_ex(right);
|
||||
bc_init_num(&first);
|
||||
bc_init_num(&second);
|
||||
bc_init_num(&result);
|
||||
bc_str2num(&first, Z_STRVAL_PP(left), scale);
|
||||
bc_str2num(&second, Z_STRVAL_PP(right), scale);
|
||||
bc_sub (first, second, &result, scale);
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
return;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string bcmul(string left_operand, string right_operand [, int scale])
|
||||
Returns the multiplication of two arbitrary precision numbers */
|
||||
PHP_FUNCTION(bcmul)
|
||||
{
|
||||
pval **left, **right, **scale_param;
|
||||
bc_num first, second, result;
|
||||
int scale=bc_precision;
|
||||
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
case 2:
|
||||
if (zend_get_parameters_ex(2, &left, &right) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (zend_get_parameters_ex(3, &left, &right, &scale_param) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(scale_param);
|
||||
scale = (int) Z_LVAL_PP(scale_param);
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
convert_to_string_ex(left);
|
||||
convert_to_string_ex(right);
|
||||
bc_init_num(&first);
|
||||
bc_init_num(&second);
|
||||
bc_init_num(&result);
|
||||
bc_str2num(&first, Z_STRVAL_PP(left), scale);
|
||||
bc_str2num(&second, Z_STRVAL_PP(right), scale);
|
||||
bc_multiply (first, second, &result, scale);
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
return;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string bcdiv(string left_operand, string right_operand [, int scale])
|
||||
Returns the quotient of two arbitrary precision numbers (division) */
|
||||
PHP_FUNCTION(bcdiv)
|
||||
{
|
||||
pval **left, **right, **scale_param;
|
||||
bc_num first, second, result;
|
||||
int scale=bc_precision;
|
||||
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
case 2:
|
||||
if (zend_get_parameters_ex(2, &left, &right) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (zend_get_parameters_ex(3, &left, &right, &scale_param) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(scale_param);
|
||||
scale = (int) Z_LVAL_PP(scale_param);
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
convert_to_string_ex(left);
|
||||
convert_to_string_ex(right);
|
||||
bc_init_num(&first);
|
||||
bc_init_num(&second);
|
||||
bc_init_num(&result);
|
||||
bc_str2num(&first, Z_STRVAL_PP(left), scale);
|
||||
bc_str2num(&second, Z_STRVAL_PP(right), scale);
|
||||
switch (bc_divide (first, second, &result, scale)) {
|
||||
case 0: /* OK */
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
break;
|
||||
case -1: /* division by zero */
|
||||
php_error(E_WARNING, "Division by zero");
|
||||
break;
|
||||
}
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
return;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string bcmod(string left_operand, string right_operand)
|
||||
Returns the modulus of the two arbitrary precision operands */
|
||||
PHP_FUNCTION(bcmod)
|
||||
{
|
||||
pval **left, **right;
|
||||
bc_num first, second, result;
|
||||
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
case 2:
|
||||
if (zend_get_parameters_ex(2, &left, &right) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
convert_to_string_ex(left);
|
||||
convert_to_string_ex(right);
|
||||
bc_init_num(&first);
|
||||
bc_init_num(&second);
|
||||
bc_init_num(&result);
|
||||
bc_str2num(&first, Z_STRVAL_PP(left), 0);
|
||||
bc_str2num(&second, Z_STRVAL_PP(right), 0);
|
||||
switch (bc_modulo(first, second, &result, 0)) {
|
||||
case 0:
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
break;
|
||||
case -1:
|
||||
php_error(E_WARNING, "Division by zero");
|
||||
break;
|
||||
}
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
return;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string bcpow(string x, string y [, int scale])
|
||||
Returns the value of an arbitrary precision number raised to the power of another */
|
||||
PHP_FUNCTION(bcpow)
|
||||
{
|
||||
pval **left, **right, **scale_param;
|
||||
bc_num first, second, result;
|
||||
int scale=bc_precision;
|
||||
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
case 2:
|
||||
if (zend_get_parameters_ex(2, &left, &right) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (zend_get_parameters_ex(3, &left, &right, &scale_param) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(scale_param);
|
||||
scale = (int) Z_LVAL_PP(scale_param);
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
convert_to_string_ex(left);
|
||||
convert_to_string_ex(right);
|
||||
bc_init_num(&first);
|
||||
bc_init_num(&second);
|
||||
bc_init_num(&result);
|
||||
bc_str2num(&first, Z_STRVAL_PP(left), scale);
|
||||
bc_str2num(&second, Z_STRVAL_PP(right), scale);
|
||||
bc_raise (first, second, &result, scale);
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
return;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string bcsqrt(string operand [, int scale])
|
||||
Returns the square root of an arbitray precision number */
|
||||
PHP_FUNCTION(bcsqrt)
|
||||
{
|
||||
pval **left, **scale_param;
|
||||
bc_num result;
|
||||
int scale=bc_precision;
|
||||
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
case 1:
|
||||
if (zend_get_parameters_ex(1, &left)== FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (zend_get_parameters_ex(2, &left, &scale_param) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(scale_param);
|
||||
scale = (int) Z_LVAL_PP(scale_param);
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
convert_to_string_ex(left);
|
||||
bc_init_num(&result);
|
||||
bc_str2num(&result, Z_STRVAL_PP(left), scale);
|
||||
if (bc_sqrt (&result, scale) != 0) {
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
} else {
|
||||
php_error(E_WARNING, "Square root of negative number");
|
||||
}
|
||||
bc_free_num(&result);
|
||||
return;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string bccomp(string left_operand, string right_operand [, int scale])
|
||||
Compares two arbitrary precision numbers */
|
||||
PHP_FUNCTION(bccomp)
|
||||
{
|
||||
pval **left, **right, **scale_param;
|
||||
bc_num first, second;
|
||||
int scale=bc_precision;
|
||||
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
case 2:
|
||||
if (zend_get_parameters_ex(2, &left, &right) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (zend_get_parameters_ex(3, &left, &right, &scale_param) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(scale_param);
|
||||
scale = (int) Z_LVAL_PP(scale_param);
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
|
||||
convert_to_string_ex(left);
|
||||
convert_to_string_ex(right);
|
||||
bc_init_num(&first);
|
||||
bc_init_num(&second);
|
||||
|
||||
bc_str2num(&first, Z_STRVAL_PP(left), scale);
|
||||
bc_str2num(&second, Z_STRVAL_PP(right), scale);
|
||||
Z_LVAL_P(return_value) = bc_compare(first, second);
|
||||
Z_TYPE_P(return_value) = IS_LONG;
|
||||
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
return;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string bcscale(int scale)
|
||||
Sets default scale parameter for all bc math functions */
|
||||
PHP_FUNCTION(bcscale)
|
||||
{
|
||||
pval **new_scale;
|
||||
|
||||
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &new_scale)==FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
convert_to_long_ex(new_scale);
|
||||
bc_precision = Z_LVAL_PP(new_scale);
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
||||
@@ -0,0 +1,14 @@
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
|
||||
PHP_ARG_ENABLE(bcmath, whether to enable bc style precision math functions,
|
||||
[ --enable-bcmath Enable bc style precision math functions.])
|
||||
|
||||
if test "$PHP_BCMATH" != "no"; then
|
||||
AC_DEFINE(WITH_BCMATH, 1, [Whether you have bcmath])
|
||||
PHP_EXTENSION(bcmath, $ext_shared)
|
||||
PHP_FAST_OUTPUT($ext_builddir/libbcmath/Makefile $ext_builddir/libbcmath/src/Makefile)
|
||||
LIB_BUILD($ext_builddir/libbcmath,$ext_shared,yes)
|
||||
LIB_BUILD($ext_builddir/libbcmath/src,$ext_shared,yes)
|
||||
fi
|
||||
@@ -0,0 +1,3 @@
|
||||
Phil Nelson <philnelson@acm.org> wrote bcmath library.
|
||||
|
||||
|
||||
@@ -0,0 +1,515 @@
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations
|
||||
below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
^L
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it
|
||||
becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
^L
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control
|
||||
compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
^L
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
^L
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
^L
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
^L
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply, and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License
|
||||
may add an explicit geographical distribution limitation excluding those
|
||||
countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
^L
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
^L
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms
|
||||
of the ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library.
|
||||
It is safest to attach them to the start of each source file to most
|
||||
effectively convey the exclusion of warranty; and each file should
|
||||
have at least the "copyright" line and a pointer to where the full
|
||||
notice is found.
|
||||
|
||||
|
||||
<one line to give the library's name and a brief idea of what it
|
||||
does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper
|
||||
mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or
|
||||
your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James
|
||||
Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
Wed Jun 7 09:39:02 2000 Phil Nelson <phil@cs.wwu.edu>
|
||||
|
||||
* configure.in and many others: version number now at 0.2.
|
||||
Many other changes/additions for getting a distribution
|
||||
to work.
|
||||
|
||||
2000-05-21 Phil Nelson <phil@cs.wwu.edu>
|
||||
|
||||
* Initial setup of bcmath library., calling it version 0.1.
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
BCMATH FAQ:
|
||||
|
||||
1) Why BCMATH?
|
||||
|
||||
The math routines of GNU bc become more generally useful in a
|
||||
library form. By separating the BCMATH library from GNU bc,
|
||||
GNU bc can be under the GPL and BCMATH can be under the LGPL.
|
||||
|
||||
2) Why BCMATH when GMP exists?
|
||||
|
||||
GMP has "integers" (no digits after a decimal), "rational numbers"
|
||||
(stored as 2 integers) and "floats". None of these will correctly
|
||||
represent a POSIX BC number. Floats are the closest, but will not
|
||||
behave correctly for many computations. For example, BC numbers have
|
||||
a "scale" that represent the number of digits to represent after the
|
||||
decimal point. The multiplying two of these numbers requires one to
|
||||
calculate an exact number of digits after the decimal point regardless
|
||||
of the number of digits in the integer part. GMP floats have a
|
||||
"fixed, but arbitrary" mantissa and so multiplying two floats will end
|
||||
up dropping digits BC must calculate.
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
Currently, only libbcmath.a is built. To build and install it, do
|
||||
|
||||
configure
|
||||
make
|
||||
make install
|
||||
|
||||
Typical configure parameters are available. (e.g. PREFIX)
|
||||
|
||||
Bugs and comments to philnelson@acm.org.
|
||||
@@ -0,0 +1,12 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
SUBDIRS= src doc
|
||||
|
||||
MAINTAINERCLEANFILES = aclocal.m4 config.h.in configure Makefile.in \
|
||||
stamp-h.in *~
|
||||
|
||||
dist-hook:
|
||||
cp $(srcdir)/doc/bcmath.1 $(distdir)/doc
|
||||
cp $(srcdir)/src/private.h $(distdir)/src
|
||||
cp $(srcdir)/FAQ $(distdir)
|
||||
|
||||
Loaded 100 of 1918 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user