1
0
mirror of https://github.com/php/php-src.git synced 2026-04-11 10:03:18 +02:00

First checkin of muscat/empower module; been using it here for some time

Developing using aegis and just checking in baseline from time to time

See samjam@php.net for questions
This commit is contained in:
Sam Liddicott
2001-01-18 13:21:34 +00:00
parent 66dafaa2c5
commit 04d7c9815f
12 changed files with 3901 additions and 0 deletions

282
ext/muscat/LICENSE Normal file
View File

@@ -0,0 +1,282 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS

30
ext/muscat/LICENSE.about Normal file
View File

@@ -0,0 +1,30 @@
/*
+----------------------------------------------------------------------+
| Muscat/Empower 1.5 Module for PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 2000 Ananova Ltd |
| http://www.ananova.com |
| Ananova Ltd, PO Box 36, Leeds, LS11 5ZA, United Kingdom |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of the GNU General Public License |
| along with this program; if not, write to the Free Software |
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
| MA 02111-1307, USA. |
| |
| A copy is availble at http://www.gnu.org/copyleft/gpl.txt |
+----------------------------------------------------------------------+
| Author: Sam Liddicott <sam@ananova.com> |
+----------------------------------------------------------------------+
*/

7
ext/muscat/Makefile.in Normal file
View File

@@ -0,0 +1,7 @@
LTLIBRARY_NAME = libmuscat.la
LTLIBRARY_SOURCES = muscat.c muscat_net.c
LTLIBRARY_SHARED_NAME = muscat.la
LTLIBRARY_SHARED_LIBADD = $(MUSCAT_SHARED_LIBADD)
include $(top_srcdir)/build/dynlib.mk

2579
ext/muscat/aegis.log Normal file

File diff suppressed because it is too large Load Diff

280
ext/muscat/config Normal file
View File

