mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-11 19:20:50 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ec8b2957d |
No files matched your search
@@ -1,11 +0,0 @@
|
||||
If you think you've found a bug in PHP3, you can report it on the bug
|
||||
reporting page at:
|
||||
http://www.php.net/
|
||||
|
||||
Current Known Bugs:
|
||||
|
||||
* split() function doesn't return regex errors nicely
|
||||
* Preprocessed scripts don't work with require() and define()
|
||||
* unset() doesn't actually erase the variables it just marks them as uninitialized
|
||||
* Some parts in the language core prevent more than 256 arguments in function
|
||||
calls from being possible
|
||||
@@ -1,624 +0,0 @@
|
||||
Noticeable Changes between PHP/FI 2.0 and PHP 3.0
|
||||
=================================================
|
||||
|
||||
This file was designed to be viewed with a tab size of 4 characters.
|
||||
|
||||
This file is divided into 4 sections:
|
||||
1. Downwards incompatible language changes. This section includes all of
|
||||
the changes in the core language which may require people to modify
|
||||
their scripts before using them with PHP 3.0. It does NOT list
|
||||
changes made in the behavior of specific functions.
|
||||
2. New language features. This section includes all of the new additions
|
||||
to the core language, that may be used to enhance scripts designed for
|
||||
PHP 3.0. Likewise, it does not include a listing of new functions.
|
||||
3. Structural changes not directly effecting the end user. The core
|
||||
of PHP 3.0 is a complete rewrite. As such, many issues effecting
|
||||
PHP/FI 2.0 were addressed and vastly improved in this version,
|
||||
resulting in a much more stable and efficient implementation. This
|
||||
section lists these changes in design.
|
||||
4. Other changes that don't fit in any of the above categories.
|
||||
|
||||
Please remember that PHP 3.0's core is a complete rewrite, and thus,
|
||||
there may be other undocumented incompatibilities we haven't thought
|
||||
of ourselves. If you think you've found a incompatibility (or a new
|
||||
feature) which is not listed here, please mail us at
|
||||
php-dev@php.iquest.net.
|
||||
|
||||
|
||||
|
||||
- Zeev
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Downwards incompatible language changes
|
||||
=======================================
|
||||
|
||||
[1] The close-PHP tag has changed from > to ?>
|
||||
|
||||
This means that instead of writing:
|
||||
|
||||
<?echo $title;>
|
||||
|
||||
You should write:
|
||||
|
||||
<?echo $title;?>
|
||||
|
||||
PHP3 also includes support for a longer-form start tag that is
|
||||
XML-compliant:
|
||||
|
||||
<?php echo $title;?>
|
||||
|
||||
The ability to use the short start tag ('<?') can be turned on and
|
||||
off using the short_tags() function. Whether it is enabled or not by
|
||||
default is a compile-time option (normally set to enabled by default).
|
||||
|
||||
|
||||
[2] Semicolons in if/elseif/else must be replaced with colons.
|
||||
|
||||
For example, the equivalent of:
|
||||
|
||||
if (expr);
|
||||
statements
|
||||
...
|
||||
elseif (expr);
|
||||
statements
|
||||
...
|
||||
else;
|
||||
statements
|
||||
endif;
|
||||
|
||||
in PHP 3.0 would be:
|
||||
|
||||
if (expr):
|
||||
statements
|
||||
...
|
||||
elseif (expr):
|
||||
statements
|
||||
...
|
||||
else:
|
||||
statements
|
||||
endif;
|
||||
|
||||
Note that the endif is followed by a semicolon and not a colon even in
|
||||
PHP 3.0, which marks the end of the entire IF sentence.
|
||||
|
||||
Also note that the implementation of the colon-mode and curly-braces
|
||||
mode in PHP 3.0 is identical, one isn't buggier than the other (note
|
||||
that I'm not saying they're not buggy, though :)
|
||||
|
||||
|
||||
[3] Semicolons in while loops must also be replaced with colons.
|
||||
|
||||
For example, the equivalent of:
|
||||
|
||||
while (expr);
|
||||
statements
|
||||
...
|
||||
endwhile;
|
||||
|
||||
in PHP 3.0 would be:
|
||||
|
||||
while (expr):
|
||||
statements
|
||||
...
|
||||
endwhile;
|
||||
|
||||
Note that the endwhile is followed by a semicolon and not a colon even
|
||||
in PHP 3.0, which marks the end of the WHILE sentence. As with the IF
|
||||
statement, the implementation of the colon-mode and curly-braces mode
|
||||
in PHP 3.0 is identical, one isn't buggier than the other.
|
||||
|
||||
Also note that failing to change the semicolon to a colon can result in
|
||||
scripts that get stuck in the while loop because the loop-condition never
|
||||
changes.
|
||||
|
||||
|
||||
[4] $foo[0] is no longer identical to $foo.
|
||||
|
||||
In PHP/FI 2.0, a side-effect of the implementation caused $foo[0] to be
|
||||
identical to $foo. This is not the case in PHP 3.0.
|
||||
|
||||
|
||||
[5] Expressions determine their types differently.
|
||||
|
||||
The way expressions are evaluated has changed radically in PHP 3.0.
|
||||
Expressions are no longer given the type of the left argument, but are
|
||||
assigned types taking both types into account, and regardless of which
|
||||
is on the left side and which is on the right side. On simple scripts
|
||||
that should probably not effect you, but if you've relied on this fact
|
||||
(even without realizing you do) it may change the way your scripts work.
|
||||
Consider the next example:
|
||||
|
||||
$a[0]=5;
|
||||
$a[1]=7;
|
||||
|
||||
$key = key($a);
|
||||
while ("" != $key) {
|
||||
echo "$key\n";
|
||||
next($a);
|
||||
}
|
||||
|
||||
|
||||
In PHP/FI 2.0, this would display both of $a's indices. In PHP 3.0, it
|
||||
wouldn't display anything. The reason is that in PHP/FI 2.0, because the
|
||||
left argument's type was string, a string comparison was made, and indeed
|
||||
"" does not equal "0", and the loop went through. In PHP 3.0, when a
|
||||
string is compared with an integer, an integer comparison is made (the
|
||||
string is converted to an integer). This results in comparing atoi("")
|
||||
which is 0, and $key which is also 0, and since 0==0, the loop doesn't
|
||||
go through even once. The fix for this is simple, by replacing the
|
||||
while statement with:
|
||||
|
||||
while ("" != stringval($key)) {
|
||||
|
||||
This would first convert the integer 0 to a string "0", and then
|
||||
compare "" and "0", which are not equal, and the loop would go through
|
||||
as expected. As mentioned later, casting operators are supported in
|
||||
PHP 3.0 for a quicker and more readable way of changing variables'
|
||||
types. For example, you could use:
|
||||
|
||||
while ("" != (string)$key) {
|
||||
|
||||
|
||||
[6] The structure of error messages has changed.
|
||||
|
||||
Although the error messages are usually more accurate, you won't be shown
|
||||
the actual line of text and actual place in which the error occured.
|
||||
You'll be supplied with the line number in which the error has occured,
|
||||
though.
|
||||
|
||||
|
||||
[7] The format string argument to echo is no longer supported.
|
||||
|
||||
Use printf(format,arg1,arg2,arg3,...) instead (unlimited arguments).
|
||||
|
||||
|
||||
[8] The use of read-mode $array[] is no longer supported.
|
||||
|
||||
That is, you cannot traverse an array by having a loop that does $data =
|
||||
$array[]. Use current() and next() instead. Also, $array1[] = $array2
|
||||
does not append the values of $array2 to $array1, but appends $array2
|
||||
as the last entry of $array1 (see the multidimensional array support).
|
||||
|
||||
|
||||
[9] Apache versions older than 1.2 are not supported anymore.
|
||||
|
||||
The apache module requires apache 1.2 or later (1.3-beta is supported).
|
||||
|
||||
|
||||
[10] Indirect references inside quoted strings
|
||||
|
||||
PHP2-style indirect reference inside quoted strings is no longer
|
||||
supported. That is, if $foo="bar", and $bar="abc", in PHP2,
|
||||
"$$foo" would print out "abc". In PHP3, this would print
|
||||
"$bar" (the contents of $foo is replaced with "bar").
|
||||
To use indirect reference in PHP3 inside quoted strings, you should use
|
||||
the new notation: "${$foo}". The standard $$foo notation will work
|
||||
outside of the quoted string.
|
||||
|
||||
[11]
|
||||
Some functions have changed names, are missing, or have been deprecated
|
||||
by other functions
|
||||
|
||||
As a whole new rewrite, written by many more people and supporting many
|
||||
more APIs than it's predecessor, there's a good chance some of the functions
|
||||
you're used to from PHP/FI 2 aren't available in release 3, or have changed
|
||||
names. Many functions that do exist behave a bit differently, mainly
|
||||
because they return different values for errors (false) but also for other
|
||||
reasons. We can't list all of these functions here, simply because drawing
|
||||
a full comparison between the function sets of the two versions is way too
|
||||
much work. If a converted PHP/FI 2 script doesn't work for you, nothing
|
||||
can replace the good old human eye going over the code, doublechecking
|
||||
with the online manual that each function still does what you expected it
|
||||
to do.
|
||||
|
||||
[12] Other incompatibilities.
|
||||
|
||||
It's not too unlikely that other documented behavior of PHP2 has changed
|
||||
in this release. If you think you've found an example, please mail
|
||||
us at php-dev@php.iquest.net. Even if you've found an undocumented
|
||||
feature of PHP2 that stopped working in PHP3, we'd like to know about it
|
||||
(although it's more than likely that it will not be supported).
|
||||
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
|
||||
New Language Features
|
||||
=====================
|
||||
|
||||
[1] Expressions
|
||||
|
||||
PHP 3.0 includes a rich implementation of expressions, much more advanced
|
||||
than this of 2.0. Just about any complex C-like or perl-like expression
|
||||
would work. Support was added for assignment operators (+=, -=, *= etc),
|
||||
pre and post increment/decerement (e.g. $i++, ++$i) and the questionmark
|
||||
operator ( (expr?expr:expr) ). Every assignment is now an expression
|
||||
with a value, which means stuff like $a = $b = $c = $d = 0; would work.
|
||||
It is difficult to describe the power of expressions within a few lines
|
||||
of text, but if you're familiar with them, you probably get the picture.
|
||||
|
||||
|
||||
[2] for loops are now supported.
|
||||
|
||||
for loops were fairly difficult to implement (in fact, we didn't find
|
||||
any parallel interpreter that supports for loops anywhere (no, perl is
|
||||
not an interpreter)). The bottom line is that for loops work, and are
|
||||
around 5% slower than comparable while loops (that may vary), but often
|
||||
they're much nicer.
|
||||
|
||||
The syntax is identical to the one of C:
|
||||
|
||||
for (expr; expr; expr) statement;
|
||||
|
||||
or
|
||||
|
||||
for (expr; expr; expr) { statements ... }
|
||||
|
||||
The first expression is executed the first time the loop is encountered,
|
||||
the loop is run as long as the second expression is evaluated as TRUE,
|
||||
and after each iteration, the 3rd expression is evaluated.
|
||||
|
||||
Colon-mode FOR loops are also supported:
|
||||
for (expr; expr; expr):
|
||||
statements
|
||||
...
|
||||
endfor;
|
||||
|
||||
|
||||
[3] do..while(expr) loops are now supported.
|
||||
|
||||
Like with its C parallel, the statements inside a do..while loop are
|
||||
run once the first time the loop is encountered, and then as long as
|
||||
the expression evaluates as true.
|
||||
|
||||
For example:
|
||||
|
||||
do {
|
||||
statements;
|
||||
} while ($i++ < $max);
|
||||
|
||||
|
||||
[4] break and continue statements are now supported inside loops.
|
||||
|
||||
You can break out of loops, or continue to the next iteration of the
|
||||
loop using these statements. A special feature of PHP is the ability
|
||||
to specify an expression argument to break or continue, which specifies
|
||||
how many loops you want to break out from or continue to. For example:
|
||||
|
||||
for ($i=0; $i<10; $i++) {
|
||||
for ($j=0; $j<10; $j++) {
|
||||
if ($j>5)
|
||||
break;
|
||||
if ($i>5)
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
|
||||
The first break statement would end the inner loop every time $j is
|
||||
greater than 5. The second break statement would end both the inner
|
||||
and outer loop when $i is greater than 5.
|
||||
|
||||
Note: For this matter, switch statements are considered as loops. So
|
||||
if you write "break 2;" inside a switch statement, you would be asking
|
||||
to break out of the switch, and the innermost loop in which is nested.
|
||||
|
||||
|
||||
[5] Switched to C-style declaration of functions.
|
||||
|
||||
Here's a pretty useless function which makes a good example:
|
||||
|
||||
function concat($str1,$str2)
|
||||
{
|
||||
return $str1.$str2;
|
||||
}
|
||||
|
||||
NOTE: The old style function definition is still supported, to
|
||||
allow easier upgrading from PHP/FI 2.0 scripts. Simply
|
||||
change 'function' to 'old_function' for these functions.
|
||||
|
||||
|
||||
[6] OOP support
|
||||
|
||||
Classes and inheritance are supported to a limited extent in PHP 3.0.
|
||||
Here's how to declare a simple class:
|
||||
|
||||
class simple_class {
|
||||
var $property1,$property2;
|
||||
var $property3=5;
|
||||
|
||||
function display() {
|
||||
printf("p1=%d, p2=%d, p3=%d\n",
|
||||
$this->property1,
|
||||
$this->property2,
|
||||
$this->property3);
|
||||
}
|
||||
function init($p1,$p2) {
|
||||
$this->property1 = $p1;
|
||||
$this->property2 = $p2;
|
||||
}
|
||||
};
|
||||
|
||||
Here's how to create an object of that class:
|
||||
|
||||
$obj = new simple_class;
|
||||
|
||||
At this point, $obj is an object with 2 uninitialized variables, 1
|
||||
initialized variable, and 2 member functions. No protection is made on
|
||||
the internals of the object, and using its properties is simple:
|
||||
|
||||
$obj->property1 = 7;
|
||||
|
||||
would assign 7 to $property1 inside $obj. Calling member functions is
|
||||
also simple:
|
||||
|
||||
$obj->display()
|
||||
|
||||
would run the display() member function of $obj. Note that the
|
||||
implementation of display() uses the special variable $this, which is
|
||||
replaced with the object the function is called on.
|
||||
|
||||
Inheritance is pretty simple too:
|
||||
|
||||
class complex_class extends simple_class {
|
||||
var $property4="test";
|
||||
|
||||
function display() {
|
||||
printf("p1=%d, p2=%d, p3=%d, p4=%d\n",
|
||||
$this->property1,
|
||||
$this->property2,
|
||||
$this->property3,
|
||||
$this->property4);
|
||||
}
|
||||
}
|
||||
|
||||
Basically, the class complex_class inherits everything from its parent,
|
||||
simple_class, except properties or member functions which override the
|
||||
ones in the parent. In this example, since we supply an alternative
|
||||
display() function, it would be used with complex_class objects instead
|
||||
of the display() function that was declared in simple_class. On the other
|
||||
hand, since we don't supply an alternative init() function, complex_class
|
||||
objects would have the same init() function as simple_class objects do.
|
||||
|
||||
As with expressions, it's impossible to teach OOP in a few lines, and
|
||||
personally I'm unclear as to how useful this would be in day to day
|
||||
scripting. If you like this, play with this until you figure it out :)
|
||||
|
||||
Objects can reside in arrays, and can contain arrays. However,
|
||||
a limitation of the current implementation doesn't allow an object
|
||||
to contain an array of objects (actually, this is allowed, but
|
||||
there's no way to address the properties of such an object directly,
|
||||
but only indirectly). For example, assuming $a[3] is an object,
|
||||
$a[3]->b[2] is an object as well, you can't address the properties
|
||||
of $a[3]->b[2] (i.e. you can't write $a[3]->b[2]->foo = "bar", for
|
||||
instance).
|
||||
|
||||
|
||||
[7] Function pointers are now supported.
|
||||
|
||||
A simple illustrative example:
|
||||
|
||||
$func_ptr = "time";
|
||||
$current_time = $func_ptr();
|
||||
|
||||
is identical to
|
||||
|
||||
$current_time = time();
|
||||
|
||||
|
||||
[8] Indirect references are much more powerful.
|
||||
|
||||
For example, one can use the dollar operator an infinite amount of times:
|
||||
|
||||
$a = "b";
|
||||
$b = "c";
|
||||
$c = "d";
|
||||
$d = "e";
|
||||
$e = "Testing\n";
|
||||
|
||||
echo $$$$$a;
|
||||
|
||||
Would display $e's content, which is "Testing\n".
|
||||
|
||||
In addition, one can use complex expressions to generate variable names
|
||||
using a perl-like notation:
|
||||
|
||||
$i="123";
|
||||
${"test".$i} = 5;
|
||||
|
||||
would assign 5 to $test123.
|
||||
|
||||
[9] A string concatenation operator was added, '+' no longer concatenates strings.
|
||||
|
||||
A perl-like string concatenation operator was added, the '.' operator.
|
||||
It converts both of its arguments to strings, and concatenates them.
|
||||
For example:
|
||||
|
||||
$result = "abcd".5;
|
||||
|
||||
assigns "abcd5" to result. Note that under PHP 3.0, the '+' operator
|
||||
no longer performs concatenation if its arguments are strings. Use
|
||||
the '.' operator instead.
|
||||
|
||||
[10] Supports passing function arguments by references instead of by value.
|
||||
|
||||
Support for passing function arguments by reference instead of by value
|
||||
has been added. This doesn't result in having to change the function
|
||||
implementations in any way, but, when calling the function, you can
|
||||
decide on whether the variable you supply would actually be changed by
|
||||
the function, or a copy of it.
|
||||
|
||||
Example:
|
||||
|
||||
function inc($arg)
|
||||
{
|
||||
$arg++;
|
||||
}
|
||||
|
||||
$i=0;
|
||||
inc($i); # here $i in the outer scope wouldn't change, and remain 0
|
||||
inc(&$i); # here $i is passed by reference, and would change to 1
|
||||
|
||||
|
||||
[11] Support for multidimensional arrays.
|
||||
|
||||
(Or as Andi calls them, 'hyperdimensional variables'.)
|
||||
|
||||
The easiest way to define this support of PHP 3.0 is inductive -
|
||||
arrays can contain any type of variables, including other arrays.
|
||||
A simple example:
|
||||
|
||||
$a[0]=5;
|
||||
$a[1]["testing"]=17;
|
||||
$b["foo"]=$a;
|
||||
|
||||
Ok, so it may be not so simple. Play with it, it's pretty powerful.
|
||||
|
||||
|
||||
[12] Array initialization is now supported.
|
||||
|
||||
For example, let's say you want to initialize a lookup table to convert
|
||||
number to month names:
|
||||
|
||||
$months = array("January", "February", "March",
|
||||
"April", "May", "June", "July", "August",
|
||||
"September", "October", "November", "December");
|
||||
|
||||
would assign $months[0] to be January, $months[1] to be February, etc.
|
||||
Alternately, you may want the count to start at '1' instead of 0.
|
||||
You can do so easily:
|
||||
|
||||
$months = array(1=>"January", "February", "March",
|
||||
"April", "May", "June", "July", "August",
|
||||
"September", "October", "November", "December");
|
||||
|
||||
Also, you can specify an index for every entry, not just the first one:
|
||||
|
||||
$first_names = array("Doe"=>"John", "Gates"=>"William",
|
||||
"Clinton"=>"Bill" });
|
||||
|
||||
would assign $first_names["Doe"]="John", etc.
|
||||
|
||||
|
||||
[13] Perl style lists now supported.
|
||||
|
||||
Multiple values from arrays may now be assigned into several
|
||||
variables using one assignment. For example:
|
||||
|
||||
$str = "johndoe:x:555:555:Doe, John:/home/johndoe:/bin/tcsh";
|
||||
|
||||
list($username,$passwd,$uid,$gid,$realname,$homedir,$shell) =
|
||||
explode(":",$str);
|
||||
|
||||
Would assign 'johndoe' into $username, 'x' into $passwd, etc.
|
||||
|
||||
|
||||
[14] Colons are supported in 'case' and 'default' statements.
|
||||
|
||||
For example:
|
||||
|
||||
switch($value) {
|
||||
case 'A':
|
||||
statement;
|
||||
break;
|
||||
case 'B':
|
||||
statement;
|
||||
break;
|
||||
case 'C':
|
||||
statement;
|
||||
/* fall-through */
|
||||
default:
|
||||
statement;
|
||||
}
|
||||
|
||||
Semicolons are still supported, but when writing new scripts, they
|
||||
should be phased out in favour of colons.
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Non Language Related New Features
|
||||
=================================
|
||||
|
||||
[1] Persistent resource lists.
|
||||
|
||||
In plain english this means that there's now an easy way of writing the
|
||||
SQL drivers so that they don't open and close the SQL link every time,
|
||||
but instead open it the first time it's required, and then use it on
|
||||
every later hit. As of PHP 3.0a1, only the MySQL, mSQL and PostgresSQL
|
||||
drivers have been changed (rewritten) to take advantage of this option.
|
||||
To use it, use mysql_pconnect() instead of mysql_connect() (or the
|
||||
equivalents for the two other databases).
|
||||
|
||||
|
||||
[2] Configuration file.
|
||||
|
||||
PHP now has its own configuration file, and many compile-time options
|
||||
of PHP2 are now configurable at runtime.
|
||||
|
||||
|
||||
[3] Syntax Highlighting.
|
||||
|
||||
A syntax highlighter has been built into PHP 3.0, which means PHP 3.0 can
|
||||
display your code, syntax highlighted, instead of executing it.
|
||||
There are currently two ways to use the syntax highlighter. One is to
|
||||
use the show_source() statement. This statement is identical to the
|
||||
include() statement, except instead of executing the file, it displays
|
||||
its source syntax highlighted.
|
||||
The second way is possible only when running as an apache module, and is
|
||||
to define a special extension for PHP 3.0 source files (e.g. .php3s)
|
||||
and instruct apache to automatically syntax highlight them.
|
||||
|
||||
|
||||
[4] Loadable modules.
|
||||
|
||||
This would have a huge impact on the Windows version, and would probably
|
||||
be used in the UNIX environment as well. One can now add PHP internal
|
||||
functions in runtime by loading a dynamic module. This is known to work
|
||||
under Solaris, Linux and Win32 at this time, but would be ported to any
|
||||
other capable platform if an incompatability is found.
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Other Interesting Issues
|
||||
========================
|
||||
|
||||
|
||||
[1] Improved performance.
|
||||
|
||||
The performance of PHP 3.0 is much better than the one of PHP/FI 2.0.
|
||||
Memory consumption has been dramatically reduced in many cases, due
|
||||
to the use of an internal memory manager, instead of apache's pools.
|
||||
Speedwise, PHP 3.0 is somewhere between 2 and 3 times faster than
|
||||
PHP/FI 2.0.
|
||||
|
||||
|
||||
[2] More reliable parser.
|
||||
|
||||
After PHP 3.0 is well tested, it'll be pretty safe to say that it's
|
||||
more reliable than PHP/FI 2.0 is. While PHP/FI 2.0 performed well on
|
||||
simple, and fairly complex scripts, a fundamental design difference
|
||||
from PHP 3.0 makes it more prone to errors. In PHP 3.0, obscure parser
|
||||
problems are much less likely.
|
||||
|
||||
|
||||
[3] Improved C API.
|
||||
|
||||
If you're a C coder, adding functionality to PHP was never easier.
|
||||
A pretty well documented API is available (apidoc.txt), and you no longer
|
||||
have to touch the parser or scanner code when adding your function.
|
||||
Also, it's more complicated to 'go wrong' when implementing a PHP3
|
||||
function than it was in PHP2 (no stack to maintain) - but of course,
|
||||
you can mess up here too :)
|
||||
|
||||
|
||||
[4] Name change.
|
||||
|
||||
PHP/FI 2.0 was renamed to PHP 3.0, and the meaning has changed from
|
||||
'Personal Home Pages / Forms Interpreter' to 'PHP: Hypertext Preprocessor'.
|
||||
'Personal' home pages was an understatement for PHP/FI 2.0, and is
|
||||
definitely an understatement for PHP 3.0.
|
||||
@@ -1,149 +0,0 @@
|
||||
PHP Coding Standards
|
||||
====================
|
||||
|
||||
|
||||
This file lists several standards that any programmer, adding or changing
|
||||
code in PHP, should follow. Since this file was added at a very late
|
||||
stage of the development of PHP v3.0, the code base does not (yet) fully
|
||||
follow it, but it's going in that general direction.
|
||||
This is an initial version - it'll most probably grow as time passes.
|
||||
|
||||
|
||||
Code Implementation
|
||||
-------------------
|
||||
|
||||
[1] Functions that are given pointers to resources should not free them
|
||||
|
||||
For instance, function int mail(char *to, char *from) should NOT free
|
||||
to and/or from.
|
||||
Exceptions:
|
||||
|
||||
- The function's designated behavior is freeing that resource. E.g. efree()
|
||||
- The function is given a boolean argument, that controls whether or not
|
||||
the function may free its arguments (if true - the function must free its
|
||||
arguments, if false - it must not)
|
||||
- Low-level parser routines, that are tightly integrated with the token
|
||||
cache and the bison code for minimum memory copying overhead.
|
||||
|
||||
[2] Functions that are tightly integrated with other functions within the
|
||||
same module, and rely on each other non-trivial behavior, should be
|
||||
documented as such and declared 'static'. They should be avoided if
|
||||
possible.
|
||||
|
||||
[3] Use definitions and macros whenever possible, so that constants have
|
||||
meaningful names and can be easily manipulated. The only exceptions
|
||||
to this rule are 0 and 1, when used as false and true (respectively).
|
||||
Any other use of a numeric constant to specify different behavior
|
||||
or actions should be done through a #define.
|
||||
|
||||
[4] When writing functions that deal with strings, be sure to remember
|
||||
that PHP holds the length property of each string, and that it
|
||||
shouldn't be calculated with strlen(). Write your functions in a such
|
||||
a way so that they'll take advantage of the length property, both
|
||||
for efficiency and in order for them to be binary-safe.
|
||||
Functions that change strings and obtain their new lengths while
|
||||
doing so, should return that new length, so it doesn't have to be
|
||||
recalculated with strlen() (e.g. _php3_addslashes())
|
||||
|
||||
[5] Use php3_error() to report any errors/warnings during code execution.
|
||||
Use descriptive error messages, and try to avoid using identical
|
||||
error strings for different stages of an error. For example,
|
||||
if in order to obtain a URL you have to parse the URL, connect,
|
||||
and retreive the text, assuming something can go wrong at each
|
||||
of these stages, don't report an error "Unable to get URL"
|
||||
on all of them, but instead, write something like "Unable
|
||||
to parse URL", "Unable to connect to URL server" and "Unable
|
||||
to fetch URL text", respectively.
|
||||
|
||||
[6] NEVER USE strncat(). If you're absolutely sure you know what you're doing,
|
||||
check its man page again, and only then, consider using it, and even then,
|
||||
try avoiding it.
|
||||
|
||||
|
||||
Naming Conventions
|
||||
------------------
|
||||
|
||||
[1] Function names for user functions implementation should be prefixed with
|
||||
"php3_", and followed by a word or an underscore-delimited list of words,
|
||||
in lowercase letters, that describes the function.
|
||||
|
||||
[2] Function names used by user functions implementations should be prefixed
|
||||
with "_php3_", 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'.
|
||||
|
||||
[3] 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++) ...).
|
||||
|
||||
[4] Variable names should be in lowercase; Use underscores to seperate
|
||||
between words.
|
||||
|
||||
|
||||
|
||||
Syntax and indentation
|
||||
----------------------
|
||||
|
||||
[1] Never use C++ style comments (i.e. // comment). Always use C-style
|
||||
comments instead. PHP is written in C, and is aimed at compiling
|
||||
under any ANSI-C compliant compiler. Even though many compilers
|
||||
accept C++-style comments in C code, you have to ensure that your
|
||||
code would compile with other compilers as well.
|
||||
The only exception to this rule is code that is Win32-specific,
|
||||
because the Win32 port is MS-Visual C++ specific, and this compiler
|
||||
is known to accept C++-style comments in C code.
|
||||
|
||||
[2] Use K&R-style. Of course, we can't and don't want to
|
||||
force anybody to use a style she's not used to, but
|
||||
at the very least, when you write code that goes into the core
|
||||
of PHP or one of its standard modules, please maintain the K&R
|
||||
style. This applies to just about everything, starting with
|
||||
indentation and comment styles and up to function decleration
|
||||
syntax.
|
||||
|
||||
[3] Be generous with whitespace and braces. Always prefer
|
||||
if (foo) {
|
||||
bar;
|
||||
}
|
||||
to
|
||||
if(foo)bar;
|
||||
|
||||
Keep one empty line between the variable decleration section and
|
||||
the statements in a block, as well as between logical statement
|
||||
groups in a block. Maintain at least one empty line between
|
||||
two functions, preferably two.
|
||||
|
||||
Documentation and Folding Hooks
|
||||
-------------------------------
|
||||
|
||||
In order to make sure that the online documentation stays in line with
|
||||
the code, each user-level function should have its user-level function
|
||||
prototype before it along with a brief one-line description of what the
|
||||
function does. It would look like this:
|
||||
|
||||
/* {{{ proto int abs(int number)
|
||||
Return the absolute value of the number */
|
||||
void php3_abs(INTERNAL_FUNCTION_PARAMETERS) {
|
||||
...
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
The {{{ symbols are the default folding symbols for the folding mode in
|
||||
Emacs. vim will soon have support for folding as well. Folding is very
|
||||
useful when dealing with large files because you can scroll through the
|
||||
file quickly and just unfold the function you wish to work on. The }}}
|
||||
at the end of each function marks the end of the fold, and should be on
|
||||
a separate line.
|
||||
|
||||
The "proto" keyword there is just a helper for the doc/genfuncsummary script
|
||||
which generates a full function summary. Having this keyword in front of the
|
||||
function prototypes allows us to put folds elsewhere in the code without
|
||||
messing up the function summary.
|
||||
|
||||
Optional arguments are written like this:
|
||||
|
||||
/* {{{ proto object imap_header(int stream_id, int msg_no [, int from_length [, int subject_length [, string default_host]]])
|
||||
|
||||
And yes, please keep everything on a single line, even if that line is massive.
|
||||
|
||||
|
||||
@@ -1,339 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
@@ -1,176 +0,0 @@
|
||||
PHP Version 3.0 Development Team
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Core Developers
|
||||
===============
|
||||
|
||||
Rasmus Lerdorf (rasmus@lerdorf.on.ca)
|
||||
|
||||
* Original language definition and implementation
|
||||
* CGI loader and many internal functions
|
||||
* Apache module support
|
||||
* SNMP module
|
||||
* Original mSQL, MySQL and Sybase modules
|
||||
* Oracle module work
|
||||
|
||||
|
||||
Andi Gutmans (andi@php.net) and Zeev Suraski (zeev@php.net)
|
||||
|
||||
* New language definition and implementation
|
||||
* Internal functions API design
|
||||
* General hash table implementation for symbol tables, arrays and objects
|
||||
* Memory manager
|
||||
* Token cache manager
|
||||
* A lot of internal functions (including hebrev :) and migration from PHP 2.0
|
||||
* Syntax highlighting mode
|
||||
* Configuration file parser
|
||||
* New persistent/multilink MySQL, PosgresSQL, Sybase and mSQL modules
|
||||
* Win32 COM support
|
||||
|
||||
|
||||
Stig Bakken (ssb@guardian.no)
|
||||
|
||||
* Oracle support
|
||||
* configure/install script work
|
||||
* sprintf reimplementation
|
||||
* XML support
|
||||
* SGML documentation framework
|
||||
|
||||
|
||||
Shane Caraveo (shane@caraveo.com)
|
||||
|
||||
* Porting to Visual C++
|
||||
* Generalization to support different server APIs
|
||||
* Work on ISAPI and NSAPI APIs
|
||||
|
||||
|
||||
Jim Winstead (jimw@php.net)
|
||||
|
||||
* Lots of PHP2 -> PHP3 porting
|
||||
* dBase support
|
||||
* URL parsing functions
|
||||
* Makefile work
|
||||
* Regex rewrite
|
||||
* Win32 work
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Major Contributors
|
||||
==================
|
||||
|
||||
* Jouni Ahto (jah@cultnet.fi)
|
||||
Postgres, Informix
|
||||
|
||||
* Alex Belits (abelits@phobos.illtel.denver.co.us)
|
||||
fhttpd support
|
||||
|
||||
* Bjørn Borud (borud@guardian.no)
|
||||
soundex code and lots of enthusiasm
|
||||
|
||||
* Christian Cartus (chc@idgruppe.de)
|
||||
Informix Universal Server support
|
||||
|
||||
* John Ellson (ellson@lucent.com)
|
||||
Freetype support
|
||||
|
||||
* Dean Gaudet (dgaudet@arctic.org)
|
||||
Apache module debugging + helpful hints along the way
|
||||
|
||||
* Mitch Golden (mgolden@interport.net)
|
||||
Oracle testing and bug fixes
|
||||
|
||||
* Danny Heijl (Danny.Heijl@cevi.be)
|
||||
Informix SE support
|
||||
|
||||
* Mark Henderson (mark@togglemedia.com)
|
||||
Various odds and ends
|
||||
|
||||
* Jaakko Hyvätti (jaakko@hyvatti.iki.fi)
|
||||
Prototype cop, regular expression code fixes, CGI security issues
|
||||
|
||||
* Amitay Isaacs (amitay@w-o-i.com)
|
||||
LDAP
|
||||
|
||||
* Andreas Karajannis (Andreas.Karajannis@gmd.de)
|
||||
Adabas D, ODBC, Oracle
|
||||
|
||||
* Igor Kovalenko (owl@infomarket.ru)
|
||||
QNX support issues
|
||||
|
||||
* Richard Lynch (lynch@lscorp.com)
|
||||
Documentation
|
||||
|
||||
* Tom May (tom@go2net.com)
|
||||
Sybase-CT work
|
||||
|
||||
* Muhammad A Muquit (MA_Muquit@fccc.ed)
|
||||
Original Sybase module
|
||||
|
||||
* Mark Musone (musone@edgeglobal.com)
|
||||
IMAP
|
||||
|
||||
* Jeroen van der Most (jvdmost@digiface.nl)
|
||||
Solid
|
||||
|
||||
* Chad Robinson (chadr@brttech.com)
|
||||
Documentation, FilePro
|
||||
|
||||
* Lachlan Roche (lr@www.wwi.com.au)
|
||||
MD5
|
||||
|
||||
* Stefan Roehrich (sr@linux.de)
|
||||
zlib
|
||||
|
||||
* Nikolay P. Romanyuk (mag@redcom.ru)
|
||||
Velocis support
|
||||
|
||||
* Brian Schaffner (brian@tool.net)
|
||||
ODBC support, PHP3 API testing
|
||||
|
||||
* Egon Schmid (eschmid@delos.lf.net)
|
||||
Documentation
|
||||
|
||||
* (sopwith@redhat.com)
|
||||
Solid
|
||||
|
||||
* Colin Viebrock (cmv@privateworld.com)
|
||||
Website graphic design and layout, PHP logo
|
||||
|
||||
* Eric Warnke (ericw@albany.edu)
|
||||
LDAP
|
||||
|
||||
* Lars Torben Wilson (torben@netmill.com)
|
||||
Documentation
|
||||
|
||||
* Uwe Steinmann (Uwe.Steinmann@fernuni-hagen.de)
|
||||
Hyperwave, PDF, Acrobat FDF Toolkit
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Beta Testers
|
||||
------------
|
||||
|
||||
* Niklas Saers (berenmls@saers.com)
|
||||
FreeBSD/x86
|
||||
|
||||
* Chuck Hagenbuch <chuck@osmos.ml.org>
|
||||
Linux/x86 glibc2, MySQL, mod_ssl
|
||||
|
||||
* Sascha Schumann (sas@schell.de)
|
||||
FreeBSD/x86, PostgreSQL, IMAP, gdttf
|
||||
|
||||
* Jim Jagielski (jim@jagunet.com)
|
||||
A/UX, FreeBSD/x86
|
||||
|
||||
* Jouni Ahto (jah@cultnet.fi)
|
||||
Debian Linux 2.0
|
||||
|
||||
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Andi Gutmans and Zeev Suraski would like to thank Professor Michael Rodeh for
|
||||
his positive input during the initial development of the interpreter.
|
||||
@@ -1,860 +0,0 @@
|
||||
PHP 3.0 CHANGE LOG ChangeLog
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
|
||||
December 24 1998, Version 3.0.6
|
||||
- Fix GetImageSize() to work with non-standard jpg images
|
||||
- Add Mersenne Twister functions (mt_rand, mt_srand, etc)
|
||||
- Add str_replace() function
|
||||
- Add chunk_split() function
|
||||
- Fixed a bug in the memory limit code, in cases where $php_errormsg was
|
||||
also used.
|
||||
- Add iptcparse() function
|
||||
- Adobe FDF supported
|
||||
- getallheaders() NULL string fix <michale@utko.fee.vutbr.cz>
|
||||
- Add all configuration directives to phpinfo() page
|
||||
- Functions pack() and unpack() rewritten to be binary and buffer overrun
|
||||
safe and behave like the Perl functions for all implemented format codes.
|
||||
- Ensured that msql_error() will not return error messages generated by
|
||||
previously-run scripts.
|
||||
- Add base_convert() function
|
||||
- Make sprintf() and printf() output binary safe
|
||||
- Made gzgetc binary safe
|
||||
- Add convert_cyr_string() and quoted_printable_decode() functions
|
||||
- Fix ldap_free_result() core dump bug
|
||||
- Add support for current OpenLDAP-2.0-devel library
|
||||
- Add php3_asp_tags directive so it can be set from Apache config files
|
||||
- Added UTF-8 support in the XML extension
|
||||
- Make rand(min,max) safer on older platforms where the low-order bits have
|
||||
short cycles.
|
||||
- Added new pdf (Portable Document Format) module
|
||||
- Added an XML parsing extension using James Clark's "expat" library
|
||||
- Optimized parts of the token cache code.
|
||||
- Terminate on out-of-memory errors. Until now, PHP could crash in out of
|
||||
memory situations (clean-up, no real effect).
|
||||
- Unterminated comments in include files were being reported with the wrong line
|
||||
number. Fixed.
|
||||
- Added ImageCopy() and ImageColorDeallocate(). ImageCopy() is about
|
||||
20% faster than ImageCopyResized(). ImageColorDeallocate() marks
|
||||
palette entries free for reuse (by <mka@satama.com>).
|
||||
- In the CGI version, it was impossible to access resources (e.g. SQL links,
|
||||
images) from user-defined shutdown functions. Fixed.
|
||||
- Added optional third parameter to strpos() to specify the offset to
|
||||
start searching from.
|
||||
- Fixed a crash bug in unset() when unsetting illegal variables (rare).
|
||||
- Made ImageInterlace and ImageTransparentColor parameters optional, and made
|
||||
them return the current/new settings.
|
||||
- Optimized GetImageSize() <thies@digicol.de>.
|
||||
- Made odbc_autocommit() without args return status
|
||||
- Added connect workaround for OpenLink ODBC
|
||||
- Added minimal InterBase support. Tested only on 4.0 & Linux.
|
||||
- Fixed some memory leaks and bogus error messages in the URL handler of
|
||||
the various file open functions. Should only affect error handling
|
||||
in bad URLs.
|
||||
|
||||
October 5 1998 Version 3.0.5
|
||||
- mysql_field_flags now reports all MySQL flags and the result is suitable
|
||||
for automatic parsing. Compatibility warning: The result format has
|
||||
changed. If you have scripts parsing the result of this function, you
|
||||
may need to adapt them.
|
||||
- Made nl2br() binary safe (not that it's of much use).
|
||||
- Fixed a bug in the API function getThis(). It affected mostly the dir
|
||||
functions, if nested within objects.
|
||||
- Fixed a problem in require() in conjunction with switch(), and in some other
|
||||
cases. Also fixed an identical problem with the call_user_function() API
|
||||
function.
|
||||
- Removed -lpthread when compiling with MySQL support. It caused various
|
||||
serious problems when compiled into Apache.
|
||||
- Add serialize() and unserialize() functions from jkl@njet.net
|
||||
- Fix in_addr_t check for systems with in_addr_t in netinet/in.h
|
||||
- Add atan2() function
|
||||
|
||||
September 22 1998 Version 3.0.4
|
||||
- Added uksort() - array key sort using a user defined comparison function.
|
||||
- Added 'j' support to date() - generates the day of the month, without
|
||||
possible leading zeros.
|
||||
- Added support for multiple crypt() encryptions if the system supports it
|
||||
- Added optional support for ASP-style <% %> and <%= tags
|
||||
- Fixed data loss problems with very large numeric array indices on 64-bit
|
||||
platforms (e.g. DEC UNIX).
|
||||
- 2 cursor_type parameters for ifx_query() and ifx_prepare changed
|
||||
to 1 (bitmask). Added a few constants for use in Informix module.
|
||||
- Added php3.ini option ifx.charasvarchar. If set, trailing blanks
|
||||
are stripped from fixed-length char columns. (Makes life easier
|
||||
for people using Informix SE.)
|
||||
- Static SNMP module which compiles with ucd-snmp 3.5.2
|
||||
- fixed imap_header & header_info from crashing when a header line
|
||||
is > 1024 characters.
|
||||
- Added patch for rfc822_parse_adr to return an array of objects instead
|
||||
of a single object.
|
||||
- Informix Online 7.x & SE 7.x support now fairly complete and stable
|
||||
- Add dbase_get_record_with_names() function
|
||||
- Added a special case for open_basedir. When open_basedir is set to "."
|
||||
the directory in which the script is stored will be used as basedir.
|
||||
- Include alloca.c in the distribution for platforms without alloca().
|
||||
- Improved stripping of URL passwords from error messages - the length of the
|
||||
username/password isn't obvious now, and all protocols are handled properly
|
||||
(most importantly, http).
|
||||
- Copying objects that had member functions with static variables produced
|
||||
undetermined results. Fixed.
|
||||
- Added function lstat() and cleaned up the status functions,
|
||||
added tests for file status functions (this may break on some plattforms)
|
||||
- Fixed is_link() - it was returning always false.
|
||||
- Fixed apache_note() - it was corrupting memory.
|
||||
- New Function. void get_meta_tags(string filename); Parses filename until
|
||||
closing head tag and turns all meta tags into variables prefixed with 'meta_'.
|
||||
The below meta tag would produce $meta_test="some string here"
|
||||
<meta name="test" content="some string here">
|
||||
- Generalized some internal functions in order to better support calling
|
||||
user-level functions from C code. Fixes a few sporadic problems related
|
||||
to constructors inside eval() and more.
|
||||
- Fixed an endless loop in explode(), strstr() and strpos() in case of an
|
||||
invalid empty delimiter.
|
||||
- rand() now accepts two optional arguments, which denote the requested range
|
||||
of the generated number. E.g., rand(3,7) would generate a random number
|
||||
between 3 and 7.
|
||||
- Added M_PI constant.
|
||||
- Added deg2rad() and rad2deg() for converting radians<->degrees.
|
||||
- ImageArc() misbehaved when given negative angles, fixed.
|
||||
- Fixed a bug in ereg() that may have caused buglets under some circumstances.
|
||||
- Added imap_status
|
||||
- Shutdown functions, registered via register_shutdown_function(), could never
|
||||
generate output in the Apache module version. Fixed.
|
||||
- Brought IMAP docs into sync with acutal imap code
|
||||
- imap_fetchstructure now takes in optional flags
|
||||
- Fix potential core dumps in imap_append and imap_fetchtext_full
|
||||
- Fix problem in SetCookie() function related to long cookies
|
||||
- Add uasort() function to go along with usort (like sort() and asort())
|
||||
- Add port number to Host header as per section 14.23 of the HTTP 1.1 RFC
|
||||
- Fix imap_reopen to only take 2 arguments with an optional 3rd flags arg
|
||||
- Add optional 2nd argument to imap_close
|
||||
- Add CL_EXPUNGE flag to imap_open() flags
|
||||
- Fix 4th arg on imap_append(). It was getting converted to a long by mistake.
|
||||
- Fix shutdown warning in the LDAP module
|
||||
- *COMPATIBILITY WARNING* imap_fetchstructure() "parametres" object and property
|
||||
name changed to "parameters" to match the documentation and to be consistent
|
||||
with the rest of the API.
|
||||
- Delete uploaded temporary files automatically at the end of a request
|
||||
- Add upload_max_filesize and correponsing php3_upload_max_filesize directive
|
||||
to control the maximum size of an uploaded file. Setting this to 0 would
|
||||
completely eliminate file uploads.
|
||||
- Force $PHP_SELF to PATH_INFO value when running in CGI FORCE_CGI_REDIRECT mode
|
||||
- Add apache_lookup_uri() function which does an internal sub-request lookup
|
||||
and returns an object containing the request_rec fields for the URI. (Yes,
|
||||
you have to be a bit of a gearhead to figure this one out)
|
||||
- Fix a few signed char problems causing functions like ucfirst() not to work
|
||||
correctly with non-English charsets
|
||||
- md5() function not binary safe - fixed
|
||||
|
||||
August 15 1998 Version 3.0.3
|
||||
- Changed the name of fopen_basedir to open_basedir, to be a little more
|
||||
accurate about what it does.
|
||||
- Added Hyperwave module
|
||||
- Added config-option (php3_)enable_dl <on/off>. This enables/disables the
|
||||
dl() function. In safe-mode dl() is always disabled.
|
||||
- Auto-prepended files were crashing under some circumstances - fixed.
|
||||
- Win32 mail fixes provided by walton@nordicdms.com
|
||||
- Comparing between arrays and/or objects now generates a warning (it always
|
||||
returns false, as it used to; no comparison is made)
|
||||
- Fixed a bug in the syntax highlighting code, that made ending-double-quotes
|
||||
appear twice under certain circumstances.
|
||||
- Fix bug in filetype() function related to symlinks
|
||||
- Started integrating Informix SE support to PHP configure/makefile setup.
|
||||
- gdttf roundoff fixes from ellson@lucent.com
|
||||
- Added initial Informix SE support files from Danny Heijl - This code still
|
||||
needs to be integrated into the PHP configure/makefile setup and the code
|
||||
itself needs more work.
|
||||
- return in the global scope now terminates the execution of the current file.
|
||||
- Added the ability to register shutdown function(s), via
|
||||
register_shutdown_function($function_name).
|
||||
- Clean up const warnings
|
||||
- Add write support to ftp fopen wrappers
|
||||
- Add strspn() and strcspn() functions
|
||||
- On systems without strerror use Apache version if compiling as Apache module
|
||||
- The PHP start tag was being ignored under some circumstances - fixed.
|
||||
- The db, dbase and filepro functions are now Safe-Mode aware.
|
||||
- Added config-option (php3_)fopen_basedir <path>. This limits the directory-
|
||||
tree scripts can open files in to <path>.
|
||||
- Fixed pg_loreadall that didn't always return all the contents in a PostgreSQL
|
||||
large object. Also, doesn't pass through anything if method is HEAD.
|
||||
- configure fix to create target Apache module dir
|
||||
- Fix core dump in imageTTFtext() function
|
||||
- Added static IMAP support
|
||||
- Syntax highlighting was generating additional whitespace - fixed.
|
||||
- Added ucwords. Works like ucfirst, but works on all words within a string.
|
||||
- Added array_walk() - apply user function to every element of an array
|
||||
- Added usort() - array sort that accepts a user defined comparison function!
|
||||
- Added the ability to call user-level functions and object methods on demand
|
||||
from the C source using a completely generalized, slick API function.
|
||||
Miracles do happen every once in a while.
|
||||
- Added constructors. Don't even squeek about destructors! :) (we mean that)
|
||||
- Make pg_lowrite() binary safe
|
||||
- Fixed mod_charset option in ./setup
|
||||
- Fixed rewinddir() and dir()::rewind() under Win32 (they didn't work before).
|
||||
- Add Win32 COM support! By-name referencing is supported using the IDispatch
|
||||
interface (automation). Available functions - COM_Load(), COM_Invoke(),
|
||||
COM_PropGet() and COM_PropSet().
|
||||
|
||||
July 20 1998 Version 3.0.2a
|
||||
- Fix a quirk in the configuration file parser, the endless fountain of joy
|
||||
and fun.
|
||||
- Fix a bug in the API function add_method() that made dir() crash.
|
||||
|
||||
July 18 1998 Version 3.0.2
|
||||
- Compile cleanups for *BSD
|
||||
- Add support for the OpenLink ODBC Drivers
|
||||
- Add PHP_SELF, PHP_AUTH_* and HTTP_*_VARS PHP variables to phpinfo() output
|
||||
- Add workaround for broken makes
|
||||
- Add Apache 1.3.1 support (some Apache header files were moved around)
|
||||
- Added apache_note() function.
|
||||
- Fix order of system libraries and detect libresolv correctly
|
||||
- Fixed a bug in the Sybase-DB module. Several numeric field types were
|
||||
getting truncated when having large values.
|
||||
- Added testpages for unified odbc
|
||||
- Fix php -s seg fault when filename was missing
|
||||
- Made getdate() without args default to current time
|
||||
- Added ImageColorResolve() and some fixes to the freetype support.
|
||||
- Added strcasecmp()
|
||||
- Added error_prepend_string and error_append_string .ini and .conf directives
|
||||
to make it possible to configure the look of error messages displayed by PHP
|
||||
to some extent
|
||||
- Added E_ERROR, E_WARNING, E_NOTICE, E_PARSE and E_ALL constants, that can be
|
||||
used in conjunction with error_reporting()
|
||||
(e.g. error_reporting(E_ERROR|E_WARNING|E_NOTICE);
|
||||
- Fixed a crash problem with classes that contained function(s) with default
|
||||
values.
|
||||
- Fixed a problem in the browscap module. Browscap files weren't being read
|
||||
properly.
|
||||
- Fix -L path in libphp4.module to make ApacheSSL compile without errors
|
||||
- Fix StripSlashes so it correctly decodes a \0 to a NUL
|
||||
|
||||
July 04 1998 Version 3.0.1
|
||||
- echo/print of empty strings don't trigger sending the header anymore.
|
||||
- Implemented shift left and shift right operators (<< and >>)
|
||||
- Compile fix for cc on HP-UX.
|
||||
- Look for beta-version Solid libraries as well.
|
||||
- Make GD module show more info in phpinfo().
|
||||
- Compile fix for NextStep 3.0.
|
||||
- Fix for Oracle extension on OSF/1.
|
||||
- Fix gd 1.3 bug in ImageColorAt().
|
||||
- pg_loread() hopefully handles binary data now.
|
||||
- Turned off some warnings in dns.c
|
||||
- Added ImageTTFBBox() and made ImageTTFText() return bounding box.
|
||||
- Added constants for Ora_Bind()'s modes.
|
||||
- Renamed all hash_*() routines to _php3_hash_*() to avoid clashes with other
|
||||
libraries.
|
||||
- Changed uodbc default LONG behaviour: longreadlen 4096 bytes, binmode 1.
|
||||
The module now actually uses the php.ini settings.
|
||||
- New PostgreSQL functions: pg_fetch_row(), pg_fetch_array()
|
||||
and pg_fetch_object()
|
||||
- Fix a segmentation fault when calling invalid functions in certain
|
||||
circumstances
|
||||
- Fix bug that caused link-related functions to not pay attention to
|
||||
run-time safe mode setting (it was using whatever was set at compile time).
|
||||
- Fix bug in exec() function when used in safe mode
|
||||
|
||||
June 6 1998 Version 3.0
|
||||
- Add checkdnsrr function (check availability DNS records)
|
||||
- Add getmxrr function (get MX hostnames and weights)
|
||||
- Fixed bug in nl2br() function
|
||||
- Fix for an RC5 related problem in the Sybase module, when dealing
|
||||
with very long data types.
|
||||
- Speed up string concatenation by roughly a factor of 2
|
||||
- Add escape-handling to date function
|
||||
- Make base64 functions binary safe
|
||||
- Add strrpos function to complement strpos function added in RC5
|
||||
- Add ltrim function (strips only at the start of string)
|
||||
- Add rtrim as an alias to chop() for completeness sake
|
||||
- Add trim function (similar to chop, except it strips at the start as well)
|
||||
- Added 2 optional args to fsockopen function - errno and errstr
|
||||
- Fixed bug in split() function related to leading matches
|
||||
- Fixed problem in error_log() function (thanks to Jan Legenhausen)
|
||||
- empty("0") was returning true - fixed
|
||||
- Removed the old sybsql module. Use the new sybase_*() functions instead.
|
||||
- Several fixes to the configuration file parser
|
||||
- LDAP fixes - fixed return values on several functions
|
||||
|
||||
May 23 1998 Version 3.0RC5
|
||||
- The BC math library functions now compile in by default.
|
||||
- Fixed a bug in virtual() and other types of SSI's (e.g. <!--#exec). Under
|
||||
certain circumstances, this used to result in random problems.
|
||||
- Fixed a bug in virtual(). It was misbehaving if it was called before any
|
||||
other output.
|
||||
- Added mysql.default_port, mysql.default_host, mysql.default_user and
|
||||
mysql.default_password ini-file directives.
|
||||
- Improved handling of the MySQL default port. It now honors /etc/services
|
||||
and $MYSQL_TCP_PORT.
|
||||
- Fixed a crash in opening of broken ftp:// URLs, and improved error reporting
|
||||
in opening of URLs.
|
||||
- Fixed several non-critical scanner issues with syntax highlighting mode and
|
||||
the <script language=php> tag.
|
||||
- Fixed fseek on windows. (windows only): fseek will not return proper results
|
||||
on files opened as text mode. PHP uses binary mode as the default for file
|
||||
operations, but this can be overiden by fopen. Do not open files in text
|
||||
mode and use fseek on them!
|
||||
- Add strpos() function
|
||||
- Added zlib module, requires zlib >= 1.0.9
|
||||
- Improved the module API implementation. Dynamic modules may now register
|
||||
persistent resources (not that it makes much sense, but at least PHP
|
||||
won't crash). The API itself remains unchanged.
|
||||
- bcmod() wasn't always behaving like modulus should behave (it was behaving
|
||||
exactly like GNU bc's % operator). Fixed.
|
||||
- Changed the Sybase-DB module to always return strings, instead of auto-typing
|
||||
result sets. This was done for consistency with the other database modules,
|
||||
and in order to avoid overflows due to the platform-dependant limitations
|
||||
of the numeric data types of PHP. You can turn compatability mode on using
|
||||
the sybase.compatability_mode directive in the php3.ini file.
|
||||
- Fixed problems with the TINYINT field in the Sybase-CT module.
|
||||
- Applied some small speed optimizations to the Sybase-DB module querying code.
|
||||
- Added 'numeric' and 'type' properties to the object returned by
|
||||
sybase_fetch_field().
|
||||
- The 'new' operator doesn't accept all expressions anymore. Instead, it
|
||||
accepts a class name, or a variable reference (scalar, array element, etc).
|
||||
- Add ora_numcols() function
|
||||
- Add ora_do() and ora_fetch_into() functions to Oracle driver
|
||||
- Add persistent connection support to Oracle driver
|
||||
- Make Oracle driver clean up open connections and open cursors automatically
|
||||
- Added fread() and fwrite() that properly handle binary data.
|
||||
- Add Ora_ColumnSize() to Oracle code
|
||||
- The string "0" means FALSE again. This was done in order to maintain type
|
||||
conversion consistency.
|
||||
- Added solid_fetch_prev() for fetching the previous result row from Solid.
|
||||
- Huge integers are now automatically converted to floating point numbers
|
||||
(that have a wider range).
|
||||
- Floating point numbers are now displayed using scientific notation when
|
||||
they're extremely big or extremely small. The 'precision' php3.ini directive
|
||||
no longer designates the number of decimal digits, but rather, the maximum
|
||||
number of significant digits required.
|
||||
- Added support for scientific notation for floating point numbers (e.g. 1E7)
|
||||
throughout the entire language.
|
||||
- Fixed a potential/probable memory corruption problem with HEAD request
|
||||
handling.
|
||||
- Using un-encapsulated strings now generates a NOTICE-level warning
|
||||
(e.g. $a = foo; instead of $a = "foo";)
|
||||
- Added defined("name") function to check if a certain constant is defined
|
||||
or not.
|
||||
- Support new Apache mechanism for setting SERVER_SUBVERSION
|
||||
- Added PHP_OS and PHP_VERSION constants
|
||||
- Added the ability to define constants in runtime! Constants are script-wide,
|
||||
(there's no scope, once the constant is defined, it's valid everywhere).
|
||||
Syntax is define("name", $value [, $case_insensitive]). 'name' can be any name
|
||||
that is a valid variable name, *without* the $ prefix. 'value' can be
|
||||
any *scalar* value. If the optional 'case_insensitive' parameter is 1,
|
||||
then the constant is created case-insensitive (the default is case
|
||||
sensitive). Note: define() is currently *NOT* supported in preprocessed
|
||||
scripts.
|
||||
- Added general support for constants. The Syslog constants (e.g.
|
||||
LOG_ERR, LOG_CRIT, etc.) should be accessed as constants from now on (that
|
||||
is, without a $ prefix). You can still set define_syslog_variables to On
|
||||
in the php3.ini file if you want to define the various $ variables. The
|
||||
default for this directive in the php3.ini-dist file has been changed to
|
||||
Off.
|
||||
- The configuration file path variable now expands . and .. into their
|
||||
respective directories. You can obtain the path of the php3.ini file
|
||||
that was used by printing get_cfg_var("cfg_file_path").
|
||||
- Fixed a crash-recovery parser crash ($a=7; $a[3]+=5;)
|
||||
- Add gmmktime() function
|
||||
- Fixed a crash with implode() and empty arrays.
|
||||
- Fixed a bug that, under fairly rare circumstances, caused PHP not to
|
||||
recognize if(), require() and other statements as statements, and
|
||||
to complain about them as being unsupported functions.
|
||||
- Beautified php3.ini-dist and added more comments to it. Also changed
|
||||
the behavior of the configuration file parser to be brighter about
|
||||
the various constants (TRUE/FALSE/ON/OFF etc).
|
||||
- Fixed a bug in openlog() - the specified device name was being mangled.
|
||||
- Memory leaks were sometimes reported erroneously - fixed.
|
||||
- Improved the convertor to handle some quirks of the PHP/FI 2 parser with
|
||||
comments.
|
||||
- Fixed number_format() to properly handle negative numbers, and optimized it
|
||||
a bit.
|
||||
- Fixed static variables inside class member functions. Note that using such
|
||||
static variables inside member functions usually defeats the purpose of
|
||||
objects, so it is not recommended.
|
||||
- Fixed a bug in fpassthru() (the file was being closed twice).
|
||||
- Added strftime().
|
||||
- Add set_socket_blocking() function to control blocking on socket fd's
|
||||
- The sendmail_path in php3.ini was being ignored - fixed.
|
||||
- Fixed a bug with file upload, with files that contained the MIME boundary
|
||||
inside them.
|
||||
- Fixed a bug with form variables of type array, with spaces in their
|
||||
index (e.g. name="foo[bar bar]").
|
||||
- gd-1.3 autodetect and support
|
||||
- Year 2000 compliance is now togglable from the php3.ini file. Setting PHP
|
||||
to be y2k compliant effects the way it creates cookies, and means it'll
|
||||
NOT work with many browsers out there that are not y2k compliant! For
|
||||
that reason, the default for this option is off.
|
||||
- safe mode / fix from monti@vesatec.com
|
||||
- Integrated the FreeType support in the GD extension.
|
||||
- Added --with-gd=DIR and --without-gd options to configure
|
||||
|
||||
April 18 1998 Version 3.0 Release Candidate 4
|
||||
- Auto-prepended and auto-appended files were reporting the wrong filename
|
||||
in errors and in __FILE__ - fixed.
|
||||
- Fix GPC problem related to mixed scalar and array vars with the same name
|
||||
- Made putenv() Apache-safe. Environment variables may no longer leak in
|
||||
between requests.
|
||||
- The trailing semicolon is no longer required in class declarations.
|
||||
- Fixed a memory leak in the (array) and (object) operators under certain
|
||||
conditions.
|
||||
- <script> tags weren't working unless short tags were enabled - Fixed.
|
||||
- Fixed a bug in certain array indices that weren't treated as numbers
|
||||
even though they looked like numbers (e.g. "10", "20").
|
||||
- Changes to support renamed API functions in Apache-1.3
|
||||
- Fixed the -p and -e command line switches
|
||||
- Fix a segfault when calling command line version without parameters
|
||||
- Fix for feof() when used on a socket
|
||||
- Fix off-by-one error in fgets() when used on a socket
|
||||
- Fix bug in ImageSetPixel() (Thanks to ecain@Phosphor.net)
|
||||
|
||||
March 31 1998 Version 3.0 Release Candidate 3
|
||||
- Tiny bugfix for magic_quotes_sybase
|
||||
- Fix Apache build problems introduced in RC2
|
||||
- $a["0"]==$a[0] fix
|
||||
- Apache-1.3 build changes to support 100% automatic builds and shared library
|
||||
module builds. See INSTALL file.
|
||||
|
||||
March 30 1998 Version 3.0 Release Candidate 2
|
||||
- Changed the socket implementation under UNIX to not use FILE pointers, in
|
||||
order to work around the buggy Solaris libc (and possibly buggy libc's
|
||||
in other platforms).
|
||||
- Fixed a bug in min() and max() with certain arrays.
|
||||
- *WARNING* Move Apache 1.3 php3 file install to src/modules/php4 instead of
|
||||
src/modules/extra. Make sure you change your AddModule line correctly
|
||||
in your Apache Configuration file. This change is to take advantage of
|
||||
new Apache-1.3 configuration mechanism which makes it easier to build an
|
||||
Apache server with PHP automatically enabled. It will also help building
|
||||
a shared library module version of PHP soon.
|
||||
- Fixed a crash bug with auto-appended files.
|
||||
- Made --enable-discard-path work on all Unix servers #!/path/php CGI scripts
|
||||
should now work everywhere. I have tested on Apache, WN and Netscape 2.0
|
||||
- Made $a["123"] and $a[123] be identical. $a["0123"] is still different,
|
||||
though.
|
||||
- Added 'precision' ini directive, to set the number of decimal digits
|
||||
displayed for floating point numbers (default - 6).
|
||||
- Made integer/integer divisions evaluate to floating point numbers when
|
||||
applicable (e.g., 5/2==2.5(float), but 4/2==2(int))
|
||||
- Get rid of reliance on tied streams and move all socket reads and writes
|
||||
to recv/send calls
|
||||
- Cleaned up head.c a bit and fixed CGI SetCookie order problem
|
||||
- Changed default variable parsing order to Get-Cookie-Post (GPC)
|
||||
- Fixed setup so it has all configure options and defaults.
|
||||
- Added optional decimal point and thousands seperator to number_format()
|
||||
e.g., number_format(1500,2,',','.') == 1.500,00
|
||||
- Fixed cgi bug in windows that prevented files from being parsed on many
|
||||
systems and servers.
|
||||
|
||||
March 23 1998 Version 3.0 Release Candidate
|
||||
- Added support for the Raima database (ALPHA)
|
||||
- Fixed a bug in persistent PostgreSQL links and the connection-string method.
|
||||
- Added EXTENSION_STATUS file, that specifies the stability and status of
|
||||
every module in the distribution.
|
||||
- Added optional parameters to user functions with default values, variables
|
||||
that are forced to be passed by reference and variables that can be
|
||||
optionally passed by reference. The ini file directive
|
||||
'ignore_missing_userfunc_args' is no longer supported.
|
||||
- Added fhttpd support (by Alex Belits)
|
||||
- Improved performance by approximately 20-30%.
|
||||
- Added mysql_error(), mysql_errno() (if available) and msql_error().
|
||||
Errors coming back from the database backend no longer issue warnings.
|
||||
Instead, use these functions to retreive the error.
|
||||
- Patched count(), each(), prev(), next(), reset() and end() to work around
|
||||
the implementation side effects of unset(). As far as the users are
|
||||
concerned, this should be transparent now (even though it's slower now,
|
||||
until it's thoroughly fixed in 3.1).
|
||||
- Added number_format(). number_format(2499,2)=='2,499.00'.
|
||||
- error_reporting() now sets the error reporting level to the supplied
|
||||
argument, without any interpretations.
|
||||
- Fixed a lookahead parser bug that occured under rare circumstances.
|
||||
- Change the comparison operators to compare numeric strings as numbers. If
|
||||
you want to compare them as strings, you can use the new C-like strcmp()
|
||||
- Fixed Ora_GetColumn() bug when fetching strings
|
||||
- Added Ora_ColumnName() and Ora_ColumnType()
|
||||
- Preliminary LONG and LONG RAW support in Oracle extension
|
||||
- Add \123 and \xAB style octal and hex escapes to "" and `` strings
|
||||
- Add "-c" command line flag for specifying path to php3.ini file
|
||||
- Improved list() so that elements can be skipped, for example:
|
||||
list($name,,,$realname) = explode(":",fgets($passwd_file));
|
||||
- Fixed a tiny bug in the hash initialization which caused excessive use of
|
||||
memory. Report and fix by short@k332.feld.cvut.cz
|
||||
- Fixed strtolower() and strtoupper() to work with 8-bit chars
|
||||
- Fixed to compile and run on SunOS 4.1
|
||||
- Fixed a crash in soundex() of an empty string
|
||||
- Fixed parse_str() - it wasn't always defining the right variables,
|
||||
and didn't work with arrays.
|
||||
- Made [m,My]SQL create/drop database functions return success status
|
||||
- Fixed some memory leak/crash problems in the Adabas module
|
||||
- Added each() in order to allow for easy and correct array traversing.
|
||||
- Make Apache module version respect LOCALE setting
|
||||
- Add support for Apache 1.3b6+ ap_config.h file
|
||||
- Fixed a nasty corruption bug in eval() and show_source() that resulted in
|
||||
script termination (e.g. eval("exit();").
|
||||
- Fixed a syntax highlighting problem with keywords used as variable
|
||||
names.
|
||||
- Fixed a possible crash and/or file descriptor leak
|
||||
- Fixed line number being off by one in #! shell style execution
|
||||
- Made it possible to disable auto_prepend/append with "none" filename
|
||||
- Allow safe CGI calling through #!php style scripts
|
||||
|
||||
March 2 1998 Version 3.0b6
|
||||
- Made [s]printf handle %ld
|
||||
- Changed CGI version to only open regular files as input script
|
||||
- Added ignore_missing_userfunc_args directive to suppress warnings messages
|
||||
about missing arguments to user-defined functions
|
||||
- Added Postgres function - pg_cmdtuples(), by Vladimir Litovka
|
||||
- Disabled command line options if used as CGI
|
||||
- Changed CGI version to use PATH_TRANSLATED as the script file name
|
||||
- Link with solid shared library instead of static one
|
||||
- Fixed a crash with functions that aren't being called correctly
|
||||
- Fixed file descriptor leak in auto-prepend/append
|
||||
- Imap module is usable. See README in dl/imap.
|
||||
|
||||
February 24 1998 Version 3.0b5
|
||||
- Made the URL aware file functions be enabled by default
|
||||
- Fixed an unlikely crash bug in the parser, with uninitialized array elements
|
||||
which are refered to as objects.
|
||||
- Fixed several fields that were being incorrectly read in Sybase CT.
|
||||
- Fix Apache-1.3 related SIGHUP problem which was preventing php3.ini from
|
||||
getting re-read on a SIGHUP
|
||||
- *** WARNING *** Downwards incompatible change: The plus operator (+) is not
|
||||
longer overloaded as concatenation for strings. Instead, it converts its
|
||||
arguments to numbers and performs numeric addition.
|
||||
- Add Stig and Tin's bdf2gdfont script to extra/gd directory
|
||||
- Added join() as an alias to implode()
|
||||
- Made implode() accept arguments in the order used by explode() as well
|
||||
- Made $php_errormsg local in function calls
|
||||
- Fixed Apache configuration directive bugs
|
||||
- Added a number of .ini directives to Apache .conf directive list
|
||||
- Fixed a 'memory leak' with strtok()
|
||||
- echo/print now handle binary data correctly.
|
||||
- NEW now accepts any expression for the class name argument.
|
||||
- Add ImageDashedLine() GD function
|
||||
- Add arg_separator .ini directive so the '&' GET method separator can be
|
||||
changed to ';' for example. Corresponding php3_arg_separator Apache .conf
|
||||
directive works as well.
|
||||
- Walked around an implementation side effect of switch(). <? switch(expr) { ?>
|
||||
now works.
|
||||
- Added memory caching, resulting in a significant performance boost
|
||||
- Added support for for(): .. endfor; loops
|
||||
- Added a new predicate - empty($var). Returns true if $var is not set,
|
||||
or is FALSE. Returns false otherwise.
|
||||
- Added is_integer() (same as is_long()) and is_real() (same as is_double()).
|
||||
- Added sizeof() as an alias to the count() function
|
||||
- Added --enable-force-cgi-redirect, to prevent the CGI from working if
|
||||
someone directly accesses PHP not through Apache's CGI redirect
|
||||
(off by default).
|
||||
- Fixed marking of deleted dBase records. Noticed by Simon Gornall
|
||||
<simon@oyster.co.uk>.
|
||||
- Fixed fixed "%%" bug in [s]printf
|
||||
- Fixed a UMR (initialized memory read) in the Oracle code
|
||||
- Potential fix for mysql-related SIGPIPE problem which caused httpd to spin
|
||||
- Made PHP responsive to the Apache link status (stop executing if the link
|
||||
dies).
|
||||
- Fixed a crash bug with StrongHold and secure pages
|
||||
- Fixed StrongHold installation
|
||||
- Optimized the function call sequence a bit.
|
||||
- Fixed Sybase/CT date/datetime/money fields work to correctly.
|
||||
- Fixed Apache module startup problems - php3_module_startup should only be
|
||||
called once.
|
||||
- Fixed ord() with characters >127
|
||||
- Fixed bug in file_exists() function
|
||||
- Fixed stripslashes() to remove the escaping quote (instead of backslash)
|
||||
in case magic_quotes_sybase is true.
|
||||
- Also make echo and print automatically remove trailing decimal zeros.
|
||||
- Added htmlentities(), currently handling only ISO-8859-1 entities
|
||||
- "0" is no longer considered false, the only string which is false is the
|
||||
empty string "".
|
||||
- Added 'true' and 'false' keywords
|
||||
- Added 'xor' (logical exclusive or)
|
||||
- Automatic conversion from double to string removes decimal trailing zeros.
|
||||
- Added arsort() and rsort() to sort in descending order.
|
||||
- Turned on "XLATOPT_NOCNV" by default for uODBC/Solid.
|
||||
- Added support for a port number in the mysql_(p)connect() functions
|
||||
- Fixed a file descriptor leak in the configuration parser.
|
||||
- Fixed a few buglets with syntax highlighting with certain language keywords
|
||||
- Added functions to control minimum severity level of Sybase messages to
|
||||
display.
|
||||
- Added highlight_string() - behaves like highlight_file(), only instead
|
||||
of highlighting a file, it syntax highlights the contents of its
|
||||
argument.
|
||||
- Renamed show_source() to highlight_file(). show_source() is still
|
||||
supported for downwards compatability.
|
||||
- Fixed a bug in class inheritence - member functions with upper case
|
||||
letters in their names couldn't be redefined.
|
||||
- Made chown(), chgrp() and chmod() return TRUE/FALSE instead of 0/-1.
|
||||
|
||||
February 02 1998 Version 3.0b4
|
||||
- Fixed a segfault bug in one of the unified ODBC error messages.
|
||||
- Set default file modes to binary on Win32 (solved a lot of bs)
|
||||
- Fixed file copy on Win32
|
||||
- MIME file uploads fixed on Win32
|
||||
- Added contributed icons by Colin Viebrock (undex extra/icons)
|
||||
- Fixed the debugger enough to call it "beta code".
|
||||
- Fixed some leaks in the Oracle module, tidied up the code a bit.
|
||||
- Added __FILE__ and __LINE__ which evaluate to the currently parsed file
|
||||
and currently parsed line respectively.
|
||||
- Added ImageColorAt(), ImageColorSet(), ImageColorsForIndex(), and
|
||||
ImageColorsTotal() to allow manipulating the palette of GIF images.
|
||||
- Rename '--enable-url-includes' option to '--enable-url-fopen-wrapper' to
|
||||
better describe what it does, and pay attention to the setting.
|
||||
- Added optional parameter to the file(), readfile() and fopen() functions
|
||||
to look for files located in the include path.
|
||||
- Fixed bug that allowed the file() and readfile() to open files in the
|
||||
include path inadvertantly.
|
||||
- Fixed a (documented) bug in printf()/sprintf() with hard limited strings
|
||||
and alignment (e.g. %-.20s).
|
||||
- Optimized several quoted string routines.
|
||||
- Added error_log ini directive to select where errors get logged when
|
||||
log_errors is turned on or the error_log() function is used.
|
||||
- Added the ability to direct errors to log files instead of or in addition
|
||||
to the script output. Use the new display_errors and log_errors
|
||||
php3.ini directives.
|
||||
- Made environment variables uneraseable by POST/GET/Cookie variables.
|
||||
- Fixed a bug in the elseif() construct. The expression was being evaluated
|
||||
even if a previous if/elseif already evaluated to true and got executed.
|
||||
- Fixed a bug in the exit code parameter of system()
|
||||
- Tighten up all exec() related functions in safe mode
|
||||
- Added error_log() function to log messages to the server error log, or
|
||||
stderr for the CGI version.
|
||||
- Added support for a general memory limit of scripts.
|
||||
- Fixed a segfault bug that occured under certain circumstances with shell
|
||||
escapes ($foo = `...`)
|
||||
- Made keywords be valid property names of objects.
|
||||
- Fixed a segfault bug when creating new objects of an unknown class.
|
||||
- Fixed a problem with the maximum execution time limit, that may have
|
||||
prevented this feature from working on certain platforms.
|
||||
- PHP would now warn you with E_NOTICE about unknown escape characters,
|
||||
e.g. "\f". It would still be considered as a backslash followed by f,
|
||||
but the proper way of writing this is "\\f" or '\f'.
|
||||
- Added support for ${...} inside encapsulated strings. Supported: ${foo},
|
||||
${foo[bar]}, ${foo[0]}, ${$foo[$bar]}, ${$foo->bar} and ${$foo}
|
||||
- Fixed a bug in automatic persistent link reconnect of the Sybase/DB module.
|
||||
Thanks to Steve Willer for finding that 'stealth' bug!
|
||||
- Fixed a crash bug in the GET/POST/Cookie parser in case of regular
|
||||
and array variables with the same name.
|
||||
- Added round() function.
|
||||
- Can't use encapsed strings as variable names anymore, ie. $"blah blah".
|
||||
- Fixed bug in gethostby*() functions that resulted in a core dump.
|
||||
(Noticed by torben@coastnet.com.)
|
||||
- Fixed bug in dbase_get_record that prevented number and date fields
|
||||
from being properly decoded. (Thanks again to colins@infofind.com.)
|
||||
- Make dbase_get_record include a 'deleted' field that indicates whether
|
||||
that record had been marked for deletion.
|
||||
- Fixed bug in dbase library that stomped on the deleted flag of the first
|
||||
record in the file if it was set. (Thanks to colins@infofind.com.)
|
||||
- Fixed putenv() to not report a memory leak and possibly prevent a bug
|
||||
from that memory being freed.
|
||||
- Added setlocale()
|
||||
- Added pg_fieldisnull() (by Stephan Duehr)
|
||||
- Changed pg_exec() to always return a result identifier on succees
|
||||
- Solid linking fixes (tries to find the right library)
|
||||
- Fixed a but with date() and the 'w' element.
|
||||
- Tried to eliminate unimportant memory leak notifications.
|
||||
- Made min() and max() backwards compatible and able to handle doubles.
|
||||
- Add fgetc() function
|
||||
- Fixed bug in getmyuid(), getmyinode() and getlastmod(). Thanks to
|
||||
khim@sch57.msk.ru for pointing this out.
|
||||
- Fixed http:// URL includes with no path specified send request for /.
|
||||
- Added GetAllHeaders() (Apache-only)
|
||||
- Added workaround that made the Image text functions 8-bit clean
|
||||
- Made snmp internally compilable for Win32 (not the unix one though),
|
||||
only adds 2k to binary size, so no reason not to have it there.
|
||||
- Fixed ldap loading on Win32
|
||||
- Fixed MySQL Info function on Win32 platform
|
||||
- Fixed compilation of syntax highlighting mode
|
||||
|
||||
January 17 1998 Version 3.0b3
|
||||
- Added mysql support under windows ;) happy happy joy joy
|
||||
- Fixed dbase.dll for Win32 to actualy load now.
|
||||
- Enhanced the convertor to recognize ?> as a php-close-block as well.
|
||||
- Fixed potential SetCookie() core dumps
|
||||
- Changed print to be an expression instead of a statement. That means you can
|
||||
now do stuff like foobar() or print("Unable to foobar!"). echo has NOT been
|
||||
changed.
|
||||
- Removed the flex optimization flags to reduce the size of the scanner
|
||||
- Added memory leak logging into apache log files (apache module only)
|
||||
- Fixed a nasty bug in one of the internal stacks. This may have caused
|
||||
random crashes in several occassions.
|
||||
- Fixed bug in ImageGif() making it hang sometimes
|
||||
- Added ImageLoadFont(), ImageFontWidth() and ImageFontHeight()
|
||||
- error_reporting() now returns the old error reporting level
|
||||
- Fixed url includes/opens not working under Win32
|
||||
- Fixed errorneous handling of multipart/form-data input
|
||||
- Added rawurlencode(), rawurldecode() and changed urlencode() and urldecode()
|
||||
a bit too.
|
||||
- Fixed a bug in [s]printf, sign was forgotten for doubles.
|
||||
- Fixed a segfault bug in pg_fieldprtlen(), and made it accept field names
|
||||
in addition to field offsets.
|
||||
- Made the setup script a little more user-friendly.
|
||||
- Added is_long(), is_double(), is_string(), is_array() and is_object()
|
||||
- Fixed a bug in freeing of mSQL results.
|
||||
- Improved pg_exec() to properly return true or false with queries that don't
|
||||
return rows (i.e. insert, update, create, etc)
|
||||
- Added get_cfg_var() to enable checking cfg file directives from within
|
||||
a script.
|
||||
- Fixed a bug with urlencode() and characters 0x80-0xff
|
||||
- Changed the behaviour of ereg_replace to more intuitive. The
|
||||
backslashes other than valid existing back references in the second
|
||||
argument are no more evaluated as escape sequences.
|
||||
- Fixed a bug in the configuration file loader and safe mode.
|
||||
- Fixed a bug with configuration variables taken from the environment.
|
||||
- Added <script language=php> </script> as PHP open/close tags, to allow
|
||||
the use of editors such as Microsoft Frontpage.
|
||||
- Fixed a bug in the default php3.ini directory - it wasn't defaulting to
|
||||
/usr/local/lib properly.
|
||||
- Added support for \r\n line endings
|
||||
- Fixed a bug that may have prevented POST method variables from working
|
||||
with certain scripts when using the CGI version.
|
||||
- Convertor: Added support for single-quoted strings
|
||||
- Fixed segfault bug in the Adabas module, with queries that don't return
|
||||
rows (update, insert, etc).
|
||||
|
||||
December 22 1997 Version 3.0b2
|
||||
- Changed variable type conversions that do not specify base to always use
|
||||
base 10. "010" is no more 8, it is 10. Use intval ($x, 0) to get C-style
|
||||
octal and hex numbers recognized.
|
||||
- Fixed a possible segfault bug in several functions, when using the concat
|
||||
operator and possibly other operators/functions.
|
||||
- # is no longer accepted as a comment in php3.ini. Use ; instead.
|
||||
- Added browscap support
|
||||
- Configuration file directives are now case-sensitive
|
||||
- Fixed msql_tablename() and msql_dbname()
|
||||
- Added a PHP/FI 2.0 -> PHP 3.0 convertor
|
||||
- Added support for shell/perl-style single quotes
|
||||
- Added support for execution of external programs using backquotes ($a=`ls -l`)
|
||||
- fixed mail() on windows, also fixed memory leaks in mail on windows
|
||||
- added sendmail_from to handle return route on windows
|
||||
- Changed the way the config file is searched. The file name is now
|
||||
php3.ini (hardcoded), and it'll be looked for in: local directory, $PHPRC
|
||||
and builtin path designated by ./configure under UNIX or Windows directory
|
||||
under Windows.
|
||||
- Fixed ereg_replace replacing empty matches and a one off buffer overflow
|
||||
- Fixed File upload on windows platform
|
||||
- Fixed a bug that caused 'HTTP/1.1 100 Continue' messages with
|
||||
Internet Explorer 4.0 and certain scripts that receive POST variables
|
||||
- Get/POST/Cookie data variables are from now *ALWAYS* strings. If you want
|
||||
to use them in integer/real context, you must explicitly change their types.
|
||||
This was done in order to avoid possible loss of data when doing these
|
||||
conversions automatically.
|
||||
- Variables named as keywords are now allowed (e.g. $function, $class, etc)
|
||||
- Fixed a problem with msql() and mysql() with NULL fields
|
||||
- Fixed a segfault bug with class declarations
|
||||
- Fixed bugs with FOR loops and include() from within eval()
|
||||
- Changed include() to be executed conditionally. PHP-3.0 efficient
|
||||
unconditional include is now require()
|
||||
|
||||
December 08 1997 Version 3.0b1
|
||||
- Switched to public beta test phase
|
||||
- Generalized unset() and isset() to work on any type of variables, including
|
||||
specific array indices or object properties (e.g., unset($a[4]) now works).
|
||||
- Added support for object references inside encapsulated strings
|
||||
(for example, 'echo "Username: $user->name"' now works)
|
||||
- Added arbitary precision math support (basic operations with
|
||||
unlimited range numbers, and support for unlimited decimal digits)
|
||||
- Apache module can now handle preprocessed scripts (by using:
|
||||
AddType application/x-httpd-php3-preprocessed .php3p
|
||||
in the Apache configuration)
|
||||
- Made settype() pass its first parameter by value. Improved it to be able
|
||||
to convert to arrays and objects (originally by Steve Willer)
|
||||
- Implemented CPU time limit on scripts when setitimer() is available
|
||||
- Computed field names in the Sybase/CT and Sybase/DB modules are now named
|
||||
computed, computed1, computed2, ...
|
||||
- Added Sybase/CT client/server message handlers and updated the Sybase/DB ones
|
||||
- Made the regexp function automatically take arguments by reference
|
||||
when necessary
|
||||
- Added builtin support for auto append and prepend in the parser level
|
||||
- Improved the Sybase/CT sybase_query(). Should be more stable now, and
|
||||
hopefully work with a wider range of queries. It's difficult to work
|
||||
without docs, though, so it may still not be 100% right...
|
||||
- Changed error messages to show error type, file and line with bold
|
||||
- Added support for autoprepend and autoprepend
|
||||
- Added some more warning flags if gcc is used
|
||||
|
||||
December 03 1997 Version 3.0a4
|
||||
- Improved the internal functions API - no need to explicitly pass
|
||||
parameters by reference to internal functions that specifically
|
||||
require them, e.g. sort(), ksort(), reset(), count(), etc.
|
||||
This is *STILL* downwards compatible with the previous alphas,
|
||||
in the sense that you can explicitly pass the arguments by reference
|
||||
if you want to.
|
||||
- use srandom/random instead of srand/rand if available
|
||||
- Added [m,My]sql_listfields() for downwards compatability
|
||||
- -p now replaces .php3 extension with .php3p (otherwise it adds .php3p)
|
||||
- Added C++ style comments (// comment)
|
||||
- Fixed # commenting to terminate at a close PHP tag
|
||||
- Added \0 back reference for full string match to *reg*_replace and
|
||||
added backslash escaping to replace string
|
||||
- Fixed a few bugs in the Sybase DB-library module.
|
||||
- Added Sybase CT-library support. It should be considered experimental.
|
||||
Syntax is identical to the one of the DB-library. Allows people to
|
||||
connect to MS-SQL servers from Linux without having to pay for a
|
||||
library!
|
||||
- Beautified phpinfo()
|
||||
- Add ImageColorClosest() and ImageColorExact() GD functions
|
||||
- Make all .ini directives work as Apache .conf directives as well
|
||||
- Added PHP2-like File() function with PHP3 URL support
|
||||
- Upgraded the Sybase interface. It's practically MySQL compatible now!
|
||||
Among other things, added sybase_fetch_array() and sybase_fetch_object().
|
||||
- Fixed problem in multi dimensional array handling and self modifying
|
||||
operators (+=, -=, etc).
|
||||
- Safe Mode file open implementation
|
||||
- SVR3 portability problem fix
|
||||
|
||||
November 23 1997 Version 3.0a3
|
||||
- Made the global statement behave like PHP 2 with undefined variables
|
||||
- Added msql_fetch_object() and msql_fetch_array()
|
||||
- Switched between the 1st and 2nd parameters to explode(), so that it acts
|
||||
like split()
|
||||
- Fixed passthru(), exec() and system() functions
|
||||
- Implemented second optional parameter to intval() to specify conversion base
|
||||
(The default is to assume you want to do a base 10 conversion.)
|
||||
- Implemented SQL safe mode for MySQL
|
||||
- Read UploadTmpDir from php3.ini instead of apache conf files
|
||||
- Added mysql_fetch_object() and mysql_fetch_array()
|
||||
- Changed function->old_function. function is now an alias to cfunction.
|
||||
- Split the magic_quotes directive to get/post/data and other
|
||||
- Added generic copy() function
|
||||
- Added a $GLOBALS[] array, which contains all global variables
|
||||
- Fix broken getimagesize() function
|
||||
- Made mysql_fetch_field() and msql_fetch_field() optionally accept a 2nd argument
|
||||
- Fixed mysql_data_seek() and msql_data_seek()
|
||||
- Changed list assignment to list(...) and array init to array(...)
|
||||
- Made <?php_track_vars?> work
|
||||
- cgi when not in debug mode uses regular malloc(), free() functions now
|
||||
- Added preliminary support for perl-style list assignments
|
||||
- Fixed a bug in mysql_result() and msql_result() when specifying table
|
||||
- renamed internal error-handling function and levels
|
||||
- Added basename and dirname functions similar to sh counterparts
|
||||
- Added base64_encode() and base64_decode()
|
||||
- Support Basic authorization for http url includes
|
||||
- Added parse_url() function to extract url components
|
||||
- Made it possible to use anonymous ftp on URL includes
|
||||
- Fixed url includes to handle different URLs better
|
||||
- Fixed mysql_field*() functions
|
||||
- Made mysql_connect() smarter, after a mysql_close() (applies to msql and pgsql too)
|
||||
|
||||
November 6 1997 Version 3.0a2
|
||||
- Fixed a segfault bug caused by non-persistent connect in [m,My,Postgres]SQL modules
|
||||
- Fix command line argument handling
|
||||
- Made empty array list assignments work ($a=({});)
|
||||
- Made '$' escaping optional when a variable name parsing isn't possible
|
||||
- Added support for mysql_[p]connect(host) and mysql_[p]connect(host,user)
|
||||
- New layout in phpinfo()
|
||||
- Update Oracle extension to use php3_list functions
|
||||
- Add includepath support
|
||||
- Add #!php shell script escape support
|
||||
- Change name of CGI/command line version from php3.cgi to php
|
||||
- Add SNMP extension
|
||||
- show_source() support
|
||||
- Parsing of command-line args for CGI version
|
||||
- Support for backreferences in ereg_replace
|
||||
- Support for hexadecimal numbers directly at the scanner level
|
||||
- Support octal numbers directly at the scanner level
|
||||
- Fixed problem with huge html files (with little or no php code)
|
||||
- Fix eval() empty string argument core dump
|
||||
- renamed 'install' to 'setup' to be more accurate and avoid name conflict
|
||||
- Fixed Oracle compilation
|
||||
- Fixed mSQL 1.0 compilation
|
||||
- Fixed a problem in the mSQL, MySQL and PostgresSQL drivers and NULL fields.
|
||||
- Fixed the GLOBAL statement to be able to declare an array.
|
||||
|
||||
October 29 1997 Version 3.0a1
|
||||
- Start with excellent new parser from Andi and Zeev
|
||||
@@ -1,86 +0,0 @@
|
||||
|
||||
This is the ChangeLog from PHP3 as of Apr 12 1999.
|
||||
|
||||
Entries should be removed from this file, if you transfer changes
|
||||
over to PHP4.
|
||||
|
||||
============================================================================
|
||||
|
||||
?? 1999, Version 3.0.8
|
||||
- added Oracle-OCI8 persistent connections
|
||||
- fixed OCIDefineByName crash.
|
||||
- fixed some NULL-column related problems in OCI8-module.
|
||||
- Some Informix driver improvements.
|
||||
- PUT method support (mlemos@acm.org)
|
||||
- Fix parameter count problem in odbc_setoption()
|
||||
- Really fix implode() this time. The fix in 3.0.7 was bogus
|
||||
- Added more option to the date() function: (Colin Viebrock)
|
||||
'g' - hour, 12-hour format, no leading zeros
|
||||
'G' - hour, 24-hour format, no leading zeros
|
||||
'n' - month, numeric, no leading zeros
|
||||
- Make fgetss() slightly smarter
|
||||
- Add strip_tags() which uses the fgetss state-machine but acts on a string
|
||||
|
||||
March 1 1999, Version 3.0.7
|
||||
- Added pdf_put_image and pdf_execute_image
|
||||
- Initial work on an ImageMagick module - doesn't do anything yet
|
||||
- Make configure script detect Netscape's LDAP SDK automagically
|
||||
- Fixed Oracle-OCI8 module for windows.
|
||||
- Add OCIRowCount function. (Number of affected rows for update-statements)
|
||||
- Add OCIDefineByName function.
|
||||
- Change the behaviour of open_basedir. It's now possible to supply more
|
||||
than one directory. open_basedir paths from parent directories are now
|
||||
automatically inherited.
|
||||
- fix rand() and mt_rand() to make the ranges work correctly
|
||||
- htmlspecialchars() and htmlentities() are now binary safe.
|
||||
- Add extract() function.
|
||||
- Oracle-OCI8 driver now supports BLOBS/CLOBS and IN/OUT binding of local php
|
||||
variables.
|
||||
- Clean up apxs build
|
||||
- Add INSTALL.REDHAT file to walk RedHat users through the install
|
||||
- Added optional second argument to mysql_fetch_array(); MYSQL_ASSOC will
|
||||
cause the resulting array to contain the associative indices only,
|
||||
MYSQL_NUM will cause the array to contain the numeric indices only (like
|
||||
mysql_fetch_row()) and MYSQL_BOTH would cause them both to be defined
|
||||
(default).
|
||||
- Backport the Zend debugging memory manager into the PHP 3.0.x tree.
|
||||
- Add function_exists() function.
|
||||
- Add another version of WDDX module
|
||||
(we need to pick a single implementation here)
|
||||
- Fixed includes for iODBC to support both the old and the new LGPL version
|
||||
- Fix implode() bug - When imploding an array that contained unset() elements
|
||||
it wasn't correctly skipping past these
|
||||
- Add connection_status() function. This returns the raw bitfield which
|
||||
indicates whether the script terminated due to a user abort, a timeout
|
||||
or normally. Note that if ignore_user_abort is enabled, then both the
|
||||
timeout state and the user abort state can be active
|
||||
- Add connection_timeout() function. This one can be called in a shutdown
|
||||
function to tell you if you got there because of a timeout
|
||||
- Add ignore_user_abort() function and .ini/.conf directive of same name
|
||||
- Fix connection abort detection code - It should now work reliably with
|
||||
Apache. Also added a user-level connection_aborted() function designed to
|
||||
let people check whether the user aborted the connection in a user-level
|
||||
shutdown function.
|
||||
- Add pfsockopen() function
|
||||
- Improvements in FreeType support: Macintosh fonts work, and non-antialiased
|
||||
output is considerably cleaner <mka@satama.com>
|
||||
- Fixed checkdate() function, range of valid years is now 0 to 32767
|
||||
- hw_insertdocument() returns object id now
|
||||
- Add pdf_open() warning in configure and documentation
|
||||
- Add diskfreespace() function
|
||||
- Added aspell support
|
||||
- Iptcparse would sometimes find a wrong tag.
|
||||
- Force var_dump() to output headers
|
||||
- Add optional 3th parameter to ora_fetchinto.
|
||||
- Serialize and var_dump no longer show array elements that
|
||||
have been unset.
|
||||
- Add IptcEmbed() function (can replace an APP13-Marker in a JPEG file)
|
||||
- Add OCI8 module for Windows
|
||||
- Fix bug in pdf_close() function
|
||||
- Add WDDX support (see http://www.wddx.org for more info)
|
||||
- Add similar_text() function
|
||||
- Constructors of parent classes weren't accessible to derived classes (as
|
||||
of 3.0.6). Fixed.
|
||||
- Introduce simple regex compilation cache
|
||||
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
The core of PHP 3.0 is considered to be stable at this time. However, some of
|
||||
the modules that are bundled with it are still undergoing development, or
|
||||
contain known bugs. The purpose of this file is to document the status of
|
||||
each module (extension). Patches to unstable modules will be available through
|
||||
the CVS, and through periodic maintenance releases.
|
||||
|
||||
Stability scale:
|
||||
Rock solid - We believe it's safe to base a production site on it.
|
||||
Stable - It should be safe to base a production site on it.
|
||||
Isn't rated as rock-solid because it contained problems
|
||||
in the not-so-far past, or doesn't have enough users
|
||||
to test it to know it's rock solid.
|
||||
Beta - This module probably contains bugs, sometimes even known
|
||||
bugs. You can give it a try and there's a good chance
|
||||
it'll work fine, but it might not be a good idea to base
|
||||
a production site on it.
|
||||
Alpha - This module is in initial development steps. Don't trust
|
||||
it, play with it at your own risk.
|
||||
Deprecated - This module is only available for downwards compatability,
|
||||
and will not be supported in any way. The code quality
|
||||
is usually around the Beta status.
|
||||
|
||||
The standard disclaimers apply, that is, if a rock-solid module blows up on
|
||||
you and ruins your site, nobody in the PHP development team is responsible.
|
||||
We'll probably try to help, though.
|
||||
|
||||
|
||||
Extension Name Status Comments
|
||||
-----------------------------------------------------------------------------
|
||||
DBM Rock Solid That relies on a working DBM library.
|
||||
The flatfile support is probably not
|
||||
as stable.
|
||||
MySQL Rock Solid
|
||||
mSQL Rock Solid
|
||||
Sybase DB Stable
|
||||
Sybase CT Stable
|
||||
BC Math Rock Solid Arbitary precision math library
|
||||
Postgres SQL Stable Postgres 6.2 and earlier is stable,
|
||||
but problems were reported with 6.3
|
||||
Debugger Beta
|
||||
Unified ODBC Beta
|
||||
Solid Deprecated Replaced by Unified ODBC
|
||||
iODBC Deprecated Replaced by Unified ODBC
|
||||
Adabas Deprecated Replaced by Unified ODBC
|
||||
LDAP Stable Lightweight Directory Access Protocol.
|
||||
dBase
|
||||
FilePro
|
||||
Oracle Beta Not tested thoroughly enough.
|
||||
IMAP Beta Bundled in the dl/ directory
|
||||
SNMP Stable Very solid, but also very limited.
|
||||
Only supports GET and WALK requests.
|
||||
Raima Velocis Beta If use with Unified ODBC, replaced
|
||||
by Unified ODBC
|
||||
Raima Velocis Alpha If use without Unified ODBC
|
||||
@@ -1,538 +0,0 @@
|
||||
Functions:
|
||||
|
||||
Functions marked with 'u' do not work, or may not work correctly under windows.
|
||||
|
||||
basic_functions
|
||||
include
|
||||
_include
|
||||
isset
|
||||
|
||||
intval
|
||||
doubleval
|
||||
strval
|
||||
short_tags
|
||||
sleep
|
||||
u usleep
|
||||
ksort
|
||||
asort
|
||||
sort
|
||||
count
|
||||
chr
|
||||
ord
|
||||
flush
|
||||
end
|
||||
prev
|
||||
next
|
||||
reset
|
||||
current
|
||||
key
|
||||
gettype
|
||||
settype
|
||||
min
|
||||
max
|
||||
|
||||
addslashes
|
||||
chop
|
||||
pos
|
||||
|
||||
fsockopen
|
||||
getimagesize
|
||||
htmlspecialchars
|
||||
md5
|
||||
|
||||
parse_url
|
||||
|
||||
parse_str
|
||||
phpinfo
|
||||
phpversion
|
||||
strlen
|
||||
strtok
|
||||
strtoupper
|
||||
strtolower
|
||||
strchr
|
||||
basename
|
||||
dirname
|
||||
stripslashes
|
||||
strstr
|
||||
strrchr
|
||||
substr
|
||||
quotemeta
|
||||
urlencode
|
||||
urldecode
|
||||
ucfirst
|
||||
strtr
|
||||
sprintf
|
||||
printf
|
||||
|
||||
exec
|
||||
system
|
||||
escapeshellcmd
|
||||
passthru
|
||||
|
||||
soundex
|
||||
|
||||
rand
|
||||
srand
|
||||
getrandmax
|
||||
gethostbyaddr
|
||||
gethostbyname
|
||||
explode
|
||||
implode
|
||||
error_reporting
|
||||
clearstatcache
|
||||
|
||||
get_current_user
|
||||
getmyuid
|
||||
getmypid
|
||||
u getmyinode
|
||||
getlastmod
|
||||
|
||||
base64_decode
|
||||
base64_encode
|
||||
|
||||
abs
|
||||
ceil
|
||||
floor
|
||||
sin
|
||||
cos
|
||||
tan
|
||||
asin
|
||||
acos
|
||||
atan
|
||||
pi
|
||||
pow
|
||||
exp
|
||||
log
|
||||
log10
|
||||
sqrt
|
||||
bindec
|
||||
hexdec
|
||||
octdec
|
||||
decbin
|
||||
decoct
|
||||
dechex
|
||||
|
||||
getenv
|
||||
putenv
|
||||
|
||||
time
|
||||
mktime
|
||||
date
|
||||
gmdate
|
||||
getdate
|
||||
checkdate
|
||||
microtime
|
||||
uniqid
|
||||
|
||||
u linkinfo
|
||||
u readlink
|
||||
u symlink
|
||||
u link
|
||||
u unlink
|
||||
|
||||
|
||||
bcmath_functions
|
||||
bcadd
|
||||
bcsub
|
||||
bcmul
|
||||
bcdiv
|
||||
bcmod
|
||||
bcpow
|
||||
bcsqrt
|
||||
bcscale
|
||||
bccomp
|
||||
|
||||
dir_functions
|
||||
opendir
|
||||
closedir
|
||||
chdir
|
||||
rewinddir
|
||||
readdir
|
||||
dir
|
||||
|
||||
dl_functions
|
||||
dl(string module_name); dynamicly load a module
|
||||
|
||||
dns_functions
|
||||
gethostbyaddr
|
||||
gethostbyname
|
||||
|
||||
file_functions
|
||||
pclose
|
||||
popen
|
||||
readfile
|
||||
rewind
|
||||
rmdir
|
||||
umask
|
||||
fclose
|
||||
feof
|
||||
fgets
|
||||
fgetss
|
||||
fopen
|
||||
fpassthru
|
||||
fseek
|
||||
ftell
|
||||
fputs
|
||||
mkdir
|
||||
rename
|
||||
copy
|
||||
tempnam
|
||||
file
|
||||
|
||||
filestat_functions
|
||||
fileatime
|
||||
filectime
|
||||
u filegroup
|
||||
u fileinode
|
||||
filemtime
|
||||
u fileowner
|
||||
fileperms
|
||||
filesize
|
||||
filetype
|
||||
stat
|
||||
u chown
|
||||
u chgrp
|
||||
u chmod
|
||||
touch
|
||||
file_exists
|
||||
is_executable
|
||||
is_dir
|
||||
is_readable
|
||||
is_writeable
|
||||
u is_link
|
||||
|
||||
header_functions
|
||||
setcookie
|
||||
header
|
||||
|
||||
mail_functions
|
||||
mail
|
||||
|
||||
reg_functions
|
||||
ereg
|
||||
ereg_replace
|
||||
eregi
|
||||
eregi_replace
|
||||
split
|
||||
sql_regcase
|
||||
|
||||
syslog_functions (writes to event log on win NT)
|
||||
openlog
|
||||
syslog
|
||||
closelog
|
||||
|
||||
The following are optional modules and may or may not be compiled into php, or may be compiled as a loadable module.
|
||||
|
||||
odbc_functions (obsolete, use uodbc below)
|
||||
sqlconnect
|
||||
sqldisconnect
|
||||
sqlfetch
|
||||
sqlexecdirect
|
||||
sqlgetdata
|
||||
sqlfree
|
||||
sqlrowcount
|
||||
|
||||
uodbc_functions
|
||||
(int) odbc_autocommit($connection_id, $OnOff)
|
||||
(void) odbc_close($connection_id)
|
||||
(void) odbc_close_all(void)
|
||||
(int) odbc_commit($connection_id)
|
||||
(int) odbc_connect($dsn, $user, $password)
|
||||
(int) odbc_pconnect($dsn, $user, $password)
|
||||
(string) odbc_cursor($result_id)
|
||||
(int) odbc_do($connection_id, $query_string)
|
||||
(int) odbc_exec($connection_id, $query_string)
|
||||
(int) odbc_prepare($connection_id, $query_string)
|
||||
(int) odbc_execute($result_id, $array)
|
||||
(int) odbc_fetch_row($result_id, $row_number)
|
||||
(int) odbc_fetch_into($result_id, $row_number, $array_ptr)
|
||||
(int) odbc_field_len($result_id, $field_number)
|
||||
(string) odbc_field_name($result_id, $field_number)
|
||||
(string) odbc_field_type($result_id, $field)
|
||||
(int) odbc_free_result($result_id)
|
||||
(int) odbc_num_fields($result_id)
|
||||
(int) odbc_num_rows($result_id)
|
||||
(string) odbc_result($result_id, $field)
|
||||
(int) odbc_result_all($result_id, $format)
|
||||
(int) odbc_rollback($connection_id)
|
||||
|
||||
msql_functions
|
||||
msql_connect
|
||||
msql_pconnect
|
||||
msql_close
|
||||
msql_select_db
|
||||
msql_create_db
|
||||
msql_drop_db
|
||||
msql_query
|
||||
msql
|
||||
msql_list_dbs
|
||||
msql_list_tables
|
||||
msql_list_fields
|
||||
msql_result
|
||||
msql_num_rows
|
||||
msql_num_fields
|
||||
msql_fetch_row
|
||||
msql_fetch_array
|
||||
msql_fetch_object
|
||||
msql_data_seek
|
||||
msql_fetch_field
|
||||
msql_field_seek
|
||||
msql_free_result
|
||||
msql_fieldname
|
||||
msql_fieldtable
|
||||
msql_fieldlen
|
||||
msql_fieldtype
|
||||
msql_fieldflags
|
||||
msql_regcase
|
||||
/* for downwards compatability */
|
||||
msql_selectdb
|
||||
msql_createdb
|
||||
msql_dropdb
|
||||
msql_freeresult
|
||||
msql_numfields
|
||||
msql_numrows
|
||||
msql_listdbs
|
||||
msql_listtables
|
||||
msql_listfields
|
||||
msql_dbname
|
||||
msql_tablename
|
||||
|
||||
ldap_functions
|
||||
ldap_connect
|
||||
ldap_bind
|
||||
ldap_unbind
|
||||
ldap_read
|
||||
ldap_list
|
||||
ldap_search
|
||||
ldap_free_result
|
||||
ldap_count_entries
|
||||
ldap_first_entry
|
||||
ldap_next_entry
|
||||
ldap_get_entries
|
||||
ldap_free_entry
|
||||
ldap_first_attribute
|
||||
ldap_next_attribute
|
||||
ldap_get_attributes
|
||||
ldap_get_values
|
||||
ldap_get_dn
|
||||
ldap_dn2ufn
|
||||
ldap_add
|
||||
ldap_delete
|
||||
ldap_modify
|
||||
|
||||
gd_functions
|
||||
imagearc
|
||||
imagechar
|
||||
imagecharup
|
||||
imagecolorallocate
|
||||
imagecolorclosest
|
||||
imagecolorexact
|
||||
imagecolortransparent
|
||||
imagecopyresized
|
||||
imagecreate
|
||||
imagecreatefromgif
|
||||
imagedestroy
|
||||
imagefill
|
||||
imagefilledpolygon
|
||||
imagefilledrectangle
|
||||
imagefilltoborder
|
||||
imagegif
|
||||
imageinterlace
|
||||
imageline
|
||||
imagepolygon
|
||||
imagerectangle
|
||||
imagesetpixel
|
||||
imagestring
|
||||
imagestringup
|
||||
imagesx
|
||||
imagesy
|
||||
|
||||
filepro_functions
|
||||
filepro
|
||||
filepro_rowcount
|
||||
filepro_fieldname
|
||||
filepro_fieldtype
|
||||
filepro_fieldwidth
|
||||
filepro_fieldcount
|
||||
filepro_retrieve
|
||||
|
||||
dbm_functions
|
||||
dblist
|
||||
dbmopen
|
||||
dbmclose
|
||||
dbminsert
|
||||
dbmfetch
|
||||
dbmreplace
|
||||
dbmexists
|
||||
dbmdelete
|
||||
dbmfirstkey
|
||||
dbmnextkey
|
||||
|
||||
dbase_functions
|
||||
dbase_open
|
||||
dbase_create
|
||||
dbase_close
|
||||
dbase_numrecords
|
||||
dbase_numfields
|
||||
dbase_add_record
|
||||
dbase_get_record
|
||||
dbase_delete_record
|
||||
dbase_pack
|
||||
|
||||
calendar_functions
|
||||
jdtogregorian
|
||||
gregoriantojd
|
||||
jdtojulian
|
||||
juliantojd
|
||||
jdtojewish
|
||||
jewishtojd
|
||||
jdtofrench
|
||||
frenchtojd
|
||||
jddayofweek
|
||||
jdmonthname
|
||||
|
||||
adabas_functions
|
||||
(int) ada_afetch($result_id, $rownumber, $result array)
|
||||
(int) ada_autocommit($connection_id, $OnOff)
|
||||
(void) ada_close($connection_id)
|
||||
ada_closeall
|
||||
(int) ada_commit($connection_id)
|
||||
(int) ada_connect($dsn, $user, $password)
|
||||
(int) ada_exec($connection_id, $query_string)
|
||||
(int) ada_fetchrow($result_id, $row?number)
|
||||
ada_fieldlen
|
||||
(string) ada_fieldname($result_id, $field_number)
|
||||
(string) ada_fieldtype($result_id, $field)
|
||||
(int) ada_freeresult($result_id)
|
||||
(int) ada_numfields($result_id)
|
||||
(int) ada_numrows($result_id)
|
||||
(string) ada_result($result_id, $field)
|
||||
(int) ada_resultall($result_id, $format)
|
||||
(int) ada_rollback($connection_id)
|
||||
***(int) ada_fieldnum($result_id, $field_name) (this function is not in adabase.c
|
||||
|
||||
crypt_functions
|
||||
crypt
|
||||
|
||||
mysql_functions
|
||||
mysql_connect
|
||||
mysql_pconnect
|
||||
mysql_close
|
||||
mysql_select_db
|
||||
mysql_create_db
|
||||
mysql_drop_db
|
||||
mysql_query
|
||||
mysql
|
||||
mysql_list_dbs
|
||||
mysql_list_tables
|
||||
mysql_list_fields
|
||||
mysql_affected_rows
|
||||
mysql_insert_id
|
||||
mysql_result
|
||||
mysql_num_rows
|
||||
mysql_num_fields
|
||||
mysql_fetch_row
|
||||
mysql_fetch_array
|
||||
mysql_fetch_object
|
||||
mysql_data_seek
|
||||
mysql_fetch_lengths
|
||||
mysql_fetch_field
|
||||
mysql_field_seek
|
||||
mysql_free_result
|
||||
mysql_fieldname
|
||||
mysql_fieldtable
|
||||
mysql_fieldlen
|
||||
mysql_fieldtype
|
||||
mysql_fieldflags
|
||||
/* for downwards compatability */
|
||||
mysql_selectdb
|
||||
mysql_createdb
|
||||
mysql_dropdb
|
||||
mysql_freeresult
|
||||
mysql_numfields
|
||||
mysql_numrows
|
||||
mysql_listdbs
|
||||
mysql_listtables
|
||||
mysql_listfields
|
||||
mysql_dbname
|
||||
mysql_tablename
|
||||
|
||||
oracle_functions
|
||||
ora_close
|
||||
ora_commit
|
||||
ora_commitoff
|
||||
ora_commiton
|
||||
ora_error
|
||||
ora_errorcode
|
||||
ora_exec
|
||||
ora_fetch
|
||||
ora_getcolumn
|
||||
ora_logoff
|
||||
ora_logon
|
||||
ora_open
|
||||
ora_parse
|
||||
ora_rollback
|
||||
|
||||
pgsql_functions
|
||||
pg_connect
|
||||
pg_pconnect
|
||||
pg_close
|
||||
pg_dbname
|
||||
pg_errormessage
|
||||
pg_options
|
||||
pg_port
|
||||
pg_tty
|
||||
pg_host
|
||||
pg_exec
|
||||
pg_numrows
|
||||
pg_numfields
|
||||
pg_fieldname
|
||||
pg_fieldsize
|
||||
pg_fieldtype
|
||||
pg_fieldnum
|
||||
pg_result
|
||||
pg_fieldprtlen
|
||||
pg_getlastoid
|
||||
pg_freeresult
|
||||
pg_locreate
|
||||
pg_lounlink
|
||||
pg_loopen
|
||||
pg_loclose
|
||||
pg_loread
|
||||
pg_lowrite
|
||||
pg_loreadall
|
||||
|
||||
sybase_functions
|
||||
sybase_connect
|
||||
sybase_pconnect
|
||||
sybase_close
|
||||
sybase_select_db
|
||||
sybase_query
|
||||
sybase_free_result
|
||||
sybase_get_last_message
|
||||
sybase_num_rows
|
||||
sybase_num_fields
|
||||
sybase_fetch_row
|
||||
sybase_fetch_array
|
||||
sybase_fetch_object
|
||||
sybase_data_seek
|
||||
sybase_fetch_field
|
||||
sybase_field_seek
|
||||
sybase_result
|
||||
|
||||
sybase_old_functions
|
||||
sybsql_seek
|
||||
sybsql_exit
|
||||
sybsql_dbuse
|
||||
sybsql_query
|
||||
sybsql_isrow
|
||||
sybsql_result
|
||||
sybsql_connect
|
||||
sybsql_nextrow
|
||||
sybsql_numrows
|
||||
sybsql_getfield
|
||||
sybsql_numfields
|
||||
sybsql_fieldname
|
||||
sybsql_result_all
|
||||
sybsql_checkconnect
|
||||
|
||||
@@ -1,159 +0,0 @@
|
||||
Installation Instructions for PHP3
|
||||
----------------------------------
|
||||
|
||||
For the impatient here is a quick set of steps that will build PHP3
|
||||
as an Apache module for Apache 1.3.0 with MySQL support. A more verbose
|
||||
explanation follows.
|
||||
|
||||
|
||||
QUICK INSTALL
|
||||
|
||||
gunzip apache_1.3.x.tar.gz
|
||||
tar xvf apache_1.3.x.tar
|
||||
gunzip php-3.0.x.tar.gz
|
||||
tar xvf php-3.0.x.tar
|
||||
cd apache_1.3.x
|
||||
./configure --prefix=/www
|
||||
cd ../php-3.0.x
|
||||
./configure --with-mysql --with-apache=../apache_1.3.x --enable-track-vars
|
||||
make
|
||||
make install
|
||||
cd ../apache_1.3.x
|
||||
./configure --prefix=/www --activate-module=src/modules/php4/libphp4.a
|
||||
(The above line is correct! Yes, we know libphp4.a does not exist at this
|
||||
stage. It isn't supposed to. It will be created.)
|
||||
make
|
||||
(you should now have an httpd binary which you can copy to your Apache bin dir)
|
||||
cd ../php-3.0.x
|
||||
cp php3.ini-dist /usr/local/lib/php3.ini
|
||||
You can edit /usr/local/lib/php3.ini file to set PHP options.
|
||||
Edit your httpd.conf or srm.conf file and add:
|
||||
AddType application/x-httpd-php3 .php3
|
||||
|
||||
|
||||
VERBOSE INSTALL
|
||||
|
||||
Installing PHP3 can be done in four simple steps:
|
||||
|
||||
1. Unpack your distribution file.
|
||||
|
||||
You will have downloaded a file named something like php3xn.tar.gz.
|
||||
Unzip this file with a command like: gunzip php3xn.tar.gz
|
||||
|
||||
Next you have to untar it with: tar -xvf php3xn.tar
|
||||
|
||||
This will create a php-3.0.x directory. cd into this new directory.
|
||||
|
||||
2. Configure PHP3.
|
||||
|
||||
You now have to choose the options you would like. There are quite
|
||||
a few of them. To see a list, type: ./configure --help
|
||||
|
||||
You can also use the supplied 'setup' script, which will ask you
|
||||
a series of questions and automatically run the configure script
|
||||
for you.
|
||||
|
||||
The only options that you are likely to want to use are the ones in
|
||||
the last section entitled, "--enable and --with options recognized:"
|
||||
|
||||
A popular choice is to build the Apache module version. You need
|
||||
to know where the source code directory for your Apache server is
|
||||
located. Then use an option like: --with-apache=/usr/local/src/apache
|
||||
if that is your Apache source code directory. If you only specify
|
||||
--with-apache, then it will default to look for your Apache source
|
||||
in /usr/local/etc/httpd.
|
||||
|
||||
NOTE: The directory you specify should be the top-level of the
|
||||
unpacked Apache (or Stronghold) distribution. The configure program
|
||||
will automatically look for httpd.h in different directories under that
|
||||
location depending on which version of Apache, including Stronghold,
|
||||
you are running.
|
||||
|
||||
For MySQL support, since newer versions of MySQL installs its various
|
||||
components under /usr/local, this is the default. If you have
|
||||
changed the location you can specify it with: --with-mysql=/opt/local
|
||||
for example. Otherwise just use: --with-mysql
|
||||
|
||||
*NOTE* If you are using Apache 1.3b6 or later, you should run the
|
||||
Apache Configure script at least once before compiling PHP. It
|
||||
doesn't matter how you have Apache configured at this point.
|
||||
|
||||
3. Compile and install the files. Simply type: make install
|
||||
|
||||
For the Apache module version this will copy the appropriate files
|
||||
to the src/modules/php4 directory in your Apache distribution if
|
||||
you are using Apache 1.3.x. If you are still running Apache 1.2.x
|
||||
these files will be copied directly to the main src directory.
|
||||
|
||||
For Apache 1.3b6 and later, you can use the new APACI configuration
|
||||
mechanism. To automatically build Apache with PHP support, use:
|
||||
|
||||
cd apache_1.3.x
|
||||
./configure --prefix=/<path>/apache \
|
||||
--activate-module=src/modules/php4/libphp4.a
|
||||
make
|
||||
make install
|
||||
|
||||
If you do not wish to use this new configuration tool, the old
|
||||
install procedure (src/Configure) will work fine.
|
||||
|
||||
If you are using the old Apache ./Configure script, you will have to
|
||||
edit the Apache src/Configuration file manually. If you do not have
|
||||
this file, copy Configuration.tmpl to Configuration.
|
||||
|
||||
For Apache 1.3.x add:
|
||||
|
||||
AddModule modules/php4/libphp4.a
|
||||
|
||||
For Apache 1.3.x don't do anything else. Just add this line and then
|
||||
run "./Configure" followed by "make".
|
||||
|
||||
For Apache 1.2.x add:
|
||||
|
||||
Module php3_module mod_php4.o
|
||||
|
||||
For Apache 1.2.x you will also have to look in the libphp4.module file,
|
||||
which was copied to the src directory. The EXTRA_LIBS line in the Apache
|
||||
Configuration file needs to be set to use the same libs as specified on
|
||||
the LIBS line in libphp4.module. You also need to make sure to add
|
||||
"-L." to the beginning of the EXTRA_LIBS line.
|
||||
|
||||
So, as an example, your EXTRA_LIBS line might look like:
|
||||
|
||||
EXTRA_LIBS=-L. -lphp3 -lgdbm -ldb -L/usr/local/mysql/lib -lmysqlclient
|
||||
|
||||
NOTE: You should not enclose the EXTRA_LIBS line in double-quotes, as it
|
||||
is in the libphp4.module file.
|
||||
|
||||
Also, look at the RULE_WANTHSREGEX setting in the libphp4.module file
|
||||
and set the WANTHSREGEX directive accordingly in your Configuration file.
|
||||
This last step applies to versions of Apache prior to 1.3b3.
|
||||
|
||||
This is a bit of a hassle, but should serve as incentive to move to
|
||||
Apache 1.3.x where this step has been eliminated.
|
||||
|
||||
Once you are satisfied with your Configuration settings, type: ./Configure
|
||||
If you get errors, chances are that you forgot a library or made a typo
|
||||
somewhere. Re-edit Configuration and try again. If it goes well,
|
||||
type: make
|
||||
|
||||
4. Setting up the server.
|
||||
|
||||
You should now have a new httpd binary. Shut down your existing server,
|
||||
if you have one, and copy this new binary overtop of it. Perhaps make
|
||||
a backup of your previous one first. Then edit your conf/srm.conf file
|
||||
and add the line:
|
||||
|
||||
AddType application/x-httpd-php3 .php3
|
||||
|
||||
There is also an interesting feature which can be quite instructive and
|
||||
helpful while debugging. That is the option of having colour syntax
|
||||
highlighting. To enable this, add the following line:
|
||||
|
||||
AddType application/x-httpd-php3-source .phps
|
||||
|
||||
Any file ending in .phps will now be displayed with full colour syntax
|
||||
highlighting instead of being executed.
|
||||
|
||||
When you are finished making changes to your srm.conf file, you can
|
||||
start up your server.
|
||||
@@ -1,64 +0,0 @@
|
||||
--------------------------------------------------------------------
|
||||
Copyright (c) 1998 The PHP Development Team. All rights reserved.
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Commercial redistribution of larger works derived from, or
|
||||
works which bundle PHP, requires written permission from the
|
||||
PHP Development Team. You may charge a fee for the physical
|
||||
act of transferring a copy, and must make it clear that the
|
||||
fee being charged is for the distribution, and not for the
|
||||
software itself. You may, at your option, offer warranty
|
||||
protection in exchange for a fee.
|
||||
|
||||
2. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
3. 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.
|
||||
|
||||
4. All advertising materials mentioning features or use of this
|
||||
software must display the following acknowledgment:
|
||||
"This product includes software written by the PHP Development
|
||||
Team"
|
||||
|
||||
5. The name "PHP" must not be used to endorse or promote products
|
||||
derived from this software without prior written permission
|
||||
from the PHP Development Team. 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.
|
||||
|
||||
6. Redistributions of any form whatsoever must retain the following
|
||||
acknowledgment:
|
||||
"This product includes software written by the PHP Development
|
||||
Team".
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
|
||||
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
|
||||
DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
--------------------------------------------------------------------
|
||||
|
||||
This software consists of voluntary contributions made by many
|
||||
individuals on behalf of the PHP Development Team.
|
||||
|
||||
The PHP Development Team can be contacted via Email at core@php.net.
|
||||
|
||||
For more information on the PHP Development Team and the PHP
|
||||
project, please see <http://www.php.net>.
|
||||
|
||||
-231
@@ -1,231 +0,0 @@
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP HTML Embedded Scripting Language Version 4.0 |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Copyright (c) 1997-1999 PHP Development Team (See Credits file) |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | This program is free software; you can redistribute it and/or modify |
|
||||
# | it under the terms of one of the following licenses: |
|
||||
# | |
|
||||
# | A) 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. |
|
||||
# | |
|
||||
# | B) the PHP License as published by the PHP Development Team and |
|
||||
# | included in the distribution in the file: LICENSE |
|
||||
# | |
|
||||
# | 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 both licenses referred to here. |
|
||||
# | If you did not, or have any questions about PHP licensing, please |
|
||||
# | contact core@php.net. |
|
||||
# +----------------------------------------------------------------------+
|
||||
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
bindir = @bindir@
|
||||
|
||||
top_builddir = .
|
||||
|
||||
ZEND_DIR = $(srcdir)/libzend
|
||||
SUBDIRS=libzend ext @TSRM_DIR@
|
||||
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
||||
LN_S = @LN_S@
|
||||
CC = @CC@
|
||||
AR = ar rc
|
||||
BINNAME = @BINNAME@
|
||||
INSTALL_IT = @INSTALL_IT@
|
||||
EXTRA_LIBS = @EXTRA_LIBS@
|
||||
EXT_LIBS = @EXT_LIBS@
|
||||
INCLUDES = @INCLUDES@
|
||||
INCLUDE = -I$(srcdir) -I. -I$(ZEND_DIR) -I$(srcdir)/TSRM $(INCLUDES)
|
||||
PROF_CFLAGS =
|
||||
CFLAGS_SHLIB = @CFLAGS_SHLIB@
|
||||
LDFLAGS_SHLIB = @LDFLAGS_SHLIB@
|
||||
LDFLAGS_SHLIB_EXPORT = @LDFLAGS_SHLIB_EXPORT@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CFLAGS = @CFLAGS@ $(CFLAGS_SHLIB) $(CPPFLAGS) $(INCLUDE) @DEBUG_CFLAGS@ @STRONGHOLD@ $(PROF_CFLAGS)
|
||||
LDFLAGS = @RPATHS@ @LDFLAGS@ $(LDFLAGS_SHLIB) $(LDFLAGS_SHLIB_EXPORT) -L$(ZEND_DIR)
|
||||
REGCFLAGS = $(CFLAGS)
|
||||
RANLIB = @RANLIB@
|
||||
YACC = @YACC@
|
||||
MAINT = @MAINT@
|
||||
APXS = @APXS@
|
||||
APXS_LDFLAGS = $(EXTRA_LIBS) $(LIBS)
|
||||
APXS_EXP = @APXS_EXP@
|
||||
WARNING_LEVEL = @WARNING_LEVEL@
|
||||
LEX_CFLAGS = -w$(WARNING_LEVEL) @LEX_CFLAGS@
|
||||
|
||||
SOURCE = main.c internal_functions.c snprintf.c php3_sprintf.c \
|
||||
configuration-parser.c configuration-scanner.c request_info.c \
|
||||
safe_mode.c fopen-wrappers.c php3_realpath.c alloca.c output.c \
|
||||
php_ini.c SAPI.c cgi_main.c rfc1867.c
|
||||
OBJS = main.o internal_functions.o snprintf.o php3_sprintf.o \
|
||||
configuration-parser.o configuration-scanner.o request_info.o \
|
||||
safe_mode.o fopen-wrappers.o php3_realpath.o alloca.o output.o \
|
||||
php_ini.o SAPI.o cgi_main.o rfc1867.o
|
||||
|
||||
PHPLIBS = -Llibzend -lzend -Lext -lphpext
|
||||
LIBS = $(PHPLIBS) $(EXTRA_LIBS) @LIBS@
|
||||
|
||||
all: $(BINNAME)
|
||||
|
||||
all-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-depend-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
for subdir in $(SUBDIRS); do \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
(cd $$subdir && $(MAKE) $$target) || fail=yes; \
|
||||
done && test -z "$$fail"
|
||||
|
||||
# CGI binary or fhttpd module
|
||||
php: all-recursive $(OBJS) @REGEX_LIB@ @FHTTPD_LIB@ @TSRM_LIB@
|
||||
$(CC) $(CFLAGS) -o $(BINNAME) $(LDFLAGS) $(OBJS) $(LIBS)
|
||||
|
||||
# Apache modules
|
||||
libphp4.a libmodphp4.a: all-recursive $(OBJS) @REGEX_LIB@
|
||||
$(AR) $@.tmp $(OBJS)
|
||||
$(srcdir)/scripts/armerge $@ $@.tmp ext/libphpext.a libzend/libzend.a @TSRM_LIB@
|
||||
@rm -f $@.tmp
|
||||
$(RANLIB) $(BINNAME)
|
||||
|
||||
# Apache modules
|
||||
libmodphp4-so.a: all-recursive $(OBJS) @REGEX_LIB@
|
||||
$(AR) $@.tmp $(OBJS)
|
||||
$(srcdir)/scripts/armerge $@ $@.tmp ext/libphpext.a libzend/libzend.a @TSRM_LIB@
|
||||
@rm -f $@.tmp
|
||||
$(RANLIB) libmodphp4-so.a
|
||||
|
||||
# Apache 1.3 shared module
|
||||
libphp4.so: $(srcdir)/mod_php4.c libmodphp4-so.a @REGEX_LIB@
|
||||
-@test -f ./mod_php4.c || test -L ./mod_php4.c || $(LN_S) $(srcdir)/mod_php4.c ./mod_php4.c
|
||||
-@test -f ./mod_php4.c || test -h ./mod_php4.c || $(LN_S) $(srcdir)/mod_php4.c ./mod_php4.c
|
||||
$(APXS) $(INCLUDE) -c -o libphp4.so @RPATHS@ ./mod_php4.c libmodphp4-so.a $(APXS_LDFLAGS) $(APXS_EXP)
|
||||
|
||||
regex/libregex.a:
|
||||
(cd regex; $(MAKE) lib)
|
||||
|
||||
configuration-parser.h configuration-parser.c: $(srcdir)/configuration-parser.y
|
||||
bison -p cfg -v -d $(srcdir)/configuration-parser.y -o configuration-parser.c
|
||||
|
||||
configuration-scanner.o: configuration-scanner.c
|
||||
$(CC) $(CFLAGS) $(LEX_CFLAGS) -c configuration-scanner.c
|
||||
|
||||
configuration-scanner.c: $(srcdir)/configuration-scanner.l
|
||||
flex -Pcfg -oconfiguration-scanner.c -i $(srcdir)/configuration-scanner.l
|
||||
|
||||
clean: clean-recursive
|
||||
-rm -f libphp4.a libmodphp4.a libphp4.so php *.o
|
||||
-rm -f test/php.desc test/php.in test/php.out test/php.test
|
||||
-rm -f test/a.tmp test/b.tmp test/test.dbm*
|
||||
|
||||
distclean: clean distclean-recursive
|
||||
-rm -f *-parser.[ch] *-scanner.c *.output
|
||||
-rm -f config.status config.cache config.log
|
||||
-rm -f Makefile Makefile.depend php_config.h build-defs.h
|
||||
-rm -f libphp4.module stamp-h
|
||||
-rm -f regex/*.o regex/*.a regex/*.ih
|
||||
-rm -f doc/checkdoc doc/funcparse doc/version.ent
|
||||
-rm -f do-conf test/test.log
|
||||
-rm -f doc/Makefile regex/Makefile
|
||||
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
|
||||
dist: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
tar chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
|
||||
distdir:
|
||||
-rm -rf $(distdir)
|
||||
files=`echo *` ;\
|
||||
mkdir $(distdir) ;\
|
||||
for file in $$files ; do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file ; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
(cd $(distdir) ; $(MAKE) distclean)
|
||||
cd $(distdir)/libzend ;\
|
||||
flex -Pzend -ozend-scanner.c -i zend-scanner.l ;\
|
||||
bison -p zend -v -d zend-parser.y -o zend-parser.c
|
||||
cd $(distdir) ;\
|
||||
flex -Pcfg -oconfiguration-scanner.c -i configuration-scanner.l ;\
|
||||
bison -p cfg -v -d configuration-parser.y -o configuration-parser.c
|
||||
find $(distdir) -name CVS -o -name .cvsignore | xargs rm -rf
|
||||
|
||||
|
||||
maintainer-clean-depend: maintainer-clean-depend-recursive
|
||||
|
||||
bench: $(BINNAME)
|
||||
./$(BINNAME) -c. tests/bench.phtml
|
||||
|
||||
# can't use a single rule for this because 'test' is a directory
|
||||
test: regression
|
||||
regression check: $(BINNAME)
|
||||
cd test && ./testall
|
||||
|
||||
config.status: configure
|
||||
./config.status --recheck
|
||||
|
||||
build-defs.h php_config.h: stamp-h
|
||||
stamp-h: php_config.h.in config.status
|
||||
CONFIG_FILES='build-defs.h stamp-h' ./config.status
|
||||
|
||||
Makefile: Makefile.in config.status
|
||||
CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
|
||||
|
||||
#
|
||||
# You must use '--enable-maintainer-mode' with configure to enable
|
||||
# these rules, which requires autoconf be installed.
|
||||
#
|
||||
configure: @MAINT@ configure.in aclocal.m4
|
||||
cd $(srcdir) && autoconf
|
||||
|
||||
php_config.h.in: @MAINT@ stamp-h.in
|
||||
stamp-h.in: configure.in aclocal.m4 acconfig.h
|
||||
cd ${srcdir} && autoheader && touch ${srcdir}/stamp-h.in
|
||||
|
||||
install: $(BINNAME)
|
||||
$(INSTALL_IT)
|
||||
|
||||
indent: clean
|
||||
indent -v -kr -cli4 -ts4 \
|
||||
-T pval -T HashTable -T Bucket -T Token -T TokenCache -T TokenCacheManager \
|
||||
-T switch_expr -T internal_function -T control_structure_data \
|
||||
-T MemoryHashTable -T MemoryBucket \
|
||||
-T pvalue_value -T Stack *.c *.h
|
||||
rm -f *~
|
||||
|
||||
.c.o:
|
||||
@rm -f $@
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
# @bn=`echo $@ | sed -e 's#functions/##'`; test -f $@ || \
|
||||
# (test "$@" != "$$bn" && test -f "$$bn" && mv $$bn $@)
|
||||
|
||||
parser-scanner: configuration-parser.c configuration-scanner.c
|
||||
|
||||
depend: parser-scanner
|
||||
$(CC) $(CFLAGS) -MM $(SOURCE) | perl -pe 's|regex/regex.h||;' > Makefile.depend
|
||||
$(CC) $(CFLAGS) -MM $(FUNCTIONS_SOURCE) | perl -pe 's|^(.+\.o)|functions/$$1|; s|regex/regex.h||;' >> Makefile.depend
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 4
|
||||
# End:
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
QNX4 Installation Notes
|
||||
-----------------------
|
||||
|
||||
NOTE: General installation instructions are in the INSTALL file
|
||||
|
||||
|
||||
1. To compile and test PHP3 you have to grab, compile and install:
|
||||
- GNU dbm library or another db library;
|
||||
- GNU bison (1.25 or later; 1.25 tested);
|
||||
- GNU flex (any version supporting -o and -P options; 2.5.4 tested);
|
||||
- GNU diffutils (any version supporting -w option; 2.7 tested);
|
||||
|
||||
2. To use CVS version you may need also:
|
||||
- GNU CVS (1.9 tested);
|
||||
- GNU autoconf (2.12 tested);
|
||||
- GNU m4 (1.3 or later preferable; 1.4 tested);
|
||||
|
||||
3. To run configure define -lunix in command line:
|
||||
LDFLAGS=-lunix ./configure
|
||||
|
||||
4. To use Sybase SQL Anywhere define ODBC_QNX and CUSTOM_ODBC_LIBS in
|
||||
command line and run configure with --with-custom-odbc:
|
||||
CFLAGS=-DODBC_QNX LDFLAGS=-lunix CUSTOM_ODBC_LIBS="-ldblib -lodbc" ./configure --with-custom-odbc=/usr/lib/sqlany50
|
||||
If you have SQL Anywhere version 5.5.00, then you have to add
|
||||
CFLAGS=-DSQLANY_BUG
|
||||
to workaround its SQLFreeEnv() bug. Other versions has not been tested,
|
||||
so try without this flag first.
|
||||
|
||||
5. To build the Apache module, you may have to hardcode an include path for
|
||||
alloc.h in your Apache base directory:
|
||||
- APACHE_DIRECTORY/src/httpd.h:
|
||||
change #include "alloc.h"
|
||||
to #include "APACHE_DIRECTORY/src/alloc.h"
|
||||
Unless you want to use system regex library, you have to hardcode also
|
||||
a path to regex.h:
|
||||
- APACHE_DIRECTORY/src/conf.h:
|
||||
change #include <regex.h>
|
||||
to #include "APACHE_DIRECTORY/src/regex/regex.h"
|
||||
I don't know so far why this required for QNX, may be it is Watcom
|
||||
compiler problem.
|
||||
|
||||
If you building Apache module with SQL Anywhere support, you'll get
|
||||
symbol conflict with BOOL. It is defined in Apache (httpd.h) and in
|
||||
SQL Anywhere (odbc.h). This has nothing to do with PHP, so you have to
|
||||
fix it yourself someway.
|
||||
|
||||
6. With above precautions, it should compile as is and pass regression
|
||||
tests completely:
|
||||
make
|
||||
make check
|
||||
make install
|
||||
|
||||
Don't bother me unless you really sure you made that all but it
|
||||
still doesn't work.
|
||||
|
||||
June 28, 1998
|
||||
Igor Kovalenko -- owl@infomarket.ru
|
||||
@@ -1,59 +0,0 @@
|
||||
Windows 95/NT Specific Notes on Compilation
|
||||
|
||||
Windows compilation has only been tested with Microsoft Visual C++
|
||||
Version 5 Standard Edition. The PHP executable has only had limited
|
||||
testing under Windows 95. SAFE MODE and any User or Group functionality
|
||||
has not been ported/tested.
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
Compiling PHP with MSVC5
|
||||
|
||||
There are three msvc workspaces provided with this distribution. The one
|
||||
most people will use is php3.dsw. This contains project files for two
|
||||
versions on PHP, one with mySQL compiled internaly, and one without (both
|
||||
have ODBC internaly compiled). It also contains all the modules.
|
||||
|
||||
The next workspace is php3extras.dsw. This project contains the converter
|
||||
and a program called phpwatch, which is a simple program to watch debugger
|
||||
output under windows. The 'socket' program is also available from the php
|
||||
site, which is a better alternative to phpwatch.
|
||||
|
||||
The third workspace is php3sapi.dsw. These projects are experimental and
|
||||
will probably not compile most of the time. It contains preliminary work
|
||||
on the server api's for windows.
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
Base Configuration and Configuration Issues
|
||||
|
||||
*The base configuration for the windows php version contains odbc
|
||||
support. Support for other database modules will be provided as external dll files.
|
||||
*ODBC can be used to connect to many of the databases previously
|
||||
supported by php (though they can still be compiled in if you have
|
||||
the libraries!)
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
Makefiles
|
||||
|
||||
Be sure to edit any windows makefile and change the include directories
|
||||
to be appropriate for your system.
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
CGI Version
|
||||
|
||||
The makefile for the cgi version of php is located in the win32
|
||||
subdirectory of the php source tree. This make file is specificaly
|
||||
for Visual C++ V5.
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
ISAPI/NSAPI/WSAPI/Apache Versions
|
||||
|
||||
These versions are not yet working. They are located in the php3sapi.dsw
|
||||
workspace.
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
Other Libraries
|
||||
|
||||
See the php faq at php.net for information on where to obtain the various
|
||||
libraries needed to compile some modules.
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
$Id$
|
||||
|
||||
+----
|
||||
| * -- to be done
|
||||
| ? -- to be done sometime if possible
|
||||
| P -- in progress (name should appear in parentheses after task)
|
||||
| D -- delayed until later date (specify in parentheses after task)
|
||||
| U -- done, untested
|
||||
| V -- done
|
||||
+----
|
||||
|
||||
Configuration Issues
|
||||
--------------------
|
||||
* properly detect dbm routines when they're in libc
|
||||
* add the appropriate #define magic for memmove and friends (see
|
||||
GNU autoconf info pages for details)
|
||||
* make it possible to disable support for some extensions (gd, dbm)
|
||||
* make it possible to build selected extensions so they are
|
||||
dynamically-loadable
|
||||
|
||||
Core Language Issues
|
||||
--------------------
|
||||
* go through PHP2's php.h and see how each special #define might be
|
||||
applied/supported in PHP3
|
||||
* move Treatdata() to language-scanner.lex where hash_environment()
|
||||
is called including a decision about priority of variables and moving
|
||||
Treatdata() to use hash_add() instead of hash_update() for insertions
|
||||
to the symbol table.
|
||||
* go through FIXME and XXX lines (egrep 'FIXME|XXX' *.[ch])
|
||||
* make lexer and parser thread-safe
|
||||
* verify that binary strings are handled correctly
|
||||
V don't evaluate truth expressions more than once
|
||||
V make unset() work on arrays (tricky)
|
||||
|
||||
Core Functions
|
||||
--------------
|
||||
* go through all file functions and make sure they are opened in binary
|
||||
mode in win32 if needed (ie copy)
|
||||
* go through all functions and look at PHP_SAFE_MODE issues
|
||||
* have a look at return codes of fsockopen() function - we should
|
||||
probably RETURN_FALSE and then set an error code somewhere (Rasmus)
|
||||
* go through FIXME and XXX lines (egrep 'FIXME|XXX' functions/*.[ch])
|
||||
* add user-level flock() implementation to let people lock and unlock files
|
||||
* add "'" modifier to sprintf to group thousands by comma
|
||||
* Add an improved eval() that doesn't "leak"
|
||||
? sorting of objects with a user-defined comparison function (like Perl)
|
||||
(this shouldn't be expected before 3.1, if at all).
|
||||
|
||||
|
||||
Extensions
|
||||
----------
|
||||
* add version strings for all extensions
|
||||
* Oracle persistent connections
|
||||
U gd support for windows
|
||||
* Illustra support (APIS)
|
||||
? CQL++ support (http://www.cql.com/)
|
||||
? GNU SQL support (does anybody actually use this?)
|
||||
? DB2 support (http://www.sleepycat.com/)
|
||||
? Shore support (http://www.cs.wisc.edu/shore/)
|
||||
? PGP Interface (use PGPlib?)
|
||||
? more Perl-like regex handling?
|
||||
|
||||
Server Support
|
||||
--------------
|
||||
P ISAPI (Shane)
|
||||
* process cookies
|
||||
* blocking functions
|
||||
* make sure it's Microsoft-clean so it can be used with other ISAPI
|
||||
implementations
|
||||
* WSAPI
|
||||
* NSAPI
|
||||
* process cookies
|
||||
* check POST method handling code
|
||||
* use Netscape memory allocation inside emalloc() and company
|
||||
* FastCGI support - see http://fastcgi.idle.com/
|
||||
|
||||
Win32 Specific
|
||||
--------------
|
||||
* implement some kind of syslog->file log support for win95.
|
||||
* change all file open/read/write functions from c library to win32
|
||||
api file functions. The win32 api functions handle both disk files
|
||||
and network files. This will allow include and require to use http
|
||||
or ftp files as the unix version does, and do away with my
|
||||
workaround to support this. (3.1?)
|
||||
* implement symlinks via windows shell links (shortcuts). This will
|
||||
work only at the script level and is not a c language level port.
|
||||
|
||||
Testing
|
||||
-------
|
||||
* truss/strace a typical PHP request and see if there are some system
|
||||
calls that could be optimized out
|
||||
* verify that regression tests exist for all core functions
|
||||
|
||||
Miscellaneous
|
||||
-------------
|
||||
* remove hard-coded compilation options
|
||||
? locale issues - funny things happen in PHP2 when the locale is set to
|
||||
use , instead of . as the decimal seperator. ie. 1.5+1.5 = 1
|
||||
? SSI->PHP3 conversion script
|
||||
? SQL-based access logging (start with examples/log-*.php3)
|
||||
@@ -1,4 +0,0 @@
|
||||
## process this file with automake to produce Makefile.am
|
||||
AUTOMAKE_OPTIONS=foreign
|
||||
lib_LIBRARIES=libtsrm.a
|
||||
libtsrm_a_SOURCES = TSRM.c
|
||||
-392
@@ -1,392 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Thread Safe Resource Manager |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to the Zend license, that is bundled |
|
||||
| with this package in the file LICENSE. If you did not receive a |
|
||||
| copy of the Zend license, please mail us at zend@zend.com so we can |
|
||||
| send you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include "TSRM.h"
|
||||
#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;
|
||||
void (*ctor)(void *resource);
|
||||
void (*dtor)(void *resource);
|
||||
} tsrm_resource_type;
|
||||
|
||||
|
||||
/* The memory manager table */
|
||||
static tsrm_tls_entry **tsrm_tls_table;
|
||||
static int tsrm_tls_table_size;
|
||||
static ts_rsrc_id id_count;
|
||||
|
||||
/* The resource sizes table */
|
||||
static tsrm_resource_type *resource_types_table;
|
||||
static int resource_types_table_size;
|
||||
|
||||
|
||||
static MUTEX_T tsmm_mutex; /* thread-safe memory manager mutex */
|
||||
|
||||
/* Debug support */
|
||||
static int tsrm_debug(const char *format, ...);
|
||||
static int tsrm_debug_status;
|
||||
|
||||
|
||||
/* Startup TSRM (call once for the entire process) */
|
||||
TSRM_FUNC int tsrm_startup(int expected_threads, int expected_resources, int debug_status)
|
||||
{
|
||||
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) {
|
||||
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) {
|
||||
free(tsrm_tls_table);
|
||||
return 0;
|
||||
}
|
||||
|
||||
tsmm_mutex = tsrm_mutex_alloc();
|
||||
|
||||
tsrm_debug_status = debug_status;
|
||||
|
||||
tsrm_debug("Started up TSRM, %d expected threads, %d expected resources\n", expected_threads, expected_resources);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Shutdown TSRM (call once for the entire process) */
|
||||
TSRM_FUNC void tsrm_shutdown()
|
||||
{
|
||||
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);
|
||||
}
|
||||
if (resource_types_table) {
|
||||
free(resource_types_table);
|
||||
}
|
||||
tsrm_mutex_free(tsmm_mutex);
|
||||
tsrm_debug("Shutdown TSRM\n");
|
||||
}
|
||||
|
||||
|
||||
/* allocates a new thread-safe-resource id */
|
||||
TSRM_FUNC ts_rsrc_id ts_allocate_id(size_t size, void (*ctor)(void *resource), void (*dtor)(void *resource))
|
||||
{
|
||||
ts_rsrc_id new_id;
|
||||
int i;
|
||||
|
||||
tsrm_debug("Obtaining a new resource id, %d bytes\n", size);
|
||||
|
||||
tsrm_mutex_lock(tsmm_mutex);
|
||||
|
||||
/* obtain a resource id */
|
||||
new_id = id_count++;
|
||||
tsrm_debug("Obtained resource id %d\n", new_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) {
|
||||
return -1;
|
||||
}
|
||||
resource_types_table_size = id_count;
|
||||
}
|
||||
resource_types_table[new_id].size = size;
|
||||
resource_types_table[new_id].ctor = ctor;
|
||||
resource_types_table[new_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->count = id_count;
|
||||
}
|
||||
p = p->next;
|
||||
}
|
||||
}
|
||||
tsrm_mutex_unlock(tsmm_mutex);
|
||||
|
||||
tsrm_debug("Successfully allocated new resource id %d\n", new_id);
|
||||
return new_id;
|
||||
}
|
||||
|
||||
|
||||
static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_T thread_id)
|
||||
{
|
||||
int i;
|
||||
|
||||
(*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;
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* fetches the requested resource for the current thread */
|
||||
void *ts_resource(ts_rsrc_id id)
|
||||
{
|
||||
THREAD_T thread_id = tsrm_thread_id();
|
||||
int hash_value;
|
||||
tsrm_tls_entry *thread_resources;
|
||||
void *resource;
|
||||
|
||||
tsrm_debug("Fetching resource id %d for thread %ld\n", 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);
|
||||
thread_resources = tsrm_tls_table[hash_value];
|
||||
} 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);
|
||||
thread_resources = thread_resources->next;
|
||||
break;
|
||||
}
|
||||
} while (thread_resources);
|
||||
}
|
||||
|
||||
resource = thread_resources->storage[id];
|
||||
|
||||
tsrm_mutex_unlock(tsmm_mutex);
|
||||
|
||||
tsrm_debug("Successfully fetched resource id %d for thread id %ld - %x\n", id, (long) thread_id, (long) resource);
|
||||
return resource;
|
||||
}
|
||||
|
||||
|
||||
/* frees all resources allocated for the current thread */
|
||||
void ts_free_thread()
|
||||
{
|
||||
THREAD_T thread_id = tsrm_thread_id();
|
||||
int hash_value;
|
||||
tsrm_tls_entry *thread_resources;
|
||||
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) {
|
||||
int i;
|
||||
|
||||
for (i=0; i<thread_resources->count; i++) {
|
||||
if (resource_types_table[i].dtor) {
|
||||
resource_types_table[i].dtor(thread_resources->storage[i]);
|
||||
}
|
||||
free(thread_resources->storage[i]);
|
||||
}
|
||||
free(thread_resources->storage);
|
||||
if (last) {
|
||||
last->next = thread_resources->next;
|
||||
} else {
|
||||
tsrm_tls_table[hash_value]=NULL;
|
||||
}
|
||||
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_FUNC THREAD_T tsrm_thread_id(void)
|
||||
{
|
||||
#ifdef WIN32
|
||||
return GetCurrentThreadId();
|
||||
#elif defined(PTHREADS)
|
||||
return pthread_self();
|
||||
#elif defined(NSAPI)
|
||||
return systhread_current();
|
||||
#elif defined(PI3WEB)
|
||||
return PIThread_getCurrent();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Allocate a mutex */
|
||||
TSRM_FUNC MUTEX_T tsrm_mutex_alloc( void )
|
||||
{
|
||||
MUTEX_T mutexp;
|
||||
|
||||
#ifdef WIN32
|
||||
mutexp = CreateMutex(NULL,FALSE,NULL);
|
||||
#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();
|
||||
#endif
|
||||
#ifdef THR_DEBUG
|
||||
printf("Mutex created thread: %d\n",mythreadid());
|
||||
#endif
|
||||
return( mutexp );
|
||||
}
|
||||
|
||||
|
||||
/* Free a mutex */
|
||||
TSRM_FUNC void tsrm_mutex_free( MUTEX_T mutexp )
|
||||
{
|
||||
if (mutexp) {
|
||||
#ifdef WIN32
|
||||
CloseHandle(mutexp);
|
||||
#elif defined(PTHREADS)
|
||||
free(mutexp);
|
||||
#elif defined(NSAPI)
|
||||
crit_terminate(mutexp);
|
||||
#elif defined(PI3WEB)
|
||||
PISync_delete(mutexp)
|
||||
#endif
|
||||
}
|
||||
#ifdef THR_DEBUG
|
||||
printf("Mutex freed thread: %d\n",mythreadid());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Lock a mutex */
|
||||
TSRM_FUNC int tsrm_mutex_lock( MUTEX_T mutexp )
|
||||
{
|
||||
//tsrm_debug("Mutex locked thread: %ld\n",tsrm_thread_id());
|
||||
#ifdef WIN32
|
||||
return WaitForSingleObject(mutexp,1000);
|
||||
#elif defined(PTHREADS)
|
||||
return pthread_mutex_lock(mutexp);
|
||||
#elif defined(NSAPI)
|
||||
return crit_enter(mutexp);
|
||||
#elif defined(PI3WEB)
|
||||
return PISync_lock(mutexp);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Unlock a mutex */
|
||||
TSRM_FUNC int tsrm_mutex_unlock( MUTEX_T mutexp )
|
||||
{
|
||||
//tsrm_debug("Mutex unlocked thread: %ld\n",tsrm_thread_id());
|
||||
#ifdef WIN32
|
||||
return ReleaseMutex(mutexp);
|
||||
#elif defined(PTHREADS)
|
||||
return pthread_mutex_unlock(mutexp);
|
||||
#elif defined(NSAPI)
|
||||
return crit_exit(mutexp);
|
||||
#elif defined(PI3WEB)
|
||||
return PISync_unlock(mutexp);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Debug support
|
||||
*/
|
||||
|
||||
static int tsrm_debug(const char *format, ...)
|
||||
{
|
||||
if (tsrm_debug_status) {
|
||||
va_list args;
|
||||
int size;
|
||||
|
||||
va_start(args, format);
|
||||
size = vprintf(format, args);
|
||||
va_end(args);
|
||||
return size;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void tsrm_debug_set(int status)
|
||||
{
|
||||
tsrm_debug_status = status;
|
||||
}
|
||||
-100
@@ -1,100 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="TSRM" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=TSRM - Win32 Debug_TS
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "TSRM.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "TSRM.mak" CFG="TSRM - Win32 Debug_TS"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "TSRM - Win32 Debug_TS" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "TSRM - Win32 Release_TS" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# 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 "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D "_LIB" /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 "WIN32" /D "_MBCS" /D "_LIB" /D "TSRM_EXPORTS" /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"
|
||||
# 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
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\TSRM.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
-97
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Thread Safe Resource Manager |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to the Zend license, that is bundled |
|
||||
| with this package in the file LICENSE. If you did not receive a |
|
||||
| copy of the Zend license, please mail us at zend@zend.com so we can |
|
||||
| send you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _TSRM_H
|
||||
#define _TSRM_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "tsrm_config.h"
|
||||
#endif
|
||||
|
||||
#if WIN32||WINNT
|
||||
# include <windows.h>
|
||||
#elif defined(PTHREADS)
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
|
||||
typedef int ts_rsrc_id;
|
||||
|
||||
#if WIN32||WINNT
|
||||
# ifdef TSRM_EXPORTS
|
||||
# define TSRM_API __declspec(dllexport)
|
||||
# else
|
||||
# define TSRM_API __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
# define TSRM_API
|
||||
#endif
|
||||
|
||||
|
||||
/* Define TSRM_FUNC */
|
||||
#ifdef __cplusplus
|
||||
#define TSRM_FUNC extern "C" TSRM_API
|
||||
#else
|
||||
#define TSRM_FUNC TSRM_API
|
||||
#endif
|
||||
|
||||
|
||||
/* Define THREAD_T and MUTEX_T */
|
||||
#if defined(WIN32)
|
||||
# define THREAD_T DWORD
|
||||
# define MUTEX_T void *
|
||||
#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 *
|
||||
#endif
|
||||
|
||||
|
||||
#define THREAD_HASH_OF(thr,ts) thr%ts
|
||||
|
||||
|
||||
/* startup/shutdown */
|
||||
TSRM_FUNC int tsrm_startup(int expected_threads, int expected_resources, int debug_status);
|
||||
TSRM_FUNC void tsrm_shutdown();
|
||||
|
||||
/* allocates a new thread-safe-resource id */
|
||||
TSRM_FUNC ts_rsrc_id ts_allocate_id(size_t size, void (*ctor)(void *resource), void (*dtor)(void *resource));
|
||||
|
||||
/* fetches the requested resource for the current thread */
|
||||
TSRM_FUNC void *ts_resource(ts_rsrc_id id);
|
||||
|
||||
/* frees all resources allocated for the current thread */
|
||||
TSRM_FUNC void ts_free_thread();
|
||||
|
||||
/* deallocates all occurrences of a given id */
|
||||
TSRM_FUNC void ts_free_id(ts_rsrc_id id);
|
||||
|
||||
|
||||
/* Debug support */
|
||||
TSRM_FUNC void tsrm_debug_set(int status);
|
||||
|
||||
/* utility functions */
|
||||
TSRM_FUNC THREAD_T tsrm_thread_id(void);
|
||||
TSRM_FUNC MUTEX_T tsrm_mutex_alloc(void);
|
||||
TSRM_FUNC void tsrm_mutex_free(MUTEX_T mutexp);
|
||||
TSRM_FUNC int tsrm_mutex_lock(MUTEX_T mutexp);
|
||||
TSRM_FUNC int tsrm_mutex_unlock(MUTEX_T mutexp);
|
||||
|
||||
#endif /* _TSRM_H */
|
||||
@@ -1,7 +0,0 @@
|
||||
#undef PTHREADS
|
||||
|
||||
#ifdef DEFINE_TSRM_VERSION
|
||||
# undef PACKAGE
|
||||
# undef VERSION
|
||||
#endif
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
mv aclocal.m4 aclocal.m4.old 2>/dev/null
|
||||
aclocal
|
||||
if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then
|
||||
echo keeping ${1}aclocal.m4
|
||||
mv aclocal.m4.old aclocal.m4
|
||||
else
|
||||
echo created or modified ${1}aclocal.m4
|
||||
fi
|
||||
|
||||
autoheader
|
||||
|
||||
automake --add-missing --include-deps
|
||||
|
||||
mv configure configure.old 2>/dev/null
|
||||
autoconf
|
||||
if cmp configure.old configure > /dev/null 2>&1; then
|
||||
echo keeping ${1}configure
|
||||
mv configure.old configure
|
||||
else
|
||||
echo created or modified ${1}configure
|
||||
fi
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
dnl $Id$
|
||||
dnl
|
||||
dnl Minimalistic configure.in for TSRM.
|
||||
dnl
|
||||
|
||||
AC_INIT(TSRM.c)
|
||||
AM_INIT_AUTOMAKE(TSRM, 1.0)
|
||||
AM_CONFIG_HEADER(tsrm_config.h)
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_CC_C_O
|
||||
AC_PROG_RANLIB
|
||||
|
||||
AC_CHECK_LIB(pthread, pthread_create, [
|
||||
AC_DEFINE(PTHREADS)
|
||||
LIBS="$LIBS -lpthread"
|
||||
],[
|
||||
AC_MSG_ERROR(You need pthreads to build TSRM.)
|
||||
])
|
||||
|
||||
AC_CHECK_HEADERS(stdarg.h)
|
||||
|
||||
AC_OUTPUT(Makefile)
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
- Persistant per-process scripting
|
||||
|
||||
Apache 1.3 has added things that makes this much easier than before.
|
||||
The module structure now contains a child_init hook and a child_exit
|
||||
hook where you can register functions to be called when an httpd
|
||||
process starts up and when one shuts down (due to MaxRequestsPerChild
|
||||
or a Kill). The only real trick now is to come up with some sort of
|
||||
syntax for specifying what to do from the child_init call and the
|
||||
child_exit call.
|
||||
|
||||
One idea is to be able to add a <PHP>...</PHP> block to the Apache
|
||||
httpd.conf file which would somehow define a series of PHP statements
|
||||
to be executed from the child_* calls. One for startup and another
|
||||
block for shutdown. These blocks would work with the per-process
|
||||
memory pool, so any variables initialized here would have a lifespan
|
||||
equal to that of the httpd process. Basically request-spanning
|
||||
global variables.
|
||||
@@ -1,55 +0,0 @@
|
||||
V Do yystype_ptr and hash pointers the right way - use the hash
|
||||
pointer and the bucket pointer, instead of a pointer to the data.
|
||||
Allows for a real unset() among other things.
|
||||
V Improve performance of simple variable lookups
|
||||
* Improve string performance by using smarter memory allocation methods
|
||||
- Improve preprocessor (handle require() efficiently), possibly handle
|
||||
automatic preprocessing for sites based on timestamp
|
||||
V Use a reference count mechanism to prevent unnecessary duplication of data.
|
||||
* Write and stabilize a complete persistent data API. Feature wishlist:
|
||||
- memory manager using shared memory
|
||||
- process-global symbol table
|
||||
- make api inter-thread capable for win32 and some far off future where unix
|
||||
version will be multithreaded
|
||||
V Handle out of memory (inside emalloc()?)
|
||||
* Try to figure out a way to declare *real* global variables
|
||||
* Improve the reading of configuration variables into php3_ini (generalize)
|
||||
Make it possible to implement config_get("configuration_variable") and
|
||||
config_set("configuration_variable","value") that'll work with *php3_ini*,
|
||||
not the configuration hash!
|
||||
* Bundle some nice classes (like Bjørn's graphing class)
|
||||
* Bundle some database abstraction classes
|
||||
* Distribute binaries
|
||||
* Clean up API and modules to make .so modules portable across CGI and server
|
||||
binaries
|
||||
* dbm cleanup (don't arbitrarily pick, and support multiple concurrent formats)
|
||||
* start system defines so that we can move away from the standard c lib on
|
||||
windows to the win32 lib. (file functions primarily)
|
||||
* COM implementation so php can be used as an asp language (cant find any docs
|
||||
on how this is done though)
|
||||
* Clean up the file structure so the top-level directory isn't such a mess.
|
||||
* Bring the module concept to maturity: use libtool and make it
|
||||
possible to decide at compile time whether you want to compile a
|
||||
module statically or dynamically. Remove the distinction between
|
||||
the stuff currently in dl/ and functions/.
|
||||
* a way of letting each module specify its options, so ini file options and
|
||||
Apache directives can be set up from the same specification.
|
||||
V Make it possible to declare smarter user functions: (done in 3.0)
|
||||
- Optional parameters
|
||||
- Parameters that are forced/prefered by reference
|
||||
* Make object parsing more general, and allow nested arrays/objects with
|
||||
unlimited levels.
|
||||
V Make it possible to copy references of variables.
|
||||
* data tainting (like perl -T)
|
||||
* multi-dimensional array support in GET/POST/COOKIE handling code
|
||||
* Persistent functions and classes
|
||||
* odbc_fetch_assoc
|
||||
* Add env handling to gpc_order
|
||||
* Populate track_vars regardless of gpc_order
|
||||
* a real exec() function
|
||||
* Support passing arguments to functions by name (e.g. foo(arg1 => "bar", arg2 => "foobar"))
|
||||
* Add an optional setting to destroy persistent resources if a PHP script terminates
|
||||
abnormally
|
||||
V COM automation support for Win32
|
||||
? Add a setting for making function names case sensitive
|
||||
* stat() files before feeding them to flex - it doesn't handle special files very well
|
||||
-121
@@ -1,121 +0,0 @@
|
||||
/* This is the default configuration file to read -*- C -*- */
|
||||
|
||||
/* these are defined by automake */
|
||||
#undef PACKAGE
|
||||
#undef VERSION
|
||||
|
||||
#undef HAVE_STRUCT_FLOCK
|
||||
#undef HAVE_TM_GMTOFF
|
||||
|
||||
#define CONFIGURATION_FILE_PATH "php3.ini"
|
||||
#define USE_CONFIG_FILE 1
|
||||
|
||||
#undef HAVE_DMALLOC
|
||||
|
||||
/* Some global constants defined by conigure */
|
||||
#undef PHP_BUILD_DATE
|
||||
#undef PHP_OS
|
||||
#undef PHP_UNAME
|
||||
|
||||
/* define uint by configure if it is missed (QNX and BSD derived) */
|
||||
#undef uint
|
||||
|
||||
/* define ulong by configure if it is missed (most probably is) */
|
||||
#undef ulong
|
||||
|
||||
/* type check for in_addr_t */
|
||||
#undef in_addr_t
|
||||
|
||||
/* Define if you have dirent.h but opendir() resides in libc rather than in libdir */
|
||||
/* This will cause HAVE_DIRENT_H defined twice sometimes, but it should be problem */
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define if you have the resolv library (-lresolv). */
|
||||
#undef HAVE_LIBRESOLV
|
||||
|
||||
/* Define if you have the pam library (-lpam). */
|
||||
#define HAVE_LIBPAM 0
|
||||
|
||||
/* Define if you have the bind library (-lbind). */
|
||||
#define HAVE_LIBBIND 0
|
||||
|
||||
/* Define if you have Netscape LDAP instead of umich ldap or openldap*/
|
||||
#define HAVE_NSLDAP 0
|
||||
|
||||
/* Define if you want safe mode enabled by default. */
|
||||
#define PHP_SAFE_MODE 0
|
||||
|
||||
/* Set to the path to the dir containing safe mode executables */
|
||||
#define PHP_SAFE_MODE_EXEC_DIR /usr/local/php/bin
|
||||
|
||||
/* Define if you want POST/GET/Cookie track variables by default */
|
||||
#define PHP_TRACK_VARS 0
|
||||
|
||||
/* Undefine if you want stricter XML/SGML compliance by default */
|
||||
/* (this disables "<?expression?>" by default) */
|
||||
#define DEFAULT_SHORT_OPEN_TAG 1
|
||||
|
||||
/* Undefine if you do not want PHP by default to escape "'" */
|
||||
/* in GET/POST/Cookie data */
|
||||
#define MAGIC_QUOTES 1
|
||||
|
||||
/* Define both of these if you want the bundled REGEX library */
|
||||
#define REGEX 0
|
||||
#define HSREGEX 0
|
||||
|
||||
/* Define if you have and want to use libnsl */
|
||||
#undef HAVE_LIBNSL
|
||||
|
||||
/* Define if you have and want to use libsocket */
|
||||
#undef HAVE_LIBSOCKET
|
||||
|
||||
/* Define if you have the sendmail program available */
|
||||
#define HAVE_SENDMAIL 0
|
||||
|
||||
/* Define if you are compiling PHP as an Apache module */
|
||||
#define APACHE 0
|
||||
|
||||
/* Define if you are compiling PHP as an Apache module with mod_charset patch applied (aka Russian Apache)*/
|
||||
#define USE_TRANSFER_TABLES 0
|
||||
|
||||
/* Define if you are compiling PHP as an fhttpd module */
|
||||
#define FHTTPD 0
|
||||
|
||||
/* Define if your Apache creates an ap_config.h header file (only 1.3b6 and later) */
|
||||
#define HAVE_AP_CONFIG_H 0
|
||||
|
||||
/* Define if your Apache has src/include/compat.h */
|
||||
#define HAVE_OLD_COMPAT_H 0
|
||||
|
||||
/* Define if your Apache has src/include/ap_compat.h */
|
||||
#define HAVE_AP_COMPAT_H 0
|
||||
|
||||
#ifndef DEBUG /* should be set to ZEND_DEBUG */
|
||||
#define DEBUG 0
|
||||
#endif
|
||||
|
||||
/* Define if you want to enable PHP RPC (experimental) */
|
||||
#define PHP_RPC 0
|
||||
|
||||
/* Define if you want to prevent the CGI from working unless REDIRECT_STATUS is defined in the environment */
|
||||
#define FORCE_CGI_REDIRECT 0
|
||||
|
||||
/* Define if you want to prevent the CGI from using path_info and path_translated */
|
||||
#define DISCARD_PATH 0
|
||||
|
||||
/* Define if you want to enable memory limit support */
|
||||
#define MEMORY_LIMIT 0
|
||||
|
||||
/* Define if you want include() and other functions to be able to open
|
||||
* http and ftp URLs as files.
|
||||
*/
|
||||
#define PHP3_URL_FOPEN 0
|
||||
|
||||
/* Define if you have broken header files like SunOS 4 */
|
||||
#define MISSING_FCLOSE_DECL 0
|
||||
|
||||
/* Define if you have broken sprintf function like SunOS 4 */
|
||||
#define BROKEN_SPRINTF 0
|
||||
|
||||
/* Define to compile PHP/Zend thread safe */
|
||||
#undef ZTS
|
||||
-152
@@ -1,152 +0,0 @@
|
||||
dnl $Id$
|
||||
dnl
|
||||
dnl This file contains local autoconf functions.
|
||||
|
||||
dnl
|
||||
dnl AC_PHP_ONCE(namespace, variable, code)
|
||||
dnl
|
||||
dnl execute code, if variable is not set in namespace
|
||||
dnl
|
||||
AC_DEFUN(AC_PHP_ONCE,[
|
||||
unique=`echo $ac_n "$2$ac_c" | tr -c -d a-zA-Z0-9`
|
||||
cmd="echo $ac_n \"\$$1$unique$ac_c\""
|
||||
if test -n "$unique" && test "`eval $cmd`" = "" ; then
|
||||
eval "$1$unique=set"
|
||||
$3
|
||||
fi
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl AC_EXPAND_PATH(path, variable)
|
||||
dnl
|
||||
dnl expands path to an absolute path and assigns it to variable
|
||||
dnl
|
||||
AC_DEFUN(AC_EXPAND_PATH,[
|
||||
if test -z "$1" || echo "$1" | grep '^/' >/dev/null ; then
|
||||
$2="$1"
|
||||
else
|
||||
$2="`pwd`/$1"
|
||||
fi
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl AC_ADD_LIBPATH(path)
|
||||
dnl
|
||||
dnl add a library to linkpath/runpath
|
||||
dnl
|
||||
AC_DEFUN(AC_ADD_LIBPATH,[
|
||||
AC_EXPAND_PATH($1, ai_p)
|
||||
AC_PHP_ONCE(LIBPATH, $ai_p, [
|
||||
EXTRA_LIBS="$EXTRA_LIBS -L$ai_p"
|
||||
if test -n "$APXS" ; then
|
||||
RPATHS="$RPATHS ${apxs_runpath_switch}$ai_p'"
|
||||
else
|
||||
RPATHS="$RPATHS ${ld_runpath_switch}$ai_p"
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl AC_ADD_INCLUDE(path)
|
||||
dnl
|
||||
dnl add a include path
|
||||
dnl
|
||||
AC_DEFUN(AC_ADD_INCLUDE,[
|
||||
AC_EXPAND_PATH($1, ai_p)
|
||||
AC_PHP_ONCE(INCLUDEPATH, $ai_p, [
|
||||
INCLUDES="$INCLUDES -I$ai_p"
|
||||
])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl AC_ADD_LIBRARY(library)
|
||||
dnl
|
||||
dnl add a library to the link line
|
||||
dnl
|
||||
AC_DEFUN(AC_ADD_LIBRARY,[
|
||||
AC_PHP_ONCE(LIBRARY, $1, [
|
||||
EXTRA_LIBS="$EXTRA_LIBS -l$1"
|
||||
])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl AC_ADD_LIBRARY_WITH_PATH(library, path)
|
||||
dnl
|
||||
dnl add a library to the link line and path to linkpath/runpath
|
||||
dnl
|
||||
AC_DEFUN(AC_ADD_LIBRARY_WITH_PATH,[
|
||||
AC_ADD_LIBPATH($2)
|
||||
AC_ADD_LIBRARY($1)
|
||||
])
|
||||
|
||||
|
||||
dnl
|
||||
dnl Check for cc option
|
||||
dnl
|
||||
AC_DEFUN(AC_CHECK_CC_OPTION,[
|
||||
echo "main(){return 0;}" > conftest.$ac_ext
|
||||
opt="$1"
|
||||
var=`echo $ac_n "$opt$ac_c"|tr -c a-zA-Z0-9 _`
|
||||
AC_MSG_CHECKING([if compiler supports -$1 really])
|
||||
ac_compile="${CC-cc} -$opt -c $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1"
|
||||
if eval $ac_compile | egrep "$opt" > /dev/null 2>&1 ; then
|
||||
eval php_cc_$var=no
|
||||
AC_MSG_RESULT(no)
|
||||
else
|
||||
eval php_cc_$var=yes
|
||||
AC_MSG_RESULT(yes)
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
dnl
|
||||
dnl See if we have broken header files like SunOS has.
|
||||
dnl
|
||||
AC_DEFUN(AC_MISSING_FCLOSE_DECL,[
|
||||
AC_MSG_CHECKING([for fclose declaration])
|
||||
AC_TRY_COMPILE([#include <stdio.h>],[int (*func)() = fclose],[
|
||||
AC_DEFINE(MISSING_FCLOSE_DECL,0)
|
||||
AC_MSG_RESULT(ok)
|
||||
],[
|
||||
AC_DEFINE(MISSING_FCLOSE_DECL,1)
|
||||
AC_MSG_RESULT(missing)
|
||||
])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Check for broken sprintf()
|
||||
dnl
|
||||
AC_DEFUN(AC_BROKEN_SPRINTF,[
|
||||
AC_MSG_CHECKING([for broken sprintf])
|
||||
AC_TRY_RUN([main() { char buf[20]; exit (sprintf(buf,"testing 123")!=11); }],[
|
||||
AC_DEFINE(BROKEN_SPRINTF,0)
|
||||
AC_MSG_RESULT(ok)
|
||||
],[
|
||||
AC_DEFINE(BROKEN_SPRINTF,1)
|
||||
AC_MSG_RESULT(broken)
|
||||
],[
|
||||
AC_DEFINE(BROKEN_SPRINTF,0)
|
||||
AC_MSG_RESULT(cannot check, guessing ok)
|
||||
])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Stuff to do when setting up a new extension.
|
||||
dnl XXX have to change the hardcoding of ".a" when we want to be able
|
||||
dnl to make dynamic libraries as well.
|
||||
dnl
|
||||
AC_DEFUN(PHP_EXTENSION,[
|
||||
EXT_SUBDIRS="$EXT_SUBDIRS $1"
|
||||
_extlib="libphpext_$1.a"
|
||||
EXT_LIBS="$EXT_LIBS $1/$_extlib"
|
||||
EXTINFO_DEPS="$EXTINFO_DEPS ../ext/$1/extinfo.c.stub"
|
||||
dnl EXT_INCLUDE_CODE="\#include \"ext/$1/php3_$1.h\"\\n$EXT_INCLUDE_CODE"
|
||||
dnl EXT_MODULE_PTRS="phpext_$1_ptr, $EXT_MODULE_PTRS"
|
||||
dnl "
|
||||
])
|
||||
|
||||
AC_SUBST(EXT_SUBDIRS)
|
||||
AC_SUBST(EXT_LIBS)
|
||||
AC_SUBST(EXTINFO_DEPS)
|
||||
dnl AC_SUBST(EXT_INCLUDE_CODE)
|
||||
dnl AC_SUBST(EXT_MODULES_PTRS)
|
||||
@@ -1,4 +0,0 @@
|
||||
This is a place-holder which indicates to Configure that it shouldn't
|
||||
provide the default targets when building the Makefile in this directory.
|
||||
Instead it'll just prepend all the important variable definitions, and
|
||||
copy the Makefile.tmpl onto the end.
|
||||
@@ -1,77 +0,0 @@
|
||||
##
|
||||
## Apache 1.3 Makefile template for PHP3 Module
|
||||
## [src/modules/php4/Makefile.tmpl]
|
||||
##
|
||||
|
||||
# the parametrized target
|
||||
LIB=libphp4.$(LIBEXT)
|
||||
|
||||
# objects for building the static library
|
||||
OBJS=mod_php4.o
|
||||
OBJS_LIB=libmodphp4.a
|
||||
|
||||
# objects for building the shared object library
|
||||
SHLIB_OBJS=mod_php4.so-o
|
||||
SHLIB_OBJS_LIB=libmodphp4-so.a
|
||||
|
||||
# the general targets
|
||||
all: lib
|
||||
lib: $(LIB)
|
||||
|
||||
# build the static library by merging the object files
|
||||
libphp4.a: $(OBJS) $(OBJS_LIB)
|
||||
cp $(OBJS_LIB) $@
|
||||
ar r $@ $(OBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
# ugly hack to support older Apache-1.3 betas that don't set $LIBEXT
|
||||
libphp4.: $(OBJS) $(OBJS_LIB)
|
||||
cp $(OBJS_LIB) $@
|
||||
ar r $@ $(OBJS)
|
||||
$(RANLIB) $@
|
||||
cp libphp4. libphp4.a
|
||||
|
||||
# build the shared object library by linking the object files
|
||||
libphp4.so: $(SHLIB_OBJS) $(SHLIB_OBJS_LIB)
|
||||
rm -f $@
|
||||
$(LD_SHLIB) $(LDFLAGS_SHLIB) -o $@ $(SHLIB_OBJS) $(SHLIB_OBJS_LIB) $(LIBS)
|
||||
|
||||
# 1. extension .o for shared objects cannot be used here because
|
||||
# first these files aren't still shared objects and second we
|
||||
# have to use a different name to trigger the different
|
||||
# implicit Make rule
|
||||
# 2. extension -so.o (as used elsewhere) cannot be used because
|
||||
# the suffix feature of Make really wants just .x, so we use
|
||||
# extension .so-o
|
||||
.SUFFIXES: .o .so-o
|
||||
.c.o:
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
|
||||
.c.so-o:
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(CFLAGS_SHLIB) $(SPACER) $< && mv $*.o $*.so-o
|
||||
|
||||
# cleanup
|
||||
clean:
|
||||
-rm -f $(OBJS) $(SHLIB_OBJS) $(LIB)
|
||||
|
||||
# We really don't expect end users to use this rule. It works only with
|
||||
# gcc, and rebuilds Makefile.tmpl. You have to re-run Configure after
|
||||
# using it.
|
||||
depend:
|
||||
cp Makefile.tmpl Makefile.tmpl.bak \
|
||||
&& sed -ne '1,/^# DO NOT REMOVE/p' Makefile.tmpl > Makefile.new \
|
||||
&& gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \
|
||||
&& sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' Makefile.new \
|
||||
> Makefile.tmpl \
|
||||
&& rm Makefile.new
|
||||
|
||||
#Dependencies
|
||||
|
||||
$(OBJS): Makefile
|
||||
|
||||
# DO NOT REMOVE
|
||||
mod_php4.o: mod_php4.c $(INCDIR)/httpd.h $(INCDIR)/conf.h \
|
||||
$(INCDIR)/alloc.h $(INCDIR)/buff.h \
|
||||
$(INCDIR)/http_config.h \
|
||||
$(INCDIR)/http_core.h $(INCDIR)/http_main.h \
|
||||
$(INCDIR)/http_protocol.h $(INCDIR)/http_request.h \
|
||||
$(INCDIR)/http_log.h $(INCDIR)/util_script.h mod_php4.h
|
||||
-276
@@ -1,276 +0,0 @@
|
||||
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 = (pval *) emalloc(sizeof(pval));
|
||||
|
||||
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.
|
||||
|
||||
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 "foo" 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
@@ -1,492 +0,0 @@
|
||||
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
|
||||
@@ -1,92 +0,0 @@
|
||||
/* -*- C -*-
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP HTML Embedded Scripting Language Version 3.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This program is free software; you can redistribute it and/or modify |
|
||||
| it under the terms of one of the following licenses: |
|
||||
| |
|
||||
| A) 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. |
|
||||
| |
|
||||
| B) the PHP License as published by the PHP Development Team and |
|
||||
| included in the distribution in the file: LICENSE |
|
||||
| |
|
||||
| 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 both licenses referred to here. |
|
||||
| If you did not, or have any questions about PHP licensing, please |
|
||||
| contact core@php.net. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Stig Sæther Bakken <ssb@guardian.no> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#define PHP_ADA_INCLUDE ""
|
||||
#define PHP_ADA_LFLAGS ""
|
||||
#define PHP_ADA_LIBS ""
|
||||
#define PHP_APACHE_INCLUDE ""
|
||||
#define PHP_APACHE_TARGET ""
|
||||
#define PHP_FHTTPD_INCLUDE ""
|
||||
#define PHP_FHTTPD_LIB ""
|
||||
#define PHP_FHTTPD_TARGET ""
|
||||
#define PHP_BINNAME ""
|
||||
#define PHP_CFLAGS ""
|
||||
#define PHP_DBASE_LIB ""
|
||||
#define PHP_DEBUG ""
|
||||
#define PHP_GDBM_INCLUDE ""
|
||||
#define PHP_HSREGEX ""
|
||||
#define PHP_IBASE_INCLUDE ""
|
||||
#define PHP_IBASE_LFLAGS ""
|
||||
#define PHP_IBASE_LIBS ""
|
||||
#define PHP_IFX_INCLUDE ""
|
||||
#define PHP_IFX_LFLAGS ""
|
||||
#define PHP_IFX_LIBS ""
|
||||
#define PHP_INSTALL_IT ""
|
||||
#define PHP_IODBC_INCLUDE ""
|
||||
#define PHP_IODBC_LFLAGS ""
|
||||
#define PHP_IODBC_LIBS ""
|
||||
#define PHP_MSQL_INCLUDE ""
|
||||
#define PHP_MSQL_LFLAGS ""
|
||||
#define PHP_MSQL_LIBS ""
|
||||
#define PHP_MYSQL_INCLUDE ""
|
||||
#define PHP_MYSQL_LFLAGS ""
|
||||
#define PHP_MYSQL_LIBS ""
|
||||
#define PHP_ORACLE_HOME ""
|
||||
#define PHP_ORACLE_INCLUDE ""
|
||||
#define PHP_ORACLE_LFLAGS ""
|
||||
#define PHP_ORACLE_LIBS ""
|
||||
#define PHP_ORACLE_SHLIBS ""
|
||||
#define PHP_ORACLE_STLIBS ""
|
||||
#define PHP_ORACLE_VERSION ""
|
||||
#define PHP_PGSQL_INCLUDE ""
|
||||
#define PHP_PGSQL_LFLAGS ""
|
||||
#define PHP_PGSQL_LIBS ""
|
||||
#define PHP_PROG_SENDMAIL "@PROG_SENDMAIL@"
|
||||
#define PHP_REGEX_LIB ""
|
||||
#define PHP_SOLID_INCLUDE ""
|
||||
#define PHP_SOLID_LIBS ""
|
||||
#define PHP_EMPRESS_INCLUDE ""
|
||||
#define PHP_EMPRESS_LIBS ""
|
||||
#define PHP_SYBASE_INCLUDE ""
|
||||
#define PHP_SYBASE_LFLAGS ""
|
||||
#define PHP_SYBASE_LIBS ""
|
||||
#define PHP_DBM_TYPE ""
|
||||
#define PHP_DBM_LIB ""
|
||||
#define PHP_LDAP_LFLAGS ""
|
||||
#define PHP_LDAP_INCLUDE ""
|
||||
#define PHP_LDAP_LIBS ""
|
||||
#define PHP_VELOCIS_INCLUDE ""
|
||||
#define PHP_VELOCIS_LIBS ""
|
||||
|
||||
#define ODBC_TYPE ""
|
||||
#define ODBC_INCDIR ""
|
||||
#define ODBC_INCLUDE ""
|
||||
#define ODBC_LIBDIR ""
|
||||
#define ODBC_LFLAGS ""
|
||||
#define ODBC_LIBS ""
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
test -d libzend || ln -s ../libzend .
|
||||
test -d TSRM || ln -s ../TSRM .
|
||||
|
||||
./scripts/preconfig
|
||||
|
||||
mv aclocal.m4 aclocal.m4.old 2>/dev/null
|
||||
aclocal
|
||||
if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then
|
||||
echo keeping aclocal.m4
|
||||
mv aclocal.m4.old aclocal.m4
|
||||
else
|
||||
echo created or modified aclocal.m4
|
||||
fi
|
||||
|
||||
autoheader
|
||||
|
||||
automake --add-missing --include-deps
|
||||
|
||||
mv configure configure.old 2>/dev/null
|
||||
autoconf
|
||||
if cmp configure.old configure > /dev/null 2>&1; then
|
||||
echo keeping configure
|
||||
mv configure.old configure
|
||||
else
|
||||
echo created or modified configure
|
||||
fi
|
||||
|
||||
(cd libzend; ./buildconf libzend/)
|
||||
(cd TSRM; ./buildconf TSRM/)
|
||||
-244
@@ -1,244 +0,0 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on calendar.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=calendar - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to calendar - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "calendar - Win32 Release" && "$(CFG)" != "calendar - Win32 Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!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 "calendar.mak" CFG="calendar - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "calendar - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "calendar - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "calendar - Win32 Release"
|
||||
|
||||
OUTDIR=.\module_release
|
||||
INTDIR=.\module_release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\module_release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\php3_calendar.dll"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\calendar.obj"
|
||||
-@erase "$(INTDIR)\dow.obj"
|
||||
-@erase "$(INTDIR)\french.obj"
|
||||
-@erase "$(INTDIR)\gregor.obj"
|
||||
-@erase "$(INTDIR)\jewish.obj"
|
||||
-@erase "$(INTDIR)\julian.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\php3_calendar.dll"
|
||||
-@erase "$(OUTDIR)\php3_calendar.exp"
|
||||
-@erase "$(OUTDIR)\php3_calendar.lib"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /D "NDEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\calendar.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\calendar.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:1 /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_calendar.pdb" /machine:I386 /out:"$(OUTDIR)\php3_calendar.dll" /implib:"$(OUTDIR)\php3_calendar.lib" /libpath:"cgi_release"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\calendar.obj" \
|
||||
"$(INTDIR)\dow.obj" \
|
||||
"$(INTDIR)\french.obj" \
|
||||
"$(INTDIR)\gregor.obj" \
|
||||
"$(INTDIR)\jewish.obj" \
|
||||
"$(INTDIR)\julian.obj"
|
||||
|
||||
"$(OUTDIR)\php3_calendar.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "calendar - Win32 Debug"
|
||||
|
||||
OUTDIR=.\module_debug
|
||||
INTDIR=.\module_debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\module_debug
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\php3_calendar.dll"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\calendar.obj"
|
||||
-@erase "$(INTDIR)\dow.obj"
|
||||
-@erase "$(INTDIR)\french.obj"
|
||||
-@erase "$(INTDIR)\gregor.obj"
|
||||
-@erase "$(INTDIR)\jewish.obj"
|
||||
-@erase "$(INTDIR)\julian.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\php3_calendar.dll"
|
||||
-@erase "$(OUTDIR)\php3_calendar.exp"
|
||||
-@erase "$(OUTDIR)\php3_calendar.ilk"
|
||||
-@erase "$(OUTDIR)\php3_calendar.lib"
|
||||
-@erase "$(OUTDIR)\php3_calendar.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "./" /I "../" /D "DEBUG" /D "_DEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\calendar.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\calendar.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:1 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_calendar.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_calendar.dll" /implib:"$(OUTDIR)\php3_calendar.lib" /pdbtype:sept /libpath:"cgi_debug"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\calendar.obj" \
|
||||
"$(INTDIR)\dow.obj" \
|
||||
"$(INTDIR)\french.obj" \
|
||||
"$(INTDIR)\gregor.obj" \
|
||||
"$(INTDIR)\jewish.obj" \
|
||||
"$(INTDIR)\julian.obj"
|
||||
|
||||
"$(OUTDIR)\php3_calendar.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("calendar.dep")
|
||||
!INCLUDE "calendar.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "calendar.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "calendar - Win32 Release" || "$(CFG)" == "calendar - Win32 Debug"
|
||||
SOURCE=.\dl\calendar\calendar.c
|
||||
|
||||
"$(INTDIR)\calendar.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\dl\calendar\dow.c
|
||||
|
||||
"$(INTDIR)\dow.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\dl\calendar\french.c
|
||||
|
||||
"$(INTDIR)\french.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\dl\calendar\gregor.c
|
||||
|
||||
"$(INTDIR)\gregor.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\dl\calendar\jewish.c
|
||||
|
||||
"$(INTDIR)\jewish.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\dl\calendar\julian.c
|
||||
|
||||
"$(INTDIR)\julian.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
-458
@@ -1,458 +0,0 @@
|
||||
#include "php.h"
|
||||
#include "php_globals.h"
|
||||
|
||||
#include "SAPI.h"
|
||||
|
||||
#if CGI_BINARY
|
||||
|
||||
#include <stdio.h>
|
||||
#include "php.h"
|
||||
#ifdef MSVC5
|
||||
#include "win32/time.h"
|
||||
#include "win32/signal.h"
|
||||
#include <process.h>
|
||||
#else
|
||||
#include "build-defs.h"
|
||||
#endif
|
||||
#if HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
#if HAVE_SETLOCALE
|
||||
#include <locale.h>
|
||||
#endif
|
||||
#include "zend.h"
|
||||
#include "php_ini.h"
|
||||
#include "php_globals.h"
|
||||
#include "main.h"
|
||||
#include "fopen-wrappers.h"
|
||||
#include "ext/standard/php3_standard.h"
|
||||
#include "snprintf.h"
|
||||
#if WIN32|WINNT
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#include "win32/syslog.h"
|
||||
#include "win32/php_registry.h"
|
||||
#else
|
||||
#include <syslog.h>
|
||||
#endif
|
||||
|
||||
#include "zend_compile.h"
|
||||
#include "zend_execute.h"
|
||||
#include "zend_highlight.h"
|
||||
#include "zend_indent.h"
|
||||
|
||||
|
||||
#if USE_SAPI
|
||||
#include "serverapi/sapi.h"
|
||||
void *gLock;
|
||||
#ifndef THREAD_SAFE
|
||||
struct sapi_request_info *sapi_rqst;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if MSVC5 || !defined(HAVE_GETOPT)
|
||||
#include "php_getopt.h"
|
||||
#endif
|
||||
|
||||
PHPAPI extern char *php3_ini_path;
|
||||
|
||||
#define PHP_MODE_STANDARD 1
|
||||
#define PHP_MODE_HIGHLIGHT 2
|
||||
#define PHP_MODE_INDENT 3
|
||||
|
||||
PHPAPI extern char *optarg;
|
||||
PHPAPI extern int optind;
|
||||
|
||||
|
||||
static int zend_cgibin_ub_write(const char *str, uint str_length)
|
||||
{
|
||||
return fwrite(str, 1, str_length, stdout);
|
||||
}
|
||||
|
||||
|
||||
static void sapi_cgi_send_header(sapi_header_struct *sapi_header, void *server_context)
|
||||
{
|
||||
if (sapi_header) {
|
||||
PHPWRITE_H(sapi_header->header, sapi_header->header_len);
|
||||
}
|
||||
PHPWRITE_H("\r\n", 2);
|
||||
}
|
||||
|
||||
|
||||
static int sapi_cgi_read_post(char *buffer, uint count_bytes SLS_DC)
|
||||
{
|
||||
uint read_bytes=0, tmp_read_bytes;
|
||||
|
||||
count_bytes = MIN(count_bytes, SG(request_info).content_length-SG(read_post_bytes));
|
||||
while (read_bytes < count_bytes) {
|
||||
tmp_read_bytes = read(0, buffer+read_bytes, count_bytes-read_bytes);
|
||||
if (tmp_read_bytes<=0) {
|
||||
break;
|
||||
}
|
||||
read_bytes += tmp_read_bytes;
|
||||
}
|
||||
return read_bytes;
|
||||
}
|
||||
|
||||
|
||||
static char *sapi_cgi_read_cookies(SLS_D)
|
||||
{
|
||||
return getenv("HTTP_COOKIE");
|
||||
}
|
||||
|
||||
|
||||
static sapi_module_struct sapi_module = {
|
||||
"PHP Language", /* name */
|
||||
|
||||
php_module_startup, /* startup */
|
||||
php_module_shutdown_wrapper, /* shutdown */
|
||||
|
||||
zend_cgibin_ub_write, /* unbuffered write */
|
||||
|
||||
php3_error, /* error handler */
|
||||
|
||||
NULL, /* header handler */
|
||||
NULL, /* send headers handler */
|
||||
sapi_cgi_send_header, /* send header handler */
|
||||
|
||||
sapi_cgi_read_post, /* read POST data */
|
||||
sapi_cgi_read_cookies /* read Cookies */
|
||||
};
|
||||
|
||||
|
||||
static void php_cgi_usage(char *argv0)
|
||||
{
|
||||
char *prog;
|
||||
|
||||
prog = strrchr(argv0, '/');
|
||||
if (prog) {
|
||||
prog++;
|
||||
} else {
|
||||
prog = "php";
|
||||
}
|
||||
|
||||
php3_printf("Usage: %s [-q] [-h]"
|
||||
" [-s]"
|
||||
" [-v] [-i] [-f <file>] | "
|
||||
"{<file> [args...]}\n"
|
||||
" -q Quiet-mode. Suppress HTTP Header output.\n"
|
||||
" -s Display colour syntax highlighted source.\n"
|
||||
" -f<file> Parse <file>. Implies `-q'\n"
|
||||
" -v Version number\n"
|
||||
" -c<path> Look for php.ini file in this directory\n"
|
||||
#if SUPPORT_INTERACTIVE
|
||||
" -a Run interactively\n"
|
||||
#endif
|
||||
" -e Generate extended information for debugger/profiler\n"
|
||||
" -i PHP information\n"
|
||||
" -h This help\n", prog);
|
||||
}
|
||||
|
||||
|
||||
static void init_request_info(SLS_D)
|
||||
{
|
||||
char *content_length = getenv("CONTENT_LENGTH");
|
||||
|
||||
SG(request_info).request_method = getenv("REQUEST_METHOD");
|
||||
SG(request_info).query_string = getenv("QUERY_STRING");
|
||||
SG(request_info).request_uri = getenv("PATH_INFO");
|
||||
SG(request_info).path_translated = NULL; /* we have to update it later, when we have that information */
|
||||
SG(request_info).content_type = getenv("CONTENT_TYPE");
|
||||
SG(request_info).content_length = (content_length?atoi(content_length):0);
|
||||
|
||||
/* CGI does not support HTTP authentication */
|
||||
SG(request_info).auth_user = NULL;
|
||||
SG(request_info).auth_password = NULL;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int cgi = 0, c, i, len;
|
||||
zend_file_handle file_handle;
|
||||
char *s;
|
||||
/* temporary locals */
|
||||
int cgi_started=0;
|
||||
int behavior=PHP_MODE_STANDARD;
|
||||
int no_headers=0;
|
||||
#if SUPPORT_INTERACTIVE
|
||||
int interactive=0;
|
||||
#endif
|
||||
/* end of temporary locals */
|
||||
#ifdef ZTS
|
||||
zend_compiler_globals *compiler_globals;
|
||||
zend_executor_globals *executor_globals;
|
||||
php_core_globals *core_globals;
|
||||
sapi_globals_struct *sapi_globals;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef ZTS
|
||||
if (setjmp(EG(bailout))!=0) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ZTS
|
||||
tsrm_startup(1,1,0);
|
||||
#endif
|
||||
|
||||
sapi_startup(&sapi_module);
|
||||
|
||||
#if WIN32|WINNT
|
||||
_fmode = _O_BINARY; /*sets default for file streams to binary */
|
||||
setmode(_fileno(stdin), O_BINARY); /* make the stdio mode be binary */
|
||||
setmode(_fileno(stdout), O_BINARY); /* make the stdio mode be binary */
|
||||
setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */
|
||||
#endif
|
||||
|
||||
|
||||
/* Make sure we detect we are a cgi - a bit redundancy here,
|
||||
but the default case is that we have to check only the first one. */
|
||||
if (getenv("SERVER_SOFTWARE")
|
||||
|| getenv("SERVER_NAME")
|
||||
|| getenv("GATEWAY_INTERFACE")
|
||||
|| getenv("REQUEST_METHOD")) {
|
||||
cgi = 1;
|
||||
if (argc > 1)
|
||||
request_info.php_argv0 = strdup(argv[1]);
|
||||
else request_info.php_argv0 = NULL;
|
||||
#if FORCE_CGI_REDIRECT
|
||||
if (!getenv("REDIRECT_STATUS")) {
|
||||
PUTS("<b>Security Alert!</b> PHP CGI cannot be accessed directly.\n\
|
||||
\n\
|
||||
<P>This PHP CGI binary was compiled with force-cgi-redirect enabled. This\n\
|
||||
means that a page will only be served up if the REDIRECT_STATUS CGI variable is\n\
|
||||
set. This variable is set, for example, by Apache's Action directive redirect.\n\
|
||||
<P>You may disable this restriction by recompiling the PHP binary with the\n\
|
||||
--disable-force-cgi-redirect switch. If you do this and you have your PHP CGI\n\
|
||||
binary accessible somewhere in your web tree, people will be able to circumvent\n\
|
||||
.htaccess security by loading files through the PHP parser. A good way around\n\
|
||||
this is to define doc_root in your php.ini file to something other than your\n\
|
||||
top-level DOCUMENT_ROOT. This way you can separate the part of your web space\n\n\
|
||||
which uses PHP from the normal part using .htaccess security. If you do not have\n\
|
||||
any .htaccess restrictions anywhere on your site you can leave doc_root undefined.\n\
|
||||
\n");
|
||||
|
||||
/* remove that detailed explanation some time */
|
||||
|
||||
return FAILURE;
|
||||
}
|
||||
#endif /* FORCE_CGI_REDIRECT */
|
||||
}
|
||||
|
||||
if (php_module_startup(&sapi_module)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
#ifdef ZTS
|
||||
compiler_globals = ts_resource(compiler_globals_id);
|
||||
executor_globals = ts_resource(executor_globals_id);
|
||||
core_globals = ts_resource(core_globals_id);
|
||||
sapi_globals = ts_resource(sapi_globals_id);
|
||||
if (setjmp(EG(bailout))!=0) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
SG(request_info).path_translated = NULL;
|
||||
init_request_info(SLS_C);
|
||||
SG(server_context) = (void *) 1; /* avoid server_context==NULL checks */
|
||||
CG(extended_info) = 0;
|
||||
|
||||
if (!cgi) { /* never execute the arguments if you are a CGI */
|
||||
request_info.php_argv0 = NULL;
|
||||
while ((c = getopt(argc, argv, "c:qvisnaeh?vf:")) != -1) {
|
||||
switch (c) {
|
||||
case 'f':
|
||||
if (!cgi_started){
|
||||
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
|
||||
php_module_shutdown();
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
if (no_headers) {
|
||||
SG(headers_sent) = 1;
|
||||
}
|
||||
cgi_started=1;
|
||||
SG(request_info).path_translated = estrdup(optarg);
|
||||
/* break missing intentionally */
|
||||
case 'q':
|
||||
no_headers = 1;
|
||||
break;
|
||||
case 'v':
|
||||
if (!cgi_started) {
|
||||
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
|
||||
php_module_shutdown();
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
if (no_headers) {
|
||||
SG(headers_sent) = 1;
|
||||
}
|
||||
php3_printf("%s\n", PHP_VERSION);
|
||||
exit(1);
|
||||
break;
|
||||
case 'i':
|
||||
if (!cgi_started) {
|
||||
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
|
||||
php_module_shutdown();
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
if (no_headers) {
|
||||
SG(headers_sent) = 1;
|
||||
}
|
||||
cgi_started=1;
|
||||
php3_TreatHeaders();
|
||||
_php3_info();
|
||||
exit(1);
|
||||
break;
|
||||
case 's':
|
||||
behavior=PHP_MODE_HIGHLIGHT;
|
||||
break;
|
||||
case 'n':
|
||||
behavior=PHP_MODE_INDENT;
|
||||
break;
|
||||
case 'c':
|
||||
php3_ini_path = strdup(optarg); /* intentional leak */
|
||||
break;
|
||||
case 'a':
|
||||
#if SUPPORT_INTERACTIVE
|
||||
printf("Interactive mode enabled\n\n");
|
||||
interactive=1;
|
||||
#else
|
||||
printf("Interactive mode not supported!\n\n");
|
||||
#endif
|
||||
break;
|
||||
case 'e':
|
||||
CG(extended_info) = 1;
|
||||
break;
|
||||
case 'h':
|
||||
case '?':
|
||||
zend_output_startup();
|
||||
SG(headers_sent) = 1;
|
||||
php_cgi_usage(argv[0]);
|
||||
exit(1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} /* not cgi */
|
||||
|
||||
#if SUPPORT_INTERACTIVE
|
||||
EG(interactive) = interactive;
|
||||
#endif
|
||||
|
||||
if (!cgi_started) {
|
||||
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
|
||||
php_module_shutdown();
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
if (no_headers) {
|
||||
SG(headers_sent) = 1;
|
||||
}
|
||||
file_handle.filename = "-";
|
||||
file_handle.type = ZEND_HANDLE_FP;
|
||||
file_handle.handle.fp = stdin;
|
||||
|
||||
php3_TreatHeaders();
|
||||
|
||||
|
||||
if (!cgi) {
|
||||
if (!SG(request_info).query_string) {
|
||||
for (i = optind, len = 0; i < argc; i++)
|
||||
len += strlen(argv[i]) + 1;
|
||||
|
||||
s = malloc(len + 1); /* leak - but only for command line version, so ok */
|
||||
*s = '\0'; /* we are pretending it came from the environment */
|
||||
for (i = optind, len = 0; i < argc; i++) {
|
||||
strcat(s, argv[i]);
|
||||
if (i < (argc - 1))
|
||||
strcat(s, "+");
|
||||
}
|
||||
SG(request_info).query_string = s;
|
||||
}
|
||||
if (!SG(request_info).path_translated && argc > optind)
|
||||
SG(request_info).path_translated = argv[optind];
|
||||
}
|
||||
/* If for some reason the CGI interface is not setting the
|
||||
PATH_TRANSLATED correctly, SG(request_info).path_translated is NULL.
|
||||
We still call php3_fopen_for_parser, because if you set doc_root
|
||||
or user_dir configuration directives, PATH_INFO is used to construct
|
||||
the filename as a side effect of php3_fopen_for_parser.
|
||||
*/
|
||||
if (cgi || SG(request_info).path_translated) {
|
||||
file_handle.handle.fp = php3_fopen_for_parser();
|
||||
file_handle.filename = SG(request_info).path_translated;
|
||||
}
|
||||
|
||||
if (cgi && !file_handle.handle.fp) {
|
||||
PUTS("No input file specified.\n");
|
||||
#if 0 /* this is here for debuging under windows */
|
||||
if (argc) {
|
||||
i = 0;
|
||||
php3_printf("\nargc %d\n",argc);
|
||||
while (i <= argc) {
|
||||
php3_printf("%s\n",argv[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
php_request_shutdown((void *) 0);
|
||||
php_module_shutdown();
|
||||
return FAILURE;
|
||||
} else if (file_handle.handle.fp && file_handle.handle.fp!=stdin) {
|
||||
/* #!php support */
|
||||
c = fgetc(file_handle.handle.fp);
|
||||
if (c == '#') {
|
||||
while (c != 10 && c != 13) {
|
||||
c = fgetc(file_handle.handle.fp); /* skip to end of line */
|
||||
}
|
||||
CG(zend_lineno)++;
|
||||
} else {
|
||||
rewind(file_handle.handle.fp);
|
||||
}
|
||||
}
|
||||
|
||||
switch (behavior) {
|
||||
case PHP_MODE_STANDARD:
|
||||
php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
|
||||
break;
|
||||
case PHP_MODE_HIGHLIGHT: {
|
||||
zend_syntax_highlighter_ini syntax_highlighter_ini;
|
||||
|
||||
if (open_file_for_scanning(&file_handle CLS_CC)==SUCCESS) {
|
||||
php_get_highlight_struct(&syntax_highlighter_ini);
|
||||
zend_highlight(&syntax_highlighter_ini);
|
||||
fclose(file_handle.handle.fp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case PHP_MODE_INDENT:
|
||||
open_file_for_scanning(&file_handle CLS_CC);
|
||||
zend_indent();
|
||||
fclose(file_handle.handle.fp);
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
||||
php3_header(); /* Make sure headers have been sent */
|
||||
php_request_shutdown((void *) 0);
|
||||
php_module_shutdown();
|
||||
#ifdef ZTS
|
||||
tsrm_shutdown();
|
||||
#endif
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
Vendored
-743
@@ -1,743 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
#
|
||||
# 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.
|
||||
|
||||
# Written by Per Bothner <bothner@cygnus.com>.
|
||||
# The master version of this file is at the FSF in /home/gd/gnu/lib.
|
||||
#
|
||||
# This script attempts to guess a canonical system name similar to
|
||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||
# exits with 0. Otherwise, it exits with 1.
|
||||
#
|
||||
# The plan is that this can be called by configure scripts if you
|
||||
# don't specify an explicit system type (host/target name).
|
||||
#
|
||||
# Only a few systems have been added to this list; please add others
|
||||
# (but try to keep the structure clean).
|
||||
#
|
||||
|
||||
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
|
||||
# (ghazi@noc.rutgers.edu 8/24/94.)
|
||||
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
|
||||
PATH=$PATH:/.attbin ; export PATH
|
||||
fi
|
||||
|
||||
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
|
||||
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
|
||||
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
||||
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
||||
|
||||
trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
|
||||
|
||||
# Note: order is significant - the case branches are not exclusive.
|
||||
|
||||
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
alpha:OSF1:*:*)
|
||||
# A Vn.n version is a released version.
|
||||
# A Tn.n version is a released field test version.
|
||||
# A Xn.n version is an unreleased experimental baselevel.
|
||||
# 1.2 uses "1.2" for uname -r.
|
||||
echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`
|
||||
exit 0 ;;
|
||||
21064:Windows_NT:50:3)
|
||||
echo alpha-dec-winnt3.5
|
||||
exit 0 ;;
|
||||
Amiga*:UNIX_System_V:4.0:*)
|
||||
echo m68k-cbm-sysv4
|
||||
exit 0;;
|
||||
amiga:NetBSD:*:*)
|
||||
echo m68k-cbm-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
amiga:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
arc64:OpenBSD:*:*)
|
||||
echo mips64el-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
arc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
hkmips:OpenBSD:*:*)
|
||||
echo mips-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
pmax:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sgi:OpenBSD:*:*)
|
||||
echo mips-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
wgrisc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||
exit 0;;
|
||||
SR2?01:HI-UX/MPP:*:*)
|
||||
echo hppa1.1-hitachi-hiuxmpp
|
||||
exit 0;;
|
||||
Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
|
||||
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
|
||||
if test "`(/bin/universe) 2>/dev/null`" = att ; then
|
||||
echo pyramid-pyramid-sysv3
|
||||
else
|
||||
echo pyramid-pyramid-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
NILE:*:*:dcosx)
|
||||
echo pyramid-pyramid-svr4
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
|
||||
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
i86pc:SunOS:5.*:*)
|
||||
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:6*:*)
|
||||
# According to config.sub, this is the proper way to canonicalize
|
||||
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
|
||||
# it's likely to be more like Solaris than SunOS4.
|
||||
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:*:*)
|
||||
case "`/usr/bin/arch -k`" in
|
||||
Series*|S4*)
|
||||
UNAME_RELEASE=`uname -v`
|
||||
;;
|
||||
esac
|
||||
# Japanese Language versions have a version number like `4.1.3-JL'.
|
||||
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
|
||||
exit 0 ;;
|
||||
sun3*:SunOS:*:*)
|
||||
echo m68k-sun-sunos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
aushp:SunOS:*:*)
|
||||
echo sparc-auspex-sunos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
atari*:NetBSD:*:*)
|
||||
echo m68k-atari-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
atari*:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun3*:NetBSD:*:*)
|
||||
echo m68k-sun-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun3*:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mac68k:NetBSD:*:*)
|
||||
echo m68k-apple-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mac68k:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mvme68k:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mvme88k:OpenBSD:*:*)
|
||||
echo m88k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
powerpc:machten:*:*)
|
||||
echo powerpc-apple-machten${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
RISC*:Mach:*:*)
|
||||
echo mips-dec-mach_bsd4.3
|
||||
exit 0 ;;
|
||||
RISC*:ULTRIX:*:*)
|
||||
echo mips-dec-ultrix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
VAX*:ULTRIX*:*:*)
|
||||
echo vax-dec-ultrix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
2020:CLIX:*:*)
|
||||
echo clipper-intergraph-clix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mips:*:*:UMIPS | mips:*:*:RISCos)
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
int main (argc, argv) int argc; char **argv; {
|
||||
#if defined (host_mips) && defined (MIPSEB)
|
||||
#if defined (SYSTYPE_SYSV)
|
||||
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
|
||||
#endif
|
||||
#if defined (SYSTYPE_SVR4)
|
||||
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
|
||||
#endif
|
||||
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
|
||||
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
exit (-1);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy \
|
||||
&& ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
|
||||
&& rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
echo mips-mips-riscos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
Night_Hawk:Power_UNIX:*:*)
|
||||
echo powerpc-harris-powerunix
|
||||
exit 0 ;;
|
||||
m88k:CX/UX:7*:*)
|
||||
echo m88k-harris-cxux7
|
||||
exit 0 ;;
|
||||
m88k:*:4*:R4*)
|
||||
echo m88k-motorola-sysv4
|
||||
exit 0 ;;
|
||||
m88k:*:3*:R3*)
|
||||
echo m88k-motorola-sysv3
|
||||
exit 0 ;;
|
||||
AViiON:dgux:*:*)
|
||||
# DG/UX returns AViiON for all architectures
|
||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||
if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
|
||||
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
|
||||
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
|
||||
echo m88k-dg-dgux${UNAME_RELEASE}
|
||||
else
|
||||
echo m88k-dg-dguxbcs${UNAME_RELEASE}
|
||||
fi
|
||||
else echo i586-dg-dgux${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
|
||||
echo m88k-dolphin-sysv3
|
||||
exit 0 ;;
|
||||
M88*:*:R3*:*)
|
||||
# Delta 88k system running SVR3
|
||||
echo m88k-motorola-sysv3
|
||||
exit 0 ;;
|
||||
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
|
||||
echo m88k-tektronix-sysv3
|
||||
exit 0 ;;
|
||||
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
|
||||
echo m68k-tektronix-bsd
|
||||
exit 0 ;;
|
||||
*:IRIX*:*:*)
|
||||
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
|
||||
exit 0 ;;
|
||||
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
|
||||
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
|
||||
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
|
||||
i?86:AIX:*:*)
|
||||
echo i386-ibm-aix
|
||||
exit 0 ;;
|
||||
*:AIX:2:3)
|
||||
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
#include <sys/systemcfg.h>
|
||||
|
||||
main()
|
||||
{
|
||||
if (!__power_pc())
|
||||
exit(1);
|
||||
puts("powerpc-ibm-aix3.2.5");
|
||||
exit(0);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
echo rs6000-ibm-aix3.2.5
|
||||
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
echo rs6000-ibm-aix3.2.4
|
||||
else
|
||||
echo rs6000-ibm-aix3.2
|
||||
fi
|
||||
exit 0 ;;
|
||||
*:AIX:*:4)
|
||||
if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
|
||||
IBM_ARCH=rs6000
|
||||
else
|
||||
IBM_ARCH=powerpc
|
||||
fi
|
||||
if [ -x /usr/bin/oslevel ] ; then
|
||||
IBM_REV=`/usr/bin/oslevel`
|
||||
else
|
||||
IBM_REV=4.${UNAME_RELEASE}
|
||||
fi
|
||||
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
|
||||
exit 0 ;;
|
||||
*:AIX:*:*)
|
||||
echo rs6000-ibm-aix
|
||||
exit 0 ;;
|
||||
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
|
||||
echo romp-ibm-bsd4.4
|
||||
exit 0 ;;
|
||||
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
|
||||
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
|
||||
exit 0 ;; # report: romp-ibm BSD 4.3
|
||||
*:BOSX:*:*)
|
||||
echo rs6000-bull-bosx
|
||||
exit 0 ;;
|
||||
DPX/2?00:B.O.S.:*:*)
|
||||
echo m68k-bull-sysv3
|
||||
exit 0 ;;
|
||||
9000/[34]??:4.3bsd:1.*:*)
|
||||
echo m68k-hp-bsd
|
||||
exit 0 ;;
|
||||
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
|
||||
echo m68k-hp-bsd4.4
|
||||
exit 0 ;;
|
||||
9000/[3478]??:HP-UX:*:*)
|
||||
case "${UNAME_MACHINE}" in
|
||||
9000/31? ) HP_ARCH=m68000 ;;
|
||||
9000/[34]?? ) HP_ARCH=m68k ;;
|
||||
9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
|
||||
9000/8?? ) HP_ARCH=hppa1.0 ;;
|
||||
esac
|
||||
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
|
||||
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
|
||||
exit 0 ;;
|
||||
3050*:HI-UX:*:*)
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
#include <unistd.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
long cpu = sysconf (_SC_CPU_VERSION);
|
||||
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
|
||||
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
|
||||
results, however. */
|
||||
if (CPU_IS_PA_RISC (cpu))
|
||||
{
|
||||
switch (cpu)
|
||||
{
|
||||
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
|
||||
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
|
||||
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
|
||||
default: puts ("hppa-hitachi-hiuxwe2"); break;
|
||||
}
|
||||
}
|
||||
else if (CPU_IS_HP_MC68K (cpu))
|
||||
puts ("m68k-hitachi-hiuxwe2");
|
||||
else puts ("unknown-hitachi-hiuxwe2");
|
||||
exit (0);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
echo unknown-hitachi-hiuxwe2
|
||||
exit 0 ;;
|
||||
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
|
||||
echo hppa1.1-hp-bsd
|
||||
exit 0 ;;
|
||||
9000/8??:4.3bsd:*:*)
|
||||
echo hppa1.0-hp-bsd
|
||||
exit 0 ;;
|
||||
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
|
||||
echo hppa1.1-hp-osf
|
||||
exit 0 ;;
|
||||
hp8??:OSF1:*:*)
|
||||
echo hppa1.0-hp-osf
|
||||
exit 0 ;;
|
||||
i?86:OSF1:*:*)
|
||||
if [ -x /usr/sbin/sysversion ] ; then
|
||||
echo ${UNAME_MACHINE}-unknown-osf1mk
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-osf1
|
||||
fi
|
||||
exit 0 ;;
|
||||
parisc*:Lites*:*:*)
|
||||
echo hppa1.1-hp-lites
|
||||
exit 0 ;;
|
||||
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
||||
echo c1-convex-bsd
|
||||
exit 0 ;;
|
||||
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
|
||||
if getsysinfo -f scalar_acc
|
||||
then echo c32-convex-bsd
|
||||
else echo c2-convex-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
|
||||
echo c34-convex-bsd
|
||||
exit 0 ;;
|
||||
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
|
||||
echo c38-convex-bsd
|
||||
exit 0 ;;
|
||||
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
|
||||
echo c4-convex-bsd
|
||||
exit 0 ;;
|
||||
CRAY*X-MP:*:*:*)
|
||||
echo xmp-cray-unicos
|
||||
exit 0 ;;
|
||||
CRAY*Y-MP:*:*:*)
|
||||
echo ymp-cray-unicos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
CRAY*[A-Z]90:*:*:*)
|
||||
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
|
||||
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
|
||||
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
|
||||
exit 0 ;;
|
||||
CRAY*TS:*:*:*)
|
||||
echo t90-cray-unicos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
CRAY-2:*:*:*)
|
||||
echo cray2-cray-unicos
|
||||
exit 0 ;;
|
||||
F300:UNIX_System_V:*:*)
|
||||
FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||
echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit 0 ;;
|
||||
F301:UNIX_System_V:*:*)
|
||||
echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
|
||||
exit 0 ;;
|
||||
hp3[0-9][05]:NetBSD:*:*)
|
||||
echo m68k-hp-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
hp300:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
i?86:BSD/386:*:* | *:BSD/OS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:FreeBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||
exit 0 ;;
|
||||
*:NetBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
*:OpenBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
i*:CYGWIN*:*)
|
||||
echo i386-pc-cygwin32
|
||||
exit 0 ;;
|
||||
p*:CYGWIN*:*)
|
||||
echo powerpcle-unknown-cygwin32
|
||||
exit 0 ;;
|
||||
prep*:SunOS:5.*:*)
|
||||
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
*:GNU:*:*)
|
||||
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||
exit 0 ;;
|
||||
*:Linux:*:*)
|
||||
# The BFD linker knows what the default object file format is, so
|
||||
# first see if it will tell us.
|
||||
ld_help_string=`ld --help 2>&1`
|
||||
if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i.86"; then
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86linux"; then
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86coff"; then
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then
|
||||
echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then
|
||||
echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32ppc"; then
|
||||
echo "powerpc-unknown-linux-gnu" ; exit 0
|
||||
elif test "${UNAME_MACHINE}" = "alpha" ; then
|
||||
echo alpha-unknown-linux-gnu ; exit 0
|
||||
elif test "${UNAME_MACHINE}" = "sparc" ; then
|
||||
echo sparc-unknown-linux-gnu ; exit 0
|
||||
elif test "${UNAME_MACHINE}" = "mips" ; then
|
||||
cat >dummy.c <<EOF
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
#ifdef __MIPSEB__
|
||||
printf ("%s-unknown-linux-gnu\n", argv[1]);
|
||||
#endif
|
||||
#ifdef __MIPSEL__
|
||||
printf ("%sel-unknown-linux-gnu\n", argv[1]);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
else
|
||||
# Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us
|
||||
# useful --help. Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout.
|
||||
test ! -d /usr/lib/ldscripts/. \
|
||||
&& echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
|
||||
# Determine whether the default compiler is a.out or elf
|
||||
cat >dummy.c <<EOF
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
#ifdef __ELF__
|
||||
printf ("%s-pc-linux-gnu\n", argv[1]);
|
||||
#else
|
||||
printf ("%s-pc-linux-gnuaout\n", argv[1]);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
fi ;;
|
||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
|
||||
# are messed up and put the nodename in both sysname and nodename.
|
||||
i?86:DYNIX/ptx:4*:*)
|
||||
echo i386-sequent-sysv4
|
||||
exit 0 ;;
|
||||
i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
|
||||
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
|
||||
echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
|
||||
else
|
||||
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
i?86:*:3.2:*)
|
||||
if test -f /usr/options/cb.name; then
|
||||
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
|
||||
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
|
||||
elif /bin/uname -X 2>/dev/null >/dev/null ; then
|
||||
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
|
||||
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
|
||||
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
|
||||
&& UNAME_MACHINE=i586
|
||||
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
|
||||
else
|
||||
echo ${UNAME_MACHINE}-pc-sysv32
|
||||
fi
|
||||
exit 0 ;;
|
||||
Intel:Mach:3*:*)
|
||||
echo i386-pc-mach3
|
||||
exit 0 ;;
|
||||
paragon:*:*:*)
|
||||
echo i860-intel-osf1
|
||||
exit 0 ;;
|
||||
i860:*:4.*:*) # i860-SVR4
|
||||
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
|
||||
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
|
||||
else # Add other i860-SVR4 vendors below as they are discovered.
|
||||
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
|
||||
fi
|
||||
exit 0 ;;
|
||||
mini*:CTIX:SYS*5:*)
|
||||
# "miniframe"
|
||||
echo m68010-convergent-sysv
|
||||
exit 0 ;;
|
||||
M68*:*:R3V[567]*:*)
|
||||
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
|
||||
3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
|
||||
OS_REL=''
|
||||
test -r /etc/.relid \
|
||||
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
|
||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& echo i486-ncr-sysv4.3${OS_REL} && exit 0
|
||||
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
|
||||
&& echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
|
||||
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& echo i486-ncr-sysv4 && exit 0 ;;
|
||||
m68*:LynxOS:2.*:*)
|
||||
echo m68k-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mc68030:UNIX_System_V:4.*:*)
|
||||
echo m68k-atari-sysv4
|
||||
exit 0 ;;
|
||||
i?86:LynxOS:2.*:*)
|
||||
echo i386-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
TSUNAMI:LynxOS:2.*:*)
|
||||
echo sparc-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
|
||||
echo rs6000-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
SM[BE]S:UNIX_SV:*:*)
|
||||
echo mips-dde-sysv${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
RM*:SINIX-*:*:*)
|
||||
echo mips-sni-sysv4
|
||||
exit 0 ;;
|
||||
*:SINIX-*:*:*)
|
||||
if uname -p 2>/dev/null >/dev/null ; then
|
||||
UNAME_MACHINE=`(uname -p) 2>/dev/null`
|
||||
echo ${UNAME_MACHINE}-sni-sysv4
|
||||
else
|
||||
echo ns32k-sni-sysv
|
||||
fi
|
||||
exit 0 ;;
|
||||
BS2000:POSIX-BC:*:*) # EBCDIC based mainframe with POSIX subsystem
|
||||
echo bs2000-siemens-sysv4
|
||||
exit 0 ;;
|
||||
PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||
echo i586-unisys-sysv4
|
||||
exit 0 ;;
|
||||
*:UNIX_System_V:4*:FTX*)
|
||||
# From Gerald Hewes <hewes@openmarket.com>.
|
||||
# How about differentiating between stratus architectures? -djm
|
||||
echo hppa1.1-stratus-sysv4
|
||||
exit 0 ;;
|
||||
*:*:*:FTX*)
|
||||
# From seanf@swdc.stratus.com.
|
||||
echo i860-stratus-sysv4
|
||||
exit 0 ;;
|
||||
mc68*:A/UX:*:*)
|
||||
echo m68k-apple-aux${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
|
||||
if [ -d /usr/nec ]; then
|
||||
echo mips-nec-sysv${UNAME_RELEASE}
|
||||
else
|
||||
echo mips-unknown-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
|
||||
|
||||
cat >dummy.c <<EOF
|
||||
#ifdef _SEQUENT_
|
||||
# include <sys/types.h>
|
||||
# include <sys/utsname.h>
|
||||
#endif
|
||||
main ()
|
||||
{
|
||||
#if defined (sony)
|
||||
#if defined (MIPSEB)
|
||||
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
|
||||
I don't know.... */
|
||||
printf ("mips-sony-bsd\n"); exit (0);
|
||||
#else
|
||||
#include <sys/param.h>
|
||||
printf ("m68k-sony-newsos%s\n",
|
||||
#ifdef NEWSOS4
|
||||
"4"
|
||||
#else
|
||||
""
|
||||
#endif
|
||||
); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__arm) && defined (__acorn) && defined (__unix)
|
||||
printf ("arm-acorn-riscix"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (hp300) && !defined (hpux)
|
||||
printf ("m68k-hp-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (NeXT)
|
||||
#if !defined (__ARCHITECTURE__)
|
||||
#define __ARCHITECTURE__ "m68k"
|
||||
#endif
|
||||
int version;
|
||||
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
|
||||
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
|
||||
exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (MULTIMAX) || defined (n16)
|
||||
#if defined (UMAXV)
|
||||
printf ("ns32k-encore-sysv\n"); exit (0);
|
||||
#else
|
||||
#if defined (CMU)
|
||||
printf ("ns32k-encore-mach\n"); exit (0);
|
||||
#else
|
||||
printf ("ns32k-encore-bsd\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__386BSD__)
|
||||
printf ("i386-pc-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (sequent)
|
||||
#if defined (i386)
|
||||
printf ("i386-sequent-dynix\n"); exit (0);
|
||||
#endif
|
||||
#if defined (ns32000)
|
||||
printf ("ns32k-sequent-dynix\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (_SEQUENT_)
|
||||
struct utsname un;
|
||||
|
||||
uname(&un);
|
||||
|
||||
if (strncmp(un.version, "V2", 2) == 0) {
|
||||
printf ("i386-sequent-ptx2\n"); exit (0);
|
||||
}
|
||||
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
|
||||
printf ("i386-sequent-ptx1\n"); exit (0);
|
||||
}
|
||||
printf ("i386-sequent-ptx\n"); exit (0);
|
||||
|
||||
#endif
|
||||
|
||||
#if defined (vax)
|
||||
#if !defined (ultrix)
|
||||
printf ("vax-dec-bsd\n"); exit (0);
|
||||
#else
|
||||
printf ("vax-dec-ultrix\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (alliant) && defined (i860)
|
||||
printf ("i860-alliant-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
exit (1);
|
||||
}
|
||||
EOF
|
||||
|
||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
|
||||
# Apollos put the system type in the environment.
|
||||
|
||||
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
|
||||
|
||||
# Convex versions that predate uname can use getsysinfo(1)
|
||||
|
||||
if [ -x /usr/convex/getsysinfo ]
|
||||
then
|
||||
case `getsysinfo -f cpu_type` in
|
||||
c1*)
|
||||
echo c1-convex-bsd
|
||||
exit 0 ;;
|
||||
c2*)
|
||||
if getsysinfo -f scalar_acc
|
||||
then echo c32-convex-bsd
|
||||
else echo c2-convex-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
c34*)
|
||||
echo c34-convex-bsd
|
||||
exit 0 ;;
|
||||
c38*)
|
||||
echo c38-convex-bsd
|
||||
exit 0 ;;
|
||||
c4*)
|
||||
echo c4-convex-bsd
|
||||
exit 0 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
#echo '(Unable to guess system type)' 1>&2
|
||||
|
||||
exit 1
|
||||
Vendored
-939
@@ -1,939 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script, version 1.1.
|
||||
# Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
# can handle that machine. It does not imply ALL GNU software can.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# 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.
|
||||
|
||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||
# Supply the specified configuration type as an argument.
|
||||
# If it is invalid, we print an error message on stderr and exit with code 1.
|
||||
# Otherwise, we print the canonical config type on stdout and succeed.
|
||||
|
||||
# This file is supposed to be the same for all GNU packages
|
||||
# and recognize all the CPU types, system types and aliases
|
||||
# that are meaningful with *any* GNU software.
|
||||
# Each package is responsible for reporting which valid configurations
|
||||
# it does not support. The user should be able to distinguish
|
||||
# a failure to support a valid configuration from a meaningless
|
||||
# configuration.
|
||||
|
||||
# The goal of this file is to map all the various variations of a given
|
||||
# machine specification into a single specification in the form:
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or in some cases, the newer four-part form:
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# It is wrong to echo any other type of specification.
|
||||
|
||||
if [ x$1 = x ]
|
||||
then
|
||||
echo Configuration name missing. 1>&2
|
||||
echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
|
||||
echo "or $0 ALIAS" 1>&2
|
||||
echo where ALIAS is a recognized configuration type. 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# First pass through any local machine types.
|
||||
case $1 in
|
||||
*local*)
|
||||
echo $1
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
linux-gnu*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
*)
|
||||
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
||||
if [ $basic_machine != $1 ]
|
||||
then os=`echo $1 | sed 's/.*-/-/'`
|
||||
else os=; fi
|
||||
;;
|
||||
esac
|
||||
|
||||
### Let's recognize common machines as not being operating systems so
|
||||
### that things like config.sub decstation-3100 work. We also
|
||||
### recognize some manufacturers as not being operating systems, so we
|
||||
### can provide default operating systems below.
|
||||
case $os in
|
||||
-sun*os*)
|
||||
# Prevent following clause from handling this invalid input.
|
||||
;;
|
||||
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
|
||||
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
|
||||
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
|
||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
-sco5)
|
||||
os=sco3.2v5
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco4)
|
||||
os=-sco3.2v4
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco3.2.[4-9]*)
|
||||
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco3.2v[4-9]*)
|
||||
# Don't forget version if it is 3.2v4 or newer.
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco*)
|
||||
os=-sco3.2v2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-isc)
|
||||
os=-isc2.2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-clix*)
|
||||
basic_machine=clipper-intergraph
|
||||
;;
|
||||
-isc*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-lynx*)
|
||||
os=-lynxos
|
||||
;;
|
||||
-ptx*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
|
||||
;;
|
||||
-windowsnt*)
|
||||
os=`echo $os | sed -e 's/windowsnt/winnt/'`
|
||||
;;
|
||||
-psos*)
|
||||
os=-psos
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode aliases for certain CPU-COMPANY combinations.
|
||||
case $basic_machine in
|
||||
# Recognize the basic CPU types without company name.
|
||||
# Some are omitted here because they have special meanings below.
|
||||
tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arm \
|
||||
| arme[lb] | pyramid | mn10300 \
|
||||
| tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
|
||||
| alpha | we32k | ns16k | clipper | i370 | sh \
|
||||
| powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
|
||||
| pdp11 | mips64el | mips64orion | mips64orionel \
|
||||
| sparc | sparclet | sparclite | sparc64)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
# We use `pc' rather than `unknown'
|
||||
# because (1) that's what they normally are, and
|
||||
# (2) the word "unknown" tends to confuse beginning users.
|
||||
i[3456]86)
|
||||
basic_machine=$basic_machine-pc
|
||||
;;
|
||||
# Object if more than one company name word.
|
||||
*-*-*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
# Recognize the basic CPU types with company name.
|
||||
vax-* | tahoe-* | i[3456]86-* | i860-* | m32r-* | m68k-* | m68000-* \
|
||||
| m88k-* | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
|
||||
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
|
||||
| none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
|
||||
| hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
|
||||
| pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
|
||||
| pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
|
||||
| mips64el-* | mips64orion-* | mips64orionel-* | f301-*)
|
||||
;;
|
||||
# Recognize the various machine names and aliases which stand
|
||||
# for a CPU type and a company and sometimes even an OS.
|
||||
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
|
||||
basic_machine=m68000-att
|
||||
;;
|
||||
3b*)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
alliant | fx80)
|
||||
basic_machine=fx80-alliant
|
||||
;;
|
||||
altos | altos3068)
|
||||
basic_machine=m68k-altos
|
||||
;;
|
||||
am29k)
|
||||
basic_machine=a29k-none
|
||||
os=-bsd
|
||||
;;
|
||||
amdahl)
|
||||
basic_machine=580-amdahl
|
||||
os=-sysv
|
||||
;;
|
||||
amiga | amiga-*)
|
||||
basic_machine=m68k-cbm
|
||||
;;
|
||||
amigados)
|
||||
basic_machine=m68k-cbm
|
||||
os=-amigados
|
||||
;;
|
||||
amigaunix | amix)
|
||||
basic_machine=m68k-cbm
|
||||
os=-sysv4
|
||||
;;
|
||||
apollo68)
|
||||
basic_machine=m68k-apollo
|
||||
os=-sysv
|
||||
;;
|
||||
aux)
|
||||
basic_machine=m68k-apple
|
||||
os=-aux
|
||||
;;
|
||||
balance)
|
||||
basic_machine=ns32k-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
convex-c1)
|
||||
basic_machine=c1-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c2)
|
||||
basic_machine=c2-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c32)
|
||||
basic_machine=c32-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c34)
|
||||
basic_machine=c34-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c38)
|
||||
basic_machine=c38-convex
|
||||
os=-bsd
|
||||
;;
|
||||
cray | ymp)
|
||||
basic_machine=ymp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
cray2)
|
||||
basic_machine=cray2-cray
|
||||
os=-unicos
|
||||
;;
|
||||
[ctj]90-cray)
|
||||
basic_machine=c90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
crds | unos)
|
||||
basic_machine=m68k-crds
|
||||
;;
|
||||
da30 | da30-*)
|
||||
basic_machine=m68k-da30
|
||||
;;
|
||||
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
|
||||
basic_machine=mips-dec
|
||||
;;
|
||||
delta | 3300 | motorola-3300 | motorola-delta \
|
||||
| 3300-motorola | delta-motorola)
|
||||
basic_machine=m68k-motorola
|
||||
;;
|
||||
delta88)
|
||||
basic_machine=m88k-motorola
|
||||
os=-sysv3
|
||||
;;
|
||||
dpx20 | dpx20-*)
|
||||
basic_machine=rs6000-bull
|
||||
os=-bosx
|
||||
;;
|
||||
dpx2* | dpx2*-bull)
|
||||
basic_machine=m68k-bull
|
||||
os=-sysv3
|
||||
;;
|
||||
ebmon29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-ebmon
|
||||
;;
|
||||
elxsi)
|
||||
basic_machine=elxsi-elxsi
|
||||
os=-bsd
|
||||
;;
|
||||
encore | umax | mmax)
|
||||
basic_machine=ns32k-encore
|
||||
;;
|
||||
fx2800)
|
||||
basic_machine=i860-alliant
|
||||
;;
|
||||
genix)
|
||||
basic_machine=ns32k-ns
|
||||
;;
|
||||
gmicro)
|
||||
basic_machine=tron-gmicro
|
||||
os=-sysv
|
||||
;;
|
||||
h3050r* | hiux*)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
h8300hms)
|
||||
basic_machine=h8300-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
harris)
|
||||
basic_machine=m88k-harris
|
||||
os=-sysv3
|
||||
;;
|
||||
hp300-*)
|
||||
basic_machine=m68k-hp
|
||||
;;
|
||||
hp300bsd)
|
||||
basic_machine=m68k-hp
|
||||
os=-bsd
|
||||
;;
|
||||
hp300hpux)
|
||||
basic_machine=m68k-hp
|
||||
os=-hpux
|
||||
;;
|
||||
hp9k2[0-9][0-9] | hp9k31[0-9])
|
||||
basic_machine=m68000-hp
|
||||
;;
|
||||
hp9k3[2-9][0-9])
|
||||
basic_machine=m68k-hp
|
||||
;;
|
||||
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k8[0-9][0-9] | hp8[0-9][0-9])
|
||||
basic_machine=hppa1.0-hp
|
||||
;;
|
||||
hppa-next)
|
||||
os=-nextstep3
|
||||
;;
|
||||
i370-ibm* | ibm*)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i[3456]86v32)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv32
|
||||
;;
|
||||
i[3456]86v4*)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv4
|
||||
;;
|
||||
i[3456]86v)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv
|
||||
;;
|
||||
i[3456]86sol2)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-solaris2
|
||||
;;
|
||||
iris | iris4d)
|
||||
basic_machine=mips-sgi
|
||||
case $os in
|
||||
-irix*)
|
||||
;;
|
||||
*)
|
||||
os=-irix4
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
isi68 | isi)
|
||||
basic_machine=m68k-isi
|
||||
os=-sysv
|
||||
;;
|
||||
m88k-omron*)
|
||||
basic_machine=m88k-omron
|
||||
;;
|
||||
magnum | m3230)
|
||||
basic_machine=mips-mips
|
||||
os=-sysv
|
||||
;;
|
||||
merlin)
|
||||
basic_machine=ns32k-utek
|
||||
os=-sysv
|
||||
;;
|
||||
miniframe)
|
||||
basic_machine=m68000-convergent
|
||||
;;
|
||||
mipsel*-linux*)
|
||||
basic_machine=mipsel-unknown
|
||||
os=-linux
|
||||
;;
|
||||
mips*-linux*)
|
||||
basic_machine=mips-unknown
|
||||
os=-linux
|
||||
;;
|
||||
mips3*-*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
|
||||
;;
|
||||
mips3*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
||||
;;
|
||||
ncr3000)
|
||||
basic_machine=i486-ncr
|
||||
os=-sysv4
|
||||
;;
|
||||
news | news700 | news800 | news900)
|
||||
basic_machine=m68k-sony
|
||||
os=-newsos
|
||||
;;
|
||||
news1000)
|
||||
basic_machine=m68030-sony
|
||||
os=-newsos
|
||||
;;
|
||||
news-3600 | risc-news)
|
||||
basic_machine=mips-sony
|
||||
os=-newsos
|
||||
;;
|
||||
next | m*-next )
|
||||
basic_machine=m68k-next
|
||||
case $os in
|
||||
-nextstep* )
|
||||
;;
|
||||
-ns2*)
|
||||
os=-nextstep2
|
||||
;;
|
||||
*)
|
||||
os=-nextstep3
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
nh3000)
|
||||
basic_machine=m68k-harris
|
||||
os=-cxux
|
||||
;;
|
||||
nh[45]000)
|
||||
basic_machine=m88k-harris
|
||||
os=-cxux
|
||||
;;
|
||||
nindy960)
|
||||
basic_machine=i960-intel
|
||||
os=-nindy
|
||||
;;
|
||||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
pa-hitachi)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
paragon)
|
||||
basic_machine=i860-intel
|
||||
os=-osf
|
||||
;;
|
||||
pbd)
|
||||
basic_machine=sparc-tti
|
||||
;;
|
||||
pbb)
|
||||
basic_machine=m68k-tti
|
||||
;;
|
||||
pc532 | pc532-*)
|
||||
basic_machine=ns32k-pc532
|
||||
;;
|
||||
pentium | p5)
|
||||
basic_machine=i586-intel
|
||||
;;
|
||||
pentiumpro | p6)
|
||||
basic_machine=i686-intel
|
||||
;;
|
||||
pentium-* | p5-*)
|
||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumpro-* | p6-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
k5)
|
||||
# We don't have specific support for AMD's K5 yet, so just call it a Pentium
|
||||
basic_machine=i586-amd
|
||||
;;
|
||||
nexen)
|
||||
# We don't have specific support for Nexgen yet, so just call it a Pentium
|
||||
basic_machine=i586-nexgen
|
||||
;;
|
||||
pn)
|
||||
basic_machine=pn-gould
|
||||
;;
|
||||
power) basic_machine=rs6000-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/^[^-]*-//'`
|
||||
;;
|
||||
ps2)
|
||||
basic_machine=i386-ibm
|
||||
;;
|
||||
rm[46]00)
|
||||
basic_machine=mips-siemens
|
||||
;;
|
||||
rtpc | rtpc-*)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
sequent)
|
||||
basic_machine=i386-sequent
|
||||
;;
|
||||
sh)
|
||||
basic_machine=sh-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
sps7)
|
||||
basic_machine=m68k-bull
|
||||
os=-sysv2
|
||||
;;
|
||||
spur)
|
||||
basic_machine=spur-unknown
|
||||
;;
|
||||
sun2)
|
||||
basic_machine=m68000-sun
|
||||
;;
|
||||
sun2os3)
|
||||
basic_machine=m68000-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun2os4)
|
||||
basic_machine=m68000-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun3os3)
|
||||
basic_machine=m68k-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun3os4)
|
||||
basic_machine=m68k-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun4os3)
|
||||
basic_machine=sparc-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun4os4)
|
||||
basic_machine=sparc-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun4sol2)
|
||||
basic_machine=sparc-sun
|
||||
os=-solaris2
|
||||
;;
|
||||
sun3 | sun3-*)
|
||||
basic_machine=m68k-sun
|
||||
;;
|
||||
sun4)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
sun386 | sun386i | roadrunner)
|
||||
basic_machine=i386-sun
|
||||
;;
|
||||
symmetry)
|
||||
basic_machine=i386-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
tower | tower-32)
|
||||
basic_machine=m68k-ncr
|
||||
;;
|
||||
udi29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
ultra3)
|
||||
basic_machine=a29k-nyu
|
||||
os=-sym1
|
||||
;;
|
||||
vaxv)
|
||||
basic_machine=vax-dec
|
||||
os=-sysv
|
||||
;;
|
||||
vms)
|
||||
basic_machine=vax-dec
|
||||
os=-vms
|
||||
;;
|
||||
vpp*|vx|vx-*)
|
||||
basic_machine=f301-fujitsu
|
||||
;;
|
||||
vxworks960)
|
||||
basic_machine=i960-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
vxworks68)
|
||||
basic_machine=m68k-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
vxworks29k)
|
||||
basic_machine=a29k-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
xmp)
|
||||
basic_machine=xmp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
none)
|
||||
basic_machine=none-none
|
||||
os=-none
|
||||
;;
|
||||
|
||||
# Here we handle the default manufacturer of certain CPU types. It is in
|
||||
# some cases the only manufacturer, in others, it is the most popular.
|
||||
mips)
|
||||
if [ x$os = x-linux ]; then
|
||||
basic_machine=mips-unknown
|
||||
else
|
||||
basic_machine=mips-mips
|
||||
fi
|
||||
;;
|
||||
romp)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
rs6000)
|
||||
basic_machine=rs6000-ibm
|
||||
;;
|
||||
vax)
|
||||
basic_machine=vax-dec
|
||||
;;
|
||||
pdp11)
|
||||
basic_machine=pdp11-dec
|
||||
;;
|
||||
we32k)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
sparc)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
cydra)
|
||||
basic_machine=cydra-cydrome
|
||||
;;
|
||||
orion)
|
||||
basic_machine=orion-highlevel
|
||||
;;
|
||||
orion105)
|
||||
basic_machine=clipper-highlevel
|
||||
;;
|
||||
*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Here we canonicalize certain aliases for manufacturers.
|
||||
case $basic_machine in
|
||||
*-digital*)
|
||||
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
|
||||
;;
|
||||
*-commodore*)
|
||||
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode manufacturer-specific aliases for certain operating systems.
|
||||
|
||||
if [ x"$os" != x"" ]
|
||||
then
|
||||
case $os in
|
||||
# First match some system type aliases
|
||||
# that might get confused with valid system types.
|
||||
# -solaris* is a basic system type, with this one exception.
|
||||
-solaris1 | -solaris1.*)
|
||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||
;;
|
||||
-solaris)
|
||||
os=-solaris2
|
||||
;;
|
||||
-unixware* | svr4*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-gnu/linux*)
|
||||
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
|
||||
;;
|
||||
# First accept the basic system types.
|
||||
# The portable systems comes first.
|
||||
# Each alternative MUST END IN A *, to match a version number.
|
||||
# -sysv* is not here because it comes later, after sysvr4.
|
||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
||||
| -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -linux-gnu* | -uxpv*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-linux*)
|
||||
os=`echo $os | sed -e 's|linux|linux-gnu|'`
|
||||
;;
|
||||
-sunos5*)
|
||||
os=`echo $os | sed -e 's|sunos5|solaris2|'`
|
||||
;;
|
||||
-sunos6*)
|
||||
os=`echo $os | sed -e 's|sunos6|solaris3|'`
|
||||
;;
|
||||
-osfrose*)
|
||||
os=-osfrose
|
||||
;;
|
||||
-osf*)
|
||||
os=-osf
|
||||
;;
|
||||
-utek*)
|
||||
os=-bsd
|
||||
;;
|
||||
-dynix*)
|
||||
os=-bsd
|
||||
;;
|
||||
-acis*)
|
||||
os=-aos
|
||||
;;
|
||||
-ctix* | -uts*)
|
||||
os=-sysv
|
||||
;;
|
||||
-ns2 )
|
||||
os=-nextstep2
|
||||
;;
|
||||
# Preserve the version number of sinix5.
|
||||
-sinix5.*)
|
||||
os=`echo $os | sed -e 's|sinix|sysv|'`
|
||||
;;
|
||||
-sinix*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-triton*)
|
||||
os=-sysv3
|
||||
;;
|
||||
-oss*)
|
||||
os=-sysv3
|
||||
;;
|
||||
-svr4)
|
||||
os=-sysv4
|
||||
;;
|
||||
-svr3)
|
||||
os=-sysv3
|
||||
;;
|
||||
-sysvr4)
|
||||
os=-sysv4
|
||||
;;
|
||||
# This must come after -sysvr4.
|
||||
-sysv*)
|
||||
;;
|
||||
-xenix)
|
||||
os=-xenix
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
# Get rid of the `-' at the beginning of $os.
|
||||
os=`echo $os | sed 's/[^-]*-//'`
|
||||
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
|
||||
# Here we handle the default operating systems that come with various machines.
|
||||
# The value should be what the vendor currently ships out the door with their
|
||||
# machine or put another way, the most popular os provided with the machine.
|
||||
|
||||
# Note that if you're going to try to match "-MANUFACTURER" here (say,
|
||||
# "-sun"), then you have to tell the case statement up towards the top
|
||||
# that MANUFACTURER isn't an operating system. Otherwise, code above
|
||||
# will signal an error saying that MANUFACTURER isn't an operating
|
||||
# system, and we'll never get to this point.
|
||||
|
||||
case $basic_machine in
|
||||
*-acorn)
|
||||
os=-riscix1.2
|
||||
;;
|
||||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
pdp11-*)
|
||||
os=-none
|
||||
;;
|
||||
*-dec | vax-*)
|
||||
os=-ultrix4.2
|
||||
;;
|
||||
m68*-apollo)
|
||||
os=-domain
|
||||
;;
|
||||
i386-sun)
|
||||
os=-sunos4.0.2
|
||||
;;
|
||||
m68000-sun)
|
||||
os=-sunos3
|
||||
# This also exists in the configure program, but was not the
|
||||
# default.
|
||||
# os=-sunos4
|
||||
;;
|
||||
*-tti) # must be before sparc entry or we get the wrong os.
|
||||
os=-sysv3
|
||||
;;
|
||||
sparc-* | *-sun)
|
||||
os=-sunos4.1.1
|
||||
;;
|
||||
*-ibm)
|
||||
os=-aix
|
||||
;;
|
||||
*-hp)
|
||||
os=-hpux
|
||||
;;
|
||||
*-hitachi)
|
||||
os=-hiux
|
||||
;;
|
||||
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
|
||||
os=-sysv
|
||||
;;
|
||||
*-cbm)
|
||||
os=-amigados
|
||||
;;
|
||||
*-dg)
|
||||
os=-dgux
|
||||
;;
|
||||
*-dolphin)
|
||||
os=-sysv3
|
||||
;;
|
||||
m68k-ccur)
|
||||
os=-rtu
|
||||
;;
|
||||
m88k-omron*)
|
||||
os=-luna
|
||||
;;
|
||||
*-next )
|
||||
os=-nextstep
|
||||
;;
|
||||
*-sequent)
|
||||
os=-ptx
|
||||
;;
|
||||
*-crds)
|
||||
os=-unos
|
||||
;;
|
||||
*-ns)
|
||||
os=-genix
|
||||
;;
|
||||
i370-*)
|
||||
os=-mvs
|
||||
;;
|
||||
*-next)
|
||||
os=-nextstep3
|
||||
;;
|
||||
*-gould)
|
||||
os=-sysv
|
||||
;;
|
||||
*-highlevel)
|
||||
os=-bsd
|
||||
;;
|
||||
*-encore)
|
||||
os=-bsd
|
||||
;;
|
||||
*-sgi)
|
||||
os=-irix
|
||||
;;
|
||||
*-siemens)
|
||||
os=-sysv4
|
||||
;;
|
||||
*-masscomp)
|
||||
os=-rtu
|
||||
;;
|
||||
f301-fujitsu)
|
||||
os=-uxpv
|
||||
;;
|
||||
*)
|
||||
os=-none
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Here we handle the case where we know the os, and the CPU type, but not the
|
||||
# manufacturer. We pick the logical manufacturer.
|
||||
vendor=unknown
|
||||
case $basic_machine in
|
||||
*-unknown)
|
||||
case $os in
|
||||
-riscix*)
|
||||
vendor=acorn
|
||||
;;
|
||||
-sunos*)
|
||||
vendor=sun
|
||||
;;
|
||||
-aix*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-hpux*)
|
||||
vendor=hp
|
||||
;;
|
||||
-hiux*)
|
||||
vendor=hitachi
|
||||
;;
|
||||
-unos*)
|
||||
vendor=crds
|
||||
;;
|
||||
-dgux*)
|
||||
vendor=dg
|
||||
;;
|
||||
-luna*)
|
||||
vendor=omron
|
||||
;;
|
||||
-genix*)
|
||||
vendor=ns
|
||||
;;
|
||||
-mvs*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-ptx*)
|
||||
vendor=sequent
|
||||
;;
|
||||
-vxsim* | -vxworks*)
|
||||
vendor=wrs
|
||||
;;
|
||||
-aux*)
|
||||
vendor=apple
|
||||
;;
|
||||
esac
|
||||
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
||||
;;
|
||||
esac
|
||||
|
||||
echo $basic_machine$os
|
||||
-978
@@ -1,978 +0,0 @@
|
||||
dnl $Id$ -*- sh -*-
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
|
||||
|
||||
divert(0)
|
||||
AC_INIT(main.c)
|
||||
recurse=yes
|
||||
for arg in $@; do
|
||||
case $arg in
|
||||
## This is to prevent "./config.status --recheck" from
|
||||
## running configure in libzend again.
|
||||
--no-recursion) recurse=no;;
|
||||
--enable-thread-safety) threadsafe=yes;;
|
||||
*) ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test "$recurse" = "yes"; then
|
||||
cwd=`pwd`
|
||||
(set -x; test -d libzend || mkdir libzend ; cd libzend; $cwd/$srcdir/libzend/configure --cache-file=$cwd/config.cache $@)
|
||||
if test "$threadsafe" = "yes"; then
|
||||
(set -x; test -d TSRM || mkdir TSRM; cd TSRM; $cwd/$srcdir/TSRM/configure --cache-file=$cwd/config.cache $@)
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl ## Diversion 1 is the initial checking of OS features, programs,
|
||||
dnl ## libraries and so on.
|
||||
|
||||
dnl ## In diversion 2 we check for compile-time options to the PHP
|
||||
dnl ## core and how to deal with different system dependencies. This
|
||||
dnl ## includes what regex library is used and whether debugging or short
|
||||
dnl ## tags are enabled, and the default behaviour of php3.ini options.
|
||||
dnl ## This is also where an SAPI interface is selected (choosing between
|
||||
dnl ## Apache module, CGI etc.)
|
||||
|
||||
dnl ## In diversion 3 we check which extensions should be compiled.
|
||||
dnl ## All of these are normally in the extension directories.
|
||||
|
||||
dnl ## Diversion 4 is the last one. Here we generate files and clean up.
|
||||
|
||||
divert(1)
|
||||
|
||||
dnl ## This is where the version number is changed from now on!
|
||||
AM_INIT_AUTOMAKE(php, 4.0pa1)
|
||||
|
||||
|
||||
|
||||
PHP_VERSION=$VERSION
|
||||
echo "#define PHP_VERSION \"$PHP_VERSION\"" > php_version.h.new
|
||||
cmp php_version.h.new php_version.h >/dev/null 2>&1
|
||||
if test $? -ne 0 ; then
|
||||
rm -f php_version.h && mv php_version.h.new php_version.h && \
|
||||
echo 'Updated php_version.h'
|
||||
else
|
||||
rm -f php_version.h.new
|
||||
fi
|
||||
AC_SUBST(PHP_VERSION)
|
||||
|
||||
AM_CONFIG_HEADER(php_config.h)
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
dnl We want this one before the checks, so the checks can modify CFLAGS.
|
||||
test -z "$CFLAGS" && auto_cflags=1
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_YACC
|
||||
if test "$YACC" != "bison -y"; then
|
||||
AC_MSG_WARN(You will need bison if you want to regenerate the PHP parsers.)
|
||||
else
|
||||
AC_MSG_CHECKING(bison version)
|
||||
set `$YACC --version| sed -e 's/^GNU Bison version //' -e 's/\./ /'`
|
||||
if test "$1" = "1" -a "$2" -lt "25"; then
|
||||
AC_MSG_WARN(You will need bison 1.25 if you want to regenerate the PHP parsers (found $1.$2).)
|
||||
fi
|
||||
AC_MSG_RESULT($1.$2 (ok))
|
||||
fi
|
||||
|
||||
dnl ## there has to be a better way...
|
||||
dnl## OLDLIBS=$LIBS; LIBS=""
|
||||
AC_PROG_CC
|
||||
dnl## LIBS=$OLDLIBS
|
||||
|
||||
AC_PROG_RANLIB
|
||||
AC_PROG_CC_C_O
|
||||
AC_PROG_LN_S
|
||||
AC_PATH_PROG(PERL_PATH, perl)
|
||||
|
||||
|
||||
dnl Make flex scanners use const if they can, even if __STDC__ is not
|
||||
dnl true, for compilers like Sun's that only set __STDC__ true in
|
||||
dnl "limit-to-ANSI-standard" mode, not in "ANSI-compatible" mode
|
||||
AC_C_CONST
|
||||
if test "$ac_cv_c_const" = "yes" ; then
|
||||
LEX_CFLAGS="-DYY_USE_CONST"
|
||||
fi
|
||||
AC_SUBST(LEX_CFLAGS)
|
||||
|
||||
dnl Hack to work around a Mac OS X cpp problem
|
||||
dnl Known versions needing this workaround are 5.3 and 5.4
|
||||
if test "$ac_cv_prog_gcc" = "yes" -a "`uname -s`" = "Rhapsody"; then
|
||||
CPPFLAGS="$CPPFLAGS -traditional-cpp"
|
||||
fi
|
||||
|
||||
if test "`uname -sv`" = "AIX 4" -a "$GCC" != "yes"; then
|
||||
APXS_EXP="-bE:mod_php4.exp"
|
||||
fi
|
||||
AC_SUBST(APXS_EXP)
|
||||
|
||||
dnl Ugly hack to get around a problem with gcc on AIX.
|
||||
if test "$CC" = "gcc" -a "$ac_cv_prog_cc_g" = "yes" -a \
|
||||
"`uname -sv`" = "AIX 4"; then
|
||||
CFLAGS=`echo $CFLAGS | sed -e 's/-g//'`
|
||||
fi
|
||||
|
||||
dnl check for -R, etc. switch
|
||||
AC_MSG_CHECKING(if compiler supports -R)
|
||||
AC_CACHE_VAL(php_cv_cc_dashr,[
|
||||
SAVE_LIBS="${LIBS}"
|
||||
LIBS="-R /usr/lib ${LIBS}"
|
||||
AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no)
|
||||
LIBS="${SAVE_LIBS}"])
|
||||
AC_MSG_RESULT($php_cv_cc_dashr)
|
||||
if test $php_cv_cc_dashr = "yes"; then
|
||||
ld_runpath_switch="-R"
|
||||
apxs_runpath_switch="-Wl,-R'"
|
||||
else
|
||||
AC_MSG_CHECKING([if compiler supports -Wl,-rpath,])
|
||||
AC_CACHE_VAL(php_cv_cc_rpath,[
|
||||
SAVE_LIBS="${LIBS}"
|
||||
LIBS="-Wl,-rpath,/usr/lib ${LIBS}"
|
||||
AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no)
|
||||
LIBS="${SAVE_LIBS}"])
|
||||
AC_MSG_RESULT($php_cv_cc_rpath)
|
||||
if test $php_cv_cc_rpath = "yes"; then
|
||||
ld_runpath_switch="-Wl,-rpath,"
|
||||
apxs_runpath_switch="-Wl,'-rpath "
|
||||
else
|
||||
dnl something innocuous
|
||||
ld_runpath_switch="-L"
|
||||
apxs_runpath_switch="-L'"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
dnl Check compiler support for -rdynamic
|
||||
AC_MSG_CHECKING(if compiler supports -rdynamic)
|
||||
AC_CACHE_VAL(php_cc_rdynamic,[
|
||||
SAVE_LIBS="${LIBS}"
|
||||
LIBS="-rdynamic ${LIBS}"
|
||||
AC_TRY_LINK([], [], php_cc_rdynamic=yes, php_cc_rdynamic=no)
|
||||
LIBS="${SAVE_LIBS}"])
|
||||
AC_MSG_RESULT($php_cc_rdynamic)
|
||||
if test $php_cc_rdynamic = "yes"; then
|
||||
AC_CHECK_CC_OPTION(rdynamic)
|
||||
fi
|
||||
if test $php_cc_rdynamic = "yes"; then
|
||||
LDFLAGS="${LDFLAGS} -rdynamic"
|
||||
RDYNAMIC_LFLAGS="-rdynamic"
|
||||
else
|
||||
RDYNAMIC_LFLAGS=""
|
||||
fi
|
||||
AC_SUBST(RDYNAMIC_LFLAGS)
|
||||
|
||||
dnl AC_PROG_INSTALL
|
||||
AC_PATH_PROG(PROG_SENDMAIL, sendmail, /usr/lib/sendmail, $PATH /usr/bin /usr/sbin /usr/etc /etc /usr/ucblib)
|
||||
if test -n "$PROG_SENDMAIL"; then
|
||||
AC_DEFINE(HAVE_SENDMAIL)
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Check for /usr/pkg/{lib,include} which is where NetBSD puts binary
|
||||
dnl and source packages. This should be harmless on other OSs.
|
||||
dnl
|
||||
if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then
|
||||
CFLAGS="$CFLAGS -I/usr/pkg/include"
|
||||
LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
|
||||
fi
|
||||
|
||||
INCLUDES="-I\$(top_builddir)/libzend -I\$(top_builddir)/TSRM"
|
||||
AC_SUBST(INCLUDES)
|
||||
|
||||
AC_CHECK_LIB(nsl, gethostname, [
|
||||
LIBS="-lnsl $LIBS"
|
||||
AC_DEFINE(HAVE_LIBNSL) ], [])
|
||||
|
||||
AC_CHECK_LIB(c, socket, [:], [
|
||||
AC_CHECK_LIB(socket, socket, [
|
||||
LIBS="-lsocket $LIBS"
|
||||
AC_DEFINE(HAVE_LIBSOCKET) ], []) ])
|
||||
|
||||
AC_CHECK_LIB(c, gethostbyaddr, [:], [
|
||||
AC_CHECK_LIB(nsl, gethostbyaddr, [
|
||||
LIBS="-lnsl $LIBS"
|
||||
AC_DEFINE(HAVE_LIBNSL) ], []) ])
|
||||
|
||||
AC_CHECK_LIB(c, crypt, [:], [
|
||||
AC_CHECK_LIB(crypt, crypt, [
|
||||
LIBS="-lcrypt $LIBS"
|
||||
AC_DEFINE(HAVE_LIBCRYPT) ], []) ])
|
||||
|
||||
dnl The sin may be in a library which need not be specifed
|
||||
dnl as well as res_search resides in libsocket
|
||||
AC_CHECK_LIB(c, sin, [:], [
|
||||
AC_CHECK_LIB(m, sin) ])
|
||||
|
||||
dnl The res_search may be in libsocket as well, and if it is
|
||||
dnl make sure to check for dn_skipname in libresolv, or if res_search
|
||||
dnl is in neither of these libs, still check for dn_skipname in libresolv
|
||||
AC_CHECK_LIB(socket, res_search, [
|
||||
AC_CHECK_LIB(resolv, dn_skipname)
|
||||
AC_CHECK_LIB(resolv, __dn_skipname)
|
||||
LIBS="$LIBS -lsocket"
|
||||
AC_DEFINE(HAVE_LIBSOCKET) ], [
|
||||
AC_CHECK_LIB(resolv, res_search, [
|
||||
LIBS="$LIBS -lresolv"
|
||||
AC_DEFINE(HAVE_LIBRESOLV)
|
||||
], [
|
||||
AC_CHECK_LIB(resolv, dn_skipname)
|
||||
AC_CHECK_LIB(resolv, __dn_skipname)
|
||||
])
|
||||
])
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
|
||||
dnl In QNX opendir resides in libc but dirent.h is still required
|
||||
if test "`uname -s 2>/dev/null`" != "QNX"; then
|
||||
AC_HEADER_DIRENT
|
||||
else
|
||||
AC_CHECK_HEADERS(dirent.h)
|
||||
fi
|
||||
AC_MISSING_FCLOSE_DECL
|
||||
dnl QNX requires unix.h to allow functions in libunix to work properly
|
||||
AC_CHECK_HEADERS(fcntl.h unistd.h crypt.h sys/file.h memory.h pwd.h grp.h sys/socket.h sys/wait.h syslog.h string.h sys/varargs.h stdarg.h sys/time.h signal.h netinet/in.h dlfcn.h limits.h sys/types.h unix.h arpa/inet.h locale.h)
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_STRUCT_TM
|
||||
AC_STRUCT_TIMEZONE
|
||||
|
||||
AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,
|
||||
[AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_gmtoff;],
|
||||
ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)])
|
||||
|
||||
if test "$ac_cv_struct_tm_gmtoff" = yes; then
|
||||
AC_DEFINE(HAVE_TM_GMTOFF)
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK(for struct flock,php_struct_flock,
|
||||
AC_TRY_COMPILE([
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
],
|
||||
[struct flock x;],
|
||||
[
|
||||
php_struct_flock=yes
|
||||
],[
|
||||
php_struct_flock=no
|
||||
])
|
||||
)
|
||||
if test "$php_struct_flock" = "yes" ; then
|
||||
AC_DEFINE(HAVE_STRUCT_FLOCK, 1)
|
||||
else
|
||||
AC_DEFINE(HAVE_STRUCT_FLOCK, 0)
|
||||
fi
|
||||
|
||||
AC_CHECK_SIZEOF(long, 8)
|
||||
AC_CHECK_SIZEOF(int, 4)
|
||||
|
||||
dnl Check for members of the stat structure
|
||||
AC_STRUCT_ST_BLKSIZE
|
||||
dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exists
|
||||
dnl The WARNING_LEVEL required because cc in QNX hates -w option without an argument
|
||||
if test "`uname -s 2>/dev/null`" != "QNX"; then
|
||||
AC_STRUCT_ST_BLOCKS
|
||||
else
|
||||
AC_MSG_WARN(warnings level for cc set to 0)
|
||||
WARNING_LEVEL=0
|
||||
AC_SUBST(WARNING_LEVEL)
|
||||
fi
|
||||
AC_STRUCT_ST_RDEV
|
||||
|
||||
dnl Checks for types
|
||||
AC_TYPE_SIZE_T
|
||||
AC_TYPE_UID_T
|
||||
dnl This is required for QNX and may be some BSD derived systems
|
||||
AC_CHECK_TYPE( uint, unsigned int )
|
||||
AC_CHECK_TYPE( ulong, unsigned long )
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_FUNC_VPRINTF
|
||||
AC_CHECK_FUNCS(memcpy memmove strdup strerror strcasecmp strstr flock lockf putenv tempnam usleep setlocale gettimeofday setvbuf srand48 lrand48 srandom random link symlink regcomp getlogin cuserid vsnprintf snprintf gcvt utime crypt rint unsetenv strftime setsockopt tzset shutdown inet_aton)
|
||||
AC_FUNC_UTIME_NULL
|
||||
AC_FUNC_ALLOCA
|
||||
dnl## OLDLIBS=$LIBS; LIBS=""
|
||||
AC_BROKEN_SPRINTF
|
||||
dnl## LIBS=$OLDLIBS
|
||||
AC_REPLACE_FUNCS(getopt)
|
||||
|
||||
dnl AIX keeps in_addr_t in /usr/include/netinet/in.h
|
||||
dnl AC_MSG_CHECKING(for in_addr_t)
|
||||
AC_CACHE_VAL(ac_cv_type_$1,
|
||||
[AC_EGREP_CPP(dnl
|
||||
changequote(<<,>>)dnl
|
||||
<<in_addr_t[^a-zA-Z_0-9]>>dnl
|
||||
changequote([,]), [#include <sys/types.h>
|
||||
#if STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif], ac_cv_type_in_addr_t=yes, ac_cv_type_in_addr_t=no)])dnl
|
||||
|
||||
dnl AC_MSG_RESULT($ac_cv_type_in_addr_t)
|
||||
if test $ac_cv_type_in_addr_t = no; then
|
||||
AC_DEFINE(in_addr_t, u_int)
|
||||
fi
|
||||
|
||||
divert(2)
|
||||
|
||||
abs_srcdir=`(cd $srcdir; pwd)`
|
||||
abs_builddir=`pwd`
|
||||
AC_SUBST(abs_srcdir)
|
||||
AC_SUBST(abs_builddir)
|
||||
|
||||
AC_MSG_CHECKING(for Apache module support via DSO through APACI)
|
||||
AC_MSG_CHECKING(whether to use bundled regex library)
|
||||
AC_ARG_WITH(system-regex,
|
||||
[ --with-system-regex Do not use the bundled regex library],
|
||||
[
|
||||
if test -n "$APXS"; then
|
||||
if test -z "`$APXS -q CFLAGS | grep USE_HSREGEX`"; then
|
||||
HSREGEX=yes
|
||||
else
|
||||
HSREGEX=no
|
||||
fi
|
||||
else
|
||||
if test "$withval" = "no"; then
|
||||
HSREGEX=yes
|
||||
else
|
||||
HSREGEX=no
|
||||
fi
|
||||
fi
|
||||
],[
|
||||
if test -n "$APXS"; then
|
||||
if test -z "`$APXS -q CFLAGS | grep USE_HSREGEX`"; then
|
||||
HSREGEX=yes
|
||||
else
|
||||
HSREGEX=no
|
||||
fi
|
||||
else
|
||||
HSREGEX=yes
|
||||
fi
|
||||
])
|
||||
AC_MSG_RESULT($HSREGEX)
|
||||
|
||||
if test "$HSREGEX" = "yes"; then
|
||||
REGEX_LIB=regex/libregex.a
|
||||
EXTRA_LIBS="-L$abs_builddir/regex -lregex $EXTRA_LIBS"
|
||||
AC_DEFINE(HSREGEX)
|
||||
AC_DEFINE(REGEX,1)
|
||||
else
|
||||
REGEX_LIB=
|
||||
AC_DEFINE(REGEX,0)
|
||||
fi
|
||||
|
||||
AC_SUBST(REGEX_LIB)
|
||||
AC_SUBST(HSREGEX)
|
||||
|
||||
AC_MSG_CHECKING(for Apache module support via DSO through APXS)
|
||||
AC_ARG_WITH(apxs,
|
||||
[ --with-apxs[=FILE] Build shared Apache module. FILE is the optional
|
||||
pathname to the Apache apxs tool; defaults to "apxs".
|
||||
(This option needs Perl installed)],
|
||||
[
|
||||
if test "$withval" = "yes"; then
|
||||
withval=apxs
|
||||
fi
|
||||
AC_EXPAND_PATH($withval, APXS)
|
||||
APXS_LDFLAGS="@SYBASE_LFLAGS@ @SYBASE_LIBS@ @SYBASE_CT_LFLAGS@ @SYBASE_CT_LIBS@"
|
||||
APACHE_INCLUDE="-I`$APXS -q INCLUDEDIR`"
|
||||
BINNAME=libphp4.so
|
||||
INSTALL_IT="\$(APXS) -i -a -n php4 $BINNAME"
|
||||
CFLAGS_SHLIB=`perl -V:cccdlflags | cut -d\' -f2`
|
||||
LDFLAGS_SHLIB=`perl -V:lddlflags | cut -d\' -f2`
|
||||
LDFLAGS_SHLIB_EXPORT=`perl -V:ccdlflags | cut -d\' -f2`
|
||||
PHP_LIBS=
|
||||
STRONGHOLD=
|
||||
INCLUDES="$INCLUDES $APACHE_INCLUDE"
|
||||
AC_DEFINE(APACHE)
|
||||
AC_SUBST(APXS)
|
||||
AC_SUBST(APXS_LDFLAGS)
|
||||
AC_SUBST(BINNAME)
|
||||
AC_SUBST(INSTALL_IT)
|
||||
AC_SUBST(PHP_LIBS)
|
||||
AC_SUBST(APACHE_INCLUDE)
|
||||
AC_DEFINE(HAVE_AP_CONFIG_H)
|
||||
AC_DEFINE(HAVE_AP_COMPAT_H)
|
||||
AC_MSG_RESULT(yes)
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
|
||||
APACHE_INSTALL_FILES="$srcdir/mod_php4.* libphp4.module"
|
||||
|
||||
AC_ARG_WITH(shared-apache,
|
||||
[ --with-shared-apache[=DIR] Build shared Apache module. DIR is the top-level
|
||||
Apache build directory, defaults to /usr/local/etc/httpd.
|
||||
(This option needs Perl installed)],
|
||||
[
|
||||
if test "$withval" = "yes"; then
|
||||
# Apache's default directory
|
||||
withval=/usr/local/etc/httpd
|
||||
fi
|
||||
if test "$withval" != "no"; then
|
||||
if test -f $withval/src/include/httpd.h; then
|
||||
AC_EXPAND_PATH($withval, withval)
|
||||
APACHE_INCLUDE="-I$withval/src/include -I$withval/src/os/unix"
|
||||
APACHE_TARGET=$withval/src/modules/php4
|
||||
if test ! -d $APACHE_TARGET; then
|
||||
mkdir $APACHE_TARGET
|
||||
fi
|
||||
CFLAGS_SHLIB=`perl -V:cccdlflags | cut -d\' -f2`
|
||||
LDFLAGS_SHLIB=`perl -V:lddlflags | cut -d\' -f2`
|
||||
LDFLAGS_SHLIB_EXPORT=`perl -V:ccdlflags | cut -d\' -f2`
|
||||
PHP_LIBS=
|
||||
BINNAME=libmodphp4-so.a
|
||||
INSTALL_IT="mkdir -p $APACHE_TARGET; cp $BINNAME $APACHE_INSTALL_FILES $APACHE_TARGET; cp apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
|
||||
AC_DEFINE(APACHE)
|
||||
AC_MSG_RESULT(yes - Shared Apache 1.3.x)
|
||||
STRONGHOLD=
|
||||
if test -f $withval/src/include/ap_config.h; then
|
||||
AC_DEFINE(HAVE_AP_CONFIG_H)
|
||||
fi
|
||||
if test -f $withval/src/include/ap_compat.h; then
|
||||
AC_DEFINE(HAVE_AP_COMPAT_H)
|
||||
if test ! -f $withval/src/include/ap_config_auto.h; then
|
||||
AC_MSG_ERROR(Please run Apache's configure or src/Configure program once and try again)
|
||||
fi
|
||||
else
|
||||
if test -f $withval/src/include/compat.h; then
|
||||
AC_DEFINE(HAVE_OLD_COMPAT_H)
|
||||
fi
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_ERROR(Invalid Apache directory - unable to find httpd.h under $withval/src/include)
|
||||
fi
|
||||
fi
|
||||
INCLUDES="$INCLUDES $APACHE_INCLUDE"
|
||||
AC_SUBST(APACHE_INCLUDE)
|
||||
AC_SUBST(APACHE_TARGET)
|
||||
AC_SUBST(INSTALL_IT)
|
||||
AC_SUBST(BINNAME)
|
||||
AC_SUBST(PHP_LIBS)
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
|
||||
|
||||
if test "$BINNAME" != "libmodphp4-so.a"; then
|
||||
if test "$BINNAME" != "libphp4.so"; then
|
||||
AC_MSG_CHECKING(for Apache module support)
|
||||
AC_ARG_WITH(apache,
|
||||
[ --with-apache[=DIR] Build Apache module. DIR is the top-level Apache
|
||||
build directory, defaults to /usr/local/etc/httpd.],
|
||||
[
|
||||
if test "$withval" = "yes"; then
|
||||
# Apache's default directory
|
||||
withval=/usr/local/etc/httpd
|
||||
fi
|
||||
if test "$withval" != "no"; then
|
||||
# For Apache 1.2.x
|
||||
AC_EXPAND_PATH($withval, withval)
|
||||
if test -f $withval/src/httpd.h; then
|
||||
APACHE_INCLUDE=-I$withval/src
|
||||
APACHE_TARGET=$withval/src
|
||||
BINNAME=libphp4.a
|
||||
INSTALL_IT="mkdir -p $APACHE_TARGET; cp $BINNAME $APACHE_INSTALL_FILES $APACHE_TARGET"
|
||||
PHP_LIBS="-L. -lphp3"
|
||||
AC_DEFINE(APACHE)
|
||||
AC_MSG_RESULT(yes - Apache 1.2.x)
|
||||
STRONGHOLD=
|
||||
if test -f $withval/src/ap_config.h; then
|
||||
AC_DEFINE(HAVE_AP_CONFIG_H)
|
||||
fi
|
||||
# For Apache 1.3.x
|
||||
elif test -f $withval/src/main/httpd.h; then
|
||||
APACHE_INCLUDE="-I$withval/src/main -I$withval/src/os/unix -I$withval/src/ap"
|
||||
APACHE_TARGET=$withval/src/modules/php4
|
||||
if test ! -d $APACHE_TARGET; then
|
||||
mkdir $APACHE_TARGET
|
||||
fi
|
||||
BINNAME=libmodphp4.a
|
||||
INSTALL_IT="mkdir -p $APACHE_TARGET; cp $BINNAME $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
|
||||
PHP_LIBS="-Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4"
|
||||
AC_DEFINE(APACHE)
|
||||
AC_MSG_RESULT(yes - Apache 1.3.x)
|
||||
STRONGHOLD=
|
||||
if test -f $withval/src/include/ap_config.h; then
|
||||
AC_DEFINE(HAVE_AP_CONFIG_H)
|
||||
fi
|
||||
if test -f $withval/src/include/ap_compat.h; then
|
||||
AC_DEFINE(HAVE_AP_COMPAT_H)
|
||||
if test ! -f $withval/src/include/ap_config_auto.h; then
|
||||
AC_MSG_ERROR(Please run Apache's configure or src/Configure program once and try again)
|
||||
fi
|
||||
else
|
||||
if test -f $withval/src/include/compat.h; then
|
||||
AC_DEFINE(HAVE_OLD_COMPAT_H)
|
||||
fi
|
||||
fi
|
||||
# Also for Apache 1.3.x
|
||||
elif test -f $withval/src/include/httpd.h; then
|
||||
APACHE_INCLUDE="-I$withval/src/include -I$withval/src/os/unix"
|
||||
APACHE_TARGET=$withval/src/modules/php4
|
||||
if test ! -d $APACHE_TARGET; then
|
||||
mkdir $APACHE_TARGET
|
||||
fi
|
||||
BINNAME=libmodphp4.a
|
||||
PHP_LIBS="-Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4"
|
||||
INSTALL_IT="mkdir -p $APACHE_TARGET; cp $BINNAME $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
|
||||
AC_DEFINE(APACHE)
|
||||
AC_MSG_RESULT(yes - Apache 1.3.x)
|
||||
STRONGHOLD=
|
||||
if test -f $withval/src/include/ap_config.h; then
|
||||
AC_DEFINE(HAVE_AP_CONFIG_H)
|
||||
fi
|
||||
if test -f $withval/src/include/ap_compat.h; then
|
||||
AC_DEFINE(HAVE_AP_COMPAT_H)
|
||||
if test ! -f $withval/src/include/ap_config_auto.h; then
|
||||
AC_MSG_ERROR(Please run Apache's configure or src/Configure program once and try again)
|
||||
fi
|
||||
else
|
||||
if test -f $withval/src/include/compat.h; then
|
||||
AC_DEFINE(HAVE_OLD_COMPAT_H)
|
||||
fi
|
||||
fi
|
||||
# For StrongHold 2.2
|
||||
elif test -f $withval/apache/httpd.h; then
|
||||
APACHE_INCLUDE=-"I$withval/apache -I$withval/ssl/include"
|
||||
APACHE_TARGET=$withval/apache
|
||||
BINNAME=libmodphp4.a
|
||||
PHP_LIBS="-Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4"
|
||||
INSTALL_IT="mkdir -p $APACHE_TARGET; cp $BINNAME $APACHE_INSTALL_FILES $APACHE_TARGET"
|
||||
STRONGHOLD=-DSTRONGHOLD=1
|
||||
AC_DEFINE(APACHE)
|
||||
AC_MSG_RESULT(yes - StrongHold)
|
||||
if test -f $withval/apache/ap_config.h; then
|
||||
AC_DEFINE(HAVE_AP_CONFIG_H)
|
||||
fi
|
||||
if test -f $withval/src/ap_compat.h; then
|
||||
AC_DEFINE(HAVE_AP_COMPAT_H)
|
||||
if test ! -f $withval/src/include/ap_config_auto.h; then
|
||||
AC_MSG_ERROR(Please run Apache's configure or src/Configure program once and try again)
|
||||
fi
|
||||
else
|
||||
if test -f $withval/src/compat.h; then
|
||||
AC_DEFINE(HAVE_OLD_COMPAT_H)
|
||||
fi
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_ERROR(Invalid Apache directory - unable to find httpd.h under $withval)
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
BINNAME=php
|
||||
INSTALL_IT="cp $BINNAME \$(bindir)"
|
||||
fi
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
BINNAME=php
|
||||
INSTALL_IT="cp $BINNAME \$(bindir)"
|
||||
])
|
||||
INCLUDES="$INCLUDES $APACHE_INCLUDE"
|
||||
dnl## AC_SUBST(APACHE_INCLUDE)
|
||||
AC_SUBST(APACHE_TARGET)
|
||||
AC_SUBST(INSTALL_IT)
|
||||
AC_SUBST(BINNAME)
|
||||
AC_SUBST(STRONGHOLD)
|
||||
AC_SUBST(PHP_LIBS)
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for mod_charset compatibility option)
|
||||
AC_ARG_WITH(mod_charset,
|
||||
[ --with-mod_charset Enable transfer tables for mod_charset (Rus Apache).],
|
||||
[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_TRANSFER_TABLES)
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING(for fhttpd module support)
|
||||
AC_ARG_WITH(fhttpd,
|
||||
[ --with-fhttpd[=DIR] Build fhttpd module. DIR is the fhttpd sources
|
||||
directory, defaults to /usr/local/src/fhttpd.],
|
||||
[
|
||||
if test "$withval" = "yes"; then
|
||||
# fhttpd source directory
|
||||
withval=/usr/local/src/fhttpd
|
||||
fi
|
||||
if test "$withval" != "no"; then
|
||||
# For fhttpd 0.3.x
|
||||
if test -f $withval/servproc.h; then
|
||||
FHTTPD_INCLUDE=-I$withval/
|
||||
FHTTPD_LIB=$withval/servproc.o
|
||||
FHTTPD_TARGET=$withval/
|
||||
BINNAME=php
|
||||
AC_DEFINE(FHTTPD)
|
||||
AC_MSG_RESULT(yes - fhttpd 0.3.x)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_ERROR(Invalid fhttpd directory - unable to find servproc.h under $withval)
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
INCLUDES="$INCLUDES $FHTTPD_INCLUDE"
|
||||
dnl## AC_SUBST(FHTTPD_INCLUDE)
|
||||
AC_SUBST(FHTTPD_LIB)
|
||||
AC_SUBST(FHTTPD_TARGET)
|
||||
|
||||
|
||||
AC_MSG_CHECKING(whether to use a configuration file)
|
||||
AC_ARG_WITH(config-file-path,
|
||||
[ --with-config-file-path=PATH Sets the path in which to look for php3.ini
|
||||
defaults to /usr/local/lib],
|
||||
[
|
||||
if test "$withval" = "yes"; then
|
||||
AC_DEFINE_UNQUOTED(CONFIGURATION_FILE_PATH, "/usr/local/lib")
|
||||
AC_DEFINE(USE_CONFIG_FILE, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
if test "$withval" != "no"; then
|
||||
AC_DEFINE_UNQUOTED(CONFIGURATION_FILE_PATH, "$withval")
|
||||
AC_DEFINE(USE_CONFIG_FILE, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_DEFINE(CONFIGURATION_FILE_PATH, 0)
|
||||
AC_DEFINE(USE_CONFIG_FILE, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
],[
|
||||
AC_DEFINE_UNQUOTED(CONFIGURATION_FILE_PATH, "/usr/local/lib")
|
||||
AC_DEFINE(USE_CONFIG_FILE, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
])
|
||||
|
||||
|
||||
AC_MSG_CHECKING(whether to include debugging symbols)
|
||||
AC_ARG_ENABLE(debug,
|
||||
[ --enable-debug Compile with debugging symbols],
|
||||
[
|
||||
if test "$enableval" = "yes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(DEBUG,1)
|
||||
PHP_DEBUG=1
|
||||
DEBUG_CFLAGS="-g"
|
||||
test -n "$GCC" && DEBUG_CFLAGS="$DEBUG_CFLAGS -Wall"
|
||||
test -n "$GCC" && test "$USE_MAINTAINER_MODE" = "yes" && \
|
||||
DEBUG_CFLAGS="$DEBUG_CFLAGS -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(DEBUG,0)
|
||||
PHP_DEBUG=0
|
||||
DEBUG_CFLAGS=""
|
||||
fi
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(DEBUG,0)
|
||||
PHP_DEBUG=0
|
||||
DEBUG_CFLAGS=""
|
||||
])
|
||||
AC_SUBST(DEBUG_CFLAGS)
|
||||
AC_SUBST(PHP_DEBUG)
|
||||
CFLAGS="$CFLAGS $DEBUG_CFLAGS"
|
||||
|
||||
|
||||
AC_MSG_CHECKING(whether to enable safe mode by default)
|
||||
AC_ARG_ENABLE(safe-mode,
|
||||
[ --enable-safe-mode Enable safe mode by default.],
|
||||
[
|
||||
if test "$enableval" = "yes"; then
|
||||
AC_DEFINE(PHP_SAFE_MODE, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_DEFINE(PHP_SAFE_MODE, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
],[
|
||||
AC_DEFINE(PHP_SAFE_MODE, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
|
||||
AC_MSG_CHECKING(for safe mode exec dir)
|
||||
AC_ARG_WITH(exec-dir,
|
||||
[ --with-exec-dir[=DIR] Only allow executables in DIR when in safe mode
|
||||
defaults to /usr/local/php/bin],
|
||||
[
|
||||
if test "$withval" != "no"; then
|
||||
if test "$withval" = "yes"; then
|
||||
AC_DEFINE(PHP_SAFE_MODE_EXEC_DIR,"/usr/local/php/bin")
|
||||
AC_MSG_RESULT(/usr/local/php/bin)
|
||||
else
|
||||
AC_DEFINE_UNQUOTED(PHP_SAFE_MODE_EXEC_DIR,"$withval")
|
||||
AC_MSG_RESULT($withval)
|
||||
fi
|
||||
else
|
||||
AC_DEFINE(PHP_SAFE_MODE_EXEC_DIR,"/usr/local/php/bin")
|
||||
AC_MSG_RESULT(/usr/local/php/bin)
|
||||
fi
|
||||
],[
|
||||
AC_DEFINE(PHP_SAFE_MODE_EXEC_DIR,"/usr/local/php/bin")
|
||||
AC_MSG_RESULT(/usr/local/php/bin)
|
||||
])
|
||||
|
||||
|
||||
AC_MSG_CHECKING(whether to enable track_vars variables by default)
|
||||
AC_ARG_ENABLE(track-vars,
|
||||
[ --enable-track-vars Enable GET/POST/Cookie track variables by default.],
|
||||
[
|
||||
if test "$enableval" = "yes"; then
|
||||
AC_DEFINE(PHP_TRACK_VARS, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_DEFINE(PHP_TRACK_VARS, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
],[
|
||||
AC_DEFINE(PHP_TRACK_VARS, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
|
||||
AC_MSG_CHECKING(whether to enable magic quotes by default)
|
||||
AC_ARG_ENABLE(magic-quotes,
|
||||
[ --enable-magic-quotes Enable magic quotes by default.],
|
||||
[
|
||||
if test "$enableval" = "yes"; then
|
||||
AC_DEFINE(MAGIC_QUOTES, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_DEFINE(MAGIC_QUOTES, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
],[
|
||||
AC_DEFINE(MAGIC_QUOTES, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
|
||||
AC_MSG_CHECKING(whether to build PHP thread-safe)
|
||||
AC_ARG_ENABLE(thread-safety,
|
||||
[ --enable-thread-safety Whether to build PHP thread-safe.],[
|
||||
TSRM_LIB='TSRM/libtsrm.a'
|
||||
TSRM_DIR=TSRM
|
||||
AC_DEFINE(ZTS)
|
||||
],[
|
||||
TSRM_DIR=""
|
||||
])
|
||||
AC_SUBST(TSRM_DIR)
|
||||
AC_SUBST(TSRM_LIB)
|
||||
|
||||
dnl AC_MSG_CHECKING(whether to enable PHP RPC support)
|
||||
dnl AC_ARG_ENABLE(php-rpc,
|
||||
dnl [ --enable-php-rpc Compile with PHP RPC support.],
|
||||
dnl [
|
||||
dnl if test "$enableval" = "yes"; then
|
||||
dnl AC_DEFINE(PHP_RPC, 1)
|
||||
dnl AC_MSG_RESULT(yes)
|
||||
dnl else
|
||||
dnl AC_DEFINE(PHP_RPC, 0)
|
||||
dnl AC_MSG_RESULT(no)
|
||||
dnl fi
|
||||
dnl ],[
|
||||
dnl AC_DEFINE(PHP_RPC, 0)
|
||||
dnl AC_MSG_RESULT(no)
|
||||
dnl ])
|
||||
|
||||
if test "$BINNAME" = "php"; then
|
||||
AC_MSG_CHECKING(whether to force Apache CGI redirect)
|
||||
AC_ARG_ENABLE(force-cgi-redirect,
|
||||
[ --enable-force-cgi-redirect Enable the security check for internal server
|
||||
redirects. You should use this if you are
|
||||
running the CGI version with Apache. ],
|
||||
[
|
||||
if test "$enableval" = "yes"; then
|
||||
AC_DEFINE(FORCE_CGI_REDIRECT, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
REDIRECT=1
|
||||
else
|
||||
AC_DEFINE(FORCE_CGI_REDIRECT, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
REDIRECT=0
|
||||
fi
|
||||
],[
|
||||
AC_DEFINE(FORCE_CGI_REDIRECT, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
REDIRECT=0
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING(whether to discard path_info + path_translated)
|
||||
AC_ARG_ENABLE(discard_path,
|
||||
[ --enable-discard-path If this is enabled, the PHP CGI binary
|
||||
can safely be placed outside of the
|
||||
web tree and people will not be able
|
||||
to circumvent .htaccess security. ],
|
||||
[
|
||||
if test "$enableval" = "yes"; then
|
||||
AC_DEFINE(DISCARD_PATH, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
DISCARD_PATH=1
|
||||
else
|
||||
AC_DEFINE(DISCARD_PATH, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
DISCARD_PATH=0
|
||||
fi
|
||||
],[
|
||||
AC_DEFINE(DISCARD_PATH, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
DISCARD_PATH=0
|
||||
])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(whether to enable a memory limit)
|
||||
AC_ARG_ENABLE(memory-limit,
|
||||
[ --enable-memory-limit Compile with memory limit support. ],
|
||||
[
|
||||
if test "$enableval" = "yes"; then
|
||||
AC_DEFINE(MEMORY_LIMIT, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_DEFINE(MEMORY_LIMIT, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
],[
|
||||
AC_DEFINE(MEMORY_LIMIT, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING(whether to enable short tags by default)
|
||||
AC_ARG_ENABLE(short-tags,
|
||||
[ --disable-short-tags Disable the short-form <? start tag by default.],
|
||||
[
|
||||
if test "$enableval" = "no"; then
|
||||
AC_DEFINE(DEFAULT_SHORT_OPEN_TAG, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
else
|
||||
AC_DEFINE(DEFAULT_SHORT_OPEN_TAG, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
fi
|
||||
],[
|
||||
AC_DEFINE(DEFAULT_SHORT_OPEN_TAG, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING(whether to enable the URL-aware fopen wrapper)
|
||||
AC_ARG_ENABLE(url-fopen-wrapper,
|
||||
[ --disable-url-fopen-wrapper Disable the URL-aware fopen wrapper that allows
|
||||
accessing files via http or ftp.],
|
||||
[
|
||||
if test "$enableval" = "yes"; then
|
||||
AC_DEFINE(PHP3_URL_FOPEN, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_DEFINE(PHP3_URL_FOPEN, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
],[
|
||||
AC_DEFINE(PHP3_URL_FOPEN, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
])
|
||||
|
||||
DMALLOC_RESULT=no
|
||||
AC_MSG_CHECKING(whether to enable dmalloc)
|
||||
AC_ARG_ENABLE(dmalloc,
|
||||
[ --enable-dmalloc Enable dmalloc],
|
||||
[
|
||||
if test "$enableval" = "yes" ; then
|
||||
AC_DEFINE(HAVE_DMALLOC, 1)
|
||||
AC_ADD_LIBRARY(dmalloc)
|
||||
CFLAGS="$CFLAGS -DDMALLOC_FUNC_CHECK"
|
||||
DMALLOC_RESULT=yes
|
||||
fi
|
||||
])
|
||||
AC_MSG_RESULT($DMALLOC_RESULT)
|
||||
|
||||
divert(3)
|
||||
|
||||
AC_SUBST(EXTRA_LIBS)
|
||||
|
||||
# reading config stubs
|
||||
esyscmd(./scripts/config-stubs)
|
||||
|
||||
|
||||
divert(4)
|
||||
|
||||
dnl If we're using gcc and the user hasn't specified CFLAGS, add -O2.
|
||||
test -n "$auto_cflags" && test -n "$GCC" && CFLAGS="$CFLAGS -O2"
|
||||
|
||||
dnl If we're using cc on HP-UX, add the -Ae to CFLAGS
|
||||
if test -n "$auto_cflags" && test "`uname -s 2>/dev/null`" = "HP-UX"; then
|
||||
test -n "$GCC" || CFLAGS="-Ae $CFLAGS"
|
||||
fi
|
||||
|
||||
dnl *** Commented out - generates slow code and consumes a lot of
|
||||
dnl *** resources during compilation - we need to figure out how
|
||||
dnl *** to supply it only when absolutely necessary
|
||||
dnl If we are using gcc add -fpic to make dl() work on some platforms
|
||||
dnl test -n "$GCC" && CFLAGS="$CFLAGS -fpic"
|
||||
|
||||
AC_SUBST(CFLAGS)
|
||||
AC_SUBST(PROG_SENDMAIL)
|
||||
AC_SUBST(CFLAGS_SHLIB)
|
||||
AC_SUBST(LDFLAGS_SHLIB)
|
||||
AC_SUBST(LDFLAGS_SHLIB_EXPORT)
|
||||
AC_SUBST(RPATHS)
|
||||
|
||||
PHP_BUILD_DATE=`date '+%Y-%m-%d'`
|
||||
AC_SUBST(PHP_BUILD_DATE)
|
||||
AC_DEFINE_UNQUOTED(PHP_BUILD_DATE,"$PHP_BUILD_DATE")
|
||||
PHP_UNAME=`uname -a`
|
||||
AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME")
|
||||
PHP_OS=`uname`
|
||||
AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS")
|
||||
|
||||
AC_OUTPUT(Makefile libphp4.module
|
||||
scripts/mkextlib regex/Makefile
|
||||
@@EXT_MAKEFILES@@ build-defs.h, [
|
||||
], [
|
||||
|
||||
chmod +x scripts/mkextlib
|
||||
# Hacking while airborne considered harmful.
|
||||
#
|
||||
echo "creating internal_functions.c"
|
||||
extensions=\`grep '^s.@EXT_SUBDIRS@' \$0|sed -e 's/^.*@% *//' -e 's/%.*$//'\`
|
||||
mv -f internal_functions.c internal_functions.c.old 2>/dev/null
|
||||
sh $srcdir/genif.sh $srcdir/internal_functions.c.in $srcdir \$extensions > internal_functions.c
|
||||
if cmp internal_functions.c.old internal_functions.c > /dev/null 2>&1; then
|
||||
echo "internal_functions.c is unchanged"
|
||||
mv internal_functions.c.old internal_functions.c
|
||||
else
|
||||
rm -f internal_functions.c.old
|
||||
fi
|
||||
|
||||
|
||||
dnl Warn about CGI version with no extra security options.
|
||||
if test "$BINNAME" = "php"; then
|
||||
if test "$REDIRECT" = "0"; then
|
||||
if test "$DISCARD_PATH" = "0"; then
|
||||
echo "WARNING: You will be compiling the CGI version of PHP without any"
|
||||
echo " redirection checking. By putting this cgi binary somewhere"
|
||||
echo " in your web space, users may be able to circumvent existing .htaccess"
|
||||
echo " security by loading files directly through the parser. See"
|
||||
echo " http://www.php.net/manual/config-security.php3 for more details."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
])
|
||||
|
||||
divert
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 4
|
||||
# End:
|
||||
@@ -1,204 +0,0 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on crypt.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=crypt - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to crypt - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "crypt - Win32 Release" && "$(CFG)" != "crypt - Win32 Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!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 "crypt.mak" CFG="crypt - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "crypt - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "crypt - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "crypt - Win32 Release"
|
||||
|
||||
OUTDIR=.\module_Release
|
||||
INTDIR=.\module_Release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\module_Release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\php3_crypt.dll"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\crypt.obj"
|
||||
-@erase "$(INTDIR)\sflcryp.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\php3_crypt.dll"
|
||||
-@erase "$(OUTDIR)\php3_crypt.exp"
|
||||
-@erase "$(OUTDIR)\php3_crypt.lib"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /D HAVE_SFLCRYPT=1 /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\crypt.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\crypt.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_crypt.pdb" /machine:I386 /out:"$(OUTDIR)\php3_crypt.dll" /implib:"$(OUTDIR)\php3_crypt.lib" /libpath:"cgi_release"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\crypt.obj" \
|
||||
"$(INTDIR)\sflcryp.obj"
|
||||
|
||||
"$(OUTDIR)\php3_crypt.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "crypt - Win32 Debug"
|
||||
|
||||
OUTDIR=.\module_debug
|
||||
INTDIR=.\module_debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\module_debug
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\php3_crypt.dll"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\crypt.obj"
|
||||
-@erase "$(INTDIR)\sflcryp.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\php3_crypt.dll"
|
||||
-@erase "$(OUTDIR)\php3_crypt.exp"
|
||||
-@erase "$(OUTDIR)\php3_crypt.ilk"
|
||||
-@erase "$(OUTDIR)\php3_crypt.lib"
|
||||
-@erase "$(OUTDIR)\php3_crypt.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "./" /I "../" /I "../../" /D HAVE_SFLCRYPT=1 /D "DEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\crypt.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\crypt.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_crypt.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_crypt.dll" /implib:"$(OUTDIR)\php3_crypt.lib" /pdbtype:sept /libpath:"cgi_debug"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\crypt.obj" \
|
||||
"$(INTDIR)\sflcryp.obj"
|
||||
|
||||
"$(OUTDIR)\php3_crypt.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("crypt.dep")
|
||||
!INCLUDE "crypt.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "crypt.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "crypt - Win32 Release" || "$(CFG)" == "crypt - Win32 Debug"
|
||||
SOURCE=.\dl\crypt\crypt.c
|
||||
|
||||
"$(INTDIR)\crypt.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\dl\crypt\sflcryp.c
|
||||
|
||||
"$(INTDIR)\sflcryp.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
CVS login Name Email Works on
|
||||
andi Andi Gutmans andi@php.net Core + API
|
||||
jim Jim Winstead jimw@php.net Everything
|
||||
rasmus Rasmus Lerdorf rasmus@php.net Everything
|
||||
shane Shane Caraveo shane@php.net WIN32 + API
|
||||
ssb Stig Bakken stig@php.net Everything
|
||||
zeev Zeev Suraski zeev@php.net Everything
|
||||
jaakko Jaakko Hyvatti jaakko@hyvatti.iki.fi Everything
|
||||
veebert Rex Logan veebert@dimensional.com IMAP
|
||||
chad Chad Robinson chadr@brttech.com Documentation
|
||||
myddryn PostgreSQL
|
||||
wojtek
|
||||
mitch Mitch Golden Oracle
|
||||
brian
|
||||
lr Lachlan Roche lr@www.wwi.com.au MD5
|
||||
damian
|
||||
ian
|
||||
jah Jouni Ahto jah@cultnet.fi Postgres, Informix
|
||||
adam
|
||||
amitay Amitay Isaacs amitay@w-o-i.com LDAP
|
||||
dizzy
|
||||
mark
|
||||
guy
|
||||
jeffhu Jeffrey Hulten jeffh@premier1.net WIN32 + modules(?)
|
||||
eschmid Egon Schmid eschmid@delos.lf.net Documentation
|
||||
cslawi Torben Wilson torben@netmill.com Documentation
|
||||
bwk
|
||||
eric
|
||||
tcobb Troy Cobb www
|
||||
gareth www
|
||||
willer Steve Willer willer@interlog.com pack
|
||||
cmv Colin Viebrock cmv@privateworld.com www
|
||||
soderman
|
||||
tin
|
||||
musone Mark Musone musone@afterfive.com IMAP
|
||||
abelits Alex Belits abelits@phobos.illtel.denver.co.us fhttpd module
|
||||
ars Ariel Shkedi ars@ziplink.net setup
|
||||
mag Nikolay P. Romanyuk mag@redcom.ru Raima DB
|
||||
rse Ralf S. Engelschall rse@engelschall.com Apache configuration
|
||||
sr Stefan Roehrich sr@linux.de zlib module
|
||||
owl Igor Kovalenko owl@infomarket.ru QNX support
|
||||
pcurtis Paul Curtis pcurtis@netscape.com NSAPI work (??)
|
||||
lynch Richard Lynch lynch@lscorp.com Documentation
|
||||
steffann Sander Steffann steffann@nederland.net Safe Mode
|
||||
wdiestel Wolfram Diestel wdiestel@debis.com Oracle WebServer cartridge
|
||||
fmk Frank M. Kromann fmk@businessnet.dk Direct MS-SQL, NaVision, Lotus Notes
|
||||
steinm Uwe Steinmann Uwe.Steinmann@fernuni-hagen.de Hyperwave Module
|
||||
danny Danny Heijl Danny.Heijl@cevi.be Informix
|
||||
kara Andreas Karajannis Andreas.Karajannis@gmd.de ODBC, Oracle
|
||||
nyenyon Christian Cartus chc@idgruppe.de Informix
|
||||
kk Kristian Köhntopp kk@shonline.de Documentation
|
||||
ted Ted Rolle ted.rolle@usa.net Documentation
|
||||
holger Holger Zimmermann zimpel@t-online.de Pi3Web support
|
||||
sgk Shigeru Kanemoto sgk@happysize.co.jp Japanese language support
|
||||
jimjag Jim Jagielski jim@jaguNET.com Misc scraps
|
||||
martin Martin Kraemer Martin.Kraemer@Mch.SNI.De EBCDIC (BS2000 mainframe port)
|
||||
kwazy Landon Bradshaw landon@bradshaw.org Documentation
|
||||
thies Thies C. Arntzen thies@digicol.de implement IPTC reader, maybe some oracle stuff
|
||||
cschneid Christian Schneider cschneid@relog.ch gzip run-time encoding of output stream
|
||||
tommay Tom May tom@go2net.com Sybase-CT
|
||||
swilliam Steve Williams swilliam@empress.com Empress support in unified ODBC
|
||||
sas Sascha Schumann sas@schell.de Various tweaks
|
||||
@@ -1,234 +0,0 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on dbase.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=dbase - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to dbase - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "dbase - Win32 Release" && "$(CFG)" != "dbase - Win32 Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!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 "dbase.mak" CFG="dbase - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "dbase - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "dbase - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "dbase - Win32 Release"
|
||||
|
||||
OUTDIR=.\module_release
|
||||
INTDIR=.\module_release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\module_release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\php3_dbase.dll"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\dbase.obj"
|
||||
-@erase "$(INTDIR)\dbf_head.obj"
|
||||
-@erase "$(INTDIR)\dbf_misc.obj"
|
||||
-@erase "$(INTDIR)\dbf_ndx.obj"
|
||||
-@erase "$(INTDIR)\dbf_rec.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\php3_dbase.dll"
|
||||
-@erase "$(OUTDIR)\php3_dbase.exp"
|
||||
-@erase "$(OUTDIR)\php3_dbase.lib"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "dbase\\" /I "./" /I "../" /D DBASE=1 /D "NDEBUG" /D "THREAD_SAFE" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\dbase.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\dbase.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3 /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_dbase.pdb" /machine:I386 /out:"$(OUTDIR)\php3_dbase.dll" /implib:"$(OUTDIR)\php3_dbase.lib" /libpath:"cgi_release"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\dbase.obj" \
|
||||
"$(INTDIR)\dbf_head.obj" \
|
||||
"$(INTDIR)\dbf_misc.obj" \
|
||||
"$(INTDIR)\dbf_ndx.obj" \
|
||||
"$(INTDIR)\dbf_rec.obj"
|
||||
|
||||
"$(OUTDIR)\php3_dbase.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "dbase - Win32 Debug"
|
||||
|
||||
OUTDIR=.\module_debug
|
||||
INTDIR=.\module_debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\module_debug
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\php3_dbase.dll"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\dbase.obj"
|
||||
-@erase "$(INTDIR)\dbf_head.obj"
|
||||
-@erase "$(INTDIR)\dbf_misc.obj"
|
||||
-@erase "$(INTDIR)\dbf_ndx.obj"
|
||||
-@erase "$(INTDIR)\dbf_rec.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\php3_dbase.dll"
|
||||
-@erase "$(OUTDIR)\php3_dbase.exp"
|
||||
-@erase "$(OUTDIR)\php3_dbase.ilk"
|
||||
-@erase "$(OUTDIR)\php3_dbase.lib"
|
||||
-@erase "$(OUTDIR)\php3_dbase.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "dbase\\" /I "./" /I "../" /D DBASE=1 /D "DEBUG" /D "_DEBUG" /D "THREAD_SAFE" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\dbase.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\dbase.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_dbase.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_dbase.dll" /implib:"$(OUTDIR)\php3_dbase.lib" /pdbtype:sept /libpath:"cgi_debug"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\dbase.obj" \
|
||||
"$(INTDIR)\dbf_head.obj" \
|
||||
"$(INTDIR)\dbf_misc.obj" \
|
||||
"$(INTDIR)\dbf_ndx.obj" \
|
||||
"$(INTDIR)\dbf_rec.obj"
|
||||
|
||||
"$(OUTDIR)\php3_dbase.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("dbase.dep")
|
||||
!INCLUDE "dbase.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "dbase.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "dbase - Win32 Release" || "$(CFG)" == "dbase - Win32 Debug"
|
||||
SOURCE=.\functions\dbase.c
|
||||
|
||||
"$(INTDIR)\dbase.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\dbase\dbf_head.c
|
||||
|
||||
"$(INTDIR)\dbf_head.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\dbase\dbf_misc.c
|
||||
|
||||
"$(INTDIR)\dbf_misc.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\dbase\dbf_ndx.c
|
||||
|
||||
"$(INTDIR)\dbf_ndx.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\dbase\dbf_rec.c
|
||||
|
||||
"$(INTDIR)\dbf_rec.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
@@ -1,201 +0,0 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on dbm.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=dbm - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to dbm - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "dbm - Win32 Release" && "$(CFG)" != "dbm - Win32 Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!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 "dbm.mak" CFG="dbm - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "dbm - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "dbm - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "dbm - Win32 Release"
|
||||
|
||||
OUTDIR=.\module_release
|
||||
INTDIR=.\module_release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\module_release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\php3_dbm.dll"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\db.obj"
|
||||
-@erase "$(INTDIR)\flock.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\php3_dbm.dll"
|
||||
-@erase "$(OUTDIR)\php3_dbm.exp"
|
||||
-@erase "$(OUTDIR)\php3_dbm.lib"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /I "../../include" /D NDBM=1 /D GDBM=0 /D BSD2=1 /D "NDEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\dbm.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\dbm.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=php.lib libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:2 /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_dbm.pdb" /machine:I386 /out:"$(OUTDIR)\php3_dbm.dll" /implib:"$(OUTDIR)\php3_dbm.lib" /libpath:"..\..\lib" /libpath:"cgi_release"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\db.obj" \
|
||||
"$(INTDIR)\flock.obj"
|
||||
|
||||
"$(OUTDIR)\php3_dbm.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "dbm - Win32 Debug"
|
||||
|
||||
OUTDIR=.\module_debug
|
||||
INTDIR=.\module_debug
|
||||
|
||||
ALL : "c:\php3\php3_dbm.dll"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\db.obj"
|
||||
-@erase "$(INTDIR)\flock.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\php3_dbm.exp"
|
||||
-@erase "$(OUTDIR)\php3_dbm.lib"
|
||||
-@erase "$(OUTDIR)\php3_dbm.pdb"
|
||||
-@erase "c:\php3\php3_dbm.dll"
|
||||
-@erase "c:\php3\php3_dbm.ilk"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "./" /I "../" /I "../../include" /D NDBM=1 /D GDBM=0 /D BSD2=1 /D "DEBUG" /D "_DEBUG" /D COMPILE_DL=1 /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\dbm.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\dbm.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=php.lib libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:2 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_dbm.pdb" /debug /machine:I386 /out:"c:\php3/php3_dbm.dll" /implib:"$(OUTDIR)\php3_dbm.lib" /pdbtype:sept /libpath:"..\..\lib" /libpath:"cgi_debug"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\db.obj" \
|
||||
"$(INTDIR)\flock.obj"
|
||||
|
||||
"c:\php3\php3_dbm.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("dbm.dep")
|
||||
!INCLUDE "dbm.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "dbm.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "dbm - Win32 Release" || "$(CFG)" == "dbm - Win32 Debug"
|
||||
SOURCE=.\functions\db.c
|
||||
|
||||
"$(INTDIR)\db.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\win32\flock.c
|
||||
|
||||
"$(INTDIR)\flock.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
SUBDIRS = @EXT_SUBDIRS@
|
||||
|
||||
noinst_LIBRARIES=libphpext.a
|
||||
|
||||
libphpext.a: @EXT_LIBS@
|
||||
top_srcdir=$(top_srcdir) $(top_builddir)/scripts/mkextlib $@ $(SUBDIRS)
|
||||
-@test "`uname -s`" = "Rhapsody" && $(RANLIB) $@
|
||||
@@ -1,6 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
|
||||
noinst_LIBRARIES=libphpext_apache.a
|
||||
libphpext_apache_a_SOURCES=apache.c
|
||||
|
||||
@@ -1,404 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP HTML Embedded Scripting Language Version 3.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This program is free software; you can redistribute it and/or modify |
|
||||
| it under the terms of one of the following licenses: |
|
||||
| |
|
||||
| A) 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. |
|
||||
| |
|
||||
| B) the PHP License as published by the PHP Development Team and |
|
||||
| included in the distribution in the file: LICENSE |
|
||||
| |
|
||||
| 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 both licenses referred to here. |
|
||||
| If you did not, or have any questions about PHP licensing, please |
|
||||
| contact core@php.net. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
|
||||
| Stig Sæther Bakken <ssb@guardian.no> |
|
||||
| David Sklar <sklar@student.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
#include "php.h"
|
||||
#include "ext/standard/head.h"
|
||||
#include "php_globals.h"
|
||||
#include "php_ini.h"
|
||||
#include "SAPI.h"
|
||||
#include "mod_php4.h"
|
||||
#include "ext/standard/info.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if APACHE
|
||||
#include "http_request.h"
|
||||
#include "build-defs.h"
|
||||
|
||||
extern module *top_module;
|
||||
|
||||
PHP_FUNCTION(virtual);
|
||||
PHP_FUNCTION(getallheaders);
|
||||
PHP_FUNCTION(apachelog);
|
||||
void php3_info_apache(ZEND_MODULE_INFO_FUNC_ARGS);
|
||||
PHP_FUNCTION(apache_note);
|
||||
PHP_FUNCTION(apache_lookup_uri);
|
||||
|
||||
function_entry apache_functions[] = {
|
||||
{"virtual", php3_virtual, NULL},
|
||||
{"getallheaders", php3_getallheaders, NULL},
|
||||
{"apache_note", php3_apache_note,NULL},
|
||||
{"apache_lookup_uri", php3_apache_lookup_uri,NULL},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
static PHP_INI_MH(OnChangeApacheInt)
|
||||
{
|
||||
long *p;
|
||||
char *base = (char *) &php_apache_info;
|
||||
|
||||
p = (long *) (base+(size_t) mh_arg1);
|
||||
|
||||
if (new_value) {
|
||||
*p = atoi(new_value);
|
||||
return SUCCESS;
|
||||
} else {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static PHP_INI_MH(OnChangeApacheString)
|
||||
{
|
||||
char **p;
|
||||
char *base = (char *) &php_apache_info;
|
||||
|
||||
p = (char **) (base+(size_t) mh_arg1);
|
||||
|
||||
if (new_value) {
|
||||
*p = new_value;
|
||||
return SUCCESS;
|
||||
} else {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
PHP_INI_BEGIN()
|
||||
PHP_INI_ENTRY1("xbithack", "0", PHP_INI_ALL, OnChangeApacheInt, (void *) XtOffsetOf(php_apache_info_struct, xbithack))
|
||||
PHP_INI_ENTRY1("engine", "1", PHP_INI_ALL, OnChangeApacheInt, (void *) XtOffsetOf(php_apache_info_struct, engine))
|
||||
PHP_INI_ENTRY1("last_modified", "0", PHP_INI_ALL, OnChangeApacheInt, (void *) XtOffsetOf(php_apache_info_struct, last_modified))
|
||||
PHP_INI_ENTRY1("dav_script", NULL, PHP_INI_ALL, OnChangeApacheString, (void *) XtOffsetOf(php_apache_info_struct, dav_script))
|
||||
PHP_INI_END()
|
||||
|
||||
|
||||
static int php_apache_minit(INIT_FUNC_ARGS)
|
||||
{
|
||||
REGISTER_INI_ENTRIES();
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static int php_apache_mshutdown(SHUTDOWN_FUNC_ARGS)
|
||||
{
|
||||
UNREGISTER_INI_ENTRIES();
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
php3_module_entry apache_module_entry = {
|
||||
"Apache", apache_functions, php_apache_minit, php_apache_mshutdown, NULL, NULL, php3_info_apache, STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
/* {{{ proto string apache_note(string note_name [, string note_value])
|
||||
Get and set Apache request notes */
|
||||
PHP_FUNCTION(apache_note)
|
||||
{
|
||||
pval *arg_name,*arg_val;
|
||||
char *note_val;
|
||||
int arg_count = ARG_COUNT(ht);
|
||||
SLS_FETCH();
|
||||
|
||||
if (arg_count<1 || arg_count>2 ||
|
||||
getParameters(ht,arg_count,&arg_name,&arg_val) == FAILURE ) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
convert_to_string(arg_name);
|
||||
note_val = (char *) table_get(((request_rec *) SG(server_context))->notes,arg_name->value.str.val);
|
||||
|
||||
if (arg_count == 2) {
|
||||
convert_to_string(arg_val);
|
||||
table_set(((request_rec *) SG(server_context))->notes,arg_name->value.str.val,arg_val->value.str.val);
|
||||
}
|
||||
|
||||
if (note_val) {
|
||||
RETURN_STRING(note_val,1);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void php3_info_apache(ZEND_MODULE_INFO_FUNC_ARGS)
|
||||
{
|
||||
module *modp = NULL;
|
||||
char output_buf[128];
|
||||
#if !defined(WIN32) && !defined(WINNT)
|
||||
char name[64];
|
||||
char *p;
|
||||
#endif
|
||||
server_rec *serv;
|
||||
extern char server_root[MAX_STRING_LEN];
|
||||
extern uid_t user_id;
|
||||
extern char *user_name;
|
||||
extern gid_t group_id;
|
||||
extern int max_requests_per_child;
|
||||
SLS_FETCH();
|
||||
|
||||
serv = ((request_rec *) SG(server_context))->server;
|
||||
|
||||
PUTS("<table border=5 width=\"600\">\n");
|
||||
php_info_print_table_header(2, "Entry", "Value");
|
||||
#if WIN32|WINNT
|
||||
PUTS("Apache for Windows 95/NT<br>");
|
||||
#else
|
||||
php_info_print_table_row(2, "APACHE_INCLUDE", PHP_APACHE_INCLUDE);
|
||||
php_info_print_table_row(2, "APACHE_TARGET", PHP_APACHE_TARGET);
|
||||
#endif
|
||||
php_info_print_table_row(2, "Apache Version", SERVER_VERSION);
|
||||
#ifdef APACHE_RELEASE
|
||||
sprintf(output_buf, "%d", APACHE_RELEASE);
|
||||
php_info_print_table_row(2, "Apache Release", output_buf);
|
||||
#endif
|
||||
sprintf(output_buf, "%d", MODULE_MAGIC_NUMBER);
|
||||
php_info_print_table_row(2, "Apache API Version", output_buf);
|
||||
sprintf(output_buf, "%s:%u", serv->server_hostname,serv->port);
|
||||
php_info_print_table_row(2, "Hostname/Port", output_buf);
|
||||
#if !defined(WIN32) && !defined(WINNT)
|
||||
sprintf(output_buf, "%s(%d)/%d", user_name,(int)user_id,(int)group_id);
|
||||
php_info_print_table_row(2, "User/Group", output_buf);
|
||||
sprintf(output_buf, "per child: %d<br>keep alive: %s<br>max per connection: %d",max_requests_per_child,serv->keep_alive ? "on":"off", serv->keep_alive_max);
|
||||
php_info_print_table_row(2, "Max Requests", output_buf);
|
||||
#endif
|
||||
sprintf(output_buf, "connection: %d<br>keep-alive: %d",serv->timeout,serv->keep_alive_timeout);
|
||||
php_info_print_table_row(2, "Timeouts", output_buf);
|
||||
#if !defined(WIN32) && !defined(WINNT)
|
||||
php_info_print_table_row(2, "Server Root", server_root);
|
||||
|
||||
|
||||
PUTS("<tr><td valign=\"top\" bgcolor=\"" PHP_ENTRY_NAME_COLOR "\">Loaded modules</td><td bgcolor=\"" PHP_CONTENTS_COLOR "\">");
|
||||
for(modp = top_module; modp; modp = modp->next) {
|
||||
strncpy(name, modp->name, sizeof(name) - 1);
|
||||
if ((p = strrchr(name, '.'))) {
|
||||
*p='\0'; /* Cut off ugly .c extensions on module names */
|
||||
}
|
||||
PUTS(name);
|
||||
if (modp->next) {
|
||||
PUTS(", ");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
PUTS("</td></tr>\n");
|
||||
PUTS("</table>\n");
|
||||
}
|
||||
|
||||
/* This function is equivalent to <!--#include virtual...-->
|
||||
* in mod_include. It does an Apache sub-request. It is useful
|
||||
* for including CGI scripts or .shtml files, or anything else
|
||||
* that you'd parse through Apache (for .phtml files, you'd probably
|
||||
* want to use <?Include>. This only works when PHP is compiled
|
||||
* as an Apache module, since it uses the Apache API for doing
|
||||
* sub requests.
|
||||
*/
|
||||
/* {{{ proto int virtual(string filename)
|
||||
Perform an Apache sub-request */
|
||||
PHP_FUNCTION(virtual)
|
||||
{
|
||||
pval *filename;
|
||||
request_rec *rr = NULL;
|
||||
SLS_FETCH();
|
||||
|
||||
if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&filename) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_string(filename);
|
||||
|
||||
if (!(rr = sub_req_lookup_uri (filename->value.str.val, ((request_rec *) SG(server_context))))) {
|
||||
php3_error(E_WARNING, "Unable to include '%s' - URI lookup failed", filename->value.str.val);
|
||||
if (rr) destroy_sub_req (rr);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (rr->status != 200) {
|
||||
php3_error(E_WARNING, "Unable to include '%s' - error finding URI", filename->value.str.val);
|
||||
if (rr) destroy_sub_req (rr);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* Cannot include another PHP file because of global conflicts */
|
||||
if (rr->content_type &&
|
||||
!strcmp(rr->content_type, PHP3_MIME_TYPE)) {
|
||||
php3_error(E_WARNING, "Cannot include a PHP file "
|
||||
"(use <code><?include \"%s\"></code> instead)", filename->value.str.val);
|
||||
if (rr) destroy_sub_req (rr);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (run_sub_req(rr)) {
|
||||
php3_error(E_WARNING, "Unable to include '%s' - request execution failed", filename->value.str.val);
|
||||
if (rr) destroy_sub_req (rr);
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
if (rr) destroy_sub_req (rr);
|
||||
RETURN_TRUE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array getallheaders(void)
|
||||
Fetch all HTTP request headers */
|
||||
PHP_FUNCTION(getallheaders)
|
||||
{
|
||||
array_header *env_arr;
|
||||
table_entry *tenv;
|
||||
int i;
|
||||
SLS_FETCH();
|
||||
|
||||
if (array_init(return_value) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
env_arr = table_elts(((request_rec *) SG(server_context))->headers_in);
|
||||
tenv = (table_entry *)env_arr->elts;
|
||||
for (i = 0; i < env_arr->nelts; ++i) {
|
||||
if (!tenv[i].key ||
|
||||
(PG(safe_mode) &&
|
||||
!strncasecmp(tenv[i].key, "authorization", 13))) {
|
||||
continue;
|
||||
}
|
||||
if (add_assoc_string(return_value, tenv[i].key,(tenv[i].val==NULL) ? "" : tenv[i].val, 1)==FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto class apache_lookup_uri(string URI)
|
||||
Perform a partial request of the given URI to obtain information about it */
|
||||
PHP_FUNCTION(apache_lookup_uri)
|
||||
{
|
||||
pval *filename;
|
||||
request_rec *rr=NULL;
|
||||
SLS_FETCH();
|
||||
|
||||
if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&filename) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_string(filename);
|
||||
|
||||
if(!(rr = sub_req_lookup_uri(filename->value.str.val, ((request_rec *) SG(server_context))))) {
|
||||
php3_error(E_WARNING, "URI lookup failed", filename->value.str.val);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
object_init(return_value);
|
||||
add_property_long(return_value,"status",rr->status);
|
||||
if (rr->the_request) {
|
||||
add_property_string(return_value,"the_request",rr->the_request,1);
|
||||
}
|
||||
if (rr->status_line) {
|
||||
add_property_string(return_value,"status_line",rr->status_line,1);
|
||||
}
|
||||
if (rr->method) {
|
||||
add_property_string(return_value,"method",rr->method,1);
|
||||
}
|
||||
if (rr->content_type) {
|
||||
add_property_string(return_value,"content_type",(char *)rr->content_type,1);
|
||||
}
|
||||
if (rr->handler) {
|
||||
add_property_string(return_value,"handler",(char *)rr->handler,1);
|
||||
}
|
||||
if (rr->uri) {
|
||||
add_property_string(return_value,"uri",rr->uri,1);
|
||||
}
|
||||
if (rr->filename) {
|
||||
add_property_string(return_value,"filename",rr->filename,1);
|
||||
}
|
||||
if (rr->path_info) {
|
||||
add_property_string(return_value,"path_info",rr->path_info,1);
|
||||
}
|
||||
if (rr->args) {
|
||||
add_property_string(return_value,"args",rr->args,1);
|
||||
}
|
||||
if (rr->boundary) {
|
||||
add_property_string(return_value,"boundary",rr->boundary,1);
|
||||
}
|
||||
add_property_long(return_value,"no_cache",rr->no_cache);
|
||||
add_property_long(return_value,"no_local_copy",rr->no_local_copy);
|
||||
add_property_long(return_value,"allowed",rr->allowed);
|
||||
add_property_long(return_value,"sent_bodyct",rr->sent_bodyct);
|
||||
add_property_long(return_value,"bytes_sent",rr->bytes_sent);
|
||||
add_property_long(return_value,"byterange",rr->byterange);
|
||||
add_property_long(return_value,"clength",rr->clength);
|
||||
|
||||
#if MODULE_MAGIC_NUMBER >= 19980324
|
||||
if (rr->unparsed_uri) {
|
||||
add_property_string(return_value,"unparsed_uri",rr->unparsed_uri,1);
|
||||
}
|
||||
if(rr->mtime) {
|
||||
add_property_long(return_value,"mtime",rr->mtime);
|
||||
}
|
||||
#endif
|
||||
if(rr->request_time) {
|
||||
add_property_long(return_value,"request_time",rr->request_time);
|
||||
}
|
||||
|
||||
destroy_sub_req(rr);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if 0
|
||||
This function is most likely a bad idea. Just playing with it for now.
|
||||
|
||||
PHP_FUNCTION(apache_exec_uri)
|
||||
{
|
||||
pval *filename;
|
||||
request_rec *rr=NULL;
|
||||
SLS_FETCH();
|
||||
|
||||
if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&filename) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_string(filename);
|
||||
|
||||
if(!(rr = ap_sub_req_lookup_uri(filename->value.str.val, ((request_rec *) SG(server_context))))) {
|
||||
php3_error(E_WARNING, "URI lookup failed", filename->value.str.val);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETVAL_LONG(ap_run_sub_req(rr));
|
||||
ap_destroy_sub_req(rr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -1,5 +0,0 @@
|
||||
dnl $Id$
|
||||
|
||||
if test -n "$APACHE_INCLUDE"; then
|
||||
PHP_EXTENSION(apache)
|
||||
fi
|
||||
@@ -1,6 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
|
||||
noinst_LIBRARIES=libphpext_aspell.a
|
||||
libphpext_aspell_a_SOURCES=aspell.c
|
||||
|
||||
@@ -1,218 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP HTML Embedded Scripting Language Version 3.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-1999 PHP Development Team (See Credits file) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This program is free software; you can redistribute it and/or modify |
|
||||
| it under the terms of one of the following licenses: |
|
||||
| |
|
||||
| A) 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. |
|
||||
| |
|
||||
| B) the PHP License as published by the PHP Development Team and |
|
||||
| included in the distribution in the file: LICENSE |
|
||||
| |
|
||||
| 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 both licenses referred to here. |
|
||||
| If you did not, or have any questions about PHP licensing, please |
|
||||
| contact core@php.net. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#include "php.h"
|
||||
#if defined(COMPILE_DL)
|
||||
#include "phpdl.h"
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if HAVE_ASPELL
|
||||
|
||||
#include "php3_aspell.h"
|
||||
#if APACHE
|
||||
# ifndef DEBUG
|
||||
# undef palloc
|
||||
# endif
|
||||
#endif
|
||||
#include <aspell-c.h>
|
||||
|
||||
function_entry aspell_functions[] = {
|
||||
{"aspell_new", php3_aspell_new, NULL},
|
||||
{"aspell_check", php3_aspell_check, NULL},
|
||||
{"aspell_check_raw", php3_aspell_check_raw, NULL},
|
||||
{"aspell_suggest", php3_aspell_suggest, NULL},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
static int le_aspell;
|
||||
|
||||
php3_module_entry aspell_module_entry = {
|
||||
"Aspell", aspell_functions, php3_minit_aspell, NULL, NULL, NULL, php3_info_aspell, STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
|
||||
#if COMPILE_DL
|
||||
DLEXPORT php3_module_entry *get_module(void) { return &aspell_module_entry; }
|
||||
#endif
|
||||
|
||||
int php3_minit_aspell(INIT_FUNC_ARGS)
|
||||
{
|
||||
le_aspell = register_list_destructors(php3_aspell_close,NULL);
|
||||
return SUCCESS;
|
||||
|
||||
}
|
||||
void php3_aspell_close(aspell *sc)
|
||||
{
|
||||
aspell_free(sc);
|
||||
}
|
||||
|
||||
/* {{{ proto int aspell_new(string master[, string personal])
|
||||
Load a dictionary */
|
||||
void php3_aspell_new(INTERNAL_FUNCTION_PARAMETERS)
|
||||
{
|
||||
pval *master, *personal;
|
||||
int argc;
|
||||
aspell *sc;
|
||||
int ind;
|
||||
TLS_VARS;
|
||||
|
||||
argc = ARG_COUNT(ht);
|
||||
if (argc < 1 || argc > 2 || getParameters(ht, argc, &master,&personal) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_string(master);
|
||||
if(argc==2)
|
||||
{
|
||||
convert_to_string(personal) ;
|
||||
sc=aspell_new(master->value.str.val,personal->value.str.val);
|
||||
}
|
||||
else
|
||||
sc=aspell_new(master->value.str.val,"");
|
||||
|
||||
ind = php3_list_insert(sc, le_aspell);
|
||||
RETURN_LONG(ind);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array aspell_suggest(aspell int,string word)
|
||||
Return array of Suggestions */
|
||||
void php3_aspell_suggest(INTERNAL_FUNCTION_PARAMETERS)
|
||||
{
|
||||
pval *scin, *word;
|
||||
int argc;
|
||||
aspell *sc;
|
||||
int ind,type;
|
||||
aspellSuggestions *sug;
|
||||
size_t i;
|
||||
|
||||
TLS_VARS;
|
||||
|
||||
argc = ARG_COUNT(ht);
|
||||
if (argc != 2 || getParameters(ht, argc, &scin,&word) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long(scin);
|
||||
convert_to_string(word);
|
||||
sc= (aspell *) php3_list_find(scin->value.lval, &type);
|
||||
if(!sc)
|
||||
{
|
||||
php3_error(E_WARNING, "%d is not a ASPELL result index", scin->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (array_init(return_value) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
sug = aspell_suggest(sc, word->value.str.val);
|
||||
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 */
|
||||
void php3_aspell_check(INTERNAL_FUNCTION_PARAMETERS)
|
||||
{
|
||||
int type;
|
||||
pval *scin,*word;
|
||||
aspell *sc;
|
||||
int argc;
|
||||
TLS_VARS;
|
||||
argc = ARG_COUNT(ht);
|
||||
if (argc != 2 || getParameters(ht, argc, &scin,&word) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long(scin);
|
||||
convert_to_string(word);
|
||||
sc= (aspell *) php3_list_find(scin->value.lval, &type);
|
||||
if(!sc)
|
||||
{
|
||||
php3_error(E_WARNING, "%d is not a ASPELL result index", scin->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (aspell_check(sc, word->value.str.val))
|
||||
{
|
||||
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*/
|
||||
void php3_aspell_check_raw(INTERNAL_FUNCTION_PARAMETERS)
|
||||
{
|
||||
pval *scin,*word;
|
||||
int type;
|
||||
int argc;
|
||||
aspell *sc;
|
||||
TLS_VARS;
|
||||
|
||||
argc = ARG_COUNT(ht);
|
||||
if (argc != 2 || getParameters(ht, argc, &scin,&word) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long(scin);
|
||||
convert_to_string(word);
|
||||
sc= (aspell *) php3_list_find(scin->value.lval, &type);
|
||||
if(!sc)
|
||||
{
|
||||
php3_error(E_WARNING, "%d is not a ASPELL result index", scin->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (aspell_check_raw(sc, word->value.str.val))
|
||||
{
|
||||
RETURN_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void php3_info_aspell(void)
|
||||
{
|
||||
TLS_VARS;
|
||||
php3_printf("ASpell support enabled");
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,3 +0,0 @@
|
||||
/* Define if you want the ASPELL interface */
|
||||
#define HAVE_ASPELL 0
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
dnl $Id$
|
||||
|
||||
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
|
||||
|
||||
AC_ADD_INCLUDE($ASPELL_DIR/include)
|
||||
AC_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)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_ERROR(no)
|
||||
fi
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP HTML Embedded Scripting Language Version 3.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-1999 PHP Development Team (See Credits file) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This program is free software; you can redistribute it and/or modify |
|
||||
| it under the terms of one of the following licenses: |
|
||||
| |
|
||||
| A) 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. |
|
||||
| |
|
||||
| B) the PHP License as published by the PHP Development Team and |
|
||||
| included in the distribution in the file: LICENSE |
|
||||
| |
|
||||
| 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 both licenses referred to here. |
|
||||
| If you did not, or have any questions about PHP licensing, please |
|
||||
| contact core@php.net. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef _ASPELL_H
|
||||
#define _ASPELL_H
|
||||
#if HAVE_ASPELL
|
||||
extern php3_module_entry aspell_module_entry;
|
||||
#define php3_aspell_module_ptr &aspell_module_entry
|
||||
|
||||
extern int php3_minit_aspell(INIT_FUNC_ARGS);
|
||||
extern void php3_info_aspell(void);
|
||||
extern void php3_aspell_close();
|
||||
void php3_aspell_new(INTERNAL_FUNCTION_PARAMETERS);
|
||||
void php3_aspell_check(INTERNAL_FUNCTION_PARAMETERS);
|
||||
void php3_aspell_check_raw(INTERNAL_FUNCTION_PARAMETERS);
|
||||
void php3_aspell_suggest(INTERNAL_FUNCTION_PARAMETERS);
|
||||
|
||||
#else
|
||||
#define php3_aspell_module_ptr NULL
|
||||
#endif
|
||||
#endif /* _ASPELL_H */
|
||||
@@ -1,5 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
|
||||
noinst_LIBRARIES=libphpext_bcmath.a
|
||||
libphpext_bcmath_a_SOURCES=bcmath.c number.c
|
||||
@@ -1,445 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP HTML Embedded Scripting Language Version 3.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This program is free software; you can redistribute it and/or modify |
|
||||
| it under the terms of one of the following licenses: |
|
||||
| |
|
||||
| A) 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. |
|
||||
| |
|
||||
| B) the PHP License as published by the PHP Development Team and |
|
||||
| included in the distribution in the file: LICENSE |
|
||||
| |
|
||||
| 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 both licenses referred to here. |
|
||||
| If you did not, or have any questions about PHP licensing, please |
|
||||
| contact core@php.net. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "php.h"
|
||||
|
||||
#if WITH_BCMATH
|
||||
|
||||
#include "number.h"
|
||||
#include "php3_bcmath.h"
|
||||
|
||||
function_entry bcmath_functions[] = {
|
||||
{"bcadd", php3_bcmath_add, NULL},
|
||||
{"bcsub", php3_bcmath_sub, NULL},
|
||||
{"bcmul", php3_bcmath_mul, NULL},
|
||||
{"bcdiv", php3_bcmath_div, NULL},
|
||||
{"bcmod", php3_bcmath_mod, NULL},
|
||||
{"bcpow", php3_bcmath_pow, NULL},
|
||||
{"bcsqrt", php3_bcmath_sqrt, NULL},
|
||||
{"bcscale", php3_bcmath_set_scale, NULL},
|
||||
{"bccomp", php3_bcmath_comp, NULL},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
php3_module_entry bcmath_module_entry = {
|
||||
"bcmath", bcmath_functions, NULL, NULL, php3_rinit_bcmath, php3_rend_bcmath, NULL, STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
#if COMPILE_DL
|
||||
php3_module_entry *get_module() { return &bcmath_module_entry; };
|
||||
#endif
|
||||
|
||||
#ifndef THREAD_SAFE
|
||||
static long bc_precision;
|
||||
#endif
|
||||
|
||||
int php3_rinit_bcmath(INIT_FUNC_ARGS)
|
||||
{
|
||||
init_numbers();
|
||||
if (cfg_get_long("bcmath.scale",&bc_precision)==FAILURE) {
|
||||
bc_precision=0;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
int php3_rend_bcmath(SHUTDOWN_FUNC_ARGS)
|
||||
{
|
||||
destruct_numbers();
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* {{{ proto string bcadd(string left_operand, string right_operand [, int scale])
|
||||
Returns the sum of two arbitrary precision numbers */
|
||||
PHP_FUNCTION(bcmath_add)
|
||||
{
|
||||
pval *left, *right,*scale_param;
|
||||
bc_num first, second, result;
|
||||
int scale=bc_precision;
|
||||
|
||||
switch (ARG_COUNT(ht)) {
|
||||
case 2:
|
||||
if (getParameters(ht, 2, &left, &right) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long(scale_param);
|
||||
scale = (int) scale_param->value.lval;
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
convert_to_string(left);
|
||||
convert_to_string(right);
|
||||
init_num(&first);
|
||||
init_num(&second);
|
||||
init_num(&result);
|
||||
str2num(&first,left->value.str.val,scale);
|
||||
str2num(&second,right->value.str.val,scale);
|
||||
bc_add (first,second,&result, scale);
|
||||
return_value->value.str.val = num2str(result);
|
||||
return_value->value.str.len = strlen(return_value->value.str.val);
|
||||
return_value->type = IS_STRING;
|
||||
free_num(&first);
|
||||
free_num(&second);
|
||||
free_num(&result);
|
||||
return;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string bcsub(string left_operand, string right_operand [, int scale])
|
||||
Returns the difference between two arbitrary precision numbers (subtration) */
|
||||
PHP_FUNCTION(bcmath_sub)
|
||||
{
|
||||
pval *left, *right,*scale_param;
|
||||
bc_num first, second, result;
|
||||
int scale=bc_precision;
|
||||
|
||||
switch (ARG_COUNT(ht)) {
|
||||
case 2:
|
||||
if (getParameters(ht, 2, &left, &right) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long(scale_param);
|
||||
scale = (int) scale_param->value.lval;
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
convert_to_string(left);
|
||||
convert_to_string(right);
|
||||
init_num(&first);
|
||||
init_num(&second);
|
||||
init_num(&result);
|
||||
str2num(&first,left->value.str.val,scale);
|
||||
str2num(&second,right->value.str.val,scale);
|
||||
bc_sub (first,second,&result, scale);
|
||||
return_value->value.str.val = num2str(result);
|
||||
return_value->value.str.len = strlen(return_value->value.str.val);
|
||||
return_value->type = IS_STRING;
|
||||
free_num(&first);
|
||||
free_num(&second);
|
||||
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(bcmath_mul)
|
||||
{
|
||||
pval *left, *right,*scale_param;
|
||||
bc_num first, second, result;
|
||||
int scale=bc_precision;
|
||||
|
||||
switch (ARG_COUNT(ht)) {
|
||||
case 2:
|
||||
if (getParameters(ht, 2, &left, &right) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long(scale_param);
|
||||
scale = (int) scale_param->value.lval;
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
convert_to_string(left);
|
||||
convert_to_string(right);
|
||||
init_num(&first);
|
||||
init_num(&second);
|
||||
init_num(&result);
|
||||
str2num(&first,left->value.str.val,scale);
|
||||
str2num(&second,right->value.str.val,scale);
|
||||
bc_multiply (first,second,&result, scale);
|
||||
return_value->value.str.val = num2str(result);
|
||||
return_value->value.str.len = strlen(return_value->value.str.val);
|
||||
return_value->type = IS_STRING;
|
||||
free_num(&first);
|
||||
free_num(&second);
|
||||
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(bcmath_div)
|
||||
{
|
||||
pval *left, *right,*scale_param;
|
||||
bc_num first, second, result;
|
||||
int scale=bc_precision;
|
||||
|
||||
switch (ARG_COUNT(ht)) {
|
||||
case 2:
|
||||
if (getParameters(ht, 2, &left, &right) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long(scale_param);
|
||||
scale = (int) scale_param->value.lval;
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
convert_to_string(left);
|
||||
convert_to_string(right);
|
||||
init_num(&first);
|
||||
init_num(&second);
|
||||
init_num(&result);
|
||||
str2num(&first,left->value.str.val,scale);
|
||||
str2num(&second,right->value.str.val,scale);
|
||||
switch (bc_divide (first,second,&result, scale)) {
|
||||
case 0: /* OK */
|
||||
return_value->value.str.val = num2str(result);
|
||||
return_value->value.str.len = strlen(return_value->value.str.val);
|
||||
return_value->type = IS_STRING;
|
||||
break;
|
||||
case -1: /* division by zero */
|
||||
php3_error(E_WARNING,"Division by zero");
|
||||
break;
|
||||
}
|
||||
free_num(&first);
|
||||
free_num(&second);
|
||||
free_num(&result);
|
||||
return;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string bcmod(string left_operand, string right_operand)
|
||||
Returns the modulus of the two arbitrary precision operands */
|
||||
PHP_FUNCTION(bcmath_mod)
|
||||
{
|
||||
pval *left, *right;
|
||||
bc_num first, second, result;
|
||||
|
||||
switch (ARG_COUNT(ht)) {
|
||||
case 2:
|
||||
if (getParameters(ht, 2, &left, &right) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
convert_to_string(left);
|
||||
convert_to_string(right);
|
||||
init_num(&first);
|
||||
init_num(&second);
|
||||
init_num(&result);
|
||||
str2num(&first,left->value.str.val,0);
|
||||
str2num(&second,right->value.str.val,0);
|
||||
switch (bc_modulo(first,second,&result, 0)) {
|
||||
case 0:
|
||||
return_value->value.str.val = num2str(result);
|
||||
return_value->value.str.len = strlen(return_value->value.str.val);
|
||||
return_value->type = IS_STRING;
|
||||
break;
|
||||
case -1:
|
||||
php3_error(E_WARNING,"Division by zero");
|
||||
break;
|
||||
}
|
||||
free_num(&first);
|
||||
free_num(&second);
|
||||
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(bcmath_pow)
|
||||
{
|
||||
pval *left, *right,*scale_param;
|
||||
bc_num first, second, result;
|
||||
int scale=bc_precision;
|
||||
|
||||
switch (ARG_COUNT(ht)) {
|
||||
case 2:
|
||||
if (getParameters(ht, 2, &left, &right) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long(scale_param);
|
||||
scale = (int) scale_param->value.lval;
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
convert_to_string(left);
|
||||
convert_to_string(right);
|
||||
init_num(&first);
|
||||
init_num(&second);
|
||||
init_num(&result);
|
||||
str2num(&first,left->value.str.val,scale);
|
||||
str2num(&second,right->value.str.val,scale);
|
||||
bc_raise (first,second,&result, scale);
|
||||
return_value->value.str.val = num2str(result);
|
||||
return_value->value.str.len = strlen(return_value->value.str.val);
|
||||
return_value->type = IS_STRING;
|
||||
free_num(&first);
|
||||
free_num(&second);
|
||||
free_num(&result);
|
||||
return;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string bcsqrt(string operand [, int scale])
|
||||
Returns the square root of an arbitray precision number */
|
||||
PHP_FUNCTION(bcmath_sqrt)
|
||||
{
|
||||
pval *left,*scale_param;
|
||||
bc_num result;
|
||||
int scale=bc_precision;
|
||||
|
||||
switch (ARG_COUNT(ht)) {
|
||||
case 1:
|
||||
if (getParameters(ht, 1, &left) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (getParameters(ht, 2, &left, &scale_param) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long(scale_param);
|
||||
scale = (int) scale_param->value.lval;
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
convert_to_string(left);
|
||||
init_num(&result);
|
||||
str2num(&result,left->value.str.val,scale);
|
||||
if (bc_sqrt (&result, scale) != 0) {
|
||||
return_value->value.str.val = num2str(result);
|
||||
return_value->value.str.len = strlen(return_value->value.str.val);
|
||||
return_value->type = IS_STRING;
|
||||
} else {
|
||||
php3_error(E_WARNING,"Square root of negative number");
|
||||
}
|
||||
free_num(&result);
|
||||
return;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string bccomp(string left_operand, string right_operand [, int scale])
|
||||
Compares two arbitrary precision numbers */
|
||||
PHP_FUNCTION(bcmath_comp)
|
||||
{
|
||||
pval *left, *right, *scale_param;
|
||||
bc_num first, second;
|
||||
int scale=bc_precision;
|
||||
|
||||
switch (ARG_COUNT(ht)) {
|
||||
case 2:
|
||||
if (getParameters(ht, 2, &left, &right) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long(scale_param);
|
||||
scale = (int) scale_param->value.lval;
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
|
||||
convert_to_string(left);
|
||||
convert_to_string(right);
|
||||
init_num(&first);
|
||||
init_num(&second);
|
||||
|
||||
str2num(&first,left->value.str.val,scale);
|
||||
str2num(&second,right->value.str.val,scale);
|
||||
return_value->value.lval = bc_compare(first,second);
|
||||
return_value->type = IS_LONG;
|
||||
|
||||
free_num(&first);
|
||||
free_num(&second);
|
||||
return;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string bcscale(int scale)
|
||||
Sets default scale parameter for all bc math functions */
|
||||
PHP_FUNCTION(bcmath_set_scale)
|
||||
{
|
||||
pval *new_scale;
|
||||
|
||||
if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &new_scale)==FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
convert_to_long(new_scale);
|
||||
bc_precision = new_scale->value.lval;
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -1,2 +0,0 @@
|
||||
/* Define if you want to enable bc style precision math support */
|
||||
#define WITH_BCMATH 0
|
||||
@@ -1,19 +0,0 @@
|
||||
dnl $Id$
|
||||
|
||||
AC_MSG_CHECKING(whether to enable bc style precision math functions)
|
||||
AC_ARG_ENABLE(bcmath,
|
||||
[ --disable-bcmath Compile without bc style precision math functions. ],
|
||||
[
|
||||
if test "$enableval" = "yes"; then
|
||||
AC_DEFINE(WITH_BCMATH, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
PHP_EXTENSION(bcmath)
|
||||
else
|
||||
AC_DEFINE(WITH_BCMATH, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
],[
|
||||
AC_DEFINE(WITH_BCMATH, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
PHP_EXTENSION(bcmath)
|
||||
])
|
||||
-1626
File diff suppressed because it is too large.
Load diff
@@ -1,118 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP HTML Embedded Scripting Language Version 3.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This program is free software; you can redistribute it and/or modify |
|
||||
| it under the terms of one of the following licenses: |
|
||||
| |
|
||||
| A) 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. |
|
||||
| |
|
||||
| B) the PHP License as published by the PHP Development Team and |
|
||||
| included in the distribution in the file: LICENSE |
|
||||
| |
|
||||
| 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 both licenses referred to here. |
|
||||
| If you did not, or have any questions about PHP licensing, please |
|
||||
| contact core@php.net. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Modified for PHP by Andi Gutmans <andi@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* number.h: Arbitrary precision numbers header file. */
|
||||
|
||||
/* This file is part of GNU bc.
|
||||
Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 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; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
You may contact the author by:
|
||||
e-mail: phil@cs.wwu.edu
|
||||
us-mail: Philip A. Nelson
|
||||
Computer Science Department, 9062
|
||||
Western Washington University
|
||||
Bellingham, WA 98226-9062
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef _NUMBER_H
|
||||
#define _NUMBER_H
|
||||
|
||||
typedef enum {PLUS, MINUS} sign;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
sign n_sign;
|
||||
int n_len; /* The number of digits before the decimal point. */
|
||||
int n_scale; /* The number of digits after the decimal point. */
|
||||
int n_refs; /* The number of pointers to this number. */
|
||||
char n_value[1]; /* The storage. Not zero char terminated. It is
|
||||
allocated with all other fields. */
|
||||
} bc_struct;
|
||||
|
||||
typedef bc_struct *bc_num;
|
||||
|
||||
/* The base used in storing the numbers in n_value above.
|
||||
Currently this MUST be 10. */
|
||||
|
||||
#define BASE 10
|
||||
|
||||
/* Some useful macros and constants. */
|
||||
|
||||
#define CH_VAL(c) (c - '0')
|
||||
#define BCD_CHAR(d) (d + '0')
|
||||
|
||||
#if 0
|
||||
#ifdef MIN
|
||||
#undef MIN
|
||||
#undef MAX
|
||||
#endif
|
||||
#define MAX(a,b) ((a)>(b)?(a):(b))
|
||||
#define MIN(a,b) ((a)>(b)?(b):(a))
|
||||
|
||||
#endif
|
||||
|
||||
#define ODD(a) ((a)&1)
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
void init_numbers (void);
|
||||
void destruct_numbers (void);
|
||||
void str2num (bc_num *num, char *str, int scale);
|
||||
extern char *num2str (bc_num num);
|
||||
void bc_add ( bc_num n1, bc_num n2, bc_num *result, int scale_min);
|
||||
void bc_sub (bc_num n1, bc_num n2, bc_num *result, int scale_min);
|
||||
void bc_multiply (bc_num n1, bc_num n2, bc_num *prod, int scale);
|
||||
extern int bc_divide (bc_num n1, bc_num n2, bc_num *quot, int scale);
|
||||
extern int bc_modulo (bc_num num1, bc_num num2, bc_num *result, int scale);
|
||||
void bc_raise (bc_num num1, bc_num num2, bc_num *result, int scale);
|
||||
extern int bc_sqrt (bc_num *num, int scale);
|
||||
extern int bc_compare (bc_num n1, bc_num n2);
|
||||
|
||||
void free_num (bc_num *num);
|
||||
void init_num (bc_num *num);
|
||||
|
||||
#endif
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP HTML Embedded Scripting Language Version 3.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This program is free software; you can redistribute it and/or modify |
|
||||
| it under the terms of one of the following licenses: |
|
||||
| |
|
||||
| A) 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. |
|
||||
| |
|
||||
| B) the PHP License as published by the PHP Development Team and |
|
||||
| included in the distribution in the file: LICENSE |
|
||||
| |
|
||||
| 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 both licenses referred to here. |
|
||||
| If you did not, or have any questions about PHP licensing, please |
|
||||
| contact core@php.net. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef _PHP3_BCMATH_H
|
||||
#define _PHP3_BCMATH_H
|
||||
|
||||
#if COMPILE_DL
|
||||
#undef WITH_BCMATH
|
||||
#define WITH_BCMATH 1
|
||||
#endif
|
||||
|
||||
#if WITH_BCMATH
|
||||
|
||||
extern php3_module_entry bcmath_module_entry;
|
||||
#define phpext_bcmath_ptr &bcmath_module_entry
|
||||
|
||||
extern int php3_rinit_bcmath(INIT_FUNC_ARGS);
|
||||
extern int php3_rend_bcmath(SHUTDOWN_FUNC_ARGS);
|
||||
PHP_FUNCTION(bcmath_add);
|
||||
PHP_FUNCTION(bcmath_sub);
|
||||
PHP_FUNCTION(bcmath_mul);
|
||||
PHP_FUNCTION(bcmath_div);
|
||||
PHP_FUNCTION(bcmath_mod);
|
||||
PHP_FUNCTION(bcmath_pow);
|
||||
PHP_FUNCTION(bcmath_sqrt);
|
||||
PHP_FUNCTION(bcmath_comp);
|
||||
PHP_FUNCTION(bcmath_set_scale);
|
||||
|
||||
#else
|
||||
|
||||
#define phpext_bcmath_ptr NULL
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _PHP3_BCMATH_H */
|
||||
@@ -1,6 +0,0 @@
|
||||
# $Source$
|
||||
# $Id$
|
||||
|
||||
define_option enable-bcmath 'Enable bc style precision math functions' yesno \
|
||||
yes \
|
||||
' Enables bc style arbitrary precision math functions.'
|
||||
@@ -1,24 +0,0 @@
|
||||
#ifndef _PHP3_COM_H
|
||||
#define _PHP3_COM_H
|
||||
|
||||
#if WIN32|WINNT
|
||||
|
||||
extern int php3_minit_COM(INIT_FUNC_ARGS);
|
||||
extern int php3_mshutdown_COM(SHUTDOWN_FUNC_ARGS);
|
||||
PHP_FUNCTION(COM_load);
|
||||
PHP_FUNCTION(COM_invoke);
|
||||
|
||||
PHP_FUNCTION(com_propget);
|
||||
PHP_FUNCTION(com_propput);
|
||||
extern php3_module_entry COM_module_entry;
|
||||
#define COM_module_ptr &COM_module_entry
|
||||
|
||||
#else
|
||||
|
||||
#define COM_module_ptr NULL
|
||||
|
||||
#endif /* Win32|WINNT */
|
||||
|
||||
#define phpext_COM_ptr COM_module_ptr
|
||||
|
||||
#endif /* _PHP3_COM_H */
|
||||
@@ -1,6 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
|
||||
noinst_LIBRARIES=libphpext_dav.a
|
||||
libphpext_dav_a_SOURCES=dav.c
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
/* Define to compile with mod_dav support */
|
||||
#define HAVE_MOD_DAV 0
|
||||
@@ -1,29 +0,0 @@
|
||||
dnl $Id$
|
||||
dnl config.m4 for extension dav
|
||||
dnl don't forget to call PHP_EXTENSION(dav)
|
||||
|
||||
AC_MSG_CHECKING(whether to enable DAV support through mod_dav)
|
||||
AC_ARG_WITH(mod-dav,
|
||||
[ --with-mod-dav=DIR Include DAV support through Apache's mod_dav,
|
||||
DIR is mod_dav's installation directory (Apache
|
||||
module version only!)],
|
||||
[
|
||||
if test "$withval" = "yes"; then
|
||||
AC_MSG_ERROR(Must give parameter to --with-mod-dav!)
|
||||
else
|
||||
if test "$withval" != "no"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_MOD_DAV, 1)
|
||||
CFLAGS="$CFLAGS -DHAVE_MOD_DAV -I$withval"
|
||||
INCLUDES="$INCLUDES -I$withval"
|
||||
PHP_EXTENSION(dav)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(HAVE_MOD_DAV, 0)
|
||||
fi
|
||||
fi
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(HAVE_MOD_DAV, 0)
|
||||
])
|
||||
|
||||
-300
@@ -1,300 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP HTML Embedded Scripting Language Version 3.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This program is free software; you can redistribute it and/or modify |
|
||||
| it under the terms of one of the following licenses: |
|
||||
| |
|
||||
| A) 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. |
|
||||
| |
|
||||
| B) the PHP License as published by the PHP Development Team and |
|
||||
| included in the distribution in the file: LICENSE |
|
||||
| |
|
||||
| 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 both licenses referred to here. |
|
||||
| If you did not, or have any questions about PHP licensing, please |
|
||||
| contact core@php.net. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Stig Sæther Bakken <ssb@guardian.no> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#define IS_EXT_MODULE
|
||||
#if COMPILE_DL
|
||||
# if PHP_31
|
||||
# include "../phpdl.h"
|
||||
# else
|
||||
# include "dl/phpdl.h"
|
||||
# endif
|
||||
#endif
|
||||
#include "php.h"
|
||||
#include "php3_dav.h"
|
||||
|
||||
#if defined(THREAD_SAFE) && !PHP_31
|
||||
# undef THREAD_SAFE
|
||||
#endif
|
||||
|
||||
#if HAVE_MOD_DAV
|
||||
|
||||
# include "mod_dav.h"
|
||||
# include "phpdav.h"
|
||||
# include "variables.h"
|
||||
|
||||
/* {{{ thread safety stuff */
|
||||
|
||||
# ifdef THREAD_SAFE
|
||||
# define DAV_GLOBAL(a) phpdav_globals->a
|
||||
# define DAV_TLS_VARS phpdav_global_struct *phpdav_globals = TlsGetValue(PHPDAVTls);
|
||||
|
||||
void *phpdav_mutex;
|
||||
DWORD PHPDAVTls;
|
||||
static int numthreads=0;
|
||||
|
||||
typedef struct phpdav_global_struct {
|
||||
phpdav_module php3_dav_module;
|
||||
} phpdav_global_struct;
|
||||
|
||||
# else /* !defined(THREAD_SAFE) */
|
||||
# define DAV_GLOBAL(a) a
|
||||
# define DAV_TLS_VARS
|
||||
|
||||
phpdav_module php3_dav_module;
|
||||
|
||||
# endif /* defined(THREAD_SAFE) */
|
||||
|
||||
# define DAV_HANDLER(a) DAV_GLOBAL(php3_dav_module).a##_handler
|
||||
# define DAV_SET_HANDLER(a,b) \
|
||||
dav_set_handler(&DAV_GLOBAL(php3_dav_module).a##_handler,(b))
|
||||
|
||||
|
||||
/* }}} */
|
||||
/* {{{ dynamically loadable module stuff */
|
||||
|
||||
# if COMPILE_DL
|
||||
DLEXPORT php3_module_entry *get_module() { return &phpdav_module_entry; };
|
||||
# endif /* COMPILE_DL */
|
||||
|
||||
/* }}} */
|
||||
/* {{{ function prototypes */
|
||||
|
||||
int php3_minit_phpdav(INIT_FUNC_ARGS);
|
||||
int php3_rinit_phpdav(INIT_FUNC_ARGS);
|
||||
int php3_mshutdown_phpdav(SHUTDOWN_FUNC_ARGS);
|
||||
int php3_rshutdown_phpdav(SHUTDOWN_FUNC_ARGS);
|
||||
void php3_info_phpdav(ZEND_MODULE_INFO_FUNC_ARGS);
|
||||
|
||||
/* }}} */
|
||||
/* {{{ extension definition structures */
|
||||
|
||||
function_entry phpdav_functions[] = {
|
||||
PHP_FE(dav_set_mkcol_handlers, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
php3_module_entry phpdav_module_entry = {
|
||||
"DAV", /* extension name */
|
||||
phpdav_functions, /* extension function list */
|
||||
php3_minit_phpdav, /* extension-wide startup function */
|
||||
php3_mshutdown_phpdav, /* extension-wide shutdown function */
|
||||
php3_rinit_phpdav, /* per-request startup function */
|
||||
php3_rshutdown_phpdav, /* per-request shutdown function */
|
||||
php3_info_phpdav, /* information function */
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
/* }}} */
|
||||
/* {{{ startup, shutdown and info functions */
|
||||
|
||||
/* {{{ php3_minit_phpdav */
|
||||
|
||||
int php3_minit_phpdav(INIT_FUNC_ARGS)
|
||||
{
|
||||
#if defined(THREAD_SAFE)
|
||||
phpdav_global_struct *phpdav_globals;
|
||||
PHP3_MUTEX_ALLOC(phpdav_mutex);
|
||||
PHP3_MUTEX_LOCK(phpdav_mutex);
|
||||
numthreads++;
|
||||
if (numthreads==1){
|
||||
if (!PHP3_TLS_PROC_STARTUP(PHPDAVTls)){
|
||||
PHP3_MUTEX_UNLOCK(phpdav_mutex);
|
||||
PHP3_MUTEX_FREE(phpdav_mutex);
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
PHP3_MUTEX_UNLOCK(phdpav_mutex);
|
||||
if(!PHP3_TLS_THREAD_INIT(PHPDAVTls,phpdav_globals,phpdav_global_struct)){
|
||||
PHP3_MUTEX_FREE(phpdav_mutex);
|
||||
return FAILURE;
|
||||
}
|
||||
#endif
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ php3_rinit_phpdav */
|
||||
|
||||
int php3_rinit_phpdav(INIT_FUNC_ARGS)
|
||||
{
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ php3_mshutdown_phpdav() */
|
||||
|
||||
int php3_mshutdown_phpdav(SHUTDOWN_FUNC_ARGS)
|
||||
{
|
||||
DAV_TLS_VARS;
|
||||
#ifdef THREAD_SAFE
|
||||
PHP3_TLS_THREAD_FREE(phpdav_globals);
|
||||
PHP3_MUTEX_LOCK(phpdav_mutex);
|
||||
numthreads--;
|
||||
if (numthreads < 1) {
|
||||
PHP3_TLS_PROC_SHUTDOWN(PHPDAVTls);
|
||||
PHP3_MUTEX_UNLOCK(phpdav_mutex);
|
||||
PHP3_MUTEX_FREE(phpdav_mutex);
|
||||
return SUCCESS;
|
||||
}
|
||||
PHP3_MUTEX_UNLOCK(phpdav_mutex);
|
||||
#endif
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ php3_rshutdown_phpdav() */
|
||||
|
||||
int php3_rshutdown_phpdav(SHUTDOWN_FUNC_ARGS)
|
||||
{
|
||||
if (DAV_HANDLER(mkcol_test)) {
|
||||
efree(DAV_HANDLER(mkcol_test));
|
||||
}
|
||||
if (DAV_HANDLER(mkcol_create)) {
|
||||
efree(DAV_HANDLER(mkcol_create));
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ php3_info_phpdav() */
|
||||
|
||||
void php3_info_phpdav(ZEND_MODULE_INFO_FUNC_ARGS)
|
||||
{
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* }}} */
|
||||
/* {{{ extension-internal functions */
|
||||
|
||||
/* {{{ dav_set_handler() */
|
||||
|
||||
static void
|
||||
dav_set_handler(char **nameBufp, pval *data)
|
||||
{
|
||||
if (data->value.str.len > 0) {
|
||||
if (*nameBufp != NULL) {
|
||||
efree(*nameBufp);
|
||||
}
|
||||
*nameBufp = php3i_pval_strdup(data);
|
||||
} else {
|
||||
if (*nameBufp != NULL) {
|
||||
efree(*nameBufp);
|
||||
}
|
||||
*nameBufp = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ dav_call_handler() */
|
||||
|
||||
static int
|
||||
dav_call_handler(char *funcName, int argc, pval **argv)
|
||||
{
|
||||
if (funcName) {
|
||||
pval *retval, *func;
|
||||
int i, ret;
|
||||
HashTable *function_table;
|
||||
|
||||
func = php3i_string_pval(funcName);
|
||||
retval = emalloc(sizeof(pval));
|
||||
function_table = php3i_get_function_table();
|
||||
if (call_user_function(function_table, NULL, func, retval, argc, argv) == FAILURE) {
|
||||
php3tls_pval_destructor(retval);
|
||||
efree(retval);
|
||||
return HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
php3tls_pval_destructor(func);
|
||||
efree(func);
|
||||
for (i = 0; i < argc; i++) {
|
||||
php3tls_pval_destructor(argv[i]);
|
||||
efree(argv[i]);
|
||||
}
|
||||
convert_to_long(retval);
|
||||
ret = retval->value.lval;
|
||||
efree(retval);
|
||||
return ret;
|
||||
}
|
||||
return DECLINED;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
int phpdav_mkcol_test_handler(request_rec *r)
|
||||
{
|
||||
pval *arg;
|
||||
|
||||
if (DAV_HANDLER(mkcol_test) == NULL) {
|
||||
return DECLINED;
|
||||
}
|
||||
arg = php3i_string_pval(r->filename);
|
||||
return dav_call_handler(DAV_HANDLER(mkcol_test), 1, &arg);
|
||||
}
|
||||
|
||||
int phpdav_mkcol_create_handler(request_rec *r)
|
||||
{
|
||||
pval *arg;
|
||||
|
||||
if (DAV_HANDLER(mkcol_create) == NULL) {
|
||||
return DECLINED;
|
||||
}
|
||||
arg = php3i_string_pval(r->filename);
|
||||
return dav_call_handler(DAV_HANDLER(mkcol_create), 1, &arg);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/************************* EXTENSION FUNCTIONS *************************/
|
||||
|
||||
/* {{{ proto void dav_set_mkcol_handlers(string test, string create)
|
||||
Sets the function to test whether a DAV collection exists for MKCOL */
|
||||
PHP_FUNCTION(dav_set_mkcol_handlers)
|
||||
{
|
||||
pval *test, *create;
|
||||
DAV_TLS_VARS;
|
||||
|
||||
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &test, &create) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
DAV_SET_HANDLER(mkcol_test, test);
|
||||
DAV_SET_HANDLER(mkcol_create, create);
|
||||
RETVAL_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP HTML Embedded Scripting Language Version 3.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This program is free software; you can redistribute it and/or modify |
|
||||
| it under the terms of one of the following licenses: |
|
||||
| |
|
||||
| A) 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. |
|
||||
| |
|
||||
| B) the PHP License as published by the PHP Development Team and |
|
||||
| included in the distribution in the file: LICENSE |
|
||||
| |
|
||||
| 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 both licenses referred to here. |
|
||||
| If you did not, or have any questions about PHP licensing, please |
|
||||
| contact core@php.net. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Stig Sæther Bakken <ssb@guardian.no> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id */
|
||||
|
||||
#ifndef _PHP_DAV_H
|
||||
# define _PHP_DAV_H
|
||||
|
||||
# if HAVE_MOD_DAV
|
||||
|
||||
typedef struct {
|
||||
int foo;
|
||||
char *mkcol_test_handler;
|
||||
char *mkcol_create_handler;
|
||||
} phpdav_module;
|
||||
|
||||
extern php3_module_entry phpdav_module_entry;
|
||||
# define phpdav_module_ptr &phpdav_module_entry
|
||||
|
||||
int phpdav_mkcol_test_handler(request_rec *);
|
||||
|
||||
PHP_FUNCTION(dav_set_mkcol_handlers);
|
||||
|
||||
# else /* !HAVE_MOD_DAV */
|
||||
|
||||
# define phpdav_module_ptr NULL
|
||||
|
||||
# endif /* HAVE_MOD_DAV */
|
||||
|
||||
#define phpext_dav_ptr phpdav_module_ptr
|
||||
|
||||
#endif /* _PHP_DAV_H */
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -1,2 +0,0 @@
|
||||
# $Id$
|
||||
# This extension is still very much under construction.
|
||||
@@ -1,6 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
|
||||
noinst_LIBRARIES=libphpext_db.a
|
||||
libphpext_db_a_SOURCES=db.c
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
/* Define if you have an ndbm compatible library (-ldbm). */
|
||||
#define NDBM 0
|
||||
|
||||
/* Define if you have the gdbm library (-lgdbm). */
|
||||
#define GDBM 0
|
||||
@@ -1,53 +0,0 @@
|
||||
dnl $Id$
|
||||
dnl config.m4 for extension db
|
||||
dnl don't forget to call PHP_EXTENSION(db)
|
||||
|
||||
divert(1)
|
||||
|
||||
# Checks for libraries.
|
||||
# Prefer gdbm, Berkeley DB and ndbm/dbm, in that order
|
||||
AC_DEFUN(AC_PREFERRED_DB_LIB,[
|
||||
AC_CHECK_LIB(gdbm, gdbm_open,[AC_DEFINE(GDBM) DBM_TYPE=gdbm; DBM_LIB=-lgdbm],
|
||||
[AC_CHECK_LIB(db, dbm_open,[AC_DEFINE(NDBM) DBM_TYPE=ndbm; DBM_LIB=-ldb],
|
||||
[AC_CHECK_LIB(c, dbm_open,[AC_DEFINE(NDBM) DBM_TYPE=ndbm; DBM_LIB=],
|
||||
[AC_CHECK_LIB(dbm, dbm_open,[AC_DEFINE(NDBM) DBM_TYPE=ndbm; DBM_LIB=-ldbm],
|
||||
[DBM_TYPE=""])])])])
|
||||
AC_MSG_CHECKING([preferred dbm library])
|
||||
if test "a$DBM_TYPE" = a; then
|
||||
AC_MSG_RESULT(none found)
|
||||
AC_MSG_WARN(No dbm library found - using built-in flatfile support)
|
||||
else
|
||||
AC_MSG_RESULT($DBM_TYPE chosen)
|
||||
fi
|
||||
AC_SUBST(DBM_LIB)
|
||||
AC_SUBST(DBM_TYPE)
|
||||
])
|
||||
|
||||
AC_PREFERRED_DB_LIB
|
||||
|
||||
divert(3)
|
||||
|
||||
if test "$DBM_LIB" = "-lgdbm"; then
|
||||
AC_CHECK_HEADER(gdbm.h, [ GDBM_INCLUDE="" ], [
|
||||
AC_MSG_RESULT("Try /usr/local/include/gdbm.h");
|
||||
AC_CHECK_HEADER(/usr/local/include/gdbm.h, [ GDBM_INCLUDE="-I/usr/local/include" ],[
|
||||
AC_MSG_RESULT("Try /opt/local/include/gdbm.h");
|
||||
AC_CHECK_HEADER(/opt/local/include/gdbm.h, [ GDBM_INCLUDE="-I/opt/local/include" ],[
|
||||
dnl if in /usr/pkg/include, do not add anything. See above.
|
||||
AC_MSG_RESULT("Try /usr/pkg/include/gdbm.h");
|
||||
AC_CHECK_HEADER(/usr/pkg/include/gdbm.h, [ GDBM_INCLUDE="" ],[
|
||||
AC_MSG_RESULT("Giving up - You need to install gdbm.h somewhere");
|
||||
exit
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
fi
|
||||
|
||||
if test -n "$DBM_LIB"; then
|
||||
INCLUDES="$INCLUDES $GDBM_INCLUDE"
|
||||
EXTRA_LIBS="$EXTRA_LIBS $DBM_LIB"
|
||||
fi
|
||||
|
||||
PHP_EXTENSION(db)
|
||||
|
||||
-1172
File diff suppressed because it is too large.
Load diff
@@ -1,94 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP HTML Embedded Scripting Language Version 3.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This program is free software; you can redistribute it and/or modify |
|
||||
| it under the terms of one of the following licenses: |
|
||||
| |
|
||||
| A) 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. |
|
||||
| |
|
||||
| B) the PHP License as published by the PHP Development Team and |
|
||||
| included in the distribution in the file: LICENSE |
|
||||
| |
|
||||
| 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 both licenses referred to here. |
|
||||
| If you did not, or have any questions about PHP licensing, please |
|
||||
| contact core@php.net. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
|
||||
| Jim Winstead <jimw@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
#ifndef _PHP3_DB_H
|
||||
#define _PHP3_DB_H
|
||||
|
||||
|
||||
#ifndef DLEXPORT
|
||||
#define DLEXPORT
|
||||
#endif
|
||||
|
||||
|
||||
extern php3_module_entry dbm_module_entry;
|
||||
#define phpext_db_ptr &dbm_module_entry
|
||||
|
||||
|
||||
|
||||
typedef struct dbm_info {
|
||||
char *filename;
|
||||
char *lockfn;
|
||||
int lockfd;
|
||||
void *dbf;
|
||||
} dbm_info;
|
||||
|
||||
/*
|
||||
we're not going to bother with flatfile on win32
|
||||
because the dbm module will be external, and we
|
||||
do not want flatfile compiled staticly
|
||||
*/
|
||||
#if defined(MSVC5) && !defined(COMPILE_DL)
|
||||
#undef phpext_db_ptr
|
||||
#define phpext_db_ptr NULL
|
||||
#endif
|
||||
|
||||
dbm_info *_php3_finddbm(pval *id,HashTable *list);
|
||||
int _php3_dbmclose(dbm_info *info);
|
||||
dbm_info *_php3_dbmopen(char *filename, char *mode);
|
||||
int _php3_dbminsert(dbm_info *info, char *key, char *value);
|
||||
char *_php3_dbmfetch(dbm_info *info, char *key);
|
||||
int _php3_dbmreplace(dbm_info *info, char *key, char *value);
|
||||
int _php3_dbmexists(dbm_info *info, char *key);
|
||||
int _php3_dbmdelete(dbm_info *info, char *key);
|
||||
char *_php3_dbmfirstkey(dbm_info *info);
|
||||
char *_php3_dbmnextkey(dbm_info *info, char *key);
|
||||
|
||||
/* db file functions */
|
||||
int php3_minit_db(INIT_FUNC_ARGS);
|
||||
int php3_rinit_db(INIT_FUNC_ARGS);
|
||||
void php3_info_db(ZEND_MODULE_INFO_FUNC_ARGS);
|
||||
PHP_FUNCTION(dblist);
|
||||
PHP_FUNCTION(dbmopen);
|
||||
PHP_FUNCTION(dbmclose);
|
||||
PHP_FUNCTION(dbminsert);
|
||||
PHP_FUNCTION(dbmfetch);
|
||||
PHP_FUNCTION(dbmreplace);
|
||||
PHP_FUNCTION(dbmexists);
|
||||
PHP_FUNCTION(dbmdelete);
|
||||
PHP_FUNCTION(dbmfirstkey);
|
||||
PHP_FUNCTION(dbmnextkey);
|
||||
|
||||
#undef phpext_db_ptr
|
||||
#define phpext_db_ptr NULL
|
||||
|
||||
#endif /* _PHP3_DB_H */
|
||||
@@ -1,5 +0,0 @@
|
||||
## Process this file with automake to produce Makefile.in -*- makefile -*-
|
||||
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
|
||||
noinst_LIBRARIES=libphpext_dbase.a
|
||||
libphpext_dbase_a_SOURCES=dbf_head.c dbf_rec.c dbf_misc.c dbf_ndx.c dbase.c
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
/* Define if you want to use the supplied dbase library */
|
||||
#define DBASE 0
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
dnl $Id$
|
||||
|
||||
AC_MSG_CHECKING(whether to include the bundled dbase library)
|
||||
AC_ARG_WITH(dbase,
|
||||
[ --with-dbase Include the bundled dbase library],
|
||||
[
|
||||
if test "$withval" = "yes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(DBASE,1)
|
||||
PHP_EXTENSION(dbase)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(DBASE,0)
|
||||
DBASE_LIB=
|
||||
fi
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(DBASE,0)
|
||||
DBASE_LIB=
|
||||
])
|
||||
AC_SUBST(DBASE_LIB)
|
||||
@@ -1,762 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP HTML Embedded Scripting Language Version 4.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This program is free software; you can redistribute it and/or modify |
|
||||
| it under the terms of one of the following licenses: |
|
||||
| |
|
||||
| A) 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. |
|
||||
| |
|
||||
| B) the PHP License as published by the PHP Development Team and |
|
||||
| included in the distribution in the file: LICENSE |
|
||||
| |
|
||||
| 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 both licenses referred to here. |
|
||||
| If you did not, or have any questions about PHP licensing, please |
|
||||
| contact core@php.net. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Jim Winstead (jimw@php.net) |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
#if defined(COMPILE_DL)
|
||||
#include "dl/phpdl.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include "php.h"
|
||||
#include "safe_mode.h"
|
||||
#include "fopen-wrappers.h"
|
||||
#include "php_globals.h"
|
||||
|
||||
#if DBASE
|
||||
#include "php_dbase.h"
|
||||
#include "dbf.h"
|
||||
#if defined(THREAD_SAFE)
|
||||
DWORD DbaseTls;
|
||||
static int numthreads=0;
|
||||
void *dbase_mutex;
|
||||
|
||||
typedef struct dbase_global_struct{
|
||||
int le_dbhead;
|
||||
}dbase_global_struct;
|
||||
|
||||
#define DBase_GLOBAL(a) dbase_globals->a
|
||||
|
||||
#define DBase_TLS_VARS \
|
||||
dbase_global_struct *dbase_globals; \
|
||||
dbase_globals=TlsGetValue(DbaseTls);
|
||||
|
||||
#else
|
||||
static int le_dbhead;
|
||||
#define DBase_GLOBAL(a) a
|
||||
#define DBase_TLS_VARS
|
||||
#endif
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
static void _close_dbase(dbhead_t *dbhead)
|
||||
{
|
||||
close(dbhead->db_fd);
|
||||
free_dbf_head(dbhead);
|
||||
}
|
||||
|
||||
|
||||
int php3_minit_dbase(INIT_FUNC_ARGS)
|
||||
{
|
||||
#if defined(THREAD_SAFE)
|
||||
dbase_global_struct *dbase_globals;
|
||||
#if !defined(COMPILE_DL)
|
||||
CREATE_MUTEX(dbase_mutex,"DBase_TLS");
|
||||
SET_MUTEX(dbase_mutex);
|
||||
numthreads++;
|
||||
if (numthreads==1){
|
||||
if ((DbaseTls=TlsAlloc())==0xFFFFFFFF){
|
||||
FREE_MUTEX(dbase_mutex);
|
||||
return 0;
|
||||
}}
|
||||
FREE_MUTEX(dbase_mutex);
|
||||
#endif
|
||||
dbase_globals = (dbase_global_struct *) LocalAlloc(LPTR, sizeof(dbase_global_struct));
|
||||
TlsSetValue(DbaseTls, (void *) dbase_globals);
|
||||
#endif
|
||||
DBase_GLOBAL(le_dbhead) = register_list_destructors(_close_dbase,NULL);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static int php3_mend_dbase(void){
|
||||
#if defined(THREAD_SAFE)
|
||||
dbase_global_struct *dbase_globals;
|
||||
dbase_globals = TlsGetValue(DbaseTls);
|
||||
if (dbase_globals != 0)
|
||||
LocalFree((HLOCAL) dbase_globals);
|
||||
#if !defined(COMPILE_DL)
|
||||
SET_MUTEX(dbase_mutex);
|
||||
numthreads--;
|
||||
if (!numthreads){
|
||||
if (!TlsFree(DbaseTls)){
|
||||
FREE_MUTEX(dbase_mutex);
|
||||
return 0;
|
||||
}}
|
||||
FREE_MUTEX(dbase_mutex);
|
||||
#endif
|
||||
#endif
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* {{{ proto int dbase_open(string name, int mode)
|
||||
Opens a dBase-format database file */
|
||||
PHP_FUNCTION(dbase_open) {
|
||||
pval *dbf_name, *options;
|
||||
dbhead_t *dbh;
|
||||
int handle;
|
||||
DBase_TLS_VARS;
|
||||
|
||||
if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&dbf_name,&options)==FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_string(dbf_name);
|
||||
convert_to_long(options);
|
||||
|
||||
if (PG(safe_mode) && (!_php3_checkuid(dbf_name->value.str.val, 2))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (_php3_check_open_basedir(dbf_name->value.str.val)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
dbh = dbf_open(dbf_name->value.str.val, options->value.lval);
|
||||
if (dbh == NULL) {
|
||||
php3_error(E_WARNING, "unable to open database %s", dbf_name->value.str.val);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
handle = php3_list_insert(dbh, DBase_GLOBAL(le_dbhead));
|
||||
RETURN_LONG(handle);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool dbase_close(int identifier)
|
||||
Closes an open dBase-format database file */
|
||||
PHP_FUNCTION(dbase_close) {
|
||||
pval *dbh_id;
|
||||
dbhead_t *dbh;
|
||||
int dbh_type;
|
||||
DBase_TLS_VARS;
|
||||
|
||||
if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&dbh_id)==FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long(dbh_id);
|
||||
dbh = php3_list_find(dbh_id->value.lval, &dbh_type);
|
||||
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
|
||||
php3_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
php3_list_delete(dbh_id->value.lval);
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int dbase_numrecords(int identifier)
|
||||
Returns the number of records in the database */
|
||||
PHP_FUNCTION(dbase_numrecords) {
|
||||
pval *dbh_id;
|
||||
dbhead_t *dbh;
|
||||
int dbh_type;
|
||||
DBase_TLS_VARS;
|
||||
|
||||
if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&dbh_id)==FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long(dbh_id);
|
||||
dbh = php3_list_find(dbh_id->value.lval, &dbh_type);
|
||||
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
|
||||
php3_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_LONG(dbh->db_records);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int dbase_numfields(int identifier)
|
||||
Returns the number of fields (columns) in the database */
|
||||
PHP_FUNCTION(dbase_numfields) {
|
||||
pval *dbh_id;
|
||||
dbhead_t *dbh;
|
||||
int dbh_type;
|
||||
DBase_TLS_VARS;
|
||||
|
||||
if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&dbh_id)==FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long(dbh_id);
|
||||
dbh = php3_list_find(dbh_id->value.lval, &dbh_type);
|
||||
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
|
||||
php3_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_LONG(dbh->db_nfields);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool dbase_pack(int identifier)
|
||||
Packs the database (deletes records marked for deletion) */
|
||||
PHP_FUNCTION(dbase_pack) {
|
||||
pval *dbh_id;
|
||||
dbhead_t *dbh;
|
||||
int dbh_type;
|
||||
DBase_TLS_VARS;
|
||||
|
||||
if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&dbh_id)==FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long(dbh_id);
|
||||
dbh = php3_list_find(dbh_id->value.lval, &dbh_type);
|
||||
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
|
||||
php3_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
pack_dbf(dbh);
|
||||
put_dbf_info(dbh);
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool dbase_add_record(int identifier, array data)
|
||||
Adds a record to the database */
|
||||
PHP_FUNCTION(dbase_add_record) {
|
||||
pval *dbh_id, *fields, *field;
|
||||
dbhead_t *dbh;
|
||||
int dbh_type;
|
||||
|
||||
int num_fields;
|
||||
dbfield_t *dbf, *cur_f;
|
||||
char *cp, *t_cp;
|
||||
int i;
|
||||
DBase_TLS_VARS;
|
||||
|
||||
if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&dbh_id,&fields)==FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long(dbh_id);
|
||||
if (fields->type != IS_ARRAY) {
|
||||
php3_error(E_WARNING, "Expected array as second parameter");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
dbh = php3_list_find(dbh_id->value.lval, &dbh_type);
|
||||
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
|
||||
php3_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
num_fields = _php3_hash_num_elements(fields->value.ht);
|
||||
|
||||
if (num_fields != dbh->db_nfields) {
|
||||
php3_error(E_WARNING, "Wrong number of fields specified");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
cp = t_cp = (char *)emalloc(dbh->db_rlen + 1);
|
||||
if (!cp) {
|
||||
php3_error(E_WARNING, "unable to allocate memory");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
*t_cp++ = VALID_RECORD;
|
||||
|
||||
dbf = dbh->db_fields;
|
||||
for (i = 0, cur_f = dbf; cur_f < &dbf[num_fields]; i++, cur_f++) {
|
||||
if (_php3_hash_index_find(fields->value.ht, i, (void **)&field) == FAILURE) {
|
||||
php3_error(E_WARNING, "unexpected error");
|
||||
efree(cp);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
convert_to_string(field);
|
||||
sprintf(t_cp, cur_f->db_format, field->value.str.val);
|
||||
t_cp += cur_f->db_flen;
|
||||
}
|
||||
|
||||
dbh->db_records++;
|
||||
if (put_dbf_record(dbh, dbh->db_records, cp) < 0) {
|
||||
php3_error(E_WARNING, "unable to put record at %ld", dbh->db_records);
|
||||
efree(cp);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
put_dbf_info(dbh);
|
||||
efree(cp);
|
||||
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool dbase_replace_record(int identifier, array data, int recnum)
|
||||
Replaces a record to the database */
|
||||
void php3_dbase_replace_record(INTERNAL_FUNCTION_PARAMETERS) {
|
||||
pval *dbh_id, *fields, *field, *recnum;
|
||||
dbhead_t *dbh;
|
||||
int dbh_type;
|
||||
|
||||
int num_fields;
|
||||
dbfield_t *dbf, *cur_f;
|
||||
char *cp, *t_cp;
|
||||
int i;
|
||||
DBase_TLS_VARS;
|
||||
|
||||
if (ARG_COUNT(ht) != 3 || getParameters(ht,3,&dbh_id,&fields,&recnum)==FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long(dbh_id);
|
||||
convert_to_long(recnum);
|
||||
if (fields->type != IS_ARRAY) {
|
||||
php3_error(E_WARNING, "Expected array as second parameter");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
dbh = php3_list_find(dbh_id->value.lval, &dbh_type);
|
||||
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
|
||||
php3_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
num_fields = _php3_hash_num_elements(fields->value.ht);
|
||||
|
||||
if (num_fields != dbh->db_nfields) {
|
||||
php3_error(E_WARNING, "Wrong number of fields specified");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
cp = t_cp = (char *)emalloc(dbh->db_rlen + 1);
|
||||
if (!cp) {
|
||||
php3_error(E_WARNING, "unable to allocate memory");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
*t_cp++ = VALID_RECORD;
|
||||
|
||||
dbf = dbh->db_fields;
|
||||
for (i = 0, cur_f = dbf; cur_f < &dbf[num_fields]; i++, cur_f++) {
|
||||
if (_php3_hash_index_find(fields->value.ht, i, (void **)&field) == FAILURE) {
|
||||
php3_error(E_WARNING, "unexpected error");
|
||||
efree(cp);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
convert_to_string(field);
|
||||
sprintf(t_cp, cur_f->db_format, field->value.str.val);
|
||||
t_cp += cur_f->db_flen;
|
||||
}
|
||||
|
||||
if (put_dbf_record(dbh, recnum->value.lval, cp) < 0) {
|
||||
php3_error(E_WARNING, "unable to put record at %ld", dbh->db_records);
|
||||
efree(cp);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
put_dbf_info(dbh);
|
||||
efree(cp);
|
||||
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool dbase_delete_record(int identifier, int record)
|
||||
Marks a record to be deleted */
|
||||
PHP_FUNCTION(dbase_delete_record) {
|
||||
pval *dbh_id, *record;
|
||||
dbhead_t *dbh;
|
||||
int dbh_type;
|
||||
DBase_TLS_VARS;
|
||||
|
||||
if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&dbh_id,&record)==FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long(dbh_id);
|
||||
convert_to_long(record);
|
||||
|
||||
dbh = php3_list_find(dbh_id->value.lval, &dbh_type);
|
||||
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
|
||||
php3_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (del_dbf_record(dbh, record->value.lval) < 0) {
|
||||
if (record->value.lval > dbh->db_records) {
|
||||
php3_error(E_WARNING, "record %d out of bounds", record->value.lval);
|
||||
} else {
|
||||
php3_error(E_WARNING, "unable to delete record %d", record->value.lval);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
put_dbf_info(dbh);
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array dbase_get_record(int identifier, int record)
|
||||
Returns an array representing a record from the database */
|
||||
PHP_FUNCTION(dbase_get_record) {
|
||||
pval *dbh_id, *record;
|
||||
dbhead_t *dbh;
|
||||
int dbh_type;
|
||||
dbfield_t *dbf, *cur_f;
|
||||
char *data, *fnp, *str_value;
|
||||
size_t cursize = 0;
|
||||
DBase_TLS_VARS;
|
||||
|
||||
if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&dbh_id,&record)==FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long(dbh_id);
|
||||
convert_to_long(record);
|
||||
|
||||
dbh = php3_list_find(dbh_id->value.lval, &dbh_type);
|
||||
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
|
||||
php3_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if ((data = get_dbf_record(dbh, record->value.lval)) == NULL) {
|
||||
php3_error(E_WARNING, "Tried to read bad record %d", record->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
dbf = dbh->db_fields;
|
||||
|
||||
if (array_init(return_value) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
fnp = NULL;
|
||||
for (cur_f = dbf; cur_f < &dbf[dbh->db_nfields]; cur_f++) {
|
||||
/* get the value */
|
||||
str_value = (char *)emalloc(cur_f->db_flen + 1);
|
||||
|
||||
if(cursize <= cur_f->db_flen) {
|
||||
cursize = cur_f->db_flen + 1;
|
||||
fnp = erealloc(fnp, cursize);
|
||||
}
|
||||
snprintf(str_value, cursize, cur_f->db_format, get_field_val(data, cur_f, fnp));
|
||||
|
||||
/* now convert it to the right php internal type */
|
||||
switch (cur_f->db_type) {
|
||||
case 'C':
|
||||
case 'D':
|
||||
add_next_index_string(return_value,str_value,1);
|
||||
break;
|
||||
case 'N': /* FALLS THROUGH */
|
||||
case 'L': /* FALLS THROUGH */
|
||||
if (cur_f->db_fdc == 0) {
|
||||
add_next_index_long(return_value, strtol(str_value, NULL, 10));
|
||||
} else {
|
||||
add_next_index_double(return_value, atof(str_value));
|
||||
}
|
||||
break;
|
||||
case 'M':
|
||||
/* this is a memo field. don't know how to deal with
|
||||
this yet */
|
||||
break;
|
||||
default:
|
||||
/* should deal with this in some way */
|
||||
break;
|
||||
}
|
||||
efree(str_value);
|
||||
}
|
||||
efree(fnp);
|
||||
|
||||
/* mark whether this record was deleted */
|
||||
if (data[0] == '*') {
|
||||
add_assoc_long(return_value,"deleted",1);
|
||||
}
|
||||
else {
|
||||
add_assoc_long(return_value,"deleted",0);
|
||||
}
|
||||
|
||||
free(data);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* From Martin Kuba <makub@aida.inet.cz> */
|
||||
/* {{{ proto array dbase_get_record_with_names(int identifier, int record)
|
||||
Returns an associative array representing a record from the database */
|
||||
PHP_FUNCTION(dbase_get_record_with_names) {
|
||||
pval *dbh_id, *record;
|
||||
dbhead_t *dbh;
|
||||
int dbh_type;
|
||||
dbfield_t *dbf, *cur_f;
|
||||
char *data, *fnp, *str_value;
|
||||
DBase_TLS_VARS;
|
||||
|
||||
if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&dbh_id,&record)==FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long(dbh_id);
|
||||
convert_to_long(record);
|
||||
|
||||
dbh = php3_list_find(dbh_id->value.lval, &dbh_type);
|
||||
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
|
||||
php3_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if ((data = get_dbf_record(dbh, record->value.lval)) == NULL) {
|
||||
php3_error(E_WARNING, "Tried to read bad record %d", record->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
dbf = dbh->db_fields;
|
||||
|
||||
if (array_init(return_value) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
fnp = (char *)emalloc(dbh->db_rlen);
|
||||
for (cur_f = dbf; cur_f < &dbf[dbh->db_nfields]; cur_f++) {
|
||||
/* get the value */
|
||||
str_value = (char *)emalloc(cur_f->db_flen + 1);
|
||||
sprintf(str_value, cur_f->db_format, get_field_val(data, cur_f, fnp));
|
||||
|
||||
/* now convert it to the right php internal type */
|
||||
switch (cur_f->db_type) {
|
||||
case 'C':
|
||||
case 'D':
|
||||
add_assoc_string(return_value,cur_f->db_fname,str_value,1);
|
||||
break;
|
||||
case 'N': /* FALLS THROUGH */
|
||||
case 'L': /* FALLS THROUGH */
|
||||
if (cur_f->db_fdc == 0) {
|
||||
add_assoc_long(return_value,cur_f->db_fname,strtol(str_value, NULL, 10));
|
||||
} else {
|
||||
add_assoc_double(return_value,cur_f->db_fname,atof(str_value));
|
||||
}
|
||||
break;
|
||||
case 'M':
|
||||
/* this is a memo field. don't know how to deal with this yet */
|
||||
break;
|
||||
default:
|
||||
/* should deal with this in some way */
|
||||
break;
|
||||
}
|
||||
efree(str_value);
|
||||
}
|
||||
efree(fnp);
|
||||
|
||||
/* mark whether this record was deleted */
|
||||
if (data[0] == '*') {
|
||||
add_assoc_long(return_value,"deleted",1);
|
||||
} else {
|
||||
add_assoc_long(return_value,"deleted",0);
|
||||
}
|
||||
|
||||
free(data);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool dbase_create(string filename, array fields)
|
||||
Creates a new dBase-format database file */
|
||||
PHP_FUNCTION(dbase_create) {
|
||||
pval *filename, *fields, *field, *value;
|
||||
int fd;
|
||||
dbhead_t *dbh;
|
||||
|
||||
int num_fields;
|
||||
dbfield_t *dbf, *cur_f;
|
||||
int i, rlen, handle;
|
||||
DBase_TLS_VARS;
|
||||
|
||||
if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&filename,&fields)==FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_string(filename);
|
||||
|
||||
if (fields->type != IS_ARRAY) {
|
||||
php3_error(E_WARNING, "Expected array as second parameter");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (PG(safe_mode) && (!_php3_checkuid(filename->value.str.val, 2))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (_php3_check_open_basedir(filename->value.str.val)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if ((fd = open(filename->value.str.val, O_BINARY|O_RDWR|O_CREAT, 0644)) < 0) {
|
||||
php3_error(E_WARNING, "Unable to create database (%d): %s", errno, strerror(errno));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
num_fields = _php3_hash_num_elements(fields->value.ht);
|
||||
|
||||
/* have to use regular malloc() because this gets free()d by
|
||||
code in the dbase library */
|
||||
dbh = (dbhead_t *)malloc(sizeof(dbhead_t));
|
||||
dbf = (dbfield_t *)malloc(sizeof(dbfield_t) * num_fields);
|
||||
if (!dbh || !dbf) {
|
||||
php3_error(E_WARNING, "Unable to allocate memory for header info");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* initialize the header structure */
|
||||
dbh->db_fields = dbf;
|
||||
dbh->db_fd = fd;
|
||||
dbh->db_dbt = DBH_TYPE_NORMAL;
|
||||
strcpy(dbh->db_date, "19930818");
|
||||
dbh->db_records = 0;
|
||||
dbh->db_nfields = num_fields;
|
||||
dbh->db_hlen = sizeof(struct dbf_dhead) + 2 + num_fields * sizeof(struct dbf_dfield);
|
||||
|
||||
rlen = 1;
|
||||
|
||||
for (i = 0, cur_f = dbf; i < num_fields; i++, cur_f++) {
|
||||
/* look up the first field */
|
||||
if (_php3_hash_index_find(fields->value.ht, i, (void **)&field) == FAILURE) {
|
||||
php3_error(E_WARNING, "unable to find field %d", i);
|
||||
free_dbf_head(dbh);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (field->type != IS_ARRAY) {
|
||||
php3_error(E_WARNING, "second parameter must be array of arrays");
|
||||
free_dbf_head(dbh);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* field name */
|
||||
if (_php3_hash_index_find(field->value.ht, 0, (void **)&value) == FAILURE) {
|
||||
php3_error(E_WARNING, "expected field name as first element of list in field %d", i);
|
||||
free_dbf_head(dbh);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
convert_to_string(value);
|
||||
if (value->value.str.len > 10 || value->value.str.len == 0) {
|
||||
php3_error(E_WARNING, "invalid field name '%s' (must be non-empty and less than or equal to 10 characters)", value->value.str.val);
|
||||
free_dbf_head(dbh);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
copy_crimp(cur_f->db_fname, value->value.str.val, value->value.str.len);
|
||||
|
||||
/* field type */
|
||||
if (_php3_hash_index_find(field->value.ht,1,(void **)&value) == FAILURE) {
|
||||
php3_error(E_WARNING, "expected field type as sececond element of list in field %d", i);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
convert_to_string(value);
|
||||
cur_f->db_type = toupper(*value->value.str.val);
|
||||
|
||||
cur_f->db_fdc = 0;
|
||||
|
||||
/* verify the field length */
|
||||
switch (cur_f->db_type) {
|
||||
case 'L':
|
||||
cur_f->db_flen = 1;
|
||||
break;
|
||||
case 'M':
|
||||
cur_f->db_flen = 9;
|
||||
dbh->db_dbt = DBH_TYPE_MEMO;
|
||||
/* should create the memo file here, probably */
|
||||
break;
|
||||
case 'D':
|
||||
cur_f->db_flen = 8;
|
||||
break;
|
||||
case 'N':
|
||||
case 'C':
|
||||
/* field length */
|
||||
if (_php3_hash_index_find(field->value.ht,2,(void **)&value) == FAILURE) {
|
||||
php3_error(E_WARNING, "expected field length as third element of list in field %d", i);
|
||||
free_dbf_head(dbh);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
convert_to_long(value);
|
||||
cur_f->db_flen = value->value.lval;
|
||||
|
||||
if (cur_f->db_type == 'N') {
|
||||
if (_php3_hash_index_find(field->value.ht,3,(void **)&value) == FAILURE) {
|
||||
php3_error(E_WARNING, "expected field precision as fourth element of list in field %d", i);
|
||||
free_dbf_head(dbh);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
convert_to_long(value);
|
||||
cur_f->db_fdc = value->value.lval;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
php3_error(E_WARNING, "unknown field type '%c'", cur_f->db_type);
|
||||
}
|
||||
cur_f->db_foffset = rlen;
|
||||
rlen += cur_f->db_flen;
|
||||
|
||||
cur_f->db_format = get_dbf_f_fmt(cur_f);
|
||||
}
|
||||
|
||||
dbh->db_rlen = rlen;
|
||||
put_dbf_info(dbh);
|
||||
|
||||
handle = php3_list_insert(dbh, DBase_GLOBAL(le_dbhead));
|
||||
RETURN_LONG(handle);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
function_entry dbase_functions[] = {
|
||||
{"dbase_open", php3_dbase_open, NULL},
|
||||
{"dbase_create", php3_dbase_create, NULL},
|
||||
{"dbase_close", php3_dbase_close, NULL},
|
||||
{"dbase_numrecords", php3_dbase_numrecords, NULL},
|
||||
{"dbase_numfields", php3_dbase_numfields, NULL},
|
||||
{"dbase_add_record", php3_dbase_add_record, NULL},
|
||||
{"dbase_replace_record", php3_dbase_replace_record, NULL},
|
||||
{"dbase_get_record", php3_dbase_get_record, NULL},
|
||||
{"dbase_get_record_with_names", php3_dbase_get_record_with_names, NULL},
|
||||
{"dbase_delete_record", php3_dbase_delete_record, NULL},
|
||||
{"dbase_pack", php3_dbase_pack, NULL},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
php3_module_entry dbase_module_entry = {
|
||||
"DBase", dbase_functions, php3_minit_dbase, php3_mend_dbase, NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
|
||||
#if defined(COMPILE_DL)
|
||||
DLEXPORT php3_module_entry *get_module(void) { return &dbase_module_entry; }
|
||||
|
||||
#if (WIN32|WINNT) && defined(THREAD_SAFE)
|
||||
|
||||
/*NOTE: You should have an odbc.def file where you
|
||||
export DllMain*/
|
||||
BOOL WINAPI DllMain(HANDLE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -1,94 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Brad Eacker,
|
||||
* (Music, Intuition, Software, and Computers)
|
||||
* All Rights Reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
* dbf header structure on disk (pc dbase III)
|
||||
*
|
||||
* Basic info taken from:
|
||||
* "File Formats for Popular PC Software"
|
||||
* Jeff Walden
|
||||
* (c) 1986 John Wiley & Sons, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _DBF_H_
|
||||
#define _DBF_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* So we can use O_BINARY on non-Win32 systems. */
|
||||
#if !defined(O_BINARY) && !defined(WIN32)
|
||||
#define O_BINARY (0)
|
||||
#endif
|
||||
|
||||
struct dbf_dhead {
|
||||
char dbh_dbt; /* memo (dbt) file present */
|
||||
char dbh_date[3]; /* last update YY, MM, DD */
|
||||
char dbh_records[4]; /* number of records LE */
|
||||
char dbh_hlen[2]; /* header length LE */
|
||||
char dbh_rlen[2]; /* record length LE */
|
||||
char dbh_res[20]; /* padding */
|
||||
};
|
||||
#define DBH_DATE_YEAR 0 /* byte offset for year in dbh_date */
|
||||
#define DBH_DATE_MONTH 1
|
||||
#define DBH_DATE_DAY 2
|
||||
|
||||
/*
|
||||
* field description on disk
|
||||
*/
|
||||
|
||||
#define DBF_NAMELEN 11
|
||||
|
||||
struct dbf_dfield {
|
||||
char dbf_name[DBF_NAMELEN]; /* name of field */
|
||||
char dbf_type; /* type of field */
|
||||
char dbf_fda[4]; /* something for dbase III */
|
||||
char dbf_flen[2]; /* field length [and decimal if N] */
|
||||
char dbf_res[14]; /* padding */
|
||||
};
|
||||
|
||||
struct db_field {
|
||||
char db_fname[DBF_NAMELEN+1]; /* 0 terminated */
|
||||
char db_type; /* type of field */
|
||||
int db_flen; /* length of field */
|
||||
int db_fdc; /* number of decimals in field */
|
||||
|
||||
char *db_format; /* format for printing %s etc */
|
||||
int db_foffset; /* offset within record */
|
||||
};
|
||||
typedef struct db_field dbfield_t;
|
||||
|
||||
struct db_head {
|
||||
int db_fd;
|
||||
unsigned char db_dbt; /* dbt present */
|
||||
char db_date[9]; /* date of last update in db format */
|
||||
long db_records; /* number of records */
|
||||
int db_hlen; /* header length */
|
||||
int db_rlen; /* record length */
|
||||
|
||||
int db_nfields; /* number of fields */
|
||||
dbfield_t *db_fields; /* field info */
|
||||
char *db_name; /* name of dbf file */
|
||||
int db_cur_rec; /* current record */
|
||||
};
|
||||
typedef struct db_head dbhead_t;
|
||||
|
||||
#define DBH_TYPE_NORMAL 0x03
|
||||
#define DBH_TYPE_MEMO 0x83
|
||||
|
||||
#define VALID_RECORD ' '
|
||||
#define DELETED_RECORD '*'
|
||||
|
||||
#include "dbf_head.h"
|
||||
#include "dbf_misc.h"
|
||||
#include "dbf_rec.h"
|
||||
|
||||
#endif /* _DBF_H_ */
|
||||
@@ -1,261 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Brad Eacker,
|
||||
* (Music, Intuition, Software, and Computers)
|
||||
* All Rights Reserved
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "dbf.h"
|
||||
|
||||
void free_dbf_head(dbhead_t *dbh);
|
||||
int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf);
|
||||
|
||||
/*
|
||||
* get the header info from the file
|
||||
* basic header info & field descriptions
|
||||
*/
|
||||
dbhead_t *get_dbf_head(int fd)
|
||||
{
|
||||
dbhead_t *dbh;
|
||||
struct dbf_dhead dbhead;
|
||||
dbfield_t *dbf, *cur_f;
|
||||
int ret, nfields, offset;
|
||||
|
||||
if ((dbh = (dbhead_t *)malloc(sizeof(dbhead_t))) == NULL)
|
||||
return NULL;
|
||||
if (lseek(fd, 0, 0) < 0)
|
||||
return NULL;
|
||||
if ((ret = read(fd, &dbhead, sizeof(dbhead))) < 0)
|
||||
return NULL;
|
||||
|
||||
/* build in core info */
|
||||
dbh->db_fd = fd;
|
||||
dbh->db_dbt = dbhead.dbh_dbt;
|
||||
dbh->db_records = get_long(dbhead.dbh_records);
|
||||
dbh->db_hlen = get_short(dbhead.dbh_hlen);
|
||||
dbh->db_rlen = get_short(dbhead.dbh_rlen);
|
||||
|
||||
db_set_date(dbh->db_date, dbhead.dbh_date[DBH_DATE_YEAR] + 1900,
|
||||
dbhead.dbh_date[DBH_DATE_MONTH],
|
||||
dbhead.dbh_date[DBH_DATE_DAY]);
|
||||
|
||||
dbh->db_nfields = nfields = (dbh->db_hlen - sizeof(struct dbf_dhead)) /
|
||||
sizeof(struct dbf_dfield);
|
||||
|
||||
/* get all the field info */
|
||||
dbf = (dbfield_t *)malloc(sizeof(dbfield_t) * nfields);
|
||||
|
||||
offset = 1;
|
||||
for (cur_f = dbf; cur_f < &dbf[nfields] ; cur_f++) {
|
||||
if (get_dbf_field(dbh, cur_f) < 0) {
|
||||
free_dbf_head(dbh);
|
||||
return NULL;
|
||||
}
|
||||
cur_f->db_foffset = offset;
|
||||
offset += cur_f->db_flen;
|
||||
}
|
||||
dbh->db_fields = dbf;
|
||||
|
||||
return dbh;
|
||||
}
|
||||
|
||||
/*
|
||||
* free up the header info built above
|
||||
*/
|
||||
void free_dbf_head(dbhead_t *dbh)
|
||||
{
|
||||
dbfield_t *dbf, *cur_f;
|
||||
int nfields;
|
||||
|
||||
dbf = dbh->db_fields;
|
||||
nfields = dbh->db_nfields;
|
||||
for (cur_f = dbf; cur_f < &dbf[nfields]; cur_f++) {
|
||||
if (cur_f->db_format) {
|
||||
free(cur_f->db_format);
|
||||
}
|
||||
}
|
||||
|
||||
free(dbf);
|
||||
free(dbh);
|
||||
}
|
||||
|
||||
/*
|
||||
* put out the header info
|
||||
*/
|
||||
int put_dbf_head(dbhead_t *dbh)
|
||||
{
|
||||
int fd = dbh->db_fd;
|
||||
struct dbf_dhead dbhead;
|
||||
int ret;
|
||||
|
||||
memset (&dbhead, 0, sizeof(dbhead));
|
||||
|
||||
/* build on disk info */
|
||||
dbhead.dbh_dbt = dbh->db_dbt;
|
||||
put_long(dbhead.dbh_records, dbh->db_records);
|
||||
put_short(dbhead.dbh_hlen, dbh->db_hlen);
|
||||
put_short(dbhead.dbh_rlen, dbh->db_rlen);
|
||||
|
||||
/* put the date spec'd into the on disk header */
|
||||
dbhead.dbh_date[DBH_DATE_YEAR] =(char)(db_date_year(dbh->db_date) -
|
||||
1900);
|
||||
dbhead.dbh_date[DBH_DATE_MONTH]=(char)(db_date_month(dbh->db_date));
|
||||
dbhead.dbh_date[DBH_DATE_DAY] =(char)(db_date_day(dbh->db_date));
|
||||
|
||||
if (lseek(fd, 0, 0) < 0)
|
||||
return -1;
|
||||
if ((ret = write(fd, &dbhead, sizeof(dbhead))) < 0)
|
||||
return -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* get a field off the disk from the current file offset
|
||||
*/
|
||||
int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf)
|
||||
{
|
||||
struct dbf_dfield dbfield;
|
||||
int ret;
|
||||
|
||||
if ((ret = read(dbh->db_fd, &dbfield, sizeof(dbfield))) < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* build the field name */
|
||||
copy_crimp(dbf->db_fname, dbfield.dbf_name, DBF_NAMELEN);
|
||||
|
||||
dbf->db_type = dbfield.dbf_type;
|
||||
switch (dbf->db_type) {
|
||||
case 'N':
|
||||
dbf->db_flen = dbfield.dbf_flen[0];
|
||||
dbf->db_fdc = dbfield.dbf_flen[1];
|
||||
break;
|
||||
default:
|
||||
dbf->db_flen = get_short(dbfield.dbf_flen);
|
||||
}
|
||||
|
||||
if ((dbf->db_format = get_dbf_f_fmt(dbf)) == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* put a field out on the disk at the current file offset
|
||||
*/
|
||||
int put_dbf_field(dbhead_t *dbh, dbfield_t *dbf)
|
||||
{
|
||||
struct dbf_dfield dbfield;
|
||||
char *scp, *dcp;
|
||||
int ret;
|
||||
|
||||
memset (&dbfield, 0, sizeof(dbfield));
|
||||
|
||||
/* build the on disk field info */
|
||||
scp = dbf->db_fname; dcp = dbfield.dbf_name;
|
||||
|
||||
strncpy(dbfield.dbf_name, dbf->db_fname, DBF_NAMELEN);
|
||||
|
||||
dbfield.dbf_type = dbf->db_type;
|
||||
switch (dbf->db_type) {
|
||||
case 'N':
|
||||
dbfield.dbf_flen[0] = dbf->db_flen;
|
||||
dbfield.dbf_flen[1] = dbf->db_fdc;
|
||||
break;
|
||||
default:
|
||||
put_short(dbfield.dbf_flen, dbf->db_flen);
|
||||
}
|
||||
|
||||
/* now write it out to disk */
|
||||
if ((ret = write(dbh->db_fd, &dbfield, sizeof(dbfield))) < 0) {
|
||||
return ret;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* put out all the info at the top of the file...
|
||||
*/
|
||||
static char end_stuff[2] = {0x0d, 0};
|
||||
|
||||
void put_dbf_info(dbhead_t *dbh)
|
||||
{
|
||||
dbfield_t *dbf;
|
||||
char *cp;
|
||||
int fcnt;
|
||||
|
||||
if ((cp = db_cur_date(NULL))) {
|
||||
strncpy(dbh->db_date, cp, 8);
|
||||
free(cp);
|
||||
}
|
||||
put_dbf_head(dbh);
|
||||
dbf = dbh->db_fields;
|
||||
for (fcnt = dbh->db_nfields; fcnt > 0; fcnt--, dbf++)
|
||||
put_dbf_field(dbh, dbf);
|
||||
write(dbh->db_fd, end_stuff, 1);
|
||||
}
|
||||
|
||||
char *get_dbf_f_fmt(dbfield_t *dbf)
|
||||
{
|
||||
char format[100];
|
||||
|
||||
/* build the field format for printf */
|
||||
switch (dbf->db_type) {
|
||||
case 'C':
|
||||
sprintf(format, "%%-%ds", dbf->db_flen);
|
||||
break;
|
||||
case 'N':
|
||||
case 'L':
|
||||
case 'D':
|
||||
sprintf(format, "%%%ds", dbf->db_flen);
|
||||
break;
|
||||
case 'M':
|
||||
strcpy(format, "%s");
|
||||
break;
|
||||
}
|
||||
return (char *)strdup(format);
|
||||
}
|
||||
|
||||
dbhead_t *dbf_open(char *dp, int o_flags)
|
||||
{
|
||||
int fd;
|
||||
char *cp;
|
||||
dbhead_t *dbh;
|
||||
|
||||
cp = dp;
|
||||
if ((fd = open(cp, o_flags|O_BINARY)) < 0) {
|
||||
cp = (char *)malloc(256);
|
||||
strcpy(cp, dp); strcat(cp, ".dbf");
|
||||
if ((fd = open(cp, o_flags)) < 0) {
|
||||
perror("open");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ((dbh = get_dbf_head(fd)) == 0) {
|
||||
fprintf(stderr, "Unable to get header\n");
|
||||
return NULL;
|
||||
}
|
||||
dbh->db_name = cp;
|
||||
dbh->db_cur_rec = 0;
|
||||
|
||||
return dbh;
|
||||
}
|
||||
|
||||
void dbf_head_info(dbhead_t *dbh)
|
||||
{
|
||||
int nfields;
|
||||
dbfield_t *dbf, *cur_f;
|
||||
|
||||
nfields = dbh->db_nfields;
|
||||
printf("# fields: %d, record len: %d, total records %ld\n",
|
||||
nfields, dbh->db_rlen, dbh->db_records);
|
||||
dbf = dbh->db_fields;
|
||||
for (cur_f = dbf; cur_f < &dbf[nfields] ; cur_f++) {
|
||||
printf("# %s, %c, %d, %d\n", cur_f->db_fname,
|
||||
cur_f->db_type, cur_f->db_flen, cur_f->db_fdc);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
extern dbhead_t *get_dbf_head(int fd);
|
||||
void free_dbf_head(dbhead_t *dbh);
|
||||
extern int put_dbf_head(dbhead_t *dbh);
|
||||
extern int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf);
|
||||
extern int put_dbf_field(dbhead_t *dbh, dbfield_t *dbf);
|
||||
void put_dbf_info(dbhead_t *dbh);
|
||||
extern char *get_dbf_f_fmt(dbfield_t *dbf);
|
||||
extern dbhead_t *dbf_open(char *dp, int o_flags);
|
||||
void dbf_head_info(dbhead_t *dbh);
|
||||
@@ -1,168 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Brad Eacker,
|
||||
* (Music, Intuition, Software, and Computers)
|
||||
* All Rights Reserved
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "dbf_misc.h"
|
||||
|
||||
/*
|
||||
* routine to change little endian long to host long
|
||||
*/
|
||||
long get_long(char *cp)
|
||||
{
|
||||
int ret;
|
||||
unsigned char *source = (unsigned char *)cp;
|
||||
|
||||
ret = *source++;
|
||||
ret += ((*source++)<<8);
|
||||
ret += ((*source++)<<16);
|
||||
ret += ((*source++)<<24);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void put_long(char *cp, long lval)
|
||||
{
|
||||
*cp++ = lval & 0xff;
|
||||
*cp++ = (lval >> 8) & 0xff;
|
||||
*cp++ = (lval >> 16) & 0xff;
|
||||
*cp++ = (lval >> 24) & 0xff;
|
||||
}
|
||||
|
||||
/*
|
||||
* routine to change little endian short to host short
|
||||
*/
|
||||
int get_short(char *cp)
|
||||
{
|
||||
int ret;
|
||||
unsigned char *source = (unsigned char *)cp;
|
||||
|
||||
ret = *source++;
|
||||
ret += ((*source++)<<8);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void put_short(char *cp, int sval)
|
||||
{
|
||||
*cp++ = sval & 0xff;
|
||||
*cp++ = (sval >> 8) & 0xff;
|
||||
}
|
||||
|
||||
double get_double(char *cp)
|
||||
{
|
||||
double ret;
|
||||
unsigned char *dp = (unsigned char *)&ret;
|
||||
|
||||
dp[7] = *cp++;
|
||||
dp[6] = *cp++;
|
||||
dp[5] = *cp++;
|
||||
dp[4] = *cp++;
|
||||
dp[3] = *cp++;
|
||||
dp[2] = *cp++;
|
||||
dp[1] = *cp++;
|
||||
dp[0] = *cp++;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void put_double(char *cp, double fval)
|
||||
{
|
||||
unsigned char *dp = (unsigned char *)&fval;
|
||||
|
||||
cp[7] = *dp++;
|
||||
cp[6] = *dp++;
|
||||
cp[5] = *dp++;
|
||||
cp[4] = *dp++;
|
||||
cp[3] = *dp++;
|
||||
cp[2] = *dp++;
|
||||
cp[1] = *dp++;
|
||||
cp[0] = *dp++;
|
||||
}
|
||||
|
||||
void copy_fill(char *dp, char *sp, int len)
|
||||
{
|
||||
while (*sp && len > 0) {
|
||||
*dp++ = *sp++;
|
||||
len--;
|
||||
}
|
||||
while (len-- > 0)
|
||||
*dp++ = ' ';
|
||||
}
|
||||
|
||||
void copy_crimp(char *dp, char *sp, int len)
|
||||
{
|
||||
while (len-- > 0) {
|
||||
*dp++ = *sp++;
|
||||
}
|
||||
*dp = 0;
|
||||
for (dp-- ; *dp == ' '; dp--) {
|
||||
*dp = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void db_set_date(char *cp, int year, int month, int day)
|
||||
{
|
||||
if (month > 12)
|
||||
month = 0;
|
||||
if (day > 31)
|
||||
day = 0;
|
||||
sprintf(cp, "%d", year);
|
||||
cp[4] = month / 10 + '0';
|
||||
cp[5] = month % 10 + '0';
|
||||
cp[6] = day / 10 + '0';
|
||||
cp[7] = day % 10 + '0';
|
||||
cp[8] = 0;
|
||||
}
|
||||
|
||||
int db_date_year(char *cp)
|
||||
{
|
||||
int year, i;
|
||||
|
||||
for (year = 0, i = 0; i < 4; i++)
|
||||
year = year * 10 + (cp[i] - '0');
|
||||
return year;
|
||||
}
|
||||
|
||||
int db_date_month(char *cp)
|
||||
{
|
||||
int month, i;
|
||||
|
||||
for (month = 0, i = 4; i < 6; i++)
|
||||
month = month * 10 + (cp[i] - '0');
|
||||
return month;
|
||||
}
|
||||
|
||||
int db_date_day(char *cp)
|
||||
{
|
||||
int day, i;
|
||||
|
||||
for (day = 0, i = 6; i < 8; i++)
|
||||
day = day * 10 + (cp[i] - '0');
|
||||
return day;
|
||||
}
|
||||
|
||||
#include <time.h>
|
||||
|
||||
char *db_cur_date(char *cp)
|
||||
{
|
||||
struct tm *ctm;
|
||||
time_t c_time;
|
||||
|
||||
c_time = time((time_t *)NULL);
|
||||
ctm = localtime(&c_time);
|
||||
if (cp == NULL)
|
||||
cp = (char *)malloc(9);
|
||||
|
||||
if (ctm == NULL || cp == NULL)
|
||||
return NULL;
|
||||
|
||||
db_set_date(cp, ctm->tm_year + 1900, ctm->tm_mon + 1, ctm->tm_mday);
|
||||
|
||||
return cp;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
void put_long(char *cp, long lval);
|
||||
extern long get_long(char *cp);
|
||||
extern int get_short(char *cp);
|
||||
void put_short(char *cp, int sval);
|
||||
void put_double(char *cp, double fval);
|
||||
extern double get_double(char *cp);
|
||||
void copy_fill(char *dp, char *sp, int len);
|
||||
void copy_crimp(char *dp, char *sp, int len);
|
||||
void db_set_date(char *cp, int year, int month, int day);
|
||||
extern int db_date_year(char *cp);
|
||||
extern int db_date_month(char *cp);
|
||||
extern int db_date_day(char *cp);
|
||||
extern char *db_cur_date(char *cp);
|
||||
@@ -1,183 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Brad Eacker,
|
||||
* (Music, Intuition, Software, and Computers)
|
||||
* All Rights Reserved
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "dbf.h"
|
||||
#include "dbf_ndx.h"
|
||||
|
||||
/*
|
||||
* get the ndx header for this file
|
||||
*/
|
||||
ndx_header_t *ndx_get_header(int fd)
|
||||
{
|
||||
dndx_header_t *dp;
|
||||
ndx_header_t *np;
|
||||
|
||||
if ((dp = (dndx_header_t *)malloc(NDX_PAGE_SZ)) == NULL)
|
||||
return NULL;
|
||||
if ((np = (ndx_header_t *)malloc(sizeof(ndx_header_t))) == NULL) {
|
||||
free(dp);
|
||||
return NULL;
|
||||
}
|
||||
if ((lseek(fd, 0, 0) < 0) || (read(fd, dp, NDX_PAGE_SZ) < 0)) {
|
||||
free(dp); free(np);
|
||||
return NULL;
|
||||
}
|
||||
np->ndx_hpage = dp;
|
||||
np->ndx_fd = fd;
|
||||
np->ndx_start_pg = get_long(dp->dndx_st_pg);
|
||||
np->ndx_total_pgs = get_long(dp->dndx_tot_pg);
|
||||
np->ndx_key_len = get_short(dp->dndx_key_len);
|
||||
np->ndx_keys_ppg = get_short(dp->dndx_keys_ppg);
|
||||
np->ndx_key_type = get_short(dp->dndx_key_type);
|
||||
np->ndx_key_size = get_long(dp->dndx_size_key);
|
||||
np->ndx_key_name = dp->dndx_key_name;
|
||||
np->ndx_unique = dp->dndx_unique;
|
||||
|
||||
np->ndx_fp = NULL;
|
||||
|
||||
return np;
|
||||
}
|
||||
|
||||
static ndx_page_t *ndx_get_page(ndx_header_t *hp, int pageno)
|
||||
{
|
||||
ndx_page_t *fp;
|
||||
dndx_page_t *dp;
|
||||
ndx_record_t *rp;
|
||||
|
||||
#if DEBUG
|
||||
printf("getting page %d", pageno);
|
||||
#endif
|
||||
if ((fp = (ndx_page_t *)malloc(sizeof(ndx_page_t))) == NULL)
|
||||
return NULL;
|
||||
if ((dp = (dndx_page_t *)malloc(NDX_PAGE_SZ)) == NULL) {
|
||||
free(fp);
|
||||
return NULL;
|
||||
}
|
||||
if ((rp = (ndx_record_t *)malloc(sizeof(ndx_record_t) * hp->ndx_keys_ppg)) == NULL) {
|
||||
free(dp); free(fp);
|
||||
return NULL;
|
||||
}
|
||||
fp->ndxp_page_data = dp;
|
||||
if ((lseek(hp->ndx_fd, pageno * NDX_PAGE_SZ, 0) < 0) ||
|
||||
(read(hp->ndx_fd, dp, NDX_PAGE_SZ) < 0)) {
|
||||
free(fp); free(dp);
|
||||
return NULL;
|
||||
}
|
||||
fp->ndxp_parent = NULL;
|
||||
fp->ndxp_page_no = pageno;
|
||||
fp->ndxp_num_keys = get_long(dp->dndxp_num_keys);
|
||||
memset(rp, 0, sizeof(ndx_record_t) * hp->ndx_keys_ppg);
|
||||
fp->ndxp_records = rp;
|
||||
fp->ndxp_header_p = hp;
|
||||
#if DEBUG
|
||||
printf(", n_keys %ld\n", fp->ndxp_num_keys);
|
||||
#endif
|
||||
return fp;
|
||||
}
|
||||
|
||||
/*
|
||||
* get the first entry for this ndx
|
||||
*/
|
||||
static ndx_page_t *ndx_get_first_pg(ndx_header_t *hp)
|
||||
{
|
||||
ndx_page_t *fp;
|
||||
|
||||
if (hp->ndx_fp)
|
||||
return hp->ndx_fp;
|
||||
if ((fp = ndx_get_page(hp, hp->ndx_start_pg))) {
|
||||
hp->ndx_fp = fp;
|
||||
}
|
||||
return fp;
|
||||
}
|
||||
|
||||
static ndx_record_t *ndx_get_record(ndx_page_t *fp, int rec_no)
|
||||
{
|
||||
ndx_record_t *rp;
|
||||
ndx_header_t *hp = fp->ndxp_header_p;
|
||||
struct dndx_record *drp;
|
||||
|
||||
#if DEBUG
|
||||
printf("page %ld, rec %d: ", fp->ndxp_page_no, rec_no);
|
||||
#endif
|
||||
if (rec_no >= fp->ndxp_num_keys)
|
||||
return NULL;
|
||||
rp = &(fp->ndxp_records[rec_no]);
|
||||
if (!rp->ndxr_page) {
|
||||
rp->ndxr_page = fp;
|
||||
drp = (dndx_record_t *)((char *)&fp->ndxp_page_data->dndx_rp
|
||||
+ rec_no * hp->ndx_key_size);
|
||||
rp->ndxr_left = get_long(drp->dndx_left_pg);
|
||||
rp->ndxr_rec = get_long(drp->dndx_dbf_rec);
|
||||
rp->ndxr_key_data = &drp->dndx_key_data;
|
||||
rp->ndxr_p_nrec = rec_no;
|
||||
}
|
||||
#if DEBUG
|
||||
printf("left %ld, dbf_rec %ld, data '%s'\n", rp->ndxr_left,
|
||||
rp->ndxr_rec, rp->ndxr_key_data);
|
||||
#endif
|
||||
return rp;
|
||||
}
|
||||
|
||||
static ndx_record_t *ndx_scan_down(ndx_header_t *hp, ndx_page_t *fp, int recno)
|
||||
{
|
||||
ndx_page_t *np;
|
||||
ndx_record_t *rp;
|
||||
|
||||
while ((rp = ndx_get_record(fp, recno)) && (rp->ndxr_rec == 0)) {
|
||||
np = ndx_get_page(hp, rp->ndxr_left);
|
||||
np->ndxp_parent = fp;
|
||||
np->ndxp_par_rno = recno;
|
||||
fp = np;
|
||||
recno = 0;
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
static ndx_record_t *ndx_scan_up(ndx_header_t *hp, ndx_page_t *fp, int recno)
|
||||
{
|
||||
ndx_record_t *rp;
|
||||
|
||||
if (fp == NULL)
|
||||
rp = NULL;
|
||||
else if (recno < fp->ndxp_num_keys) {
|
||||
rp = ndx_scan_down(hp, fp, recno);
|
||||
} else {
|
||||
rp = ndx_scan_up(hp, fp->ndxp_parent, fp->ndxp_par_rno + 1);
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
ndx_record_t *ndx_get_first_rec(ndx_header_t *hp)
|
||||
{
|
||||
ndx_page_t *fp;
|
||||
ndx_record_t *rp = NULL;
|
||||
|
||||
if ((fp = ndx_get_first_pg(hp))) {
|
||||
fp->ndxp_last_key = 0;
|
||||
rp = ndx_scan_down(hp, fp, 0);
|
||||
}
|
||||
hp->ndx_cur_rec = rp;
|
||||
return rp;
|
||||
}
|
||||
|
||||
ndx_record_t *ndx_get_next_rec(ndx_header_t *hp, ndx_record_t *rp)
|
||||
{
|
||||
ndx_page_t *fp;
|
||||
int rec_no;
|
||||
|
||||
fp = rp->ndxr_page;
|
||||
rec_no = rp->ndxr_p_nrec + 1;
|
||||
if (rec_no < fp->ndxp_num_keys) {
|
||||
rp = ndx_scan_down(hp, fp, rec_no);
|
||||
} else {
|
||||
rp = ndx_scan_up(hp, fp->ndxp_parent, fp->ndxp_par_rno + 1);
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1993 Brad Eacker,
|
||||
* (Music, Intuition, Software, and Computers)
|
||||
* All Rights Reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
* dbf .ndx header structure on disk and in memory
|
||||
*
|
||||
* Basic info taken from:
|
||||
* "Clipper Programming Guide, 3rd Edition, Version 5.01"
|
||||
* by Rick Spence
|
||||
*/
|
||||
|
||||
#ifndef _DBF_NDX_H_
|
||||
#define _DBF_NDX_H_
|
||||
|
||||
#include "dbf.h"
|
||||
|
||||
#define NDX_PAGE_SZ 512
|
||||
|
||||
/* on disk ndx header */
|
||||
struct dndx_header {
|
||||
char dndx_st_pg[4]; /* starting page number */
|
||||
char dndx_tot_pg[4]; /* total number of pages */
|
||||
char dndx_filler1[4]; /* space */
|
||||
char dndx_key_len[2]; /* key length */
|
||||
char dndx_keys_ppg[2]; /* number of keys per page */
|
||||
char dndx_key_type[2]; /* key type */
|
||||
char dndx_size_key[4]; /* size of the key record */
|
||||
char dndx_filler2; /* space */
|
||||
char dndx_unique; /* whether or not done with unique */
|
||||
char dndx_key_name[488]; /* string defining the key */
|
||||
};
|
||||
typedef struct dndx_header dndx_header_t;
|
||||
|
||||
/* in memory ndx header */
|
||||
struct ndx_header {
|
||||
long ndx_start_pg;
|
||||
long ndx_total_pgs;
|
||||
unsigned short ndx_key_len;
|
||||
unsigned short ndx_keys_ppg;
|
||||
unsigned short ndx_key_type;
|
||||
char ndx_unique;
|
||||
long ndx_key_size;
|
||||
char *ndx_key_name;
|
||||
int ndx_fd;
|
||||
struct ndx_page *ndx_fp;
|
||||
dndx_header_t *ndx_hpage;
|
||||
struct ndx_record *ndx_cur_rec;
|
||||
};
|
||||
typedef struct ndx_header ndx_header_t;
|
||||
|
||||
/* these are the possible values in the key type field */
|
||||
#define NDX_CHAR_TYPE 00
|
||||
#define NDX_NUM_TYPE 01
|
||||
|
||||
/* on disk key record */
|
||||
struct dndx_record {
|
||||
char dndx_left_pg[4]; /* number of left page */
|
||||
char dndx_dbf_rec[4]; /* dbf record number */
|
||||
char dndx_key_data; /* key data */
|
||||
};
|
||||
typedef struct dndx_record dndx_record_t;
|
||||
|
||||
struct ndx_record {
|
||||
long ndxr_left;
|
||||
long ndxr_rec;
|
||||
char *ndxr_key_data;
|
||||
struct ndx_page *ndxr_page; /* page pointer to where we are from*/
|
||||
int ndxr_p_nrec; /* number of the record within page */
|
||||
};
|
||||
typedef struct ndx_record ndx_record_t;
|
||||
|
||||
struct dndx_page {
|
||||
char dndxp_num_keys[4]; /* number of keys on this page */
|
||||
struct dndx_record dndx_rp;
|
||||
};
|
||||
typedef struct dndx_page dndx_page_t;
|
||||
|
||||
struct ndx_page {
|
||||
long ndxp_page_no;
|
||||
long ndxp_num_keys;
|
||||
dndx_page_t *ndxp_page_data;
|
||||
ndx_header_t *ndxp_header_p;
|
||||
long ndxp_last_key;
|
||||
struct ndx_page *ndxp_parent; /* parent page */
|
||||
int ndxp_par_rno; /* record number within parent */
|
||||
struct ndx_record *ndxp_records;
|
||||
};
|
||||
typedef struct ndx_page ndx_page_t;
|
||||
|
||||
extern ndx_header_t *ndx_get_header(int);
|
||||
|
||||
extern ndx_record_t *ndx_get_first_rec(ndx_header_t *);
|
||||
extern ndx_record_t *ndx_get_next_rec(ndx_header_t *, ndx_record_t *);
|
||||
|
||||
#endif /* _DBF_NDX_H_ */
|
||||
@@ -1,182 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1993 Brad Eacker,
|
||||
* (Music, Intuition, Software, and Computers)
|
||||
* All Rights Reserved
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "dbf.h"
|
||||
|
||||
int get_piece(dbhead_t *dbh, long offset, char *cp, int len);
|
||||
int put_piece(dbhead_t *dbh, long offset, char *cp, int len);
|
||||
|
||||
/*
|
||||
* get a record off the database
|
||||
*/
|
||||
char *get_dbf_record(dbhead_t *dbh, long rec_num)
|
||||
{
|
||||
long offset;
|
||||
char *cp;
|
||||
|
||||
if (rec_num > dbh->db_records) {
|
||||
return NULL;
|
||||
}
|
||||
if ((cp = (char *)malloc(dbh->db_rlen)) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* go to the correct spot on the file */
|
||||
offset = dbh->db_hlen + (rec_num - 1) * dbh->db_rlen;
|
||||
if (get_piece(dbh, offset, cp, dbh->db_rlen) != dbh->db_rlen) {
|
||||
free(cp);
|
||||
cp = NULL;
|
||||
}
|
||||
if (cp)
|
||||
dbh->db_cur_rec = rec_num;
|
||||
return cp;
|
||||
}
|
||||
|
||||
int
|
||||
get_piece(dbhead_t *dbh, long offset, char *cp, int len)
|
||||
{
|
||||
/* go to the correct spot on the file */
|
||||
if ( lseek(dbh->db_fd, offset, 0) < 0 ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* read the record into the allocated space */
|
||||
return read(dbh->db_fd, cp, len);
|
||||
}
|
||||
|
||||
/*
|
||||
* put a record to the database
|
||||
*/
|
||||
long put_dbf_record(dbhead_t *dbh, long rec_num, char *cp)
|
||||
{
|
||||
long offset;
|
||||
|
||||
if (rec_num == 0) {
|
||||
rec_num = dbh->db_records;
|
||||
}
|
||||
if (rec_num > dbh->db_records) {
|
||||
return 0L;
|
||||
}
|
||||
/* go to the correct spot on the file */
|
||||
offset = dbh->db_hlen + (rec_num - 1) * dbh->db_rlen;
|
||||
if (put_piece(dbh, offset, cp, dbh->db_rlen) != dbh->db_rlen) {
|
||||
rec_num = -1;
|
||||
}
|
||||
return rec_num;
|
||||
}
|
||||
|
||||
int put_piece(dbhead_t *dbh, long offset, char *cp, int len)
|
||||
{
|
||||
/* go to the correct spot on the file */
|
||||
if ( lseek(dbh->db_fd, offset, 0) < 0 ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* write the record into the file */
|
||||
return write(dbh->db_fd, cp, len);
|
||||
}
|
||||
|
||||
int del_dbf_record(dbhead_t *dbh, long rec_num)
|
||||
{
|
||||
int ret = 0;
|
||||
char *cp;
|
||||
|
||||
if (rec_num > dbh->db_records)
|
||||
return -1;
|
||||
if ((cp = get_dbf_record(dbh, rec_num))) {
|
||||
*cp = DELETED_RECORD;
|
||||
ret = put_dbf_record(dbh, rec_num, cp);
|
||||
free(cp);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void pack_dbf(dbhead_t *dbh)
|
||||
{
|
||||
long out_off, in_off;
|
||||
int rec_cnt, new_cnt;
|
||||
char *cp;
|
||||
|
||||
if ((cp = (char *)malloc(dbh->db_rlen)) == NULL) {
|
||||
return;
|
||||
}
|
||||
in_off = out_off = dbh->db_hlen;
|
||||
|
||||
new_cnt = 0;
|
||||
rec_cnt = dbh->db_records;
|
||||
while (rec_cnt > 0) {
|
||||
if (get_piece(dbh, in_off, cp, dbh->db_rlen) < 0)
|
||||
break;
|
||||
|
||||
if (*cp != DELETED_RECORD) {
|
||||
/* write the record into the file */
|
||||
if (put_piece(dbh, out_off, cp, dbh->db_rlen) < 0)
|
||||
break;
|
||||
out_off += dbh->db_rlen;
|
||||
new_cnt++;
|
||||
}
|
||||
in_off += dbh->db_rlen;
|
||||
rec_cnt--;
|
||||
}
|
||||
free(cp);
|
||||
if (rec_cnt == 0)
|
||||
dbh->db_records = new_cnt;
|
||||
}
|
||||
|
||||
/* routine to get a field from a record */
|
||||
char *get_field_val(char *rp, dbfield_t *fldp, char *cp)
|
||||
{
|
||||
int flen = fldp->db_flen;
|
||||
|
||||
if ( !cp )
|
||||
cp = (char *)malloc(flen + 1);
|
||||
if ( cp ) {
|
||||
strncpy(cp, &rp[fldp->db_foffset], flen);
|
||||
cp[flen] = 0;
|
||||
}
|
||||
return cp;
|
||||
}
|
||||
|
||||
void put_field_val(char *rp, dbfield_t *fldp, char *cp)
|
||||
{
|
||||
strncpy(&rp[fldp->db_foffset], cp, fldp->db_flen);
|
||||
}
|
||||
|
||||
/*
|
||||
* output a record
|
||||
*/
|
||||
void out_rec(dbhead_t *dbh, dbfield_t *dbf, char *cp)
|
||||
{
|
||||
dbfield_t *cur_f;
|
||||
int nfields = dbh->db_nfields;
|
||||
char *fnp = (char *)malloc(dbh->db_rlen);
|
||||
|
||||
printf("%c", *cp);
|
||||
for (cur_f = dbf; cur_f < &dbf[nfields] ; cur_f++) {
|
||||
printf(" ");
|
||||
printf(cur_f->db_format, get_field_val(cp, cur_f, fnp));
|
||||
}
|
||||
printf("\n");
|
||||
free(fnp);
|
||||
}
|
||||
|
||||
/* check for record validity */
|
||||
int is_valid_rec(char *cp)
|
||||
{
|
||||
if (cp && (*cp == VALID_RECORD))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* get the next record */
|
||||
char *dbf_get_next(dbhead_t *dbh)
|
||||
{
|
||||
return get_dbf_record(dbh, dbh->db_cur_rec + 1);
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
extern char *get_dbf_record(dbhead_t *dbh, long rec_num);
|
||||
extern long put_dbf_record(dbhead_t *dbh, long rec_num, char *cp);
|
||||
extern int put_piece(dbhead_t *dbh, long offset, char *cp, int len);
|
||||
extern int del_dbf_record(dbhead_t *dbh, long rec_num);
|
||||
void pack_dbf(dbhead_t *dbh);
|
||||
extern char *get_field_val(char *rp, dbfield_t *fldp, char *cp);
|
||||
void put_field_val(char *rp, dbfield_t *fldp, char *cp);
|
||||
void out_rec(dbhead_t *dbh, dbfield_t *dbf, char *cp);
|
||||
extern int is_valid_rec(char *cp);
|
||||
extern char *dbf_get_next(dbhead_t *dbh);
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP HTML Embedded Scripting Language Version 3.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This program is free software; you can redistribute it and/or modify |
|
||||
| it under the terms of one of the following licenses: |
|
||||
| |
|
||||
| A) 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. |
|
||||
| |
|
||||
| B) the PHP License as published by the PHP Development Team and |
|
||||
| included in the distribution in the file: LICENSE |
|
||||
| |
|
||||
| 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 both licenses referred to here. |
|
||||
| If you did not, or have any questions about PHP licensing, please |
|
||||
| contact core@php.net. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Jim Winstead (jimw@php.net) |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef _DBASE_H
|
||||
#define _DBASE_H
|
||||
#if DBASE
|
||||
extern php3_module_entry dbase_module_entry;
|
||||
#define dbase_module_ptr &dbase_module_entry
|
||||
|
||||
extern int php3_minit_dbase(INIT_FUNC_ARGS);
|
||||
PHP_FUNCTION(dbase_open);
|
||||
PHP_FUNCTION(dbase_create);
|
||||
PHP_FUNCTION(dbase_close);
|
||||
PHP_FUNCTION(dbase_numrecords);
|
||||
PHP_FUNCTION(dbase_numfields);
|
||||
PHP_FUNCTION(dbase_add_record);
|
||||
PHP_FUNCTION(dbase_get_record);
|
||||
PHP_FUNCTION(dbase_delete_record);
|
||||
PHP_FUNCTION(dbase_pack);
|
||||
PHP_FUNCTION(dbase_get_record_with_names);
|
||||
#else
|
||||
#define dbase_module_ptr NULL
|
||||
#endif
|
||||
|
||||
#define phpext_dbase_ptr dbase_module_ptr
|
||||
|
||||
#endif /* _DBASE_H */
|
||||
@@ -1,4 +0,0 @@
|
||||
# $Id$ -*- sh -*-
|
||||
|
||||
define_option with-dbase 'dBase support? ' yesno no \
|
||||
' Whether to use the bundled dbase library.'
|
||||
-661
@@ -1,661 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP HTML Embedded Scripting Language Version 3.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This program is free software; you can redistribute it and/or modify |
|
||||
| it under the terms of one of the following licenses: |
|
||||
| |
|
||||
| A) 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. |
|
||||
| |
|
||||
| B) the PHP License as published by the PHP Development Team and |
|
||||
| included in the distribution in the file: LICENSE |
|
||||
| |
|
||||
| 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 both licenses referred to here. |
|
||||
| If you did not, or have any questions about PHP licensing, please |
|
||||
| contact core@php.net. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
|
||||
| Jim Winstead <jimw@php.net> |
|
||||
| Jaakko Hyvätti <jaakko@hyvatti.iki.fi> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "php.h"
|
||||
#include "php3_string.h"
|
||||
#include "php_regex.h"
|
||||
#include "reg.h"
|
||||
|
||||
unsigned char third_argument_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
|
||||
|
||||
function_entry reg_functions[] = {
|
||||
{"ereg", php3_ereg, third_argument_force_ref },
|
||||
{"ereg_replace", php3_eregreplace, NULL },
|
||||
{"eregi", php3_eregi, third_argument_force_ref },
|
||||
{"eregi_replace", php3_eregireplace, NULL },
|
||||
{"split", php3_split, NULL},
|
||||
{"join", php3_implode, NULL},
|
||||
{"sql_regcase", php3_sql_regcase, NULL},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
static int php_minit_regex(INIT_FUNC_ARGS);
|
||||
static int php_mshutdown_regex(SHUTDOWN_FUNC_ARGS);
|
||||
static void php_info_regex(ZEND_MODULE_INFO_FUNC_ARGS);
|
||||
|
||||
zend_module_entry regexp_module_entry = {
|
||||
"Regular Expressions",
|
||||
reg_functions,
|
||||
php_minit_regex, php_mshutdown_regex,
|
||||
NULL, NULL, php_info_regex,
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
#ifdef ZTS
|
||||
int reg_globals_id;
|
||||
#else
|
||||
static php_reg_globals reg_globals;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
regex_t preg;
|
||||
int cflags;
|
||||
} reg_cache;
|
||||
|
||||
static int _php_regcomp(regex_t *preg, const char *pattern, int cflags)
|
||||
{
|
||||
int r = 0;
|
||||
int patlen = strlen(pattern);
|
||||
reg_cache *rc = NULL;
|
||||
REGLS_FETCH();
|
||||
|
||||
if(_php3_hash_find(®(ht_rc), (char *) pattern, patlen+1, (void **) &rc) == FAILURE ||
|
||||
rc->cflags != cflags) {
|
||||
r = regcomp(preg, pattern, cflags);
|
||||
if(!r) {
|
||||
reg_cache rcp;
|
||||
|
||||
rcp.cflags = cflags;
|
||||
memcpy(&rcp.preg, preg, sizeof(*preg));
|
||||
_php3_hash_update(®(ht_rc), (char *) pattern, patlen+1,
|
||||
(void *) &rcp, sizeof(rcp), NULL);
|
||||
}
|
||||
} else {
|
||||
memcpy(preg, &rc->preg, sizeof(*preg));
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static int _free_reg_cache(reg_cache *rc)
|
||||
{
|
||||
regfree(&rc->preg);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define regfree(a);
|
||||
#define regcomp(a,b,c) _php_regcomp(a,b,c)
|
||||
|
||||
static void php_reg_init_globals(php_reg_globals *reg_globals)
|
||||
{
|
||||
_php3_hash_init(®_globals->ht_rc, 0, NULL, (int (*)(void *)) _free_reg_cache, 1);
|
||||
}
|
||||
|
||||
static int php_minit_regex(INIT_FUNC_ARGS)
|
||||
{
|
||||
#ifdef ZTS
|
||||
reg_globals_id = ts_allocate_id(sizeof(php_reg_globals), php_reg_init_globals, NULL);
|
||||
#else
|
||||
php_reg_init_globals(®_globals);
|
||||
#endif
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static int php_mshutdown_regex(SHUTDOWN_FUNC_ARGS)
|
||||
{
|
||||
REGLS_FETCH();
|
||||
|
||||
_php3_hash_destroy(®(ht_rc));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static void php_info_regex(ZEND_MODULE_INFO_FUNC_ARGS)
|
||||
{
|
||||
#if HSREGEX
|
||||
PUTS("Bundled regex library enabled\n");
|
||||
#else
|
||||
PUTS("System regex library enabled\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* This is the maximum number of (..) constructs we'll generate from a
|
||||
call to ereg() or eregi() with the optional third argument. */
|
||||
#define NS 10
|
||||
|
||||
/*
|
||||
* _php3_reg_eprint - convert error number to name
|
||||
*/
|
||||
static void _php3_reg_eprint(int err, regex_t *re) {
|
||||
char *buf = NULL, *message = NULL;
|
||||
size_t len;
|
||||
size_t buf_len;
|
||||
|
||||
#ifdef REG_ITOA
|
||||
/* get the length of the message */
|
||||
buf_len = regerror(REG_ITOA | err, re, NULL, 0);
|
||||
if (buf_len) {
|
||||
buf = (char *)emalloc(buf_len * sizeof(char));
|
||||
if (!buf) return; /* fail silently */
|
||||
/* finally, get the error message */
|
||||
regerror(REG_ITOA | err, re, buf, buf_len);
|
||||
}
|
||||
#else
|
||||
buf_len = 0;
|
||||
#endif
|
||||
len = regerror(err, re, NULL, 0);
|
||||
if (len) {
|
||||
message = (char *)emalloc((buf_len + len + 2) * sizeof(char));
|
||||
if (!message) {
|
||||
return; /* fail silently */
|
||||
}
|
||||
if (buf_len) {
|
||||
snprintf(message, buf_len, "%s: ", buf);
|
||||
buf_len += 1; /* so pointer math below works */
|
||||
}
|
||||
/* drop the message into place */
|
||||
regerror(err, re, message + buf_len, len);
|
||||
|
||||
php3_error(E_WARNING, "%s", message);
|
||||
}
|
||||
|
||||
STR_FREE(buf);
|
||||
STR_FREE(message);
|
||||
}
|
||||
|
||||
static void _php3_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
|
||||
{
|
||||
pval *regex, /* Regular expression */
|
||||
*findin, /* String to apply expression to */
|
||||
*array = NULL; /* Optional register array */
|
||||
regex_t re;
|
||||
regmatch_t subs[NS];
|
||||
int err, i, match_len, string_len;
|
||||
int copts = 0;
|
||||
off_t start, end;
|
||||
char *buf = NULL;
|
||||
char *string = NULL;
|
||||
|
||||
if (icase)
|
||||
copts |= REG_ICASE;
|
||||
|
||||
switch(ARG_COUNT(ht)) {
|
||||
case 2:
|
||||
if (getParameters(ht, 2, ®ex, &findin) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
/* don't bother doing substring matching if we're not going
|
||||
to make use of the information */
|
||||
copts |= REG_NOSUB;
|
||||
break;
|
||||
case 3:
|
||||
if (getParameters(ht, 3, ®ex, &findin, &array) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
if (!ParameterPassedByReference(ht, 3)) {
|
||||
php3_error(E_WARNING, "Array to be filled with values must be passed by reference.");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
|
||||
/* compile the regular expression from the supplied regex */
|
||||
if (regex->type == IS_STRING) {
|
||||
err = regcomp(&re, regex->value.str.val, REG_EXTENDED | copts);
|
||||
} else {
|
||||
/* we convert numbers to integers and treat them as a string */
|
||||
if (regex->type == IS_DOUBLE)
|
||||
convert_to_long(regex); /* get rid of decimal places */
|
||||
convert_to_string(regex);
|
||||
/* don't bother doing an extended regex with just a number */
|
||||
err = regcomp(&re, regex->value.str.val, copts);
|
||||
}
|
||||
|
||||
if (err) {
|
||||
_php3_reg_eprint(err, &re);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* make a copy of the string we're looking in */
|
||||
convert_to_string(findin);
|
||||
string = estrndup(findin->value.str.val, findin->value.str.len);
|
||||
|
||||
/* actually execute the regular expression */
|
||||
err = regexec(&re, string, (size_t) NS, subs, 0);
|
||||
if (err && err != REG_NOMATCH) {
|
||||
_php3_reg_eprint(err, &re);
|
||||
regfree(&re);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
match_len = 1;
|
||||
|
||||
if (array && err != REG_NOMATCH) {
|
||||
match_len = (int) (subs[0].rm_eo - subs[0].rm_so);
|
||||
string_len = strlen(string) + 1;
|
||||
|
||||
buf = emalloc(string_len);
|
||||
if (!buf) {
|
||||
php3_error(E_WARNING, "Unable to allocate memory in _php3_ereg");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
pval_destructor(array); /* start with clean array */
|
||||
array_init(array);
|
||||
|
||||
for (i = 0; i < NS; i++) {
|
||||
start = subs[i].rm_so;
|
||||
end = subs[i].rm_eo;
|
||||
if (start != -1 && end > 0 && start < string_len && end < string_len && start < end) {
|
||||
add_index_stringl(array, i, string+start, end-start, 1);
|
||||
}
|
||||
}
|
||||
efree(buf);
|
||||
}
|
||||
|
||||
efree(string);
|
||||
if (err == REG_NOMATCH) {
|
||||
RETVAL_FALSE;
|
||||
} else {
|
||||
if (match_len == 0)
|
||||
match_len = 1;
|
||||
RETVAL_LONG(match_len);
|
||||
}
|
||||
regfree(&re);
|
||||
}
|
||||
|
||||
/* {{{ proto int ereg(string pattern, string string [, array registers])
|
||||
Regular expression match */
|
||||
PHP_FUNCTION(ereg)
|
||||
{
|
||||
_php3_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int eregi(string pattern, string string [, array registers])
|
||||
Case-insensitive regular expression match */
|
||||
PHP_FUNCTION(eregi)
|
||||
{
|
||||
_php3_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* this is the meat and potatoes of regex replacement! */
|
||||
char *_php3_regreplace(const char *pattern, const char *replace, const char *string, int icase, int extended)
|
||||
{
|
||||
regex_t re;
|
||||
regmatch_t subs[NS];
|
||||
|
||||
char *buf, /* buf is where we build the replaced string */
|
||||
*nbuf, /* nbuf is used when we grow the buffer */
|
||||
*walkbuf; /* used to walk buf when replacing backrefs */
|
||||
const char *walk; /* used to walk replacement string for backrefs */
|
||||
int buf_len;
|
||||
int pos, tmp, string_len, new_l;
|
||||
int err, copts = 0;
|
||||
|
||||
string_len = strlen(string);
|
||||
|
||||
if (icase)
|
||||
copts = REG_ICASE;
|
||||
if (extended)
|
||||
copts |= REG_EXTENDED;
|
||||
err = regcomp(&re, pattern, copts);
|
||||
if (err) {
|
||||
_php3_reg_eprint(err, &re);
|
||||
return ((char *) -1);
|
||||
}
|
||||
|
||||
/* start with a buffer that is twice the size of the stringo
|
||||
we're doing replacements in */
|
||||
buf_len = 2 * string_len + 1;
|
||||
buf = emalloc(buf_len * sizeof(char));
|
||||
if (!buf) {
|
||||
php3_error(E_WARNING, "Unable to allocate memory in _php3_regreplace");
|
||||
regfree(&re);
|
||||
return ((char *) -1);
|
||||
}
|
||||
|
||||
err = pos = 0;
|
||||
buf[0] = '\0';
|
||||
|
||||
while (!err) {
|
||||
err = regexec(&re, &string[pos], (size_t) NS, subs, (pos ? REG_NOTBOL : 0));
|
||||
|
||||
if (err && err != REG_NOMATCH) {
|
||||
_php3_reg_eprint(err, &re);
|
||||
regfree(&re);
|
||||
return ((char *) -1);
|
||||
}
|
||||
if (!err) {
|
||||
/* backref replacement is done in two passes:
|
||||
1) find out how long the string will be, and allocate buf
|
||||
2) copy the part before match, replacement and backrefs to buf
|
||||
|
||||
Jaakko Hyvätti <Jaakko.Hyvatti@iki.fi>
|
||||
*/
|
||||
|
||||
new_l = strlen(buf) + subs[0].rm_so; /* part before the match */
|
||||
walk = replace;
|
||||
while (*walk)
|
||||
if ('\\' == *walk
|
||||
&& '0' <= walk[1] && '9' >= walk[1]
|
||||
&& subs[walk[1] - '0'].rm_so > -1
|
||||
&& subs[walk[1] - '0'].rm_eo > -1) {
|
||||
new_l += subs[walk[1] - '0'].rm_eo
|
||||
- subs[walk[1] - '0'].rm_so;
|
||||
walk += 2;
|
||||
} else {
|
||||
new_l++;
|
||||
walk++;
|
||||
}
|
||||
|
||||
if (new_l + 1 > buf_len) {
|
||||
buf_len = 1 + buf_len + 2 * new_l;
|
||||
nbuf = emalloc(buf_len);
|
||||
strcpy(nbuf, buf);
|
||||
efree(buf);
|
||||
buf = nbuf;
|
||||
}
|
||||
tmp = strlen(buf);
|
||||
/* copy the part of the string before the match */
|
||||
strncat(buf, &string[pos], subs[0].rm_so);
|
||||
|
||||
/* copy replacement and backrefs */
|
||||
walkbuf = &buf[tmp + subs[0].rm_so];
|
||||
walk = replace;
|
||||
while (*walk)
|
||||
if ('\\' == *walk
|
||||
&& '0' <= walk[1] && '9' >= walk[1]
|
||||
&& subs[walk[1] - '0'].rm_so > -1
|
||||
&& subs[walk[1] - '0'].rm_eo > -1) {
|
||||
tmp = subs[walk[1] - '0'].rm_eo
|
||||
- subs[walk[1] - '0'].rm_so;
|
||||
memcpy (walkbuf,
|
||||
&string[pos + subs[walk[1] - '0'].rm_so],
|
||||
tmp);
|
||||
walkbuf += tmp;
|
||||
walk += 2;
|
||||
} else
|
||||
*walkbuf++ = *walk++;
|
||||
*walkbuf = '\0';
|
||||
|
||||
/* and get ready to keep looking for replacements */
|
||||
if (subs[0].rm_so == subs[0].rm_eo) {
|
||||
if (subs[0].rm_so + pos >= string_len)
|
||||
break;
|
||||
new_l = strlen (buf) + 1;
|
||||
if (new_l + 1 > buf_len) {
|
||||
buf_len = 1 + buf_len + 2 * new_l;
|
||||
nbuf = emalloc(buf_len * sizeof(char));
|
||||
strcpy(nbuf, buf);
|
||||
efree(buf);
|
||||
buf = nbuf;
|
||||
}
|
||||
pos += subs[0].rm_eo + 1;
|
||||
buf [new_l-1] = string [pos-1];
|
||||
buf [new_l] = '\0';
|
||||
} else {
|
||||
pos += subs[0].rm_eo;
|
||||
}
|
||||
} else { /* REG_NOMATCH */
|
||||
new_l = strlen(buf) + strlen(&string[pos]);
|
||||
if (new_l + 1 > buf_len) {
|
||||
buf_len = new_l + 1; /* now we know exactly how long it is */
|
||||
nbuf = emalloc(buf_len * sizeof(char));
|
||||
strcpy(nbuf, buf);
|
||||
efree(buf);
|
||||
buf = nbuf;
|
||||
}
|
||||
/* stick that last bit of string on our output */
|
||||
strcat(buf, &string[pos]);
|
||||
}
|
||||
}
|
||||
|
||||
/* don't want to leak memory .. */
|
||||
regfree(&re);
|
||||
|
||||
/* whew. */
|
||||
return (buf);
|
||||
}
|
||||
|
||||
static void _php3_eregreplace(INTERNAL_FUNCTION_PARAMETERS, int icase)
|
||||
{
|
||||
pval *arg_pattern,
|
||||
*arg_replace,
|
||||
*arg_string;
|
||||
char *pattern;
|
||||
char *string;
|
||||
char *replace;
|
||||
char *ret;
|
||||
|
||||
if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &arg_pattern, &arg_replace, &arg_string) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
if (arg_pattern->type == IS_STRING) {
|
||||
if (arg_pattern->value.str.val && arg_pattern->value.str.len)
|
||||
pattern = estrndup(arg_pattern->value.str.val,arg_pattern->value.str.len);
|
||||
else
|
||||
pattern = empty_string;
|
||||
} else {
|
||||
convert_to_long(arg_pattern);
|
||||
pattern = emalloc(2);
|
||||
pattern[0] = (char) arg_pattern->value.lval;
|
||||
pattern[1] = '\0';
|
||||
}
|
||||
|
||||
if (arg_replace->type == IS_STRING) {
|
||||
if (arg_replace->value.str.val && arg_replace->value.str.len)
|
||||
replace = estrndup(arg_replace->value.str.val, arg_replace->value.str.len);
|
||||
else
|
||||
replace = empty_string;
|
||||
} else {
|
||||
convert_to_long(arg_replace);
|
||||
replace = emalloc(2);
|
||||
replace[0] = (char) arg_replace->value.lval;
|
||||
replace[1] = '\0';
|
||||
}
|
||||
|
||||
convert_to_string(arg_string);
|
||||
if (arg_string->value.str.val && arg_string->value.str.len)
|
||||
string = estrndup(arg_string->value.str.val, arg_string->value.str.len);
|
||||
else
|
||||
string = empty_string;
|
||||
|
||||
/* do the actual work */
|
||||
ret = _php3_regreplace(pattern, replace, string, icase, 1);
|
||||
if (ret == (char *) -1) {
|
||||
RETVAL_FALSE;
|
||||
} else {
|
||||
RETVAL_STRING(ret,1);
|
||||
STR_FREE(ret);
|
||||
}
|
||||
STR_FREE(string);
|
||||
STR_FREE(replace);
|
||||
STR_FREE(pattern);
|
||||
}
|
||||
|
||||
/* {{{ proto string ereg_replace(string pattern, string string [, array registers])
|
||||
Replace regular expression */
|
||||
PHP_FUNCTION(eregreplace)
|
||||
{
|
||||
_php3_eregreplace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string eregi_replace(string pattern, string string [, array registers])
|
||||
Case insensitive replace regular expression */
|
||||
PHP_FUNCTION(eregireplace)
|
||||
{
|
||||
_php3_eregreplace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* ("root", "passwd", "uid", "gid", "other:stuff:like:/bin/sh")
|
||||
= split(":", $passwd_file, 5); */
|
||||
/* {{{ proto array split(string pattern, string string [, int limit])
|
||||
split string into array by regular expression */
|
||||
PHP_FUNCTION(split)
|
||||
{
|
||||
pval *spliton, *str, *arg_count = NULL;
|
||||
regex_t re;
|
||||
regmatch_t subs[1];
|
||||
char *strp, *endp;
|
||||
int err, size, count;
|
||||
|
||||
switch (ARG_COUNT(ht)) {
|
||||
case 2:
|
||||
if (getParameters(ht, 2, &spliton, &str) == FAILURE)
|
||||
WRONG_PARAM_COUNT;
|
||||
count = -1;
|
||||
break;
|
||||
case 3:
|
||||
if (getParameters(ht, 3, &spliton, &str, &arg_count) == FAILURE)
|
||||
WRONG_PARAM_COUNT;
|
||||
convert_to_long(arg_count);
|
||||
count = arg_count->value.lval;
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
convert_to_string(spliton);
|
||||
convert_to_string(str);
|
||||
|
||||
strp = str->value.str.val;
|
||||
endp = str->value.str.val + strlen(str->value.str.val);
|
||||
|
||||
err = regcomp(&re, spliton->value.str.val, REG_EXTENDED);
|
||||
if (err) {
|
||||
php3_error(E_WARNING, "unexpected regex error (%d)", err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (array_init(return_value) == FAILURE) {
|
||||
regfree(&re);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* churn through str, generating array entries as we go */
|
||||
while ((count == -1 || count > 1) && !(err = regexec(&re, strp, 1, subs, 0))) {
|
||||
if (subs[0].rm_so == 0 && subs[0].rm_eo) {
|
||||
/* match is at start of string, return empty string */
|
||||
add_next_index_stringl(return_value, empty_string, 0, 1);
|
||||
/* skip ahead the length of the regex match */
|
||||
strp+=subs[0].rm_eo;
|
||||
} else if (subs[0].rm_so==0 && subs[0].rm_eo==0) {
|
||||
/* No more matches */
|
||||
regfree(&re);
|
||||
php3_error(E_WARNING, "bad regular expression for split()");
|
||||
_php3_hash_destroy(return_value->value.ht);
|
||||
efree(return_value->value.ht);
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
/* On a real match */
|
||||
|
||||
/* make a copy of the substring */
|
||||
size = subs[0].rm_so;
|
||||
|
||||
/* add it to the array */
|
||||
add_next_index_stringl(return_value, strp, size, 1);
|
||||
|
||||
/* point at our new starting point */
|
||||
strp = strp + subs[0].rm_eo;
|
||||
}
|
||||
|
||||
/* if we're only looking for a certain number of points,
|
||||
stop looking once we hit it */
|
||||
if (count != -1) {
|
||||
count--;
|
||||
}
|
||||
}
|
||||
|
||||
/* see if we encountered an error */
|
||||
if (err && err != REG_NOMATCH) {
|
||||
php3_error(E_WARNING, "unexpected regex error (%d)", err);
|
||||
regfree(&re);
|
||||
_php3_hash_destroy(return_value->value.ht);
|
||||
efree(return_value->value.ht);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* otherwise we just have one last element to add to the array */
|
||||
size = endp - strp;
|
||||
|
||||
add_next_index_stringl(return_value, strp, size, 1);
|
||||
|
||||
regfree(&re);
|
||||
|
||||
return;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string sql_regcase(string string)
|
||||
Make regular expression for case insensitive match */
|
||||
PHPAPI PHP_FUNCTION(sql_regcase)
|
||||
{
|
||||
pval *string;
|
||||
char *tmp;
|
||||
unsigned char c;
|
||||
register int i, j;
|
||||
|
||||
if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &string)==FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
convert_to_string(string);
|
||||
|
||||
tmp = (char *) emalloc(string->value.str.len*4+1);
|
||||
|
||||
for (i=j=0; i<string->value.str.len; i++) {
|
||||
c = (unsigned char) string->value.str.val[i];
|
||||
if(isalpha(c)) {
|
||||
tmp[j++] = '[';
|
||||
tmp[j++] = toupper(c);
|
||||
tmp[j++] = tolower(c);
|
||||
tmp[j++] = ']';
|
||||
} else {
|
||||
tmp[j++] = c;
|
||||
}
|
||||
}
|
||||
tmp[j]=0;
|
||||
|
||||
tmp = erealloc(tmp, j + 1);
|
||||
|
||||
RETVAL_STRINGL(tmp, j, 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP HTML Embedded Scripting Language Version 3.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This program is free software; you can redistribute it and/or modify |
|
||||
| it under the terms of one of the following licenses: |
|
||||
| |
|
||||
| A) 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. |
|
||||
| |
|
||||
| B) the PHP License as published by the PHP Development Team and |
|
||||
| included in the distribution in the file: LICENSE |
|
||||
| |
|
||||
| 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 both licenses referred to here. |
|
||||
| If you did not, or have any questions about PHP licensing, please |
|
||||
| contact core@php.net. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef _REG_H
|
||||
#define _REG_H
|
||||
|
||||
extern php3_module_entry regexp_module_entry;
|
||||
#define regexp_module_ptr ®exp_module_entry
|
||||
|
||||
char *_php3_regreplace(const char *pattern, const char *replace, const char *string, int icase, int extended);
|
||||
|
||||
PHP_FUNCTION(ereg);
|
||||
PHP_FUNCTION(eregi);
|
||||
PHP_FUNCTION(eregireplace);
|
||||
PHP_FUNCTION(eregreplace);
|
||||
PHP_FUNCTION(split);
|
||||
PHPAPI PHP_FUNCTION(sql_regcase);
|
||||
|
||||
typedef struct {
|
||||
HashTable ht_rc;
|
||||
} php_reg_globals;
|
||||
|
||||
|
||||
#ifdef ZTS
|
||||
#define REGLS_D php_reg_globals *reg_globals
|
||||
#define REGLS_DC , REGLS_D
|
||||
#define REGLS_C reg_globals
|
||||
#define REGLS_CC , REGLS_C
|
||||
#define REG(v) (reg_globals->v)
|
||||
#define REGLS_FETCH() php_reg_globals *reg_globals = ts_resource(reg_globals_id)
|
||||
#else
|
||||
#define REGLS_D
|
||||
#define REGLS_DC
|
||||
#define REGLS_C
|
||||
#define REGLS_CC
|
||||
#define REG(v) (reg_globals.v)
|
||||
#define REGLS_FETCH()
|
||||
#endif
|
||||
|
||||
#define phpext_regex_ptr regexp_module_ptr
|
||||
|
||||
#endif /* _REG_H */
|
||||
@@ -1,14 +0,0 @@
|
||||
#ifndef _PHP_REGEX_H
|
||||
#define _PHP_REGEX_H
|
||||
|
||||
#if REGEX
|
||||
#include "regex/regex.h"
|
||||
#define _REGEX_H 1 /* this should stop Apache from loading the system version of regex.h */
|
||||
#define _RX_H 1 /* Try defining these for Linux to */
|
||||
#define __REGEXP_LIBRARY_H__ 1 /* avoid Apache including regex.h */
|
||||
#define _H_REGEX 1 /* This one is for AIX */
|
||||
#else
|
||||
#include <regex.h>
|
||||
#endif
|
||||
|
||||
#endif /* _PHP_REGEX_H */
|
||||
@@ -1,20 +0,0 @@
|
||||
Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved.
|
||||
This software is not subject to any license of the American Telephone
|
||||
and Telegraph Company or of the Regents of the University of California.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose on
|
||||
any computer system, and to alter it and redistribute it, subject
|
||||
to the following restrictions:
|
||||
|
||||
1. The author is not responsible for the consequences of use of this
|
||||
software, no matter how awful, even if they arise from flaws in it.
|
||||
|
||||
2. The origin of this software must not be misrepresented, either by
|
||||
explicit claim or by omission. Since few users ever read sources,
|
||||
credits must appear in the documentation.
|
||||
|
||||
3. Altered versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software. Since few users
|
||||
ever read sources, credits must appear in the documentation.
|
||||
|
||||
4. This notice may not be removed or altered.
|
||||
@@ -1,141 +0,0 @@
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir=@srcdir@
|
||||
VPATH=@srcdir@
|
||||
|
||||
CC=@CC@
|
||||
RANLIB=@RANLIB@
|
||||
|
||||
# You probably want to take -DREDEBUG out of CFLAGS, and put something like
|
||||
# -O in, *after* testing (-DREDEBUG strengthens testing by enabling a lot of
|
||||
# internal assertion checking and some debugging facilities).
|
||||
# Put -Dconst= in for a pre-ANSI compiler.
|
||||
# Do not take -DPOSIX_MISTAKE out.
|
||||
# REGCFLAGS isn't important to you (it's for my use in some special contexts).
|
||||
CFLAGS=-I$(srcdir) -I. -DPOSIX_MISTAKE @CFLAGS@
|
||||
|
||||
# If you have a pre-ANSI compiler, put -o into MKHFLAGS. If you want
|
||||
# the Berkeley __P macro, put -b in.
|
||||
MKHFLAGS=
|
||||
|
||||
# Flags for linking but not compiling, if any.
|
||||
LDFLAGS=@LDFLAGS@
|
||||
|
||||
# Extra libraries for linking, if any.
|
||||
LIBS=
|
||||
|
||||
# Internal stuff, should not need changing.
|
||||
OBJPRODN=regcomp.o regexec.o regerror.o regfree.o
|
||||
OBJS=$(OBJPRODN) split.o debug.o main.o
|
||||
H=cclass.h cname.h regex2.h utils.h
|
||||
REGSRC=regcomp.c regerror.c regexec.c regfree.c
|
||||
ALLSRC=$(REGSRC) engine.c debug.c main.c split.c
|
||||
|
||||
# Stuff that matters only if you're trying to lint the package.
|
||||
LINTFLAGS=-I. -Dstatic= -Dconst= -DREDEBUG
|
||||
LINTC=regcomp.c regexec.c regerror.c regfree.c debug.c main.c
|
||||
JUNKLINT=possible pointer alignment|null effect
|
||||
|
||||
# arrangements to build forward-reference header files
|
||||
.SUFFIXES: .ih .h
|
||||
.c.ih:
|
||||
sh $(srcdir)/mkh $(MKHFLAGS) -p $< >$@
|
||||
|
||||
all lib: libregex.a
|
||||
|
||||
libregex.a: $(OBJPRODN)
|
||||
rm -f libregex.a
|
||||
ar cr libregex.a $(OBJPRODN)
|
||||
$(RANLIB) libregex.a
|
||||
|
||||
default: r
|
||||
|
||||
purge:
|
||||
rm -f *.o
|
||||
|
||||
# stuff to build regex.h
|
||||
REGEXH=regex.h
|
||||
REGEXHSRC=regex2.h $(REGSRC)
|
||||
$(REGEXH): $(REGEXHSRC) mkh
|
||||
sh $(srcdir)/./mkh $(MKHFLAGS) -i _REGEX_H_ $(REGEXHSRC) >regex.h
|
||||
#cmp -s regex.tmp regex.h 2>/dev/null || cp regex.tmp regex.h
|
||||
#rm -f regex.tmp
|
||||
|
||||
# dependencies
|
||||
$(OBJPRODN) debug.o: utils.h regex.h regex2.h
|
||||
regcomp.o: cclass.h cname.h regcomp.ih
|
||||
regexec.o: engine.c engine.ih
|
||||
regerror.o: regerror.ih
|
||||
debug.o: debug.ih
|
||||
main.o: main.ih
|
||||
|
||||
# tester
|
||||
re: $(OBJS)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
|
||||
|
||||
# regression test
|
||||
r: re tests
|
||||
./re <tests
|
||||
./re -el <tests
|
||||
./re -er <tests
|
||||
|
||||
# 57 variants, and other stuff, for development use -- not useful to you
|
||||
ra: ./re tests
|
||||
-./re <tests
|
||||
-./re -el <tests
|
||||
-./re -er <tests
|
||||
|
||||
rx: ./re tests
|
||||
./re -x <tests
|
||||
./re -x -el <tests
|
||||
./re -x -er <tests
|
||||
|
||||
t: ./re tests
|
||||
-time ./re <tests
|
||||
-time ./re -cs <tests
|
||||
-time ./re -el <tests
|
||||
-time ./re -cs -el <tests
|
||||
|
||||
l: $(LINTC)
|
||||
lint $(LINTFLAGS) -h $(LINTC) 2>&1 | egrep -v '$(JUNKLINT)' | tee lint
|
||||
|
||||
fullprint:
|
||||
ti README WHATSNEW notes todo | list
|
||||
ti *.h | list
|
||||
list *.c
|
||||
list regex.3 regex.7
|
||||
|
||||
print:
|
||||
ti README WHATSNEW notes todo | list
|
||||
ti *.h | list
|
||||
list reg*.c engine.c
|
||||
|
||||
|
||||
mf.tmp: Makefile
|
||||
sed '/^REGEXH=/s/=.*/=regex.h/' Makefile | sed '/#DEL$$/d' >$@
|
||||
|
||||
DTRH=cclass.h cname.h regex2.h utils.h
|
||||
PRE=COPYRIGHT README WHATSNEW
|
||||
POST=mkh regex.3 regex.7 tests $(DTRH) $(ALLSRC) fake/*.[ch]
|
||||
FILES=$(PRE) Makefile $(POST)
|
||||
DTR=$(PRE) Makefile=mf.tmp $(POST)
|
||||
dtr: $(FILES) mf.tmp
|
||||
makedtr $(DTR) >$@
|
||||
rm mf.tmp
|
||||
|
||||
cio: $(FILES)
|
||||
cio $(FILES)
|
||||
|
||||
rdf: $(FILES)
|
||||
rcsdiff -c $(FILES) 2>&1 | p
|
||||
|
||||
# various forms of cleanup
|
||||
tidy:
|
||||
rm -f junk* core core.* *.core dtr *.tmp lint
|
||||
|
||||
clean: tidy
|
||||
rm -f *.o *.s re libregex.a
|
||||
|
||||
# don't do this one unless you know what you're doing
|
||||
spotless: clean
|
||||
rm -f mkh regex.h
|
||||
@@ -1,32 +0,0 @@
|
||||
alpha3.4 release.
|
||||
Thu Mar 17 23:17:18 EST 1994
|
||||
henry@zoo.toronto.edu
|
||||
|
||||
See WHATSNEW for change listing.
|
||||
|
||||
installation notes:
|
||||
--------
|
||||
Read the comments at the beginning of Makefile before running.
|
||||
|
||||
Utils.h contains some things that just might have to be modified on
|
||||
some systems, as well as a nested include (ugh) of <assert.h>.
|
||||
|
||||
The "fake" directory contains quick-and-dirty fakes for some header
|
||||
files and routines that old systems may not have. Note also that
|
||||
-DUSEBCOPY will make utils.h substitute bcopy() for memmove().
|
||||
|
||||
After that, "make r" will build regcomp.o, regexec.o, regfree.o,
|
||||
and regerror.o (the actual routines), bundle them together into a test
|
||||
program, and run regression tests on them. No output is good output.
|
||||
|
||||
"make lib" builds just the .o files for the actual routines (when
|
||||
you're happy with testing and have adjusted CFLAGS for production),
|
||||
and puts them together into libregex.a. You can pick up either the
|
||||
library or *.o ("make lib" makes sure there are no other .o files left
|
||||
around to confuse things).
|
||||
|
||||
Main.c, debug.c, split.c are used for regression testing but are not part
|
||||
of the RE routines themselves.
|
||||
|
||||
Regex.h goes in /usr/include. All other .h files are internal only.
|
||||
--------
|
||||
@@ -1,92 +0,0 @@
|
||||
New in alpha3.4: The complex bug alluded to below has been fixed (in a
|
||||
slightly kludgey temporary way that may hurt efficiency a bit; this is
|
||||
another "get it out the door for 4.4" release). The tests at the end of
|
||||
the tests file have accordingly been uncommented. The primary sign of
|
||||
the bug was that something like a?b matching ab matched b rather than ab.
|
||||
(The bug was essentially specific to this exact situation, else it would
|
||||
have shown up earlier.)
|
||||
|
||||
New in alpha3.3: The definition of word boundaries has been altered
|
||||
slightly, to more closely match the usual programming notion that "_"
|
||||
is an alphabetic. Stuff used for pre-ANSI systems is now in a subdir,
|
||||
and the makefile no longer alludes to it in mysterious ways. The
|
||||
makefile has generally been cleaned up some. Fixes have been made
|
||||
(again!) so that the regression test will run without -DREDEBUG, at
|
||||
the cost of weaker checking. A workaround for a bug in some folks'
|
||||
<assert.h> has been added. And some more things have been added to
|
||||
tests, including a couple right at the end which are commented out
|
||||
because the code currently flunks them (complex bug; fix coming).
|
||||
Plus the usual minor cleanup.
|
||||
|
||||
New in alpha3.2: Assorted bits of cleanup and portability improvement
|
||||
(the development base is now a BSDI system using GCC instead of an ancient
|
||||
Sun system, and the newer compiler exposed some glitches). Fix for a
|
||||
serious bug that affected REs using many [] (including REG_ICASE REs
|
||||
because of the way they are implemented), *sometimes*, depending on
|
||||
memory-allocation patterns. The header-file prototypes no longer name
|
||||
the parameters, avoiding possible name conflicts. The possibility that
|
||||
some clot has defined CHAR_MIN as (say) `-128' instead of `(-128)' is
|
||||
now handled gracefully. "uchar" is no longer used as an internal type
|
||||
name (too many people have the same idea). Still the same old lousy
|
||||
performance, alas.
|
||||
|
||||
New in alpha3.1: Basically nothing, this release is just a bookkeeping
|
||||
convenience. Stay tuned.
|
||||
|
||||
New in alpha3.0: Performance is no better, alas, but some fixes have been
|
||||
made and some functionality has been added. (This is basically the "get
|
||||
it out the door in time for 4.4" release.) One bug fix: regfree() didn't
|
||||
free the main internal structure (how embarrassing). It is now possible
|
||||
to put NULs in either the RE or the target string, using (resp.) a new
|
||||
REG_PEND flag and the old REG_STARTEND flag. The REG_NOSPEC flag to
|
||||
regcomp() makes all characters ordinary, so you can match a literal
|
||||
string easily (this will become more useful when performance improves!).
|
||||
There are now primitives to match beginnings and ends of words, although
|
||||
the syntax is disgusting and so is the implementation. The REG_ATOI
|
||||
debugging interface has changed a bit. And there has been considerable
|
||||
internal cleanup of various kinds.
|
||||
|
||||
New in alpha2.3: Split change list out of README, and moved flags notes
|
||||
into Makefile. Macro-ized the name of regex(7) in regex(3), since it has
|
||||
to change for 4.4BSD. Cleanup work in engine.c, and some new regression
|
||||
tests to catch tricky cases thereof.
|
||||
|
||||
New in alpha2.2: Out-of-date manpages updated. Regerror() acquires two
|
||||
small extensions -- REG_ITOA and REG_ATOI -- which avoid debugging kludges
|
||||
in my own test program and might be useful to others for similar purposes.
|
||||
The regression test will now compile (and run) without REDEBUG. The
|
||||
BRE \$ bug is fixed. Most uses of "uchar" are gone; it's all chars now.
|
||||
Char/uchar parameters are now written int/unsigned, to avoid possible
|
||||
portability problems with unpromoted parameters. Some unsigned casts have
|
||||
been introduced to minimize portability problems with shifting into sign
|
||||
bits.
|
||||
|
||||
New in alpha2.1: Lots of little stuff, cleanup and fixes. The one big
|
||||
thing is that regex.h is now generated, using mkh, rather than being
|
||||
supplied in the distribution; due to circularities in dependencies,
|
||||
you have to build regex.h explicitly by "make h". The two known bugs
|
||||
have been fixed (and the regression test now checks for them), as has a
|
||||
problem with assertions not being suppressed in the absence of REDEBUG.
|
||||
No performance work yet.
|
||||
|
||||
New in alpha2: Backslash-anything is an ordinary character, not an
|
||||
error (except, of course, for the handful of backslashed metacharacters
|
||||
in BREs), which should reduce script breakage. The regression test
|
||||
checks *where* null strings are supposed to match, and has generally
|
||||
been tightened up somewhat. Small bug fixes in parameter passing (not
|
||||
harmful, but technically errors) and some other areas. Debugging
|
||||
invoked by defining REDEBUG rather than not defining NDEBUG.
|
||||
|
||||
New in alpha+3: full prototyping for internal routines, using a little
|
||||
helper program, mkh, which extracts prototypes given in stylized comments.
|
||||
More minor cleanup. Buglet fix: it's CHAR_BIT, not CHAR_BITS. Simple
|
||||
pre-screening of input when a literal string is known to be part of the
|
||||
RE; this does wonders for performance.
|
||||
|
||||
New in alpha+2: minor bits of cleanup. Notably, the number "32" for the
|
||||
word width isn't hardwired into regexec.c any more, the public header
|
||||
file prototypes the functions if __STDC__ is defined, and some small typos
|
||||
in the manpages have been fixed.
|
||||
|
||||
New in alpha+1: improvements to the manual pages, and an important
|
||||
extension, the REG_STARTEND option to regexec().
|
||||
@@ -1,31 +0,0 @@
|
||||
/* character-class table */
|
||||
static struct cclass {
|
||||
char *name;
|
||||
char *chars;
|
||||
char *multis;
|
||||
} cclasses[] = {
|
||||
{ "alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
|
||||
0123456789", "" },
|
||||
{ "alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
||||
"" },
|
||||
{ "blank", " \t", "" },
|
||||
{ "cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\
|
||||
\25\26\27\30\31\32\33\34\35\36\37\177", "" },
|
||||
{ "digit", "0123456789", "" },
|
||||
{ "graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
|
||||
0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
|
||||
"" },
|
||||
{ "lower", "abcdefghijklmnopqrstuvwxyz",
|
||||
"" },
|
||||
{ "print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
|
||||
0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ",
|
||||
"" },
|
||||
{ "punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
|
||||
"" },
|
||||
{ "space", "\t\n\v\f\r ", "" },
|
||||
{ "upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||
"" },
|
||||
{ "xdigit", "0123456789ABCDEFabcdef",
|
||||
"" },
|
||||
{ NULL, 0, "" }
|
||||
};
|
||||
@@ -1,102 +0,0 @@
|
||||
/* character-name table */
|
||||
static struct cname {
|
||||
char *name;
|
||||
char code;
|
||||
} cnames[] = {
|
||||
{ "NUL", '\0' },
|
||||
{ "SOH", '\001' },
|
||||
{ "STX", '\002' },
|
||||
{ "ETX", '\003' },
|
||||
{ "EOT", '\004' },
|
||||
{ "ENQ", '\005' },
|
||||
{ "ACK", '\006' },
|
||||
{ "BEL", '\007' },
|
||||
{ "alert", '\007' },
|
||||
{ "BS", '\010' },
|
||||
{ "backspace", '\b' },
|
||||
{ "HT", '\011' },
|
||||
{ "tab", '\t' },
|
||||
{ "LF", '\012' },
|
||||
{ "newline", '\n' },
|
||||
{ "VT", '\013' },
|
||||
{ "vertical-tab", '\v' },
|
||||
{ "FF", '\014' },
|
||||
{ "form-feed", '\f' },
|
||||
{ "CR", '\015' },
|
||||
{ "carriage-return", '\r' },
|
||||
{ "SO", '\016' },
|
||||
{ "SI", '\017' },
|
||||
{ "DLE", '\020' },
|
||||
{ "DC1", '\021' },
|
||||
{ "DC2", '\022' },
|
||||
{ "DC3", '\023' },
|
||||
{ "DC4", '\024' },
|
||||
{ "NAK", '\025' },
|
||||
{ "SYN", '\026' },
|
||||
{ "ETB", '\027' },
|
||||
{ "CAN", '\030' },
|
||||
{ "EM", '\031' },
|
||||
{ "SUB", '\032' },
|
||||
{ "ESC", '\033' },
|
||||
{ "IS4", '\034' },
|
||||
{ "FS", '\034' },
|
||||
{ "IS3", '\035' },
|
||||
{ "GS", '\035' },
|
||||
{ "IS2", '\036' },
|
||||
{ "RS", '\036' },
|
||||
{ "IS1", '\037' },
|
||||
{ "US", '\037' },
|
||||
{ "space", ' ' },
|
||||
{ "exclamation-mark", '!' },
|
||||
{ "quotation-mark", '"' },
|
||||
{ "number-sign", '#' },
|
||||
{ "dollar-sign", '$' },
|
||||
{ "percent-sign", '%' },
|
||||
{ "ampersand", '&' },
|
||||
{ "apostrophe", '\'' },
|
||||
{ "left-parenthesis", '(' },
|
||||
{ "right-parenthesis", ')' },
|
||||
{ "asterisk", '*' },
|
||||
{ "plus-sign", '+' },
|
||||
{ "comma", ',' },
|
||||
{ "hyphen", '-' },
|
||||
{ "hyphen-minus", '-' },
|
||||
{ "period", '.' },
|
||||
{ "full-stop", '.' },
|
||||
{ "slash", '/' },
|
||||
{ "solidus", '/' },
|
||||
{ "zero", '0' },
|
||||
{ "one", '1' },
|
||||
{ "two", '2' },
|
||||
{ "three", '3' },
|
||||
{ "four", '4' },
|
||||
{ "five", '5' },
|
||||
{ "six", '6' },
|
||||
{ "seven", '7' },
|
||||
{ "eight", '8' },
|
||||
{ "nine", '9' },
|
||||
{ "colon", ':' },
|
||||
{ "semicolon", ';' },
|
||||
{ "less-than-sign", '<' },
|
||||
{ "equals-sign", '=' },
|
||||
{ "greater-than-sign", '>' },
|
||||
{ "question-mark", '?' },
|
||||
{ "commercial-at", '@' },
|
||||
{ "left-square-bracket", '[' },
|
||||
{ "backslash", '\\' },
|
||||
{ "reverse-solidus", '\\' },
|
||||
{ "right-square-bracket", ']' },
|
||||
{ "circumflex", '^' },
|
||||
{ "circumflex-accent", '^' },
|
||||
{ "underscore", '_' },
|
||||
{ "low-line", '_' },
|
||||
{ "grave-accent", '`' },
|
||||
{ "left-brace", '{' },
|
||||
{ "left-curly-bracket", '{' },
|
||||
{ "vertical-line", '|' },
|
||||
{ "right-brace", '}' },
|
||||
{ "right-curly-bracket", '}' },
|
||||
{ "tilde", '~' },
|
||||
{ "DEL", '\177' },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
@@ -1,242 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <regex.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include "regex2.h"
|
||||
#include "debug.ih"
|
||||
|
||||
/*
|
||||
- regprint - print a regexp for debugging
|
||||
== void regprint(regex_t *r, FILE *d);
|
||||
*/
|
||||
void
|
||||
regprint(r, d)
|
||||
regex_t *r;
|
||||
FILE *d;
|
||||
{
|
||||
register struct re_guts *g = r->re_g;
|
||||
register int i;
|
||||
register int c;
|
||||
register int last;
|
||||
int nincat[NC];
|
||||
|
||||
fprintf(d, "%ld states, %d categories", (long)g->nstates,
|
||||
g->ncategories);
|
||||
fprintf(d, ", first %ld last %ld", (long)g->firststate,
|
||||
(long)g->laststate);
|
||||
if (g->iflags&USEBOL)
|
||||
fprintf(d, ", USEBOL");
|
||||
if (g->iflags&USEEOL)
|
||||
fprintf(d, ", USEEOL");
|
||||
if (g->iflags&BAD)
|
||||
fprintf(d, ", BAD");
|
||||
if (g->nsub > 0)
|
||||
fprintf(d, ", nsub=%ld", (long)g->nsub);
|
||||
if (g->must != NULL)
|
||||
fprintf(d, ", must(%ld) `%*s'", (long)g->mlen, (int)g->mlen,
|
||||
g->must);
|
||||
if (g->backrefs)
|
||||
fprintf(d, ", backrefs");
|
||||
if (g->nplus > 0)
|
||||
fprintf(d, ", nplus %ld", (long)g->nplus);
|
||||
fprintf(d, "\n");
|
||||
s_print(g, d);
|
||||
for (i = 0; i < g->ncategories; i++) {
|
||||
nincat[i] = 0;
|
||||
for (c = CHAR_MIN; c <= CHAR_MAX; c++)
|
||||
if (g->categories[c] == i)
|
||||
nincat[i]++;
|
||||
}
|
||||
fprintf(d, "cc0#%d", nincat[0]);
|
||||
for (i = 1; i < g->ncategories; i++)
|
||||
if (nincat[i] == 1) {
|
||||
for (c = CHAR_MIN; c <= CHAR_MAX; c++)
|
||||
if (g->categories[c] == i)
|
||||
break;
|
||||
fprintf(d, ", %d=%s", i, regchar(c));
|
||||
}
|
||||
fprintf(d, "\n");
|
||||
for (i = 1; i < g->ncategories; i++)
|
||||
if (nincat[i] != 1) {
|
||||
fprintf(d, "cc%d\t", i);
|
||||
last = -1;
|
||||
for (c = CHAR_MIN; c <= CHAR_MAX+1; c++) /* +1 does flush */
|
||||
if (c <= CHAR_MAX && g->categories[c] == i) {
|
||||
if (last < 0) {
|
||||
fprintf(d, "%s", regchar(c));
|
||||
last = c;
|
||||
}
|
||||
} else {
|
||||
if (last >= 0) {
|
||||
if (last != c-1)
|
||||
fprintf(d, "-%s",
|
||||
regchar(c-1));
|
||||
last = -1;
|
||||
}
|
||||
}
|
||||
fprintf(d, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
- s_print - print the strip for debugging
|
||||
== static void s_print(register struct re_guts *g, FILE *d);
|
||||
*/
|
||||
static void
|
||||
s_print(g, d)
|
||||
register struct re_guts *g;
|
||||
FILE *d;
|
||||
{
|
||||
register sop *s;
|
||||
register cset *cs;
|
||||
register int i;
|
||||
register int done = 0;
|
||||
register sop opnd;
|
||||
register int col = 0;
|
||||
register int last;
|
||||
register sopno offset = 2;
|
||||
# define GAP() { if (offset % 5 == 0) { \
|
||||
if (col > 40) { \
|
||||
fprintf(d, "\n\t"); \
|
||||
col = 0; \
|
||||
} else { \
|
||||
fprintf(d, " "); \
|
||||
col++; \
|
||||
} \
|
||||
} else \
|
||||
col++; \
|
||||
offset++; \
|
||||
}
|
||||
|
||||
if (OP(g->strip[0]) != OEND)
|
||||
fprintf(d, "missing initial OEND!\n");
|
||||
for (s = &g->strip[1]; !done; s++) {
|
||||
opnd = OPND(*s);
|
||||
switch (OP(*s)) {
|
||||
case OEND:
|
||||
fprintf(d, "\n");
|
||||
done = 1;
|
||||
break;
|
||||
case OCHAR:
|
||||
if (strchr("\\|()^$.[+*?{}!<> ", (char)opnd) != NULL)
|
||||
fprintf(d, "\\%c", (char)opnd);
|
||||
else
|
||||
fprintf(d, "%s", regchar((char)opnd));
|
||||
break;
|
||||
case OBOL:
|
||||
fprintf(d, "^");
|
||||
break;
|
||||
case OEOL:
|
||||
fprintf(d, "$");
|
||||
break;
|
||||
case OBOW:
|
||||
fprintf(d, "\\{");
|
||||
break;
|
||||
case OEOW:
|
||||
fprintf(d, "\\}");
|
||||
break;
|
||||
case OANY:
|
||||
fprintf(d, ".");
|
||||
break;
|
||||
case OANYOF:
|
||||
fprintf(d, "[(%ld)", (long)opnd);
|
||||
cs = &g->sets[opnd];
|
||||
last = -1;
|
||||
for (i = 0; i < g->csetsize+1; i++) /* +1 flushes */
|
||||
if (CHIN(cs, i) && i < g->csetsize) {
|
||||
if (last < 0) {
|
||||
fprintf(d, "%s", regchar(i));
|
||||
last = i;
|
||||
}
|
||||
} else {
|
||||
if (last >= 0) {
|
||||
if (last != i-1)
|
||||
fprintf(d, "-%s",
|
||||
regchar(i-1));
|
||||
last = -1;
|
||||
}
|
||||
}
|
||||
fprintf(d, "]");
|
||||
break;
|
||||
case OBACK_:
|
||||
fprintf(d, "(\\<%ld>", (long)opnd);
|
||||
break;
|
||||
case O_BACK:
|
||||
fprintf(d, "<%ld>\\)", (long)opnd);
|
||||
break;
|
||||
case OPLUS_:
|
||||
fprintf(d, "(+");
|
||||
if (OP(*(s+opnd)) != O_PLUS)
|
||||
fprintf(d, "<%ld>", (long)opnd);
|
||||
break;
|
||||
case O_PLUS:
|
||||
if (OP(*(s-opnd)) != OPLUS_)
|
||||
fprintf(d, "<%ld>", (long)opnd);
|
||||
fprintf(d, "+)");
|
||||
break;
|
||||
case OQUEST_:
|
||||
fprintf(d, "(?");
|
||||
if (OP(*(s+opnd)) != O_QUEST)
|
||||
fprintf(d, "<%ld>", (long)opnd);
|
||||
break;
|
||||
case O_QUEST:
|
||||
if (OP(*(s-opnd)) != OQUEST_)
|
||||
fprintf(d, "<%ld>", (long)opnd);
|
||||
fprintf(d, "?)");
|
||||
break;
|
||||
case OLPAREN:
|
||||
fprintf(d, "((<%ld>", (long)opnd);
|
||||
break;
|
||||
case ORPAREN:
|
||||
fprintf(d, "<%ld>))", (long)opnd);
|
||||
break;
|
||||
case OCH_:
|
||||
fprintf(d, "<");
|
||||
if (OP(*(s+opnd)) != OOR2)
|
||||
fprintf(d, "<%ld>", (long)opnd);
|
||||
break;
|
||||
case OOR1:
|
||||
if (OP(*(s-opnd)) != OOR1 && OP(*(s-opnd)) != OCH_)
|
||||
fprintf(d, "<%ld>", (long)opnd);
|
||||
fprintf(d, "|");
|
||||
break;
|
||||
case OOR2:
|
||||
fprintf(d, "|");
|
||||
if (OP(*(s+opnd)) != OOR2 && OP(*(s+opnd)) != O_CH)
|
||||
fprintf(d, "<%ld>", (long)opnd);
|
||||
break;
|
||||
case O_CH:
|
||||
if (OP(*(s-opnd)) != OOR1)
|
||||
fprintf(d, "<%ld>", (long)opnd);
|
||||
fprintf(d, ">");
|
||||
break;
|
||||
default:
|
||||
fprintf(d, "!%ld(%ld)!", OP(*s), opnd);
|
||||
break;
|
||||
}
|
||||
if (!done)
|
||||
GAP();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
- regchar - make a character printable
|
||||
== static char *regchar(int ch);
|
||||
*/
|
||||
static char * /* -> representation */
|
||||
regchar(ch)
|
||||
int ch;
|
||||
{
|
||||
static char buf[10];
|
||||
|
||||
if (isprint(ch) || ch == ' ')
|
||||
sprintf(buf, "%c", ch);
|
||||
else
|
||||
sprintf(buf, "\\%o", ch);
|
||||
return(buf);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
/* ========= begin header generated by ./mkh ========= */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* === debug.c === */
|
||||
void regprint(regex_t *r, FILE *d);
|
||||
static void s_print(register struct re_guts *g, FILE *d);
|
||||
static char *regchar(int ch);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/* ========= end header generated by ./mkh ========= */
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,35 +0,0 @@
|
||||
/* ========= begin header generated by ./mkh ========= */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* === engine.c === */
|
||||
static int matcher(register struct re_guts *g, char *string, size_t nmatch, regmatch_t pmatch[], int eflags);
|
||||
static char *dissect(register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
|
||||
static char *backref(register struct match *m, char *start, char *stop, sopno startst, sopno stopst, sopno lev);
|
||||
static char *fast(register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
|
||||
static char *slow(register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
|
||||
static states step(register struct re_guts *g, sopno start, sopno stop, register states bef, int ch, register states aft);
|
||||
#define BOL (OUT+1)
|
||||
#define EOL (BOL+1)
|
||||
#define BOLEOL (BOL+2)
|
||||
#define NOTHING (BOL+3)
|
||||
#define BOW (BOL+4)
|
||||
#define EOW (BOL+5)
|
||||
#define CODEMAX (BOL+5) /* highest code used */
|
||||
#define NONCHAR(c) ((c) > CHAR_MAX)
|
||||
#define NNONCHAR (CODEMAX-CHAR_MAX)
|
||||
#ifdef REDEBUG
|
||||
static void print(struct match *m, char *caption, states st, int ch, FILE *d);
|
||||
#endif
|
||||
#ifdef REDEBUG
|
||||
static void at(struct match *m, char *title, char *start, char *stop, sopno startst, sopno stopst);
|
||||
#endif
|
||||
#ifdef REDEBUG
|
||||
static char *pchar(int ch);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/* ========= end header generated by ./mkh ========= */
|
||||
@@ -1,510 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <regex.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "main.ih"
|
||||
|
||||
char *progname;
|
||||
int debug = 0;
|
||||
int line = 0;
|
||||
int status = 0;
|
||||
|
||||
int copts = REG_EXTENDED;
|
||||
int eopts = 0;
|
||||
regoff_t startoff = 0;
|
||||
regoff_t endoff = 0;
|
||||
|
||||
|
||||
extern int split();
|
||||
extern void regprint();
|
||||
|
||||
/*
|
||||
- main - do the simple case, hand off to regress() for regression
|
||||
*/
|
||||
int main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
regex_t re;
|
||||
# define NS 10
|
||||
regmatch_t subs[NS];
|
||||
char erbuf[100];
|
||||
int err;
|
||||
size_t len;
|
||||
int c;
|
||||
int errflg = 0;
|
||||
register int i;
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
|
||||
progname = argv[0];
|
||||
|
||||
while ((c = getopt(argc, argv, "c:e:S:E:x")) != EOF)
|
||||
switch (c) {
|
||||
case 'c': /* compile options */
|
||||
copts = options('c', optarg);
|
||||
break;
|
||||
case 'e': /* execute options */
|
||||
eopts = options('e', optarg);
|
||||
break;
|
||||
case 'S': /* start offset */
|
||||
startoff = (regoff_t)atoi(optarg);
|
||||
break;
|
||||
case 'E': /* end offset */
|
||||
endoff = (regoff_t)atoi(optarg);
|
||||
break;
|
||||
case 'x': /* Debugging. */
|
||||
debug++;
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
errflg++;
|
||||
break;
|
||||
}
|
||||
if (errflg) {
|
||||
fprintf(stderr, "usage: %s ", progname);
|
||||
fprintf(stderr, "[-c copt][-C][-d] [re]\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
if (optind >= argc) {
|
||||
regress(stdin);
|
||||
exit(status);
|
||||
}
|
||||
|
||||
err = regcomp(&re, argv[optind++], copts);
|
||||
if (err) {
|
||||
len = regerror(err, &re, erbuf, sizeof(erbuf));
|
||||
fprintf(stderr, "error %s, %d/%d `%s'\n",
|
||||
eprint(err), len, sizeof(erbuf), erbuf);
|
||||
exit(status);
|
||||
}
|
||||
regprint(&re, stdout);
|
||||
|
||||
if (optind >= argc) {
|
||||
regfree(&re);
|
||||
exit(status);
|
||||
}
|
||||
|
||||
if (eopts®_STARTEND) {
|
||||
subs[0].rm_so = startoff;
|
||||
subs[0].rm_eo = strlen(argv[optind]) - endoff;
|
||||
}
|
||||
err = regexec(&re, argv[optind], (size_t)NS, subs, eopts);
|
||||
if (err) {
|
||||
len = regerror(err, &re, erbuf, sizeof(erbuf));
|
||||
fprintf(stderr, "error %s, %d/%d `%s'\n",
|
||||
eprint(err), len, sizeof(erbuf), erbuf);
|
||||
exit(status);
|
||||
}
|
||||
if (!(copts®_NOSUB)) {
|
||||
len = (int)(subs[0].rm_eo - subs[0].rm_so);
|
||||
if (subs[0].rm_so != -1) {
|
||||
if (len != 0)
|
||||
printf("match `%.*s'\n", (int)len,
|
||||
argv[optind] + subs[0].rm_so);
|
||||
else
|
||||
printf("match `'@%.1s\n",
|
||||
argv[optind] + subs[0].rm_so);
|
||||
}
|
||||
for (i = 1; i < NS; i++)
|
||||
if (subs[i].rm_so != -1)
|
||||
printf("(%d) `%.*s'\n", i,
|
||||
(int)(subs[i].rm_eo - subs[i].rm_so),
|
||||
argv[optind] + subs[i].rm_so);
|
||||
}
|
||||
exit(status);
|
||||
}
|
||||
|
||||
/*
|
||||
- regress - main loop of regression test
|
||||
== void regress(FILE *in);
|
||||
*/
|
||||
void
|
||||
regress(in)
|
||||
FILE *in;
|
||||
{
|
||||
char inbuf[1000];
|
||||
# define MAXF 10
|
||||
char *f[MAXF];
|
||||
int nf;
|
||||
int i;
|
||||
char erbuf[100];
|
||||
size_t ne;
|
||||
char *badpat = "invalid regular expression";
|
||||
# define SHORT 10
|
||||
char *bpname = "REG_BADPAT";
|
||||
regex_t re;
|
||||
|
||||
while (fgets(inbuf, sizeof(inbuf), in) != NULL) {
|
||||
line++;
|
||||
if (inbuf[0] == '#' || inbuf[0] == '\n')
|
||||
continue; /* NOTE CONTINUE */
|
||||
inbuf[strlen(inbuf)-1] = '\0'; /* get rid of stupid \n */
|
||||
if (debug)
|
||||
fprintf(stdout, "%d:\n", line);
|
||||
nf = split(inbuf, f, MAXF, "\t\t");
|
||||
if (nf < 3) {
|
||||
fprintf(stderr, "bad input, line %d\n", line);
|
||||
exit(1);
|
||||
}
|
||||
for (i = 0; i < nf; i++)
|
||||
if (strcmp(f[i], "\"\"") == 0)
|
||||
f[i] = "";
|
||||
if (nf <= 3)
|
||||
f[3] = NULL;
|
||||
if (nf <= 4)
|
||||
f[4] = NULL;
|
||||
try(f[0], f[1], f[2], f[3], f[4], options('c', f[1]));
|
||||
if (opt('&', f[1])) /* try with either type of RE */
|
||||
try(f[0], f[1], f[2], f[3], f[4],
|
||||
options('c', f[1]) &~ REG_EXTENDED);
|
||||
}
|
||||
|
||||
ne = regerror(REG_BADPAT, (regex_t *)NULL, erbuf, sizeof(erbuf));
|
||||
if (strcmp(erbuf, badpat) != 0 || ne != strlen(badpat)+1) {
|
||||
fprintf(stderr, "end: regerror() test gave `%s' not `%s'\n",
|
||||
erbuf, badpat);
|
||||
status = 1;
|
||||
}
|
||||
ne = regerror(REG_BADPAT, (regex_t *)NULL, erbuf, (size_t)SHORT);
|
||||
if (strncmp(erbuf, badpat, SHORT-1) != 0 || erbuf[SHORT-1] != '\0' ||
|
||||
ne != strlen(badpat)+1) {
|
||||
fprintf(stderr, "end: regerror() short test gave `%s' not `%.*s'\n",
|
||||
erbuf, SHORT-1, badpat);
|
||||
status = 1;
|
||||
}
|
||||
ne = regerror(REG_ITOA|REG_BADPAT, (regex_t *)NULL, erbuf, sizeof(erbuf));
|
||||
if (strcmp(erbuf, bpname) != 0 || ne != strlen(bpname)+1) {
|
||||
fprintf(stderr, "end: regerror() ITOA test gave `%s' not `%s'\n",
|
||||
erbuf, bpname);
|
||||
status = 1;
|
||||
}
|
||||
re.re_endp = bpname;
|
||||
ne = regerror(REG_ATOI, &re, erbuf, sizeof(erbuf));
|
||||
if (atoi(erbuf) != (int)REG_BADPAT) {
|
||||
fprintf(stderr, "end: regerror() ATOI test gave `%s' not `%ld'\n",
|
||||
erbuf, (long)REG_BADPAT);
|
||||
status = 1;
|
||||
} else if (ne != strlen(erbuf)+1) {
|
||||
fprintf(stderr, "end: regerror() ATOI test len(`%s') = %ld\n",
|
||||
erbuf, (long)REG_BADPAT);
|
||||
status = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
- try - try it, and report on problems
|
||||
== void try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts);
|
||||
*/
|
||||
void
|
||||
try(f0, f1, f2, f3, f4, opts)
|
||||
char *f0;
|
||||
char *f1;
|
||||
char *f2;
|
||||
char *f3;
|
||||
char *f4;
|
||||
int opts; /* may not match f1 */
|
||||
{
|
||||
regex_t re;
|
||||
# define NSUBS 10
|
||||
regmatch_t subs[NSUBS];
|
||||
# define NSHOULD 15
|
||||
char *should[NSHOULD];
|
||||
int nshould;
|
||||
char erbuf[100];
|
||||
int err;
|
||||
int len;
|
||||
char *type = (opts & REG_EXTENDED) ? "ERE" : "BRE";
|
||||
register int i;
|
||||
char *grump;
|
||||
char f0copy[1000];
|
||||
char f2copy[1000];
|
||||
|
||||
strcpy(f0copy, f0);
|
||||
re.re_endp = (opts®_PEND) ? f0copy + strlen(f0copy) : NULL;
|
||||
fixstr(f0copy);
|
||||
err = regcomp(&re, f0copy, opts);
|
||||
if (err != 0 && (!opt('C', f1) || err != efind(f2))) {
|
||||
/* unexpected error or wrong error */
|
||||
len = regerror(err, &re, erbuf, sizeof(erbuf));
|
||||
fprintf(stderr, "%d: %s error %s, %d/%d `%s'\n",
|
||||
line, type, eprint(err), len,
|
||||
sizeof(erbuf), erbuf);
|
||||
status = 1;
|
||||
} else if (err == 0 && opt('C', f1)) {
|
||||
/* unexpected success */
|
||||
fprintf(stderr, "%d: %s should have given REG_%s\n",
|
||||
line, type, f2);
|
||||
status = 1;
|
||||
err = 1; /* so we won't try regexec */
|
||||
}
|
||||
|
||||
if (err != 0) {
|
||||
regfree(&re);
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy(f2copy, f2);
|
||||
fixstr(f2copy);
|
||||
|
||||
if (options('e', f1)®_STARTEND) {
|
||||
if (strchr(f2, '(') == NULL || strchr(f2, ')') == NULL)
|
||||
fprintf(stderr, "%d: bad STARTEND syntax\n", line);
|
||||
subs[0].rm_so = strchr(f2, '(') - f2 + 1;
|
||||
subs[0].rm_eo = strchr(f2, ')') - f2;
|
||||
}
|
||||
err = regexec(&re, f2copy, NSUBS, subs, options('e', f1));
|
||||
|
||||
if (err != 0 && (f3 != NULL || err != REG_NOMATCH)) {
|
||||
/* unexpected error or wrong error */
|
||||
len = regerror(err, &re, erbuf, sizeof(erbuf));
|
||||
fprintf(stderr, "%d: %s exec error %s, %d/%d `%s'\n",
|
||||
line, type, eprint(err), len,
|
||||
sizeof(erbuf), erbuf);
|
||||
status = 1;
|
||||
} else if (err != 0) {
|
||||
/* nothing more to check */
|
||||
} else if (f3 == NULL) {
|
||||
/* unexpected success */
|
||||
fprintf(stderr, "%d: %s exec should have failed\n",
|
||||
line, type);
|
||||
status = 1;
|
||||
err = 1; /* just on principle */
|
||||
} else if (opts®_NOSUB) {
|
||||
/* nothing more to check */
|
||||
} else if ((grump = check(f2, subs[0], f3)) != NULL) {
|
||||
fprintf(stderr, "%d: %s %s\n", line, type, grump);
|
||||
status = 1;
|
||||
err = 1;
|
||||
}
|
||||
|
||||
if (err != 0 || f4 == NULL) {
|
||||
regfree(&re);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 1; i < NSHOULD; i++)
|
||||
should[i] = NULL;
|
||||
nshould = split(f4, should+1, NSHOULD-1, ",");
|
||||
if (nshould == 0) {
|
||||
nshould = 1;
|
||||
should[1] = "";
|
||||
}
|
||||
for (i = 1; i < NSUBS; i++) {
|
||||
grump = check(f2, subs[i], should[i]);
|
||||
if (grump != NULL) {
|
||||
fprintf(stderr, "%d: %s $%d %s\n", line,
|
||||
type, i, grump);
|
||||
status = 1;
|
||||
err = 1;
|
||||
}
|
||||
}
|
||||
|
||||
regfree(&re);
|
||||
}
|
||||
|
||||
/*
|
||||
- options - pick options out of a regression-test string
|
||||
== int options(int type, char *s);
|
||||
*/
|
||||
int
|
||||
options(type, s)
|
||||
int type; /* 'c' compile, 'e' exec */
|
||||
char *s;
|
||||
{
|
||||
register char *p;
|
||||
register int o = (type == 'c') ? copts : eopts;
|
||||
register char *legal = (type == 'c') ? "bisnmp" : "^$#tl";
|
||||
|
||||
for (p = s; *p != '\0'; p++)
|
||||
if (strchr(legal, *p) != NULL)
|
||||
switch (*p) {
|
||||
case 'b':
|
||||
o &= ~REG_EXTENDED;
|
||||
break;
|
||||
case 'i':
|
||||
o |= REG_ICASE;
|
||||
break;
|
||||
case 's':
|
||||
o |= REG_NOSUB;
|
||||
break;
|
||||
case 'n':
|
||||
o |= REG_NEWLINE;
|
||||
break;
|
||||
case 'm':
|
||||
o &= ~REG_EXTENDED;
|
||||
o |= REG_NOSPEC;
|
||||
break;
|
||||
case 'p':
|
||||
o |= REG_PEND;
|
||||
break;
|
||||
case '^':
|
||||
o |= REG_NOTBOL;
|
||||
break;
|
||||
case '$':
|
||||
o |= REG_NOTEOL;
|
||||
break;
|
||||
case '#':
|
||||
o |= REG_STARTEND;
|
||||
break;
|
||||
case 't': /* trace */
|
||||
o |= REG_TRACE;
|
||||
break;
|
||||
case 'l': /* force long representation */
|
||||
o |= REG_LARGE;
|
||||
break;
|
||||
case 'r': /* force backref use */
|
||||
o |= REG_BACKR;
|
||||
break;
|
||||
}
|
||||
return(o);
|
||||
}
|
||||
|
||||
/*
|
||||
- opt - is a particular option in a regression string?
|
||||
== int opt(int c, char *s);
|
||||
*/
|
||||
int /* predicate */
|
||||
opt(c, s)
|
||||
int c;
|
||||
char *s;
|
||||
{
|
||||
return(strchr(s, c) != NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
- fixstr - transform magic characters in strings
|
||||
== void fixstr(register char *p);
|
||||
*/
|
||||
void
|
||||
fixstr(p)
|
||||
register char *p;
|
||||
{
|
||||
if (p == NULL)
|
||||
return;
|
||||
|
||||
for (; *p != '\0'; p++)
|
||||
if (*p == 'N')
|
||||
*p = '\n';
|
||||
else if (*p == 'T')
|
||||
*p = '\t';
|
||||
else if (*p == 'S')
|
||||
*p = ' ';
|
||||
else if (*p == 'Z')
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
- check - check a substring match
|
||||
== char *check(char *str, regmatch_t sub, char *should);
|
||||
*/
|
||||
char * /* NULL or complaint */
|
||||
check(str, sub, should)
|
||||
char *str;
|
||||
regmatch_t sub;
|
||||
char *should;
|
||||
{
|
||||
register int len;
|
||||
register int shlen;
|
||||
register char *p;
|
||||
static char grump[500];
|
||||
register char *at = NULL;
|
||||
|
||||
if (should != NULL && strcmp(should, "-") == 0)
|
||||
should = NULL;
|
||||
if (should != NULL && should[0] == '@') {
|
||||
at = should + 1;
|
||||
should = "";
|
||||
}
|
||||
|
||||
/* check rm_so and rm_eo for consistency */
|
||||
if (sub.rm_so > sub.rm_eo || (sub.rm_so == -1 && sub.rm_eo != -1) ||
|
||||
(sub.rm_so != -1 && sub.rm_eo == -1) ||
|
||||
(sub.rm_so != -1 && sub.rm_so < 0) ||
|
||||
(sub.rm_eo != -1 && sub.rm_eo < 0) ) {
|
||||
sprintf(grump, "start %ld end %ld", (long)sub.rm_so,
|
||||
(long)sub.rm_eo);
|
||||
return(grump);
|
||||
}
|
||||
|
||||
/* check for no match */
|
||||
if (sub.rm_so == -1 && should == NULL)
|
||||
return(NULL);
|
||||
if (sub.rm_so == -1)
|
||||
return("did not match");
|
||||
|
||||
/* check for in range */
|
||||
if (sub.rm_eo > strlen(str)) {
|
||||
sprintf(grump, "start %ld end %ld, past end of string",
|
||||
(long)sub.rm_so, (long)sub.rm_eo);
|
||||
return(grump);
|
||||
}
|
||||
|
||||
len = (int)(sub.rm_eo - sub.rm_so);
|
||||
shlen = (int)strlen(should);
|
||||
p = str + sub.rm_so;
|
||||
|
||||
/* check for not supposed to match */
|
||||
if (should == NULL) {
|
||||
sprintf(grump, "matched `%.*s'", len, p);
|
||||
return(grump);
|
||||
}
|
||||
|
||||
/* check for wrong match */
|
||||
if (len != shlen || strncmp(p, should, (size_t)shlen) != 0) {
|
||||
sprintf(grump, "matched `%.*s' instead", len, p);
|
||||
return(grump);
|
||||
}
|
||||
if (shlen > 0)
|
||||
return(NULL);
|
||||
|
||||
/* check null match in right place */
|
||||
if (at == NULL)
|
||||
return(NULL);
|
||||
shlen = strlen(at);
|
||||
if (shlen == 0)
|
||||
shlen = 1; /* force check for end-of-string */
|
||||
if (strncmp(p, at, shlen) != 0) {
|
||||
sprintf(grump, "matched null at `%.20s'", p);
|
||||
return(grump);
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
- eprint - convert error number to name
|
||||
== static char *eprint(int err);
|
||||
*/
|
||||
static char *
|
||||
eprint(err)
|
||||
int err;
|
||||
{
|
||||
static char epbuf[100];
|
||||
size_t len;
|
||||
|
||||
len = regerror(REG_ITOA|err, (regex_t *)NULL, epbuf, sizeof(epbuf));
|
||||
assert(len <= sizeof(epbuf));
|
||||
return(epbuf);
|
||||
}
|
||||
|
||||
/*
|
||||
- efind - convert error name to number
|
||||
== static int efind(char *name);
|
||||
*/
|
||||
static int
|
||||
efind(name)
|
||||
char *name;
|
||||
{
|
||||
static char efbuf[100];
|
||||
regex_t re;
|
||||
|
||||
sprintf(efbuf, "REG_%s", name);
|
||||
assert(strlen(efbuf) < sizeof(efbuf));
|
||||
re.re_endp = efbuf;
|
||||
(void) regerror(REG_ATOI, &re, efbuf, sizeof(efbuf));
|
||||
return(atoi(efbuf));
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/* ========= begin header generated by ./mkh ========= */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* === main.c === */
|
||||
void regress(FILE *in);
|
||||
void try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts);
|
||||
int options(int type, char *s);
|
||||
int opt(int c, char *s);
|
||||
void fixstr(register char *p);
|
||||
char *check(char *str, regmatch_t sub, char *should);
|
||||
static char *eprint(int err);
|
||||
static int efind(char *name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/* ========= end header generated by ./mkh ========= */
|
||||
Loaded 100 of 565 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user