@@ -0,0 +1,280 @@
/*
* aegis - project change supervisor
* This file is in the Public Domain, 1995, 1998, 2000 Peter Miller.
*
* MANIFEST: example of using rcs in the project config file
*
* The entries for the commands are listed below. RCS uses a slightly
* different model than aegis wants, so some maneuvering is required.
* The command strings in this section assume that the RCS commands ci and co
* and rcs and rlog are in the command search PATH, but you may like to
* hard-wire the paths, or set PATH at the start of each. You should also note
* that the strings are always handed to the Bourne shell to be executed, and
* are set to exit with an error immediately a sub-command fails.
*
* In these commands, the RCS file is kept unlocked, since only the owner will
* be checking changes in. The RCS functionality for coordinating shared
* access is not required.
*
* One advantage of using RCS version 5.6 or later is that binary files are
* supported, should you want to have binary files in the baseline.
*
* The ${quote ...} construct is used to quote filenames which contain
* shell special characters. A minimum of quoting is performed, so if
* the filenames do not contain shell special characters, no quotes will
* be used.
*/
/*
* This command is used to create a new file history.
* This command is always executed as the project owner.
* The following substitutions are available:
*
* ${Input}
* absolute path of the source file
* ${History}
* absolute path of the history file
*
* The "ci -f" option is used to specify that a copy is to be checked-in even
* if there are no changes.
* The "ci -u" option is used to specify that an unlocked copy will remain in
* the baseline.
* The "ci -d" option is used to specify that the file time rather than the
* current time is to be used for the new revision.
* The "ci -M" option is used to specify that the mode date on the original
* file is not to be altered.
* The "ci -t" option is used to specify that there is to be no description
* text for the new RCS file.
* The "ci -m" option is used to specify that the change number is to be stored
* in the file log if this is actually an update (typically from aenf
* after aerm on the same file name).
* The "rcs -U" option is used to specify that the new RCS file is to have
* unstrict locking.
*/
history_create_command =
"ci -f -u -d -M -m$c -t/dev/null ${quote $input} ${quote $history,v}; \
rcs -U ${quote $history,v}";
/*
* This command is used to get a specific edit back from history.
* This command is always executed as the project owner.
* The following substitutions are available:
*
* ${History}
* absolute path of the history file
* ${Edit}
* edit number, as given by history_\%query_\%command
* ${Output}
* absolute path of the destination file
*
* The "co -r" option is used to specify the edit to be retrieved.
* The "co -p" option is used to specify that the results be printed on the
* standard output; this is because the destination filename will never
* look anything like the history source filename.
*/
history_get_command =
"co -r${quote $edit} -p ${quote $history,v} > ${quote $output}";
/*
* This command is used to add a new "top-most" entry to the history file.
* This command is always executed as the project owner.
* The following substitutions are available:
*
* ${Input}
* absolute path of source file
* ${History}
* absolute path of history file
*
* The "ci -f" option is used to specify that a copy is to be checked-in even
* if there are no changes.
* The "ci -u" option is used to specify that an unlocked copy will remain in
* the baseline.
* The "ci -d" option is used to specify that the file time rather than the
* current time is to be used for the new revision.
* The "ci -M" option is used to specify that the mode date on the original
* file is not to be altered.
* The "ci -m" option is used to specify that the change number is to be stored
* in the file log, which allows rlog to be used to find the change
* numbers to which each revision of the file corresponds.
*
* It is possible for a a very cautious approach has been taken, in which case
* the history_put_command may be set to the same string specified above for
* the history_create_command.
*/
history_put_command =
"ci -f -u -d -M -m$c ${quote $input} ${quote $history,v}";
/*
* This command is used to query what the history mechanism calls the top-most
* edit of a history file. The result may be any arbitrary string, it need not
* be anything like a number, just so long as it uniquely identifies the edit
* for use by the history_get_command at a later date. The edit number is to
* be printed on the standard output. This command is always executed as the
* project owner.
*
* The following substitutions are available:
*
* ${History}
* absolute path of the history file
*/
history_query_command =
"rlog -r ${quote $history,v} | awk '/^head:/ {print $$2}'";
/*
* RCS also provides a merge program, which can be used to provide a three-way
* merge. It has an output format some sites prefer to the fmerge output.
*
* This command is used by aed(1) to produce a difference listing when a file
* in the development directory is out of date compared to the current version
* in the baseline.
*
* All of the command substitutions described in aesub(5) are available.
* In addition, the following substitutions are also available:
*
* ${ORiginal}
* The absolute path name of a file containing the common ancestor
* version of ${MostRecent} and {$Input}. Usually the version originally
* copied into the change. Usually in a temporary file.
* ${Most_Recent}
* The absolute path name of a file containing the most recent version.
* Usually in the baseline.
* ${Input}
* The absolute path name of the edited version of the file. Usually in
* the development directory.
* ${Output}
* The absolute path name of the file in which to write the difference
* listing. Usually in the development directory.
*
* An exit status of 0 means successful, even of the files differ (and they
* usually do). An exit status which is non-zero means something is wrong.
*
* The "merge -L" options are used to specify labels for the baseline and the
* development directory, respectively, when conflict lines are inserted
* into the result.
* The "merge -p" options is used to specify that the results are to be printed
* on the standard output.
*/
merge_command =
"set +e; \
merge -p -L baseline -L C$c ${quote $mostrecent} ${quote $original} \
${quote $input} > ${quote $output}; \
test $? -le 1";
/*
* Many history tools (including RCS) can modify the contents of the file
* when it is committed. While there are usually options to turn this
* off, they are seldom used. The problem is: if the commit changes the
* file, the source in the repository now no longer matches the object
* file in the repository - i.e. the history tool has compromised the
* referential integrity of the repository.
*
* If you use RCS keyword substitution, you will need this next line.
* (The default is to report a fatal error.)
*/
history_put_trashes_file = warn;
/*
* aegis - project change supervisor
* This file is in the Public Domain, 1995, Peter Miller.
*
* MANIFEST: example use of cook in project config file
*
* The make(1) program exists in many forms, usually one is available with each
* UNIX version. The one used in the writing of this section is GNU Make 3.70,
* available by anonymous FTP from your nearest GNU archive site. GNU Make was
* chosen because it was the most powerful, it is widely available (usually for
* little or no cost) and discussion of the alternatives (SunOS make, BSD 4.3
* make, etc), would not be universally applicable. "Plain vanilla" make
* (with no transitive closure, no pattern rules, no functions) is not
* sufficiently capable to satisfy the demands placed on it by aegis.
*
* As mentioned in the Dependency Maintenance Tool chapter of the User Guide,
* make is not really sufficient, because it lacks dynamic include dependencies.
* However, GNU Make has a form of dynamic include dependencies, and it has a
* few quirks, but mostly works well.
*
* The other feature lacking in make is a search path. While GNU Make has
* functionality called VPATH, the implementation leaves something to be
* desired, and can't be used for the search path functionality required by
* aegis. Because of this, the create_symlinks_before_build field of the
* project config file is set to true so that aegis will arrange for the
* development directory to be full of symbolic links, making it appear that
* the entire project is in each change's development directory.
*/
/*
* The build_command field of the project config file is used to invoke the
* relevant build command. This command tells make where to find the rules.
* The ${s Makefile} expands to a path into the baseline during development
* if the file is not in the change. Look in aesub(5) for more information
* about command substitutions.
*/
build_command =
"make -f ${s Makefile.php} project=$p change=$c version=$v PHP=php-4.0.4";
/* "project=\"$p\" change=\"$c\" version=\"$v\" /bin/sh ./build";*/
/*
* The rules used in the User Guide all remove their targets before
* constructing them, which qualifies them for the following entry in the
* config file. The files must be removed first, otherwise the baseline would
* cease to be self-consistent.
*/
link_integration_directory = true;
/*
* Another field to be set in this file is one which tells aegis to maintain
* symbolic links between the development directory and the baseline. This also
* requires that rules remove their targets before constructing them, to ensure
* that development builds do not attempt to write their results onto the
* read-only versions in the baseline.
*/
create_symlinks_before_build = true;
/*
* aegis - project change supervisor
* This file is in the Public Domain, 1999 Peter Miller.
*
* MANIFEST: example use of diff in the project config file
*
* The ${quote ...} construct is used to quote filenames which contain
* shell special characters. A minimum of quoting is performed, so if
* the filenames do not contain shell special characters, no quotes will
* be used.
*/
/*
* Compare two files using GNU diff. The -U 10 option produces an output
* with inserts and deletes shown line, with 10 lines of context before
* and after. This is usually superior to -c, as it shows what happened
* more clearly (and it takes less space). The -b option could be added
* to compare runs of white space as equal.
*
* This command is used by aed(1) to produce a difference listing when
* file in the development directory was originally copied from the
* current version in the baseline.
*
* All of the command substitutions described in aesub(5) are available.
* In addition, the following substitutions are also available:
*
* ${ORiginal}
* The absolute path name of a file containing the version
* originally copied. Usually in the baseline.
* ${Input}
* The absolute path name of the edited version of the file.
* Usually in the development directory.
* ${Output}
* The absolute path name of the file in which to write the
* difference listing. Usually in the development directory.
*
* An exit status of 0 means successful, even of the files differ (and
* they usually do). An exit status which is non-zero means something
* is wrong. (So we need to massage the exit status, because diff does
* things a little differently.)
*
* The non-zero exit status may be used to overload this command with
* extra tests, such as line length limits. The difference files must
* be produced in addition to these extra tests.
*/
diff_command =
"set +e; diff -U10 ${quote $original} ${quote $input} > ${quote $output}; test $? -le 1";

35
ext/muscat/config.m4 Normal file
View File

@@ -0,0 +1,35 @@
dnl $Id$
PHP_ARG_WITH(muscat, for Muscat support,
[ --with-muscat[=DIR] Include muscat support.])
if test "$PHP_MUSCAT" != "no"; then
PHP_EXTENSION(muscat, $ext_shared)
for i in $PHP_MUSCAT /usr/local /usr /usr/local/empower /usr/local/empower/developer; do
if test -f $i/include/Muscat.h; then
MUSCAT_INCDIR=$i/include
MUSCAT_DIR=$i
fi
if test -f $i/libs/libhdmuscat3.6.a; then
MUSCAT_LIBDIR=$i/libs
MUSCAT_DIR=$i
elif test -f $i/lib/libhdmuscat3.6.a; then
MUSCAT_LIBDIR=$i/lib
MUSCAT_DIR=$i
fi
done
if test -z "$MUSCAT_INCDIR"; then
AC_MSG_ERROR(Cannot find Muscat include dir)
fi
if test -z "$MUSCAT_LIBDIR"; then
AC_MSG_ERROR(Cannot find Muscat lib dir)
fi
AC_DEFINE(HAVE_MUSCAT, 1, [ ])
PHP_SUBST(MUSCAT_SHARED_LIBADD)
AC_DEFINE_UNQUOTED(PHP_MUSCAT_DIR, "$MUSCAT_DIR", [ ])
AC_ADD_LIBRARY_WITH_PATH(hdmuscat3.6, $MUSCAT_LIBDIR, MUSCAT_SHARED_LIBADD)
AC_ADD_INCLUDE($MUSCAT_INCDIR)
fi

369
ext/muscat/muscat.c Normal file
View File

@@ -0,0 +1,369 @@
/*
+----------------------------------------------------------------------+
| Muscat/Empower 1.5 Module for PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 2000 Ananova Ltd |
| http://www.ananova.com |
| Ananova Ltd, PO Box 36, Leeds, LS11 5ZA, United Kingdom |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of the GNU General Public License |
| along with this program; if not, write to the Free Software |
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
| MA 02111-1307, USA. |
| |
| A copy is availble at http://www.gnu.org/copyleft/gpl.txt |
+----------------------------------------------------------------------+
| Author: Sam Liddicott <sam@ananova.com> |
+----------------------------------------------------------------------+
*/
#include <php.h>
#include <php_ini.h>
#include <php_muscat.h>
/* You should tweak config.m4 so this symbol (or some else suitable)
gets defined.
*/
#if HAVE_MUSCAT
#include <muscat_handles.h>
#include "../standard/file.h"
/* If you declare any globals in php_muscat.h uncomment this:*/
ZEND_DECLARE_MODULE_GLOBALS(muscat)
/* True global resources - no need for thread safety here */
static int le_muscat;
/* Every user visible function must have an entry in muscat_functions[].
*/
function_entry muscat_functions[] = {
PHP_FE(muscat_setup, NULL)
PHP_FE(muscat_setup_net, NULL)
PHP_FE(muscat_give, NULL)
PHP_FE(muscat_get, NULL)
PHP_FE(muscat_close, NULL)
{NULL, NULL, NULL} /* Must be the last line in muscat_functions[] */
};
zend_module_entry muscat_module_entry = {
"muscat",
muscat_functions,
PHP_MINIT(muscat),
PHP_MSHUTDOWN(muscat),
PHP_RINIT(muscat), /* Replace with NULL if there's nothing to do at request start */
PHP_RSHUTDOWN(muscat), /* Replace with NULL if there's nothing to do at request end */
PHP_MINFO(muscat),
STANDARD_MODULE_PROPERTIES
};
#ifdef COMPILE_DL_MUSCAT
ZEND_GET_MODULE(muscat)
#endif
/* {{{ destructor to close and free muscat handles
*/
void _muscat_close(_muscat_handle * handle) {
if (handle->open) {
if (handle->net) _net_muscat_close(&handle->handles.muscatnet_handle);
else H_Close_Muscat(&handle->handles.muscat_handle);
handle->open=0;
}
}
/* {{{ destructor to close and free muscat handles
*/
void _muscat_dispose(_muscat_handle * handle) {
if (handle->open) {
_muscat_close(handle);
}
efree(handle);
}
/* }}} */
/* Remove comments and fill if you need to have entries in php.ini
PHP_INI_BEGIN()
PHP_INI_END()
*/
PHP_MINIT_FUNCTION(muscat)
{
/* Remove comments if you have entries in php.ini
REGISTER_INI_ENTRIES();
*/
le_muscat=register_list_destructors(_muscat_dispose, NULL);
return SUCCESS;
}
PHP_MSHUTDOWN_FUNCTION(muscat)
{
/* Remove comments if you have entries in php.ini
UNREGISTER_INI_ENTRIES();
*/
return SUCCESS;
}
/* Remove if there's nothing to do at request start */
PHP_RINIT_FUNCTION(muscat)
{
return SUCCESS;
}
/* Remove if there's nothing to do at request end */
PHP_RSHUTDOWN_FUNCTION(muscat)
{
return SUCCESS;
}
PHP_MINFO_FUNCTION(muscat)
{
php_info_print_table_start();
php_info_print_table_header(1, "Muscat/Empower 1.5 Module for PHP version 4.0<br>Copyright (c) 2000 <a href=\"www.ananova.com\">Ananova Ltd<a/><br>For information on Muscat/Empower see <a href=\"www.smartlogik.com\">www.smartlogik.com</a>");
php_info_print_table_row(2, "muscat support", "enabled");
php_info_print_table_row(2, "muscat path", PHP_MUSCAT_DIR);
php_info_print_table_end();
/* Remove comments if you have entries in php.ini
DISPLAY_INI_ENTRIES();
*/
}
/* {{{ proto _local_discard(Muscat_handle * handle) {
This is not a user function, it throws away all muscat_get output
*/
void _local_discard(struct Muscat_handle * handle) {
while(! H_Getfrom_Muscat(handle)) {};
}
/* }}} */
/* {{{ proto _discard(Muscat_handle * handle) {
This is not a user function, it throws away all muscat_get output
*/
void _discard(_muscat_handle * handle) {
if (handle->net) _net_discard(&handle->handles.muscatnet_handle);
else _local_discard(&handle->handles.muscat_handle);
}
/* }}} */
/* {{{ proto resource setup_muscat(int size, string [muscat_dir])
Creates a new muscat session and returns the handle.
Size is the ammount of memory in bytes to allocate for muscat
muscat_dir is the muscat installation dir e.g. "/usr/local/empower",
it defaults to the compile time muscat directory
*/
PHP_FUNCTION(muscat_setup)
{
zval **size_arg, **muscat_dir_arg;
int size;
int muscat_dir_len;
char *muscat_dir = NULL;
int r;
_muscat_handle *handle=emalloc(sizeof(_muscat_handle));
handle->net=0;
handle->open=0;
switch (ZEND_NUM_ARGS()) {
case 1:
if (zend_get_parameters_ex(1, &size_arg)==FAILURE) WRONG_PARAM_COUNT;
muscat_dir=PHP_MUSCAT_DIR;
muscat_dir_len=strlen(muscat_dir);
break;
case 2:
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &size_arg, &muscat_dir_arg) == FAILURE) WRONG_PARAM_COUNT;
convert_to_string_ex(muscat_dir_arg);
muscat_dir = Z_STRVAL_PP(muscat_dir_arg);
muscat_dir_len = Z_STRLEN_PP(muscat_dir_arg);
default:
WRONG_PARAM_COUNT;
}
convert_to_long_ex(size_arg);
size = Z_LVAL_PP(size_arg);
if (r=H_Setup_Muscat(&handle->handles.muscat_handle,size,muscat_dir,"",0)) {
handle->open=1;
_discard(handle);
ZEND_REGISTER_RESOURCE(return_value, handle, le_muscat);
} else { // destroy this failure!
efree(handle);
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto resource setup_muscat_net(string muscat_host, int port)
Creates a new muscat session and returns the handle.
muscat_host is the hostname to connect to
port is the port number to connect to
- actually takes exactly the same args as fsockopen
*/
PHP_FUNCTION(muscat_setup_net)
{
zval **socket_arg;
_muscat_handle * handle;
void *what;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &socket_arg) == FAILURE){
WRONG_PARAM_COUNT;
}
if ((*socket_arg)->type!=IS_RESOURCE) {
zend_error(E_ERROR,"First parameter must be a socket handle");
RETURN_FALSE;
}
// Must have been successful open
handle=emalloc(sizeof(_muscat_handle));
memset(handle,0,sizeof(*handle));
MAKE_STD_ZVAL(handle->handles.muscatnet_handle.socketr);
handle->net=1;
handle->open=1;
// now need to store this result to keep its reference counted
*(handle->handles.muscatnet_handle.socketr)=**socket_arg;
zval_copy_ctor(handle->handles.muscatnet_handle.socketr);
// but for our convenience extract the FD
what=zend_fetch_resource(socket_arg,-1,"Socket-Handle",NULL,1,php_file_le_socket());
ZEND_VERIFY_RESOURCE(what);
handle->handles.muscatnet_handle.socketd=*(int*)what;
php_set_sock_blocking(handle->handles.muscatnet_handle.socketd,1);
_discard(handle);
ZEND_REGISTER_RESOURCE(return_value, handle, le_muscat);
}
PHP_FUNCTION(muscat_setup_net_)
{
_muscat_handle * handle;
void *what;
// php_fsockopen(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
if ((return_value)->type!=IS_RESOURCE) return;
// Must have been successful open
handle=emalloc(sizeof(_muscat_handle));
memset(handle,0,sizeof(*handle));
handle->net=1;
handle->open=1;
// now need to store this result to keep its reference counted
*handle->handles.muscatnet_handle.socketr=*return_value;
zval_copy_ctor(handle->handles.muscatnet_handle.socketr);
// but for our convenience extract the FD
what=zend_fetch_resource(&return_value,-1,"File-Handle",NULL,1,php_file_le_socket);
ZEND_VERIFY_RESOURCE(what);
handle->handles.muscatnet_handle.socketd=*(int*)what;
_discard(handle);
ZEND_REGISTER_RESOURCE(return_value, handle, le_muscat);
}
/* }}} */
/* {{{ proto int muscat_give(resource Muscat_handle, string string)
Sends string to the core muscat api.
*/
PHP_FUNCTION(muscat_give)
{
zval **Muscat_handle_arg, **string_arg;
int string_len;
char *string = NULL;
_muscat_handle *handle;
int r;
MUSCATLS_FETCH();
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &Muscat_handle_arg, &string_arg) == FAILURE){
WRONG_PARAM_COUNT;
}
ZEND_FETCH_RESOURCE(handle, _muscat_handle *,
Muscat_handle_arg, -1, MUSCAT_HANDLE_RESOURCE, le_muscat);
convert_to_string_ex(string_arg);
string = Z_STRVAL_PP(string_arg);
string_len = Z_STRLEN_PP(string_arg);
_discard(handle);
if (handle->net) r=_net_muscat_give(&handle->handles.muscatnet_handle,string);
else r=H_Give_Muscat(&handle->handles.muscat_handle,string);
}
/* }}} */
/* {{{ proto string muscat_get(resource Muscat_handle)
gets a line back from the core muscat api. Returns a literal false
when there is no more to get (as opposed to "").
Use ===FALSE or !==FALSE to check for this
*/
PHP_FUNCTION(muscat_get)
{
zval **Muscat_handle_arg;
_muscat_handle *handle;
int r;
MUSCATLS_FETCH();
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &Muscat_handle_arg) == FAILURE){
WRONG_PARAM_COUNT;
}
ZEND_FETCH_RESOURCE(handle, _muscat_handle *,
Muscat_handle_arg, -1, MUSCAT_HANDLE_RESOURCE, le_muscat);
if (handle->net) { // returns strings for US, no need to dup
if (! (r=_net_muscat_get(&handle->handles.muscatnet_handle))) {
RETURN_STRINGL(handle->handles.muscatnet_handle.muscat_response.p,
handle->handles.muscatnet_handle.muscat_response.length,0);
} else RETURN_FALSE;
} else { // must dup string
if (! (r=H_Getfrom_Muscat(&handle->handles.muscat_handle))) {
RETURN_STRINGL(handle->handles.muscat_handle.p,
handle->handles.muscat_handle.length,1);
} else RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto int muscat_close(resource muscat_handle)
Shuts down the muscat session and releases any memory back to php. [Not
back to the system, note!]
*/
PHP_FUNCTION(muscat_close)
{
zval **muscat_handle_arg;
_muscat_handle *handle;
MUSCATLS_FETCH();
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &muscat_handle_arg) == FAILURE){
WRONG_PARAM_COUNT;
}
if ((*muscat_handle_arg)->type!=IS_RESOURCE) {
zend_error(E_ERROR,"First parameter must be a muscat handle");
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(handle, _muscat_handle *,
muscat_handle_arg, -1, MUSCAT_HANDLE_RESOURCE, le_muscat);
_muscat_close(handle);
// Let destructor take care of efree!
zend_list_delete((*muscat_handle_arg)->value.lval);
}
/* }}} */
#endif /* HAVE_MUSCAT */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/

10
ext/muscat/muscat.php Normal file
View File

@@ -0,0 +1,10 @@
<?
$module = 'muscat';
$function = 'confirm_' . $module . '_compiled';
if (extension_loaded($module)) {
$str = $function($module);
} else {
$str = "Module $module is not compiled into PHP";
}
echo "$str\n";
?>

View File

@@ -0,0 +1,60 @@
/*
+----------------------------------------------------------------------+
| Muscat/Empower 1.5 Module for PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 2000 Ananova Ltd |
| http://www.ananova.com |
| Ananova Ltd, PO Box 36, Leeds, LS11 5ZA, United Kingdom |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of the GNU General Public License |
| along with this program; if not, write to the Free Software |
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
| MA 02111-1307, USA. |
| |
| A copy is availble at http://www.gnu.org/copyleft/gpl.txt |
+----------------------------------------------------------------------+
| Author: Sam Liddicott <sam@ananova.com> |
+----------------------------------------------------------------------+
*/
#ifndef PHP_MUSCAT_HANDLES_H
#define PHP_MUSCAT_HANDLES_H
#if HAVE_MUSCAT
#include <muscat.h>
#include <muscat_net.h>
typedef union _muscat_handles_union {
struct Muscat_handle muscat_handle;
struct MuscatNet_handle muscatnet_handle;
struct Muscat_response muscat_response;
} _muscat_handles;
typedef struct _muscat_handle_struct {
int open;
int net;
_muscat_handles handles;
} _muscat_handle;
#endif
#endif /* PHP_MUSCAT_HANDLES_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/

91
ext/muscat/muscat_net.c Normal file
View File

@@ -0,0 +1,91 @@
/*
+----------------------------------------------------------------------+
| Muscat/Empower 1.5 Module for PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 2000 Ananova Ltd |
| http://www.ananova.com |
| Ananova Ltd, PO Box 36, Leeds, LS11 5ZA, United Kingdom |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of the GNU General Public License |
| along with this program; if not, write to the Free Software |
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
| MA 02111-1307, USA. |
| |
| A copy is availble at http://www.gnu.org/copyleft/gpl.txt |
+----------------------------------------------------------------------+
| Author: Sam Liddicott <sam@ananova.com> |
+----------------------------------------------------------------------+
*/
#include "php.h"
#include "php_ini.h"
#include "php_muscat.h"
#if HAVE_MUSCAT
#include "muscat_net.h"
int _net_muscat_close(struct MuscatNet_handle *handle) {
}
int _net_muscat_give(struct MuscatNet_handle *handle, char* string) {
handle->muscat_response.type=' ';
SOCK_WRITEL(string,strlen(string),handle->socketd);
SOCK_WRITEL("\n",1,handle->socketd);
}
int _net_muscat_get(struct MuscatNet_handle * handle) {
char *buf;
char *end;
size_t ammount;
int clen;
int rlen;
if (handle->muscat_response.type == 'P') return GIVING;
// we can use bcom ourselves!!!
// read in the 6 byte header...
if (end=php_sock_fgets((char *)&(handle->muscat_response.bcom), 6, handle->socketd)==NULL) {
ammount=(char *) end - (char *) (&(handle->muscat_response.bcom)) +1;
return 1; // NEED TO RAISE ERROR HERE
}
ammount=strlen((char *)&(handle->muscat_response.bcom));
if (handle->muscat_response.bcom[5]!=' ') {
printf("%s 5 was not space but [%d]\n",&handle->muscat_response.bcom,handle->muscat_response.bcom[5]);
return 1; // NEED TO RAISE ERROR HERE
}
handle->muscat_response.bcom[5]=0;
handle->muscat_response.type=handle->muscat_response.bcom[0];
// now read bcom[1-4] and turn to an int
clen=atoi(&(handle->muscat_response.bcom[1]))+1;
// now read length bytes in!
buf=emalloc(clen+1);
memset(buf,0,clen+1);
if (end=php_sock_fgets(buf, clen, handle->socketd)==NULL) {
ammount=(char *) end - (char *) (&(handle->muscat_response.bcom)) +1;
}
handle->muscat_response.p=buf;
handle->muscat_response.length=strlen(buf);
return 0;
}
void _net_discard(struct MuscatNet_handle * handle) {
while(handle->muscat_response.type!='P') {
if (0!=_net_muscat_get(handle)) break;
}
}
#endif /* HAVE_MUSCAT */

59
ext/muscat/muscat_net.h Normal file
View File

@@ -0,0 +1,59 @@
/*
+----------------------------------------------------------------------+
| Muscat/Empower 1.5 Module for PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 2000 Ananova Ltd |
| http://www.ananova.com |
| Ananova Ltd, PO Box 36, Leeds, LS11 5ZA, United Kingdom |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of the GNU General Public License |
| along with this program; if not, write to the Free Software |
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
| MA 02111-1307, USA. |
| |
| A copy is availble at http://www.gnu.org/copyleft/gpl.txt |
+----------------------------------------------------------------------+
| Author: Sam Liddicott <sam@ananova.com> |
+----------------------------------------------------------------------+
*/
#ifndef PHP_MUSCAT_NET_H
#define PHP_MUSCAT_NET_H
#if HAVE_MUSCAT
#include "../standard/fsock.h"
struct MuscatNet_handle {
struct Muscat_response muscat_response;
zval *socketr;
int socketd;
char buffer[1024];
};
int _net_muscat_close(struct MuscatNet_handle *handle);
int _net_muscat_give(struct MuscatNet_handle *handle, char* string);
int _net_muscat_get(struct MuscatNet_handle * handle);
void _net_discard(struct MuscatNet_handle * handle);
#endif
#endif /* PHP_MUSCAT_NET_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/

99
ext/muscat/php_muscat.h Normal file
View File

@@ -0,0 +1,99 @@
/*
+----------------------------------------------------------------------+
| Muscat/Empower 1.5 Module for PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 2000 Ananova Ltd |
| http://www.ananova.com |
| Ananova Ltd, PO Box 36, Leeds, LS11 5ZA, United Kingdom |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of the GNU General Public License |
| along with this program; if not, write to the Free Software |
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
| MA 02111-1307, USA. |
| |
| A copy is availble at http://www.gnu.org/copyleft/gpl.txt |
+----------------------------------------------------------------------+
| Author: Sam Liddicott <sam@ananova.com> |
+----------------------------------------------------------------------+
*/
#ifndef PHP_MUSCAT_H
#define PHP_MUSCAT_H
/* You should tweak config.m4 so this symbol (or some else suitable)
gets defined.
*/
#if HAVE_MUSCAT
#include <muscat.h>
#define MUSCAT_HANDLE_RESOURCE "muscat handle"
extern zend_module_entry muscat_module_entry;
#define phpext_muscat_ptr &muscat_module_entry
#ifdef PHP_WIN32
#define PHP_MUSCAT_API __declspec(dllexport)
#else
#define PHP_MUSCAT_API
#endif
PHP_MINIT_FUNCTION(muscat);
PHP_MSHUTDOWN_FUNCTION(muscat);
PHP_RINIT_FUNCTION(muscat);
PHP_RSHUTDOWN_FUNCTION(muscat);
PHP_MINFO_FUNCTION(muscat);
PHP_FUNCTION(muscat_setup);
PHP_FUNCTION(muscat_setup_net);
PHP_FUNCTION(muscat_give);
PHP_FUNCTION(muscat_get);
PHP_FUNCTION(muscat_close);
/*
Declare any global variables you may need between the BEGIN
and END macros here:
*/
ZEND_BEGIN_MODULE_GLOBALS(muscat)
ZEND_END_MODULE_GLOBALS(muscat)
/* In every function that needs to use variables in php_muscat_globals,
do call MUSCATLS_FETCH(); after declaring other variables used by
that function, and always refer to them as MUSCATG(variable).
You are encouraged to rename these macros something shorter, see
examples in any other php module directory.
*/
#ifdef ZTS
#define MUSCATG(v) (muscat_globals->v)
#define MUSCATLS_FETCH() php_muscat_globals *muscat_globals = ts_resource(muscat_globals_id)
#else
#define MUSCATG(v) (muscat_globals.v)
#define MUSCATLS_FETCH()
#endif
#else
#define phpext_muscat_ptr NULL
#endif
#endif /* PHP_MUSCAT_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/