Empty HEAD of domxml, hyperwave, xslt

This commit is contained in:
Sascha Schumann 2003-06-24 13:56:57 +00:00
parent 6b5b6079da
commit e1a9dd289a
51 changed files with 0 additions and 20930 deletions

View file

@ -1,2 +0,0 @@
domxml
Uwe Steinmann, Christian Stocker

View file

@ -1,5 +0,0 @@
this extension is experimental,
its functions may change their names
or move to extension all together
so do not rely to much on them
you have been warned!

View file

@ -1,23 +0,0 @@
1) Implement the following list entries and thier destructors:
le_domxmlnotationp
2) Use ZEND_FETCH_RESOURCE() macros instead of custom functions.
3) Implement those classes we really want, kill all of the rest.
4) Remove debug code (many calls to fprintf()).
5) Make 1st arg always be the object. This is currently half-and-half, or so.
6) Take a hard look at startup/shutdown code. This is really running slower than
it ought to be.
7) Fix the many, many memory leaks.
8) Modify new_child to allow creation of attribute, cdata, dtd, etc nodes.
9) implement schema support (libxml2 has it)
10) implement scheme handlers (like in ext/xslt), should be possible with xmlRegisterInputCallbacks
11) implement real sax support
- input (building of dom-tree with sax-events) is almost finished
- started with generating of sax-events from file/string (chregu)
- generating sax-events from dom-tree is a more tricky one (see mailinglist of libxml2)
12) error reporting for xslt methods
13) (DONE long time ago) add possibility to use relative xpath queries
14) implement $dom->free() for freeing documents from memory
15) implement get_element_by_tagname_ns (and improve namespace support in general)

View file

@ -1,129 +0,0 @@
dnl
dnl $Id$
dnl
AC_DEFUN(PHP_DOM_XSLT_CHECK_VERSION,[
old_CPPFLAGS=$CPPFLAGS
CPPFLAGS=-I$DOMXSLT_DIR/include
AC_MSG_CHECKING(for libxslt version)
AC_EGREP_CPP(yes,[
#include <libxslt/xsltconfig.h>
#if LIBXSLT_VERSION >= 10018
yes
#endif
],[
AC_MSG_RESULT(>= 1.0.18)
],[
AC_MSG_ERROR(libxslt version 1.0.18 or greater required.)
])
CPPFLAGS=$old_CPPFLAGS
])
AC_DEFUN(PHP_DOM_EXSLT_CHECK_VERSION,[
old_CPPFLAGS=$CPPFLAGS
CPPFLAGS=-I$DOMEXSLT_DIR/include
AC_MSG_CHECKING(for libexslt version)
AC_EGREP_CPP(yes,[
#include <libexslt/exsltconfig.h>
#if LIBEXSLT_VERSION >= 600
yes
#endif
],[
AC_MSG_RESULT(>= 1.0.18)
],[
AC_MSG_ERROR(libxslt version 1.0.18 or greater required.)
])
CPPFLAGS=$old_CPPFLAGS
])
PHP_ARG_WITH(dom, for old deprecated DOM support,
[ --with-dom[=DIR] Old deprecated DOM support (requires libxml >= 2.4.14).
DIR is the libxml install directory.])
if test "$PHP_DOM" != "no" -a "$PHP_DOM5" != "no"; then
AC_MSG_ERROR([Either use deprecated dom or new dom5 extension.])
fi
if test "$PHP_DOM" != "no"; then
PHP_LIBXML_DIR=$PHP_DOM
PHP_SETUP_LIBXML(DOMXML_SHARED_LIBADD, [
AC_DEFINE(HAVE_DOMXML,1,[ ])
PHP_NEW_EXTENSION(domxml, php_domxml.c, $ext_shared)
PHP_SUBST(DOMXML_SHARED_LIBADD)
], [
AC_MSG_ERROR([xml2-config not found. Please check your libxml2 installation.])
])
fi
PHP_ARG_WITH(dom-xslt, for DOM XSLT support,
[ --with-dom-xslt[=DIR] DOMXML: Include DOM XSLT support (requires libxslt >= 1.0.18).
DIR is the libxslt install directory.], no, no)
if test "$PHP_DOM_XSLT" != "no"; then
if test "$PHP_DOM" = "no"; then
AC_MSG_ERROR([DOMXSLT requires DOMXML. Use --with-dom[=DIR]])
fi
if test -r "$PHP_DOM_XSLT/include/libxslt/transform.h"; then
DOMXSLT_DIR=$PHP_DOM_XSLT
else
for i in $PHP_LIBXML_DIR /usr/local /usr; do
test -r $i/include/libxslt/transform.h && DOMXSLT_DIR=$i
done
fi
if test -z "$DOMXSLT_DIR"; then
AC_MSG_RESULT(not found)
AC_MSG_ERROR(Please reinstall the libxslt >= 1.0.18 distribution)
fi
PHP_DOM_XSLT_CHECK_VERSION
PHP_ADD_LIBRARY_WITH_PATH(xslt, $DOMXSLT_DIR/lib, DOMXML_SHARED_LIBADD)
PHP_ADD_INCLUDE($DOMXSLT_DIR/include)
if test -f $PHP_LIBXML_DIR/lib/libxsltbreakpoint.a -o -f $PHP_LIBXML_DIR/lib/libxsltbreakpoint.$SHLIB_SUFFIX_NAME; then
PHP_ADD_LIBRARY_WITH_PATH(xsltbreakpoint, $PHP_LIBXML_DIR/lib, DOMXML_SHARED_LIBADD)
fi
AC_DEFINE(HAVE_DOMXSLT,1,[ ])
fi
PHP_ARG_WITH(dom-exslt, for DOM EXSLT support,
[ --with-dom-exslt[=DIR] DOMXML: Include DOM EXSLT support (requires libxslt >= 1.0.18).
DIR is the libexslt install directory.], no, no)
if test "$PHP_DOM_EXSLT" != "no"; then
if test "$PHP_DOM" = "no"; then
AC_MSG_ERROR([DOMEXSLT requires DOMXML. Use --with-dom[=DIR]])
fi
if test "$PHP_DOM_XSLT" = "no"; then
AC_MSG_ERROR([DOMEXSLT requires DOMXSLT. Use --with-dom-xslt[=DIR]])
fi
if test -r $PHP_DOM_EXSLT/include/libexslt/exslt.h; then
DOMEXSLT_DIR=$PHP_DOM_EXSLT
else
for i in $PHP_LIBXML_DIR /usr/local /usr; do
test -r $i/include/libexslt/exslt.h && DOMEXSLT_DIR=$i
done
fi
if test -z "$DOMEXSLT_DIR"; then
AC_MSG_RESULT(not found)
AC_MSG_ERROR(Please reinstall the libxslt >= 1.0.18 distribution)
fi
PHP_DOM_EXSLT_CHECK_VERSION
PHP_ADD_LIBRARY_WITH_PATH(exslt, $DOMEXSLT_DIR/lib, DOMXML_SHARED_LIBADD)
PHP_ADD_INCLUDE($DOMEXSLT_DIR/include)
AC_DEFINE(HAVE_DOMEXSLT,1,[ ])
PHP_SUBST(DOMXML_SHARED_LIBADD)
fi

View file

@ -1,114 +0,0 @@
# Microsoft Developer Studio Project File - Name="domxml" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=domxml - Win32 Release_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 "domxml.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 "domxml.mak" CFG="domxml - Win32 Release_TS"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "domxml - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "domxml - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "domxml - Win32 Release_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release_TS"
# PROP BASE Intermediate_Dir "Release_TS"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release_TS"
# PROP Intermediate_Dir "Release_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_DOMXML" /D ZTS=1 /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DOMXML_EXPORTS" /D "COMPILE_DL_DOMXML" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DOMXML=1 /D HAVE_DOMXSLT=1 /D LIBXML_THREAD_ENABLED=1 /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x406 /d "NDEBUG"
# ADD RSC /l 0x406 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
# ADD LINK32 wsock32.lib php4ts.lib libxml2.lib libxslt.lib iconv.lib resolv.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 /dll /machine:I386 /out:"..\..\Release_TS/php_domxml.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\bindlib_w32\Release" /libpath:"..\..\..\php_build\lib\libxslt"
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "domxml - Win32 Debug_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Debug_TS"
# PROP BASE Intermediate_Dir "Debug_TS"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Debug_TS"
# PROP Intermediate_Dir "Debug_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "mssql-70" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_DOMXML" /D ZTS=1 /YX /FD /c
# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DOMXML_EXPORTS" /D "COMPILE_DL_DOMXML" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DOMXML=1 /D HAVE_DOMXSLT=1 /D LIBXML_THREAD_ENABLED=1 /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x406 /d "NDEBUG"
# ADD RSC /l 0x406 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
# ADD LINK32 php4ts_debug.lib libxml2.lib libxslt.lib iconv.lib resolv.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 /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_domxml.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\bindlib_w32\Release" /libpath:"..\..\..\php_build\lib\libxslt"
!ENDIF
# Begin Target
# Name "domxml - Win32 Release_TS"
# Name "domxml - Win32 Debug_TS"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\php_domxml.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\php_domxml.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

File diff suppressed because it is too large Load diff

View file

@ -1,253 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Uwe Steinmann (Uwe.Steinmann@fernuni-hagen.de |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_DOMXML_H
#define PHP_DOMXML_H
#if HAVE_DOMXML
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
#include <libxml/tree.h>
#include <libxml/xmlerror.h>
#include <libxml/xinclude.h>
#if defined(LIBXML_HTML_ENABLED)
#include <libxml/HTMLparser.h>
#include <libxml/HTMLtree.h>
#endif
#if defined(LIBXML_XPATH_ENABLED)
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#endif
#if defined(LIBXML_XPTR_ENABLED)
#include <libxml/xpointer.h>
#endif
#if HAVE_DOMXSLT
#include <libxslt/xsltconfig.h>
#include <libxslt/xsltInternals.h>
#include <libxslt/xsltutils.h>
#include <libxslt/transform.h>
#if HAVE_DOMEXSLT
#include <libexslt/exslt.h>
#include <libexslt/exsltconfig.h>
#endif
#endif
/* DOMXML API_VERSION, please bump it up, if you change anything in the API
therefore it's easier for the script-programmers to check, what's working how
Can be checked with phpversion("domxml");
*/
#define DOMXML_API_VERSION "20030407"
extern zend_module_entry domxml_module_entry;
#define domxml_module_ptr &domxml_module_entry
#ifdef PHP_WIN32
#ifdef PHPAPI
#undef PHPAPI
#endif
#ifdef DOMXML_EXPORTS
#define PHPAPI __declspec(dllexport)
#else
#define PHPAPI __declspec(dllimport)
#endif /* DOMXML_EXPORTS */
#endif /* PHP_WIN32 */
PHPAPI zval *php_domobject_new(xmlNodePtr obj, int *found, zval* in TSRMLS_DC);
/* directory functions */
PHP_MINIT_FUNCTION(domxml);
PHP_MSHUTDOWN_FUNCTION(domxml);
PHP_MINFO_FUNCTION(domxml);
PHP_FUNCTION(domxml_version);
PHP_FUNCTION(xmldoc);
PHP_FUNCTION(xmldocfile);
#if defined(LIBXML_HTML_ENABLED)
PHP_FUNCTION(html_doc);
PHP_FUNCTION(html_doc_file);
#endif
PHP_FUNCTION(domxml_xmltree);
PHP_FUNCTION(domxml_new_xmldoc);
PHP_FUNCTION(domxml_substitute_entities_default);
/* Class Document methods */
PHP_FUNCTION(domxml_doc_doctype);
PHP_FUNCTION(domxml_doc_implementation);
PHP_FUNCTION(domxml_doc_create_element);
PHP_FUNCTION(domxml_doc_create_element_ns);
PHP_FUNCTION(domxml_doc_create_text_node);
PHP_FUNCTION(domxml_doc_create_comment);
PHP_FUNCTION(domxml_doc_create_processing_instruction);
PHP_FUNCTION(domxml_doc_create_document_fragment);
PHP_FUNCTION(domxml_doc_create_attribute);
PHP_FUNCTION(domxml_doc_create_cdata_section);
PHP_FUNCTION(domxml_doc_create_entity_reference);
PHP_FUNCTION(domxml_doc_imported_node);
PHP_FUNCTION(domxml_doc_add_root);
PHP_FUNCTION(domxml_doc_document_element);
PHP_FUNCTION(domxml_doc_set_root);
PHP_FUNCTION(domxml_intdtd);
PHP_FUNCTION(domxml_doc_ids);
PHP_FUNCTION(domxml_dump_mem);
PHP_FUNCTION(domxml_dump_mem_file);
PHP_FUNCTION(domxml_dump_node);
PHP_FUNCTION(domxml_doc_validate);
PHP_FUNCTION(domxml_doc_xinclude);
PHP_FUNCTION(domxml_doc_free_doc);
#if defined(LIBXML_HTML_ENABLED)
PHP_FUNCTION(domxml_html_dump_mem);
#endif
/* Class DocumentType methods */
PHP_FUNCTION(domxml_doctype_name);
PHP_FUNCTION(domxml_doctype_entities);
PHP_FUNCTION(domxml_doctype_notations);
PHP_FUNCTION(domxml_doctype_public_id);
PHP_FUNCTION(domxml_doctype_system_id);
PHP_FUNCTION(domxml_doctype_internal_subset);
/* Class Notation methods */
PHP_FUNCTION(domxml_notation_public_id);
PHP_FUNCTION(domxml_notation_system_id);
/* Class Node methods */
PHP_FUNCTION(domxml_node_attributes);
PHP_FUNCTION(domxml_node_children);
PHP_FUNCTION(domxml_node_first_child);
PHP_FUNCTION(domxml_node_last_child);
PHP_FUNCTION(domxml_node_next_sibling);
PHP_FUNCTION(domxml_node_previous_sibling);
PHP_FUNCTION(domxml_node_owner_document);
PHP_FUNCTION(domxml_node_insert_before);
PHP_FUNCTION(domxml_node_append_sibling);
PHP_FUNCTION(domxml_node_append_child);
PHP_FUNCTION(domxml_node_remove_child);
PHP_FUNCTION(domxml_node_replace_child);
PHP_FUNCTION(domxml_node_has_attributes);
PHP_FUNCTION(domxml_node_has_child_nodes);
PHP_FUNCTION(domxml_node_parent);
PHP_FUNCTION(domxml_node_prefix);
PHP_FUNCTION(domxml_node_namespace_uri);
PHP_FUNCTION(domxml_node_add_namespace);
PHP_FUNCTION(domxml_node_set_namespace);
PHP_FUNCTION(domxml_node);
PHP_FUNCTION(domxml_clone_node);
PHP_FUNCTION(domxml_node_unlink_node);
PHP_FUNCTION(domxml_node_replace_node);
PHP_FUNCTION(domxml_node_new_child);
PHP_FUNCTION(domxml_node_set_content);
PHP_FUNCTION(domxml_node_get_content);
PHP_FUNCTION(domxml_node_text_concat);
PHP_FUNCTION(domxml_node_set_name);
PHP_FUNCTION(domxml_node_get_path);
PHP_FUNCTION(domxml_node_name);
PHP_FUNCTION(domxml_node_type);
PHP_FUNCTION(domxml_node_value);
PHP_FUNCTION(domxml_is_blank_node);
/* Class Attribute methods */
PHP_FUNCTION(domxml_attr_name);
PHP_FUNCTION(domxml_attr_value);
PHP_FUNCTION(domxml_attr_specified);
PHP_FUNCTION(domxml_attr_set_value);
/* Class Element methods */
PHP_FUNCTION(domxml_elem_tagname);
PHP_FUNCTION(domxml_elem_get_attribute);
PHP_FUNCTION(domxml_elem_set_attribute);
PHP_FUNCTION(domxml_elem_remove_attribute);
PHP_FUNCTION(domxml_elem_get_attribute_node);
PHP_FUNCTION(domxml_elem_set_attribute_node);
PHP_FUNCTION(domxml_elem_get_elements_by_tagname);
PHP_FUNCTION(domxml_elem_has_attribute);
/* Class CData methods */
PHP_FUNCTION(domxml_cdata_length);
/* Class Notation methods */
PHP_FUNCTION(domxml_notation_public_id);
PHP_FUNCTION(domxml_notation_system_id);
/* Class Entity methods */
PHP_FUNCTION(domxml_entity_public_id);
PHP_FUNCTION(domxml_entity_system_id);
PHP_FUNCTION(domxml_entity_notation_name);
/* Class ProcessingInstructions methods*/
PHP_FUNCTION(domxml_pi_target);
PHP_FUNCTION(domxml_pi_data);
/* Class DocumentFragment methods */
PHP_FUNCTION(domxml_document_fragment_open_mem);
/* Class Parser methods */
PHP_FUNCTION(domxml_parser);
PHP_FUNCTION(domxml_parser_add_chunk);
PHP_FUNCTION(domxml_parser_end);
PHP_FUNCTION(domxml_parser_set_keep_blanks);
PHP_FUNCTION(domxml_parser_start_element);
PHP_FUNCTION(domxml_parser_end_element);
PHP_FUNCTION(domxml_parser_characters);
PHP_FUNCTION(domxml_parser_entity_reference);
PHP_FUNCTION(domxml_parser_comment);
PHP_FUNCTION(domxml_parser_cdata_section);
PHP_FUNCTION(domxml_parser_namespace_decl);
PHP_FUNCTION(domxml_parser_processing_instruction);
PHP_FUNCTION(domxml_parser_start_document);
PHP_FUNCTION(domxml_parser_end_document);
PHP_FUNCTION(domxml_parser_get_document);
/* Class XPathContext methods */
#if defined(LIBXML_XPATH_ENABLED)
PHP_FUNCTION(xpath_init);
PHP_FUNCTION(xpath_new_context);
PHP_FUNCTION(xpath_eval);
PHP_FUNCTION(xpath_eval_expression);
PHP_FUNCTION(xpath_register_ns);
PHP_FUNCTION(xpath_register_ns_auto);
PHP_FUNCTION(domxml_doc_get_elements_by_tagname);
PHP_FUNCTION(domxml_doc_get_element_by_id);
#endif
#if defined(LIBXML_XPTR_ENABLED)
PHP_FUNCTION(xptr_new_context);
PHP_FUNCTION(xptr_eval);
#endif
PHP_FUNCTION(domxml_test);
/* DOMXSLT functions */
#if HAVE_DOMXSLT
PHP_FUNCTION(domxml_xslt_stylesheet);
PHP_FUNCTION(domxml_xslt_stylesheet_doc);
PHP_FUNCTION(domxml_xslt_stylesheet_file);
PHP_FUNCTION(domxml_xslt_process);
PHP_FUNCTION(domxml_xslt_result_dump_mem);
PHP_FUNCTION(domxml_xslt_result_dump_file);
PHP_FUNCTION(domxml_xslt_version);
#endif
typedef struct {
zval *errors;
xmlValidCtxtPtr valid;
xmlParserCtxtPtr parser;
} domxml_ErrorCtxt;
#else
#define domxml_module_ptr NULL
#endif /* HAVE_DOMXML */
#define phpext_domxml_ptr domxml_module_ptr
#endif /* _PHP_DIR_H */

View file

@ -1,273 +0,0 @@
--TEST--
Test 1: Accessing single node
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once("domxml_test.inc");
echo "Test 1: accessing single nodes from php\n";
$dom = xmldoc($xmlstr);
if(!$dom) {
echo "Error while parsing the document\n";
exit;
}
// children() of of document would result in a memleak
//$children = $dom->children();
//print_node_list($children);
echo "--------- root\n";
$rootnode = $dom->root();
print_node($rootnode);
echo "--------- children of root\n";
$children = $rootnode->children();
print_node_list($children);
// The last node should be identical with the last entry in the children array
echo "--------- last\n";
$last = $rootnode->last_child();
print_node($last);
// The parent of this last node is the root again
echo "--------- parent\n";
$parent = $last->parent();
print_node($parent);
// The children of this parent are the same children as one above
echo "--------- children of parent\n";
$children = $parent->children();
print_node_list($children);
echo "--------- creating a new attribute\n";
//This is worthless
//$attr = $dom->create_attribute("src", "picture.gif");
//print_r($attr);
//$rootnode->set_attribute_node($attr); /* Not implemented */
$attr = $rootnode->set_attribute("src", "picture.gif");
$attr = $rootnode->get_attribute("src");
print_r($attr);
print "\n";
echo "--------- Get Attribute Node\n";
$attr = $rootnode->get_attribute_node("src");
print_node($attr);
echo "--------- Remove Attribute Node\n";
$attr = $rootnode->remove_attribute("src");
print "Removed " . $attr . " attributes.\n";
echo "--------- attributes of rootnode\n";
$attrs = $rootnode->attributes();
print_node_list($attrs);
echo "--------- children of an attribute\n";
$children = $attrs[0]->children();
print_node_list($children);
echo "--------- Add child to root\n";
$newchild = $rootnode->new_child("Silly", "Symphony");
print_node($newchild);
print $dom->dumpmem();
print "\n";
echo "--------- Find element by tagname\n";
echo " Using dom\n";
$children = $dom->get_elements_by_tagname("Silly");
print_node_list($children);
echo " Using elem\n";
$children = $rootnode->get_elements_by_tagname("Silly");
print_node_list($children);
echo "--------- Unlink Node\n";
print_node($children[0]);
//domxml_node_unlink_node($children[0]);
$children[0]->unlink_node();
print_node_list($rootnode->children());
print $dom->dumpmem();
echo "--------- Find element by id\n";
print ("Not implemented\n");
echo "--------- Check various node_name return values\n";
print ("Not needed\n");
?>
--EXPECT--
Test 1: accessing single nodes from php
--------- root
Node Name: chapter
Node Type: 1
Num Children: 4
--------- children of root
Node Name: title
Node Type: 1
Num Children: 1
Node Content: Title
Node Name: #text
Node Type: 3
Num Children: 0
Node Content:
Node Name: para
Node Type: 1
Num Children: 7
Node Name: #text
Node Type: 3
Num Children: 0
Node Content:
--------- last
Node Name: #text
Node Type: 3
Num Children: 0
Node Content:
--------- parent
Node Name: chapter
Node Type: 1
Num Children: 4
--------- children of parent
Node Name: title
Node Type: 1
Num Children: 1
Node Content: Title
Node Name: #text
Node Type: 3
Num Children: 0
Node Content:
Node Name: para
Node Type: 1
Num Children: 7
Node Name: #text
Node Type: 3
Num Children: 0
Node Content:
--------- creating a new attribute
picture.gif
--------- Get Attribute Node
Node Name: src
Node Type: 2
Num Children: 1
Node Content: picture.gif
--------- Remove Attribute Node
Removed 1 attributes.
--------- attributes of rootnode
Node Name: language
Node Type: 2
Num Children: 1
Node Content: en
--------- children of an attribute
Node Name: #text
Node Type: 3
Num Children: 0
Node Content: en
--------- Add child to root
Node Name: Silly
Node Type: 1
Num Children: 1
Node Content: Symphony
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE chapter SYSTEM "/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd" [
<!ENTITY sp "spanish">
]>
<!-- lsfj -->
<chapter language="en"><title language="en">Title</title>
<para language="ge">
&sp;
<!-- comment -->
<informaltable language="&sp;kkk">
<tgroup cols="3">
<tbody>
<row><entry>a1</entry><entry morerows="1">b1</entry><entry>c1</entry></row>
<row><entry>a2</entry><entry>c2</entry></row>
<row><entry>a3</entry><entry>b3</entry><entry>c3</entry></row>
</tbody>
</tgroup>
</informaltable>
</para>
<Silly>Symphony</Silly></chapter>
--------- Find element by tagname
Using dom
Node Name: Silly
Node Type: 1
Num Children: 1
Node Content: Symphony
Using elem
Node Name: Silly
Node Type: 1
Num Children: 1
Node Content: Symphony
--------- Unlink Node
Node Name: Silly
Node Type: 1
Num Children: 1
Node Content: Symphony
Node Name: title
Node Type: 1
Num Children: 1
Node Content: Title
Node Name: #text
Node Type: 3
Num Children: 0
Node Content:
Node Name: para
Node Type: 1
Num Children: 7
Node Name: #text
Node Type: 3
Num Children: 0
Node Content:
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE chapter SYSTEM "/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd" [
<!ENTITY sp "spanish">
]>
<!-- lsfj -->
<chapter language="en"><title language="en">Title</title>
<para language="ge">
&sp;
<!-- comment -->
<informaltable language="&sp;kkk">
<tgroup cols="3">
<tbody>
<row><entry>a1</entry><entry morerows="1">b1</entry><entry>c1</entry></row>
<row><entry>a2</entry><entry>c2</entry></row>
<row><entry>a3</entry><entry>b3</entry><entry>c3</entry></row>
</tbody>
</tgroup>
</informaltable>
</para>
</chapter>
--------- Find element by id
Not implemented
--------- Check various node_name return values
Not needed

View file

@ -1,31 +0,0 @@
--TEST--
Test 2: Memleak in accessing children() of document.
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once("domxml_test.inc");
$dom = xmldoc($xmlstr);
if(!$dom) {
die('Error while parsing the document');
}
$children = $dom->children();
print_node_list($children);
?>
--EXPECT--
Node Name:
Node Type: 14
Num Children: 1
Node Content:
Node Name: #comment
Node Type: 8
Num Children: 0
Node Content: lsfj
Node Name: chapter
Node Type: 1
Num Children: 4

View file

@ -1,42 +0,0 @@
<?PHP
$xmlstr = "<?xml version='1.0' standalone='yes'?>
<!DOCTYPE chapter SYSTEM '/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd'
[ <!ENTITY sp \"spanish\">
]>
<!-- lsfj -->
<chapter language='en'><title language='en'>Title</title>
<para language='ge'>
&sp;
<!-- comment -->
<informaltable language='&sp;kkk'>
<tgroup cols='3'>
<tbody>
<row><entry>a1</entry><entry morerows='1'>b1</entry><entry>c1</entry></row>
<row><entry>a2</entry><entry>c2</entry></row>
<row><entry>a3</entry><entry>b3</entry><entry>c3</entry></row>
</tbody>
</tgroup>
</informaltable>
</para>
</chapter> ";
function print_node($node)
{
print "Node Name: " . $node->node_name();
print "\nNode Type: " . $node->node_type();
print "\nNum Children: " . count($node->children());
if(count($node->children()) <= 1){
print "\nNode Content: " . $node->get_content();
}
print "\n\n";
}
function print_node_list($nodelist)
{
foreach($nodelist as $node)
{
print_node($node);
}
}
?>

View file

@ -1,3 +0,0 @@
<?php
if (!extension_loaded('domxml')) die('skip domxml extension not available');
?>

View file

@ -1,35 +0,0 @@
--TEST--
xmldoc()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once("domxml_test.inc");
$dom = xmldoc($xmlstr);
if(!$dom) {
die('Error while parsing the document');
}
var_dump($dom);
?>
--EXPECTF--
object(domdocument)#%d (9) {
["name"]=>
string(9) "#document"
["url"]=>
string(0) ""
["version"]=>
string(3) "1.0"
["standalone"]=>
int(1)
["type"]=>
int(9)
["compression"]=>
int(-1)
["charset"]=>
int(1)
[0]=>
int(5)
[1]=>
int(%d)
}

View file

@ -1,2 +0,0 @@
HyperWave
Uwe Steinmann

View file

@ -1,20 +0,0 @@
dnl
dnl $Id$
dnl
AC_MSG_CHECKING(for Hyperwave support)
AC_ARG_WITH(hyperwave,
[ --with-hyperwave Include Hyperwave support],
[
if test "$withval" != "no"; then
AC_DEFINE(HYPERWAVE,1,[ ])
AC_MSG_RESULT(yes)
PHP_NEW_EXTENSION(hyperwave, hw.c hg_comm.c)
else
AC_DEFINE(HYPERWAVE,0,[ ])
AC_MSG_RESULT(no)
fi
],[
AC_DEFINE(HYPERWAVE,0,[ ])
AC_MSG_RESULT(no)
])

View file

@ -1,206 +0,0 @@
/****************************************************************************
*
* Copyright (C) 1991 Kendall Bennett.
* All rights reserved.
*
* Filename: $RCSfile$
* Version: $Revision$
*
* Language: ANSI C
* Environment: any
*
* Description: General header file for portable code.
*
* $Id$
*
* Revision History:
* -----------------
*
* $Log$
* Revision 1.2 2000/07/02 23:46:41 sas
* Change header protection macros to conform to standard.
*
* Draft 3 of IEEE 1003.1 200x, "2.2 The Compilation Environment"
*
* All identifiers that begin with an underscore and either an uppercase
* letter or another underscore are always reserved for any use by the
* implementation.
*
* Revision 1.1 1999/04/21 23:37:47 ssb
* moved db
*
* Revision 1.1.1.1 1999/04/07 21:03:29 zeev
* PHP 4.0
*
* Revision 1.1.1.1 1999/03/17 04:29:10 andi
* PHP4
*
* Revision 1.1.1.1 1998/12/21 07:56:22 andi
* Trying to start the zend CVS tree
*
* Revision 1.1 1998/08/12 09:29:16 steinm
* First version of Hyperwave module.
*
* Revision 1.6 92/03/15 12:51:48 kjb
* Added MK_FP macro and ushort typedef.
*
* Revision 1.5 91/10/28 03:17:33 kjb
* Ported to the Iris.
*
* Revision 1.4 91/09/26 15:29:02 kjb
* Added stuff for the SGI Iris 4D.
*
* Revision 1.3 91/09/26 10:07:04 kjb
* Added general typedef stuff.
*
* Revision 1.2 91/09/03 18:19:14 ROOT_DOS
* Added a few defines that are supplied by <dir.h> for UNIX compatibility.
*
* Revision 1.1 91/08/16 13:19:06 ROOT_DOS
* Initial revision
*
****************************************************************************/
#ifndef DEBUG_H
#define DEBUG_H
#ifdef DEBUG
# define D(x) x
#else
# define D(x)
#endif
#define PRIVATE static
#define PUBLIC
#ifdef __MSDOS__ /* Compiling for MSDOS */
# define MS(x) x
# define UX(x)
# define IR(x)
# define _8086 /* We know we have an 8086 type processor */
#if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
# define LDATA
# define NULL 0L
#else
# define NULL 0
#endif
#else __MSDOS__
#ifdef __IRIS4D__ /* Compiling for the SGI Iris 4D */
# define MS(x)
# define UX(x) x /* The Iris is a UNIX machine */
# define IR(x) x
# define O_BINARY 0 /* no binary input mode in UNIX open() */
# define MAXFILE 255 /* These are defined in <dir.h>, but */
# define MAXDIR 255 /* on UNIX machines, we just define */
# define MAXPATH 255 /* them all to be the same size */
# define far /* Near and far do not exist under */
# define near /* UNIX or the Iris. */
# define NULL ((void *)0)
#else __IRIS4D__ /* Assume UNIX compilation */
# define MS(x)
# define UX(x) x
# define IR(x)
# define O_BINARY 0 /* no binary input mode in UNIX open() */
# define MAXFILE 255 /* These are defined in <dir.h>, but */
# define MAXDIR 255 /* on UNIX machines, we just define */
# define MAXPATH 255 /* them all to be the same size */
# define far /* Near and far do not exist under */
# define near /* UNIX or the Iris. */
# ifndef NULL
# define NULL ((void *)0)
# endif
#endif __IRIS4D__
#endif __MSDOS__
/****************************************************************************
*
* SEG(p) Evaluates to the segment portion of an 8086 address.
* OFF(p) Evaluates to the offset portion of an 8086 address.
* FP(s,o) Creates a far pointer given a segment offset pair.
* PHYS(p) Evaluates to a long holding a physical address
*
****************************************************************************/
#ifdef _8086
# define SEG(p) ( ((unsigned *)&(void far *)(p))[1] )
# define OFF(p) ( (unsigned)(p) )
# define FP(s,o) ( (void far *)( ((unsigned long)s << 16) + \
(unsigned long)o ))
# define PHYS(p) ( (unsigned long)OFF(p) + \
((unsigned long)SEG(p) << 4))
#else
# define PHYS(p) (p)
#endif _8086
/****************************************************************************
*
* NUMELE(array) Evaluates to the array size in elements
* LASTELE(array) Evaluates to a pointer to the last element
* INBOUNDS(array,p) Evaluates to true if p points into the array
* RANGE(a,b,c) Evaluates to true if a <= b <= c
* max(a,b) Evaluates to a or b, whichever is larger
* min(a,b) Evaluates to a or b, whichever is smaller
* ABS(a) Evaluates to the absolute value of a
* NBITS(type) Returns the number of bits in a variable of the
* indicated type
* MAXINT Evaluates to the value of the largest signed integer
*
****************************************************************************/
#define NUMELE(a) (sizeof(a)/sizeof(*(a)))
#define LASTELE(a) ((a) + (NUMELE(a)-1))
#ifdef LDATA
#define TOOHIGH(a, p) ((long)PHYS(p) - (long)PHYS(a) > (long)(NUMELE(a)-1))
#define TOOLOW(a, p) ((long)PHYS(p) - (long)PHYS(a) < 0)
#else
#define TOOHIGH(a, p) ((long)(p) - (long)(a) > (long)(NUMELE(a)-1))
#define TOOLOW(a, p) ((long)(p) - (long)(a) < 0)
#endif
#define INBOUNDS(a, p) ( ! (TOOHIGH(a, p) || TOOLOW(a, p)) )
#define _IS(t, x) (((t)1 << (x)) != 0) /* Evaluates true if the width of */
/* variable of type t is < x. */
/* The != 0 assures that the */
/* answer is 1 or 0 */
#define NBITS(t) (4 * (1 + _IS(t, 4) + _IS(t, 8) + _IS(t, 12) + _IS(t, 16) \
+ _IS(t, 20) + _IS(t, 24) + _IS(t, 28) + _IS(t, 32)))
#define MAXINT (((unsigned)~0) >> 1)
#ifndef MAX
# define MAX(a, b) ( ((a) > (b)) ? (a) : (b))
#endif
#ifndef MIN
# define MIN(a, b) ( ((a) < (b)) ? (a) : (b))
#endif
#ifndef ABS
# define ABS(a) ((a) >= 0 ? (a) : -(a))
#endif
#define RANGE(a, b, c) ( (a) <= (b) && (b) <= (c) )
/* General typedefs */
#ifndef __GENDEFS
#define __GENDEFS
typedef void *ptr;
typedef void near *nearptr;
typedef void far *farptr;
/*typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;*/
typedef int bool;
#endif __GENDEFS
/* Boolean truth values */
#define false 0
#define true 1
#define FALSE 0
#define TRUE 1
#define NO 0
#define YES 1
#endif /* DEBUG_H */

File diff suppressed because it is too large Load diff

View file

@ -1,238 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Rasmus Lerdorf <rasmus@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef HG_COMM_H
#define HG_COMM_H
#if HYPERWAVE
#define newlist
#include "hw_error.h"
#ifdef newlist
#else
#include "dlist.h"
#endif
#define HG_SERVER_PORT 418
#define F_DISTRIBUTED 0x80000000
#define F_COMPRESSED 0x40000000
#define F_VERSION 0x00003fff
#define HW_VERSION 717L /* 7.17 */
#define HEADER_LENGTH 12
#define STAT_COMMAND_STR "stat"
#define WHO_COMMAND_STR "who"
#define STAT_COMMAND 1
#define WHO_COMMAND 2
#define GETDOCBYANCHOR_MESSAGE 2
#define GETCHILDCOLL_MESSAGE 3
#define GETPARENT_MESSAGE 4
#define GETCHILDDOCCOLL_MESSAGE 5
#define GETOBJECT_MESSAGE 7
#define GETANCHORS_MESSAGE 8
#define GETOBJBYQUERY_MESSAGE 9
#define GETOBJBYQUERYCOLL_MESSAGE 10
#define OBJECTBYIDQUERY_MESSAGE 11
#define GETTEXT_MESSAGE 12
#define INSDOC_MESSAGE 14
#define INSCOLL_MESSAGE 17
#define GETSRCBYDEST_MESSAGE 19
#define MVCPDOCSCOLL_MESSAGE 22
#define MVCPCOLLSCOLL_MESSAGE 23
#define IDENTIFY_MESSAGE 24
#define READY_MESSAGE 25
#define COMMAND_MESSAGE 26
#define CHANGEOBJECT_MESSAGE 27
#define EDITTEXT_MESSAGE 28
#define GETANDLOCK_MESSAGE 29
#define UNLOCK_MESSAGE 30
#define INCOLLECTIONS_MESSAGE 31
#define INSERTOBJECT_MESSAGE 32
#define GETOBJBYFTQUERY_MESSAGE 34
#define GETOBJBYFTQUERYCOLL_MESSAGE 35
#define PIPEDOCUMENT_MESSAGE 36
#define DELETEOBJECT_MESSAGE 37
#define PUTDOCUMENT_MESSAGE 38
#define GETREMOTE_MESSAGE 39
#define GETREMOTECHILDREN_MESSAGE 40
#define HG_MAPID 43
#define CHILDREN_MESSAGE 44
#define GETCGI_MESSAGE 45
#define PIPECGI_MESSAGE 46
#define HW_DEFAULT_LINK 0
#define HW_IMAGE_LINK 1
#define HW_BACKGROUND_LINK 2
#define HW_INTAG_LINK 3
#define HW_APPLET_LINK 4
#define HW_INTAGNODEL_LINK 5
#define COPY 0
#define MOVE 1
#define DOCUMENT 0
#define COLLECTION 1
#ifdef PHP_WIN32
# define SOCK_ERR INVALID_SOCKET
# define SOCK_CONN_ERR SOCKET_ERROR
# define HWSOCK_FCLOSE(s) closesocket(s)
#else
# define SOCK_ERR -1
# define SOCK_CONN_ERR -1
# define HWSOCK_FCLOSE(s) close(s)
#endif
/* Low error messages */
#define LE_MALLOC -1
typedef struct {
int id; /* object ID of anchor */
int tanchor; /* Type of anchor. Can be 1=Src, 2=Dest */
int start; /* start of anchor */
int end; /* end of anchor */
char *nameanchor; /* name tag attribute of destination document */
/* if anchor is of type Src the following are used as well */
char *destdocname; /* name of destination document */
char *link; /* url for external destination */
int linktype; /* type of link. see above */
char *tagattr; /* more attributes of tag, like Border=0 */
char *htmlattr; /* */
char *codebase; /* codebase of applet */
char *code; /* code of applet */
char *fragment; /* name link of Src */
/* if anchor is of type Dest the following are used as well */
char *keyword; /* name link of Dest */
} ANCHOR;
typedef struct {
int length;
int version_msgid;
int msg_type;
char *buf;
} hg_msg;
typedef struct {
int socket;
int swap_on;
int version;
char *server_string;
char *hostname;
char *username;
int lasterror;
int linkroot;
} hw_connection;
typedef int hw_objectID;
typedef char hw_objrec;
typedef float hw_float;
#ifdef newlist
void fnDeleteAnchor(void *ptr1);
void fnListAnchor(zend_llist *pAnchorList);
zend_llist *fnCreateAnchorList(hw_objectID objID, char **anchors, char **docofanchorrec, char **reldestrec, int ancount, int anchormode);
char *fnInsAnchorsIntoText(char *text, zend_llist *pAnchorList, char **bodytag, char **urlprefix);
int fnCmpAnchors(const void *e1, const void *e2 TSRMLS_DC);
ANCHOR *fnAddAnchor(zend_llist *pAnchorList, int objectID, int start, int end);
#else
void fnDeleteAnchor(ANCHOR *ptr);
void fnListAnchor(DLIST *pAnchorList);
DLIST *fnCreateAnchorList(hw_objectID objID, char **anchors, char **docofanchorrec, char **reldestrec, int ancount, int anchormode);
char *fnInsAnchorsIntoText(char *text, DLIST *pAnchorList, char **bodytag, char **urlprefix);
int fnCmpAnchors(ANCHOR *a1, ANCHOR *a2 TSRMLS_DC);
ANCHOR *fnAddAnchor(DLIST *pAnchorList, int objectID, int start, int end);
#endif
extern void set_swap(int do_swap);
extern int open_hg_connection(char *server_name, int port);
extern void close_hg_connection(int sockfd);
extern int initialize_hg_connection(int sockfd, int *do_swap, int *version, char **userdata, char **server_string, char *username, char *password);
extern int send_ready(int sockfd);
extern int send_command(int sockfd, int command, char **answer);
extern hg_msg *recv_hg_msg(int sockfd);
extern hg_msg *recv_ready(int sockfd);
extern hg_msg *recv_command(int sockfd);
extern char *fnInsStr(char *str, int pos, char *insstr);
extern int fnAttributeCompare(char *object, char *attrname, char *value);
extern char *fnAttributeValue(char *object, char *attrname);
extern int getrellink(int sockfd, int rootID, int thisID, int destID, char **reldesstr);
extern int send_deleteobject(int sockfd, hw_objectID objectID);
extern int send_changeobject(int sockfd, hw_objectID objectID, char *mod);
extern int send_groupchangeobject(int sockfd, hw_objectID objectID, char *mod);
extern int send_getobject(int sockfd, hw_objectID objectID, char **attributes);
extern int send_getandlock(int sockfd, hw_objectID objectID, char **attributes);
extern int send_lock(int sockfd, hw_objectID objectID);
extern int send_unlock(int sockfd, hw_objectID objectID);
extern int send_gettext(int sockfd, hw_objectID objectID, int mode, int rootid, char **objattr, char **bodytag, char **text, int *count, char *urlprefix);
extern int send_edittext(int sockfd, char *objattr, char *text);
extern int send_getcgi(int sockfd, hw_objectID objectID, char *cgi_env_str, char **objattr, char **text, int *count);
extern int send_getremote(int sockfd, hw_objectID objectID, char **objattr, char **text, int *count);
extern int send_getremotechildren(int sockfd, char *attributes, char **text, int **childIDs, int *count);
extern int send_docbyanchor(int sockfd, hw_objectID objectID, hw_objectID *anchorID);
extern int send_docbyanchorobj(int sockfd, hw_objectID objectID, char **objrec);
extern int send_mvcpdocscollscoll(int sockfd, hw_objectID *objectIDs, int count, int from, int dest, int cpmv, int docscoll);
extern int send_childrenobj(int sockfd, hw_objectID objectID, char ***childrec, int *count);
extern int send_getchildcoll(int sockfd, int objectID, hw_objectID **childIDs, int *count);
extern int send_getchildcollobj(int sockfd, hw_objectID objectID, hw_objrec ***childrec, int *count);
extern int send_getchilddoccoll(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count);
extern int send_getchilddoccollobj(int sockfd, hw_objectID objectID, hw_objrec ***childrec, int *count);
extern int send_getanchors(int sockfd, hw_objectID objectID, hw_objectID **anchorIDs, int *count);
extern int send_getanchorsobj(int sockfd, hw_objectID objectID, char ***childrec, int *count);
extern int send_objectbyidquery(int sockfd, hw_objectID *IDs, int *count, char *query, char ***objrecs);
extern int send_getobjbyquery(int sockfd, char *query, int maxhits, hw_objectID **childIDs, int *count);
extern int send_getobjbyqueryobj(int sockfd, char *query, int maxhits, char ***childrec, int *count);
extern int send_getobjbyquerycoll(int sockfd, hw_objectID collID, char *query, int maxhits, hw_objectID **childIDs, int *count);
extern int send_getobjbyquerycollobj(int sockfd, hw_objectID collID, char *query, int maxhits, char ***childrec, int *count);
extern int send_getobjbyftquery(int sockfd, char *query, int maxhits, hw_objectID **childIDs, float **weights, int *count);
extern int send_getobjbyftqueryobj(int sockfd, char *query, int maxhits, char ***childrec, float **weights, int *count);
extern int send_getobjbyftquerycoll(int sockfd, hw_objectID collID, char *query, int maxhits, hw_objectID **childIDs, float **weight, int *count);
extern int send_getobjbyftquerycollobj(int sockfd, hw_objectID collID, char *query, int maxhits, char ***childrec, float **weight, int *count);
extern int send_identify(int sockfd, char *name, char *passwd, char **userdata);
extern int send_getparents(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count);
extern int send_children(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count);
extern int send_getparentsobj(int sockfd, hw_objectID objectID, char ***childrec, int *count);
extern int send_pipedocument(int sockfd, char *hostname, hw_objectID objectID, int mode, int rootid, char** objattr, char **bodytag, char **text, int *count, char **urlprefix);
extern int send_pipecgi(int sockfd, char *host, hw_objectID objectID, char *cgi_env_str, char **objattr, char **text, int *count);
extern int send_putdocument(int sockfd, char *hostname, hw_objectID parentID, char *objectRec, char *text, int count, hw_objectID *objectID);
extern int send_inscoll(int sockfd, hw_objectID objectID, char *objrec, hw_objectID *new_objectID);
extern int send_insertobject(int sockfd, char *objrec, char *parms, hw_objectID *objectID);
extern int send_insdoc(int sockfd, hw_objectID objectID, char *objrec, char *text, hw_objectID *new_objectID);
extern int send_incollections(int sockfd, int retcol, int cobjids, hw_objectID *objectIDs, int ccollids, hw_objectID *collIDs, int *count, hw_objectID **retIDs);
extern int send_getsrcbydest(int sockfd, hw_objectID objid, char ***childrec, int *count);
extern int send_mapid(int sockfd, int servid, hw_objectID id, int *virtid);
extern int send_dummy(int sockfd, hw_objectID objectID, int msgid, char **attributes);
extern int send_insertanchors(char **text, int *count, char **anchors, char **destrec, int ancount, char **urlprefix, char **bodytag);
extern char *get_hw_info(hw_connection *conn);
#define send_mvcpdocscoll(sockfd, objectIDs, count, from, dest, mvcp) \
send_mvcpdocscollscoll(sockfd, objectIDs, count, from, dest, mvcp, DOCUMENT)
#define send_mvcpcollscoll(sockfd, objectIDs, count, from, dest, mvcp) \
send_mvcpdocscollscoll(sockfd, objectIDs, count, from, dest, mvcp, COLLECTION)
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,111 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Rasmus Lerdorf <rasmus@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef HW_ERROR_H
#define HW_ERROR_H
#if HYPERWAVE
#define NOACCESS 1 /* Access denied */
#define NODOCS 2 /* No documents */
#define NONAME 3 /* No collection name */
#define NODOC 4 /* Object is not a document */
#define NOOBJ 5 /* No object received */
#define NOCOLLS 6 /* No collections received */
#define DBSTUBNG 7 /* Connection to low-level database failed */
#define NOTFOUND 8 /* Object not found */
#define EXIST 9 /* Collection already exists */
#define FATHERDEL 10 /* parent collection disappeared */
#define FATHNOCOLL 11 /* parent collection not a collection */
#define NOTEMPTY 12 /* Collection not empty */
#define DESTNOCOLL 13 /* Destination not a collection */
#define SRCEQDEST 14 /* Source equals destination */
#define REQPEND 15 /* Request pending */
#define TIMEOUT 16 /* Timeout */
#define NAMENOTUNIQUE 17 /* Name not unique */
#define WRITESTOPPED 18 /* Database now read-only; try again later */
#define LOCKED 19 /* Object locked; try again later */
#define CHANGEBASEFLD 20 /* Change of base-attribute */
#define NOTREMOVED 21 /* Attribute not removed */
#define FLDEXISTS 22 /* Attribute exists */
#define CMDSYNTAX 23 /* Syntax error in command */
#define NOLANGUAGE 24 /* No or unknown language specified */
#define WRGTYPE 25 /* Wrong type in object */
#define WRGVERSION 26 /* Client version too old */
#define CONNECTION 27 /* No connection to other server */
#define SYNC 28 /* Synchronization error */
#define NOPATH 29 /* No path entry */
#define WRGPATH 30 /* Wrong path entry */
#define PASSWD 31 /* Wrong password (server-to-server server authentication) */
#define LC_NO_MORE_USERS 32 /* No more users for license */
#define LC_NO_MORE_DOCS 33 /* No more documents for this session and license */
#define RSERV_NRESP 34 /* Remote server not responding */
#define Q_OVERFLOW 35 /* Query overflow */
#define USR_BREAK 36 /* Break by user */
#define N_IMPL 37 /* Not implemented */
#define WRG_VALUE 38 /* Wrong value */
#define INSUFF_FUNDS 39 /* Insufficient funds */
#define REORG 40 /* Reorganization in progress */
#define USER_LIMIT 41 /* Limit of simultaneous users reached */
#define FTCONNECT 513 /* No connection to fulltext server */
#define FTTIMEOUT 514 /* Connection timed out */
#define FTINDEX 515 /* Something wrong with fulltext index */
#define FTSYNTAX 516 /* Query syntax error */
#define REQUESTPENDING 1025 /* Request pending */
#define NOCONNECTION 1026 /* No connection to document server */
#define WRONGVERSION 1027 /* Wrong protocol version */
#define NOTINITIALIZED 1028 /* Not initialized */
#define BADREQUEST 1029 /* Bad request */
#define BADLRN 1030 /* Bad document number */
#define OPENSTORE_WRITE 1031 /* Cannot write to local store */
#define OPENSTORE_READ 1032 /* Cannot read from local store */
#define READSTORE 1033 /* Store read error */
#define WRITESTORE 1034 /* Write error */
#define CLOSESTORE 1035 /* Close error */
#define BADPATH 1036 /* Bad path */
#define NOPATHDC 1037 /* No path */
#define OPENFILE 1038 /* Cannot open file */
#define READFILE 1039 /* Cannot read from file // same */
#define WRITEFILE 1040 /* Cannot write to file */
#define CONNECTCLIENT 1041 /* Could not connect to client */
#define ACCEPT 1042 /* Could not accept connection */
#define READSOCKET 1043 /* Could not read from socket */
#define WRITESOCKET 1044 /* Could not write to socket */
#define TOOMUCHDATA 1046 /* Received too much data */
#define TOOFEWDATA 1047 /* Received too few data // ... */
#define NOTIMPLEMENTED 1049 /* Not implemented */
#define USERBREAK 1050 /* User break */
#define INTERNAL 1051 /* Internal error */
#define INVALIDOBJECT 1052 /* Invalid object */
#define JOBTIMEOUT 1053 /* Job timed out */
#define OPENPORT 1054 /* Cannot open port // ... for several resons */
#define NODATA 1055 /* Received no data */
#define NOPORT 1056 /* No port to handle this request */
#define NOTCACHED 1057 /* Document not cached */
#define BADCACHETYPE 1058 /* Bad cache type */
#define OPENCACHE_WRITE 1059 /* Cannot write to cache */
#define OPENCACHE_READ 1060 /* Cannot read from cache // same */
#define NOSOURCE 1061 /* Do not know what to read */
#define CLOSECACHE 1062 /* Could not insert into cache */
#define CONNECTREMOTE 1063 /* Could not connect to remote server */
#define LOCKREFUSED 1064 /* Lock refused // could not lock the stores */
#endif
#endif

View file

@ -1,120 +0,0 @@
# Microsoft Developer Studio Project File - Name="hyperwave" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=hyperwave - 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 "hyperwave.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 "hyperwave.mak" CFG="hyperwave - Win32 Debug_TS"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "hyperwave - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "hyperwave - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "hyperwave - Win32 Release_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release_TS"
# PROP BASE Intermediate_Dir "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 Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HYPERWAVE_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_HYPERWAVE" /D ZTS=1 /D HYPERWAVE=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "NDEBUG"
# ADD RSC /l 0x407 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 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 /dll /machine:I386
# ADD LINK32 php4ts.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 wsock32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_hyperwave.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
!ELSEIF "$(CFG)" == "hyperwave - Win32 Debug_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug_TS"
# PROP BASE Intermediate_Dir "Debug_TS"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug_TS"
# PROP Intermediate_Dir "Debug_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HYPERWAVE_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_HYPERWAVE" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HYPERWAVE=1 /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "_DEBUG"
# ADD RSC /l 0x407 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 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 /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 php4ts_debug.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 wsock32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_hyperwave.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
!ENDIF
# Begin Target
# Name "hyperwave - Win32 Release_TS"
# Name "hyperwave - Win32 Debug_TS"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\hg_comm.c
# End Source File
# Begin Source File
SOURCE=.\hw.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\hg_comm.h
# End Source File
# Begin Source File
SOURCE=.\hw_error.h
# End Source File
# Begin Source File
SOURCE=.\php_hyperwave.h
# End Source File
# End Group
# End Target
# End Project

View file

@ -1,147 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Rasmus Lerdorf <rasmus@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_HYPERWAVE_H
#define PHP_HYPERWAVE_H
#ifdef PHP_WIN32
#define PHP_HW_API __declspec(dllexport)
#else
#define PHP_HW_API
#endif
#if HYPERWAVE
#ifndef DLEXPORT
#define DLEXPORT
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
#include "hg_comm.h"
extern zend_module_entry hw_module_entry;
#define hw_module_ptr &hw_module_entry
typedef struct {
long default_link;
long default_port;
long num_links,num_persistent;
long max_links,max_persistent;
long allow_persistent;
} zend_hw_globals;
#ifdef ZTS
# define HwSG(v) TSRMG(hw_globals_id, zend_hw_globals *, v)
#else
# define HwSG(v) (hw_globals.v)
extern PHP_HW_API zend_hw_globals hw_globals;
#endif
/*extern hw_module php_hw_module;*/
typedef struct {
int size;
char *data;
char *attributes;
char *bodytag;
} hw_document;
PHP_MINIT_FUNCTION(hw);
PHP_MSHUTDOWN_FUNCTION(hw);
PHP_MINFO_FUNCTION(hw);
PHP_FUNCTION(hw_connect);
PHP_FUNCTION(hw_pconnect);
PHP_FUNCTION(hw_close);
PHP_FUNCTION(hw_root);
PHP_FUNCTION(hw_info);
PHP_FUNCTION(hw_error);
PHP_FUNCTION(hw_errormsg);
PHP_FUNCTION(hw_mv);
PHP_FUNCTION(hw_cp);
PHP_FUNCTION(hw_deleteobject);
PHP_FUNCTION(hw_changeobject);
PHP_FUNCTION(hw_modifyobject);
PHP_FUNCTION(hw_getparents);
PHP_FUNCTION(hw_getparentsobj);
PHP_FUNCTION(hw_children);
PHP_FUNCTION(hw_childrenobj);
PHP_FUNCTION(hw_getchildcoll);
PHP_FUNCTION(hw_getchildcollobj);
PHP_FUNCTION(hw_getobject);
PHP_FUNCTION(hw_getandlock);
PHP_FUNCTION(hw_unlock);
PHP_FUNCTION(hw_gettext);
PHP_FUNCTION(hw_edittext);
PHP_FUNCTION(hw_getcgi);
PHP_FUNCTION(hw_getremote);
PHP_FUNCTION(hw_getremotechildren);
PHP_FUNCTION(hw_pipedocument);
PHP_FUNCTION(hw_pipecgi);
PHP_FUNCTION(hw_insertdocument);
PHP_FUNCTION(hw_docbyanchorobj);
PHP_FUNCTION(hw_docbyanchor);
PHP_FUNCTION(hw_getobjectbyquery);
PHP_FUNCTION(hw_getobjectbyqueryobj);
PHP_FUNCTION(hw_getobjectbyquerycoll);
PHP_FUNCTION(hw_getobjectbyquerycollobj);
PHP_FUNCTION(hw_getobjectbyftquery);
PHP_FUNCTION(hw_getobjectbyftqueryobj);
PHP_FUNCTION(hw_getobjectbyftquerycoll);
PHP_FUNCTION(hw_getobjectbyftquerycollobj);
PHP_FUNCTION(hw_getchilddoccoll);
PHP_FUNCTION(hw_getchilddoccollobj);
PHP_FUNCTION(hw_getanchors);
PHP_FUNCTION(hw_getanchorsobj);
PHP_FUNCTION(hw_getusername);
PHP_FUNCTION(hw_setlinkroot);
PHP_FUNCTION(hw_inscoll);
PHP_FUNCTION(hw_incollections);
PHP_FUNCTION(hw_insertobject);
PHP_FUNCTION(hw_insdoc);
PHP_FUNCTION(hw_identify);
PHP_FUNCTION(hw_free_document);
PHP_FUNCTION(hw_new_document);
PHP_FUNCTION(hw_new_document_from_file);
PHP_FUNCTION(hw_output_document);
PHP_FUNCTION(hw_document_size);
PHP_FUNCTION(hw_document_attributes);
PHP_FUNCTION(hw_document_bodytag);
PHP_FUNCTION(hw_document_content);
PHP_FUNCTION(hw_document_setcontent);
PHP_FUNCTION(hw_objrec2array);
PHP_FUNCTION(hw_array2objrec);
PHP_FUNCTION(hw_connection_info);
PHP_FUNCTION(hw_getsrcbydestobj);
PHP_FUNCTION(hw_insertanchors);
PHP_FUNCTION(hw_getrellink);
PHP_FUNCTION(hw_dummy);
PHP_FUNCTION(hw_who);
PHP_FUNCTION(hw_stat);
PHP_FUNCTION(hw_mapid);
#else
#define hw_module_ptr NULL
#endif /* HYPERWAVE */
#define phpext_hyperwave_ptr hw_module_ptr
#endif /* PHP_HYPERWAVE_H */

View file

@ -1,285 +0,0 @@
+------------------------------------------------------------------------------+
| CREATING XSLT BACKENDS |
+------------------------------------------------------------------------------+
Author(s): Sterling Hughes <sterling@php.net>
Introduction
-------------------------------------------------------------------------------
Truth be told, at this point in time there are about a zillion and two
different XSLT libraries, each with their own unique merits and faults. If you
provide a Sablotron extension, people will clamor for a Xalan extension, if you
provide a Xalan extension people will clamor for a libxslt extension.
In order to be as user friendly as possible, we try and provide the most
options to the user. At the same time we must try to keep a level of
consistency, so the user does not need to remember 15 different syntaxes, etc.
for each XSLT extension, and when switching from XSLT backends, no changes in
the PHP code should be necessary (akin to the concept of a database independent
api, but with XSLT libraries).
At the same time, you'll also notice that in some cases extensions seem to
duplicate each others functionality. All extensions need code for calling
user-defined handlers, omitting debug messages, etc. In the interests of
laziness, we must also try to make these as minimal as possible.
Therefore, I've created a processor independent api for XSLT, aka, the XSLT
extension (but doesn't "A processor independent API for XSLT" sound cooler?).
It defines a set of functions which every XSLT backend must provide, as well
as a syntax which those functions must adhere to. Furthermore, the underlying
code, provides a "library" if you will, of code that is relevant to all XSLT
extensions.
The API
-------------------------------------------------------------------------------
Every extension must define the following functions:
- xslt_create()
- xslt_set_scheme_handlers()
- xslt_set_sax_handlers()
- xslt_set_error_handler()
- xslt_set_log()
- xslt_set_object()
- xslt_process()
- xslt_error()
- xslt_errno()
- xslt_free()
These functions are common or implementable with every single XSLT library that
I've come across so far (at least every C library) and should there for be
defined by the extension.
resource xslt_create(void)
The XSLT create function allocates a new XSLT processor and returns a resource
pointer to the XSLT processor. It also handles any initialization that the
processor requires.
void xslt_set_scheme_handlers(resource processor, array handlers)
Registers the scheme handlers for the document (aka XPath handlers), given a
XSLT processor resource (allocated by xslt_create()) and an array in the
following format:
array(
"get_all" => function,
"open" => function,
"get" => function,
"put" => function,
"close" => function
)
Where function is either a function name or an array in the following format:
array(&$obj, "method")
Note: You do not need to handle the array(&$obj, "method") syntax by yourself
as this is handled in the call_xslt_function() library function (and
more specifically, Zend's call_user_function_ex() function.
Note: The given array does not need to contain all of the different scheme
handler elements (although it can), but it only needs to conform to
the "handler" => "function" format described above.
Each of the individual scheme handler functions called are in the formats
below:
string get_all(resource processor, string scheme, string rest)
resource open(resource processor, string scheme, string rest)
int get(resource processor, resource fp, string &data)
int put(resource processor, resource fp, string data)
void close(resource processor, resource fp)
void xslt_set_sax_handlers(resource processor, array handlers)
Registers the SAX handlers for the document, given a XSLT processor resource
(allocated by xslt_create()) and an array in the following format:
array(
"document" => array(document_start_function,
document_end_function),
"element" => array(element_start_function,
element_end_function),
"namespace" => array(namespace_start_function,
namespace_end_function),
"comment" => function,
"pi" => function,
"character" => function
)
Where the functions follow the syntax described for the scheme handler
functions.
Each of the individual SAX handler functions are in the format below:
void start_doc(resource processor)
void end_doc(resource processor)
void start_element(resource processor, string name, array attributes)
void end_element(resource processor, string name)
void start_namespace(resource processor, string prefix, string uri)
void end_namespace(resource processor, string prefix)
void comment(resource processor, string contents)
void pi(resource processor, string target, string contents)
void characters(resource processor, string contents)
void xslt_set_error_handler(resource processor, function error_handler)
This function sets the user defined error handler to be called when a
processing or any other type of error occurs. It is given a XSLT
processor resource (allocated by xslt_create()) and an error function of
the same syntax described for the scheme handler function.
The user defined error handler as the following syntax:
void error(resource processor, int level, int error, array info)
void xslt_set_log(resource processor, string logname)
Sets the XSLT log to record log information (processor messages, not errors).
Its given a XSLT processor (allocated by xslt_create()) and a string containing
the name of the log file. If the string is "php://stderr" then the logging
should go to standard error (stderr). Also the default place to send log
messages is standard error (if no log file is set).
mixed xslt_process(resource processor,
string xml,
string xsl[,
string result[,
array arguments[,
array parameters]]])
This function performs the magic, it takes the user's data, performs the
transformation and depending on the context either saves the result to a file
or returns the data to the user.
To understand the way the xslt_process() function works, you must first
understand the concept of "argument buffers". Argument buffers are equivalent
to the concept of symlinks on a Unix system, take the following example:
<?php
/**
* $xml contains the contents of an XML file and $xsl contains
* the contents of an XSLT stylesheet
*/
$args = array("/_xml" => $xml,
"/_xsl" => $xsl);
$xh = xslt_create();
$data = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args);
xslt_free($xh);
print( "The results of the transformation were\n" );
print( "<br>\n<hr>\n<br>" );
print( $data );
print( "<br>\n<hr>\n<br>" );
?>
See what was done? The argument buffer was declared ($args) and the different
arguments were defined. Then when the xslt_process() function was called
instead of giving the XML filename and XSLT filename we instead gave
"arguments", which correspond to the XML and XSLT data in the argument buffers.
This concept is a bit foreign to some people, however, I find it the best way
to handle processing xsl data. If you're still having trouble with this, try
playing around with the sablotron backend a bit, you should be able to catch on
pretty quickly.
In order to use argument buffers, the XSLT extension provides a couple of easy
to use API functions, you can use them as follows:
{
zval **arguments_zp;
char **arguments_cp;
xslt_args *arguments;
char *types[] = { "file", "data" };
/* Fetch the arguments from the user into a zval ** */
/* Translate the zval array into a character array */
xslt_make_array(&arguments_cp, arguments_zp);
/* Translate the character array into an xslt_arg * structure */
arguments = xslt_parse_arguments(arguments_cp);
/* Print out the resulting xslt_arg * structure */
php_printf("XML type: %s\n", types[arguments->xml.type]);
php_printf("XML data: %s\n", arguments->xml.ptr);
PUTS("\n");
php_printf("XSLT type: %s\n", types[arguments->xsl.type]);
php_printf("XSLT data: %s\n", arguments->xsl.ptr);
PUTS("\n");
php_printf("Result type: %s\n", types[arguments->result.type]);
php_printf("Result data: %s\n", arguments->result.ptr);
PUTS("\n");
}
You can also test the "type" field by using the XSLT_IS_FILE and XSLT_IS_DATA
constants.
Anyway back to the syntax of the xslt_process() function. The first argument
to the xslt_process() function is a resource pointer to the XSLT processor to
be used. The second argument is either an "argument buffer" pointing to the
XML data or the name of a file containing the XML data. The third argument is
either an argument buffer pointing to the XSLT data or a file containing the
XSLT data. The fourth argument is optional, it either contains the name of the
file to place the results of the transformation into, NULL or "arg:/_result",
in the latter 2 cases, the results of the transformation will be returned. The
fifth optional argument is the "argument buffer" itself, it is an associative
PHP array of "argument_name" => "value" pairs, or NULL, if no arguments are to
be passed. The final optional argument is a set of parameters to pass to the
XSLT stylesheet. The parameter argument is an associative array of
"parameter_name" => "value" pairs.
string xslt_error(resource processor)
The xslt_error() function returns the last error that occured, given a XSLT
processor resource (allocated by xslt_create()).
int xslt_errno(resource processor)
The xslt_errno() function returns the last error number that occured given a
XSLT processor resource (allocated by xslt_create()).
void xslt_free(resource processor)
The xslt_free() function free's the given XSLT processor resource (allocated
by xslt_create()).
Config.m4
-------------------------------------------------------------------------------
The XSLT extension's "magic" really occurs in the config.m4 file. Here you
must add a couple of things in order for your backend to be enabled. Its a bit
too complex to describe (but easy to implement and understand). Take a look at
config.m4 (which is well commented) to see what is necessary.
Makefile.in
-------------------------------------------------------------------------------
Simply add the source files for your backend to the LTLIBRARY_SOURCES variable
and you're all set with this file.
Conclusion
-------------------------------------------------------------------------------
Nobody's perfect, I'm sure I've made some mistakes while thinking this whole
thing through and I would be glad to hear from any of you who think I'm a
colossal moron and think you have a better way to do it. Please e-mail at
sterling@php.net, this extension will only get better with feedback.
With that said, the concepts here may take a little bit of time to sink in, I
know I've written a whole lot. My suggestion to you, if you're planning on
writing an XSLT backend is simply to go off and implement, taking the api
section as a guide and making sure you match that api as closely as possible.

View file

@ -1,31 +0,0 @@
To Do List
This informal list is the working list for the php sablotron extension. It is
maintained and used by the people on sab-php@gingerall.cz. See
http://www.gingerall.org/charlie/ga/xml/m_ml.xml for more information.
The numbering of the items on the list does not imply priority. Rather it is
simply a means for efficient communication on the mailing lists.
$Id$
Short Term
==========
1. Add streams support for file paths in 4th and 5th arg of xslt_process
2. Use zend_parse_parameters and related API's
3. SDOM_* stuff which does xpath queries.
- Melvyn
Long Term
=========
1. Documentation of the wide variety of functions now available.
- Roy Huggins
2. remove TSRMLS_FETCH() and expand user_data parameter to forward the
actual tsrmls value.
- suggested by Marcus Boerger
3. Evaluate OO functions, ZE2
- All
4. Prolly an API rewrite, for php5
- All

View file

@ -1,164 +0,0 @@
dnl
dnl $Id$
dnl
dnl +------------------------------------------------------------------------------+
dnl | This is where the magic of the extension reallly is. Depending on what |
dnl | backend the user chooses, this script performs the magic |
dnl +------------------------------------------------------------------------------+
PHP_ARG_ENABLE(xslt, whether to enable xslt support,
[ --enable-xslt Enable xslt support.])
PHP_ARG_WITH(xslt-sablot, for XSLT Sablotron backend,
[ --with-xslt-sablot=DIR XSLT: Enable the sablotron backend.], no, no)
PHP_ARG_WITH(expat-dir, for libexpat dir for Sablotron XSL support,
[ --with-expat-dir=DIR XSLT: libexpat dir for Sablotron.], no, no)
PHP_ARG_WITH(iconv-dir, for iconv dir for Sablotron XSL support,
[ --with-iconv-dir=DIR XSLT: iconv dir for Sablotron.], no, no)
PHP_ARG_WITH(sablot-js, for JavaScript for Sablotron XSL support,
[ --with-sablot-js=DIR XSLT: enable JavaScript support for Sablotron.], no, no)
if test "$PHP_XSLT" != "no"; then
PHP_NEW_EXTENSION(xslt, xslt.c sablot.c, $ext_shared)
PHP_SUBST(XSLT_SHARED_LIBADD)
if test "$PHP_XSLT_SABLOT" != "no"; then
XSLT_CHECK_DIR=$PHP_XSLT_SABLOT
XSLT_TEST_FILE=/include/sablot.h
XSLT_BACKEND_NAME=Sablotron
XSLT_LIBNAME=sablot
fi
if test -z "$XSLT_BACKEND_NAME"; then
AC_MSG_ERROR([No backend specified for XSLT extension.])
fi
condition="$XSLT_CHECK_DIR$XSLT_TEST_FILE"
if test -r $condition; then
XSLT_DIR=$XSLT_CHECK_DIR
else
AC_MSG_CHECKING(for $XSLT_BACKEND_NAME libraries in the default path)
for i in /usr /usr/local; do
condition="$i$XSLT_TEST_FILE"
if test -r $condition; then
XSLT_DIR=$i
fi
done
AC_MSG_RESULT(found in $XSLT_DIR)
fi
if test -z "$XSLT_DIR"; then
AC_MSG_ERROR([not found. Please re-install the $XSLT_BACKEND_NAME distribution.])
fi
if test "$PHP_XSLT_SABLOT" != "no"; then
AC_MSG_CHECKING([for sablot-config])
if test -x $XSLT_DIR/bin/sablot-config ; then
AC_MSG_RESULT(found)
AC_DEFINE(HAVE_SABLOT_CONFIG, 1, [Whether the Sablotron config file is found])
dnl Use this script to register this information in phpinfo()
SABINF_CFLAGS=`$XSLT_DIR/bin/sablot-config --cflags`
SABINF_LIBS=`$XSLT_DIR/bin/sablot-config --libs`
SABINF_PREFIX=`$XSLT_DIR/bin/sablot-config --prefix`
SABINF_ALL="\"Cflags: $SABINF_CFLAGS\nLibs: $SABINF_LIBS\nPrefix: $SABINF_PREFIX\""
PHP_DEFINE(SAB_INFO, "$SABINF_ALL")
else
AC_MSG_RESULT(not found)
fi
AC_MSG_CHECKING([for Sablotron version])
old_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -I$XSLT_DIR/include"
AC_TRY_RUN([
#include <stdlib.h>
#include <sablot.h>
int main ()
{
double version;
version = atof(SAB_VERSION);
if (version >= 0.96) {
exit(0);
}
exit(255);
}
],[
AC_MSG_RESULT([>= 0.96])
],[
AC_MSG_ERROR([Sablotron version 0.96 or greater required.])
])
CPPFLAGS=$old_CPPFLAGS
found_expat=no
for i in $PHP_EXPAT_DIR $XSLT_DIR /usr/local /usr; do
if test -f $i/lib/libexpat.a -o -f $i/lib/libexpat.$SHLIB_SUFFIX_NAME; then
AC_DEFINE(HAVE_LIBEXPAT2, 1, [ ])
PHP_ADD_INCLUDE($i/include)
PHP_ADD_LIBRARY_WITH_PATH(expat, $i/lib, XSLT_SHARED_LIBADD)
found_expat=yes
break
fi
done
if test "$found_expat" = "no"; then
AC_MSG_ERROR([expat not found. To build sablotron you need the expat library.])
fi
if test "$PHP_ICONV_DIR" != "no"; then
PHP_ICONV=$PHP_ICONV_DIR
fi
if test "$PHP_ICONV" = "no"; then
PHP_ICONV=yes
fi
PHP_SETUP_ICONV(XSLT_SHARED_LIBADD, [], [
AC_MSG_ERROR([iconv not found. To build sablotron you need the iconv library.])
])
if test "$PHP_SABLOT_JS" != "no"; then
for i in /usr/local /usr $PHP_SABLOT_JS; do
if test -f $i/lib/libjs.a -o -f $i/lib/libjs.$SHLIB_SUFFIX_NAME; then
PHP_SABLOT_JS_DIR=$i
fi
done
PHP_CHECK_LIBRARY(js, JS_GetRuntime,
[
PHP_ADD_LIBRARY_WITH_PATH(js, $PHP_SABLOT_JS_DIR/lib, XSLT_SHARED_LIBADD)
], [
AC_MSG_ERROR([libjs not found. Please check config.log for more information.])
], [
-L$PHP_SABLOT_JS_DIR/lib
])
fi
PHP_CHECK_LIBRARY(sablot, SablotSetEncoding,
[
AC_DEFINE(HAVE_SABLOT_SET_ENCODING, 1, [ ])
], [], [
-L$XSLT_DIR/lib
])
dnl SablotSetOptions implemented in Sablotron CVS > 2002/10/31
PHP_CHECK_LIBRARY(sablot, SablotGetOptions,
[
AC_DEFINE(HAVE_SABLOT_GET_OPTIONS, 1, [Whether Sablotron supports SablotGetOptions])
], [], [
-L$XSLT_DIR/lib
])
AC_DEFINE(HAVE_SABLOT_BACKEND, 1, [ ])
fi
PHP_ADD_INCLUDE($XSLT_DIR/include)
PHP_ADD_LIBRARY_WITH_PATH($XSLT_LIBNAME, $XSLT_DIR/lib, XSLT_SHARED_LIBADD)
AC_DEFINE(HAVE_XSLT, 1, [ ])
fi

View file

@ -1,142 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Sterling Hughes <sterling@php.net> |
+----------------------------------------------------------------------+
*/
#ifndef PHP_XSLT_H
#define PHP_XSLT_H
#include "php.h"
#if HAVE_SABLOT_BACKEND
#include "php_xslt.h"
#include <sablot.h>
extern zend_module_entry xslt_module_entry;
#define phpext_xslt_ptr &xslt_module_entry
#ifdef PHP_WIN32
#define PHP_XSLT_API __declspec(dllexport)
#else
#define PHP_XSLT_API
#endif
#define XSLT_SCHEME(handle) ((handle)->handlers->scheme)
#define XSLT_SAX(handle) ((handle)->handlers->sax)
#define XSLT_ERROR(handle) ((handle)->handlers->error)
#define XSLT_PROCESSOR(handle) ((handle)->processor.ptr)
#define XSLT_SITUATION(handle) ((handle)->processor.sit)
#define XSLT_ERRNO(handle) ((handle)->err->no)
#define XSLT_ERRSTR(handle) ((handle)->err->str)
#define XSLT_LOG(handle) ((handle)->err->log)
#define XSLT_BASE_ISSET(handle) ((handle)->base_isset)
#define XSLT_FUNCH_FREE(__var) if (__var) zval_ptr_dtor(&(__var));
#define XSLT_REG_ERRMSG(msg, handle) if (XSLT_ERRSTR(handle)) efree(XSLT_ERRSTR(handle)); \
XSLT_ERRSTR(handle) = estrdup(msg);
#define XSLT_NO_INFO "No information available."
PHP_MINIT_FUNCTION(xslt);
PHP_MINFO_FUNCTION(xslt);
PHP_FUNCTION(xslt_create);
PHP_FUNCTION(xslt_set_sax_handlers);
PHP_FUNCTION(xslt_set_scheme_handlers);
PHP_FUNCTION(xslt_set_error_handler);
PHP_FUNCTION(xslt_set_base);
PHP_FUNCTION(xslt_set_encoding);
PHP_FUNCTION(xslt_set_log);
PHP_FUNCTION(xslt_process);
PHP_FUNCTION(xslt_error);
PHP_FUNCTION(xslt_errno);
PHP_FUNCTION(xslt_free);
PHP_FUNCTION(xslt_set_object);
PHP_FUNCTION(xslt_setopt);
#ifdef HAVE_SABLOT_GET_OPTIONS
PHP_FUNCTION(xslt_getopt);
#endif
PHP_FUNCTION(xslt_backend_version);
PHP_FUNCTION(xslt_backend_name);
PHP_FUNCTION(xslt_backend_info);
struct scheme_handlers {
zval *sh_get_all;
zval *sh_open;
zval *sh_get;
zval *sh_put;
zval *sh_close;
};
struct sax_handlers {
zval *doc_start;
zval *element_start;
zval *element_end;
zval *namespace_start;
zval *namespace_end;
zval *comment;
zval *pi;
zval *characters;
zval *doc_end;
};
struct xslt_handlers {
struct scheme_handlers scheme;
struct sax_handlers sax;
zval *error;
};
struct xslt_processor {
SablotHandle ptr;
SablotSituation sit;
long idx;
};
struct xslt_log {
char *path;
int fd;
int do_log;
};
struct xslt_error {
struct xslt_log log;
char *str;
int no;
};
typedef struct {
struct xslt_handlers *handlers;
struct xslt_processor processor;
struct xslt_error *err;
zval *object;
unsigned short base_isset;
} php_xslt;
#else
#define phpext_xslt_ptr NULL
#endif
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/

View file

@ -1,63 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Sterling Hughes <sterling@php.net> |
+----------------------------------------------------------------------+
*/
#ifndef _PHP_XSLT_H
#define _PHP_XSLT_H
#include "php.h"
#include "ext/standard/php_filestat.h"
#ifdef HAVE_XSLT
#define XSLT_OBJ(__func) (&(__func)->obj)
#define XSLT_FUNC(__func) ((__func)->func)
#define XSLT_IS_FILE 0
#define XSLT_IS_DATA 1
struct xslt_function {
zval *obj;
zval *func;
};
struct _xslt_argument {
char *ptr;
int type;
};
typedef struct {
struct _xslt_argument xml;
struct _xslt_argument xsl;
struct _xslt_argument result;
} xslt_args;
extern xslt_args *xslt_parse_arguments(char *, char *, char *, char **);
extern void xslt_free_arguments(xslt_args *);
extern void xslt_assign_handler(struct xslt_function **, zval **);
extern void xslt_free_handler(struct xslt_function *);
extern void xslt_call_function(char *, zval *, zval *, int, zval **, zval **);
extern void xslt_debug(char *, char *, ...);
extern void xslt_make_array(zval **zarr, char ***carr);
extern void xslt_free_array(char **arr);
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="ISO-8859-1" method="text" omit-xml-declaration="yes" />
<xsl:template match="/qa">
<xsl:apply-templates select="test" />
</xsl:template>
<xsl:template match="test[@type = 'simple']">
<xsl:value-of select="." />
</xsl:template>
</xsl:stylesheet>

View file

@ -1,15 +0,0 @@
--TEST--
Pass long string to 'file' argument, bug #17791
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php
$xmlstring = str_repeat('x', 512);
$xslstring = 'x';
$xh = xslt_create();
$result = @xslt_process($xh, $xmlstring, $xslstring);
@xslt_free($xh);
echo("OK");
?>
--EXPECT--
OK

View file

@ -1,32 +0,0 @@
--TEST--
Pass object for xslt_error_handler, bug #17931
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php
class xsl {
function xsl() {
$this->_parser = xslt_create();
}
function set_error() {
xslt_set_error_handler($this->_parser, array($this, 'xslt_trap_error'));
echo "OK";
}
function xslt_trap_error($parser, $errorno, $level, $fields) {
return TRUE;
}
function clean() {
xslt_free($this->_parser);
}
}
$x = new xsl;
// work-around for possible '$this does not exist' bug in constructor
$x->set_error();
$x->clean();
?>
--EXPECT--
OK

View file

@ -1,34 +0,0 @@
--TEST--
Relative and absolute arg handling
--SKIPIF--
<?php
include("skipif.inc");
if(!function_exists('utf8_encode')) {
die("skip function utf8_encode() not available");
}
?>
--INI--
magic_quotes_runtime=0
--FILE--
<?php
error_reporting(E_ALL);
$xslfile = dirname(__FILE__) . '/args.xsl';
$xslsheet = @implode('', @file($xslfile));
$xmldata = '<?xml version="1.0" encoding="ISO-8859-1"?>';
$xmldata .= '<!DOCTYPE qa SYSTEM "qa.dtd">' . "\n";
$xmldata .='
<qa>
<test type="simple">Test has passed</test>
<test type="complex" />
</qa>';
$xh = xslt_create();
$result = xslt_process($xh, 'arg:/_xml', $xslfile, NULL, array('/_xml' => $xmldata));
print "$result\n";
$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmldata, '/_xsl' => $xslsheet));
print "$result\n";
xslt_free($xh);
?>
--EXPECT--
Test has passed
Test has passed

View file

@ -1,33 +0,0 @@
--TEST--
Don't override xslt_set_base (bug #20518)
--SKIPIF--
<?php // vim600: syn=php ts=4 sw=4
include("skipif.inc");
mkdir(dirname(__FILE__) . '/tmp', 0777) or die("skip Cannot create working directory");
?>
--INI--
magic_quotes_runtime=0
--FILE--
<?php
error_reporting(E_ALL);
copy(dirname(__FILE__) . '/qa.dtd', dirname(__FILE__) . '/tmp/qa.dtd');
$xslfile = dirname(__FILE__) . '/args.xsl';
$xslsheet = @implode('', @file($xslfile));
$xmldata = '<?xml version="1.0" encoding="ISO-8859-1"?>';
$xmldata .= '<!DOCTYPE qa SYSTEM "qa.dtd">' . "\n";
$xmldata .='
<qa>
<test type="simple">Test has passed</test>
<test type="complex" />
</qa>';
$xh = xslt_create();
xslt_set_base($xh, 'file://' . dirname(__FILE__) . '/tmp/');
$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmldata, '/_xsl' => $xslsheet));
print "$result\n";
xslt_free($xh);
unlink(dirname(__FILE__) . '/tmp/qa.dtd');
rmdir(dirname(__FILE__) . '/tmp');
?>
--EXPECT--
Test has passed

View file

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" omit-xml-declaration="yes" encoding="ISO-8859-1" />
<xsl:param name="insertion">Test failed</xsl:param>
<xsl:template match="/qa">
<xsl:apply-templates select="test" />
</xsl:template>
<xsl:template match="test">
<xsl:choose>
<xsl:when test="@type != 'simple'">
<xsl:value-of select="$insertion" />
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE qa PUBLIC "-//PHP-QA//PHP Quality Assurance DTD //EN" "qa.dtd">
<qa>
<test type="simple">PHP QA&reg;</test>
</qa>

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!ELEMENT qa (test+)>
<!ELEMENT test (#PCDATA)>
<!ATTLIST test
type CDATA #IMPLIED
>
<!ENTITY reg "&#174;">

View file

@ -1,5 +0,0 @@
<?php
if(!extension_loaded("xslt")) {
die("skip xslt extension not available");
}
?>

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<qa>
<test type="simple">Test has passed</test>
<test type="complex" />
</qa>

View file

@ -1,21 +0,0 @@
--TEST--
Memoryleak in error printing
--SKIPIF--
<?php include("skipif.inc"); ?>
--INI--
error_reporting=2047
display_errors=0
track_errors=1
--FILE--
<?php
$xmlfile = 'ext/xslt/tests/non-existent.xml';
$xslfile = 'ext/xslt/tests/non-existent.xsl';
$xh = xslt_create();
$result = xslt_process($xh, $xmlfile, $xslfile, NULL);
xslt_free($xh);
echo $php_errormsg."\n";
?>
--EXPECTF--
Sablotron error on line none: cannot open file '%s/ext/xslt/tests/non-existent.xsl'

View file

@ -1,12 +0,0 @@
--TEST--
Check for xslt presence
--SKIPIF--
<?php if (!extension_loaded("xslt")) print "skip"; ?>
--POST--
--GET--
--FILE--
<?php
echo "xslt extension is available";
?>
--EXPECT--
xslt extension is available

View file

@ -1,49 +0,0 @@
--TEST--
xslt_backend_info: examples for detection of backend features
--SKIPIF--
<?php // vim600: noet sw=4 ts=4 syn=php ai si tw=78
include("skipif.inc");
if(!function_exists('xslt_backend_info')) {
die("skip\n");
}
// Yeah-right-but-still
if(xslt_backend_name() != "Sablotron") {
die("skip This test currently only supports Sablotron");
}
if("No information available." == xslt_backend_info()) {
die("skip Information could not be detected.");
}
?>
--FILE--
<?php
/*
* Test xslt_backend_info: basically this test is provided as a how-to for
* x-platform packages, which rely on certain features which may or may
* not be available depending on what has been linked into the backend.
*/
$tmp = explode("\n", xslt_backend_info());
$info = array();
foreach($tmp AS $line) {
list($key, $value) = explode(": ", $line, 2);
$info[strtolower($key)] = $value;
}
if(FALSE === strstr($info['libs'], " -lexpat")) {
die("You're configuration is missing expat, which conflicts with sanity.");
}
if(FALSE === strstr($info['libs'], " -liconv")) {
echo("You don't have iconv support\n");
} else {
echo("You have iconv support\n");
}
if(FALSE === strstr($info['libs'], " -ljs")) {
echo("You don't have JavaScript support\n");
} else {
echo("You have JavaScript support\n");
}
?>
--EXPECTREGEX--
You (don't )?have iconv support
You (don't )?have JavaScript support

View file

@ -1,37 +0,0 @@
--TEST--
xslt_getopt function
--SKIPIF--
<?php
include("skipif.inc");
if(!function_exists('xslt_getopt')) {
die("skip\n");
}
?>
--FILE--
<?php
error_reporting(E_ALL);
$xh = xslt_create();
xslt_setopt($xh, XSLT_SABOPT_PARSE_PUBLIC_ENTITIES);
if(xslt_getopt($xh) == XSLT_SABOPT_PARSE_PUBLIC_ENTITIES)
print("OK\n");
else
var_dump(xslt_getopt($xh));
xslt_setopt($xh, XSLT_SABOPT_PARSE_PUBLIC_ENTITIES | XSLT_SABOPT_DISABLE_ADDING_META);
if(xslt_getopt($xh) == XSLT_SABOPT_PARSE_PUBLIC_ENTITIES | XSLT_SABOPT_DISABLE_ADDING_META)
print("OK\n");
else
var_dump(xslt_getopt($xh));
xslt_setopt($xh, xslt_getopt($xh) | XSLT_OPT_SILENT);
if(xslt_getopt($xh) == XSLT_SABOPT_PARSE_PUBLIC_ENTITIES | XSLT_SABOPT_DISABLE_ADDING_META | XSLT_OPT_SILENT)
print("OK\n");
else
var_dump(xslt_getopt($xh));
xslt_free($xh);
?>
--EXPECT--
OK
OK
OK

View file

@ -1,62 +0,0 @@
--TEST--
Various ways to provide xml and xslt arguments and params
--SKIPIF--
<?php
include("skipif.inc");
if(!function_exists('utf8_encode')) {
die("skip function utf8_encode() not available");
}
?>
--INI--
magic_quotes_runtime=0
--FILE--
<?php
error_reporting(E_ALL);
$xmlfile = 'ext/xslt/tests/test.xml';
$xslfile = 'ext/xslt/tests/args.xsl';
$xmldata = @implode('', @file($xmlfile));
$xslsheet = @implode('', @file($xslfile));
$xh = xslt_create();
$result = xslt_process($xh, $xmlfile, $xslfile);
print "$result\n";
$result = xslt_process($xh, 'arg:/_xml', $xslfile, NULL, array('/_xml' => $xmldata));
print "$result\n";
$result = xslt_process($xh, $xmlfile, 'arg:/_xsl', NULL, array('/_xsl' => $xslsheet));
print "$result\n";
$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmldata, '/_xsl' => $xslsheet));
print "$result\n";
// The same, with params
$xslfile = 'ext/xslt/tests/param.xsl';
$xslsheet = implode('', file($xslfile));
$params = array("Test has passed", "PHP QA®");
foreach($params AS $val)
{
$val = utf8_encode($val);
$result = xslt_process($xh, $xmlfile, $xslfile, NULL, NULL, array('insertion' => $val));
print "$result\n";
$result = xslt_process($xh, 'arg:/_xml', $xslfile, NULL, array('/_xml' => $xmldata), array('insertion' => $val));
print "$result\n";
$result = xslt_process($xh, $xmlfile, 'arg:/_xsl', NULL, array('/_xsl' => $xslsheet), array('insertion' => $val));
print "$result\n";
$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmldata, '/_xsl' => $xslsheet), array('insertion' => $val));
print "$result\n";
}
xslt_free($xh);
?>
--EXPECT--
Test has passed
Test has passed
Test has passed
Test has passed
Test has passed
Test has passed
Test has passed
Test has passed
PHP QA®
PHP QA®
PHP QA®
PHP QA®

View file

@ -1,74 +0,0 @@
--TEST--
Crash xslt_process with reused handler (this test may take a while)
--SKIPIF--
<?php
include("skipif.inc");
if(!function_exists('utf8_encode')) {
die("skip\n");
}
?>
--FILE--
<?php
error_reporting(E_ALL);
$xmlfile = 'ext/xslt/tests/test.xml';
$xslfile = 'ext/xslt/tests/param.xsl';
$xmldata = @implode('', @file($xmlfile));
$xslsheet = @implode('', @file($xslfile));
/*
* Tested on a Cyrix 200MMX/128MB took 2 secs. Should be a reasonable margin.
*
* It's not meant as an actual speed test, but if it's slower than this,
* there must be something significantly off in the php/sablot/expat trio.
* Emulation OS's come to mind...
*/
$want_time = 6;
function make_param()
{
$ret_val = '';
$numchars = mt_rand(2,16);
$illegal = array(0,256,512);
for($i=0;$i<$numchars;$i++)
{
$char=0;
while(in_array($char, $illegal))
{
$char .= mt_rand(32, 512);
}
$ret_val .= chr($char);
}
return utf8_encode($ret_val);
}
function decode($string)
{
$ret_val = '';
for($i=0; $i<strlen($string);$i++)
{
$ret_val .= ord(substr($string,$i,1)) . " ";
}
return $ret_val;
}
$xh = xslt_create();
$t1 = time();
for ($i=0; $i<50; $i++)
{
$val = make_param();
$result = xslt_process($xh, $xmlfile, $xslfile, NULL, NULL, array('insertion' => $val));
if(!$result or $result != utf8_decode($val))
print "Failed $i / ".utf8_decode($val).": $result\n\tDecode: " . decode(utf8_decode($val)) . "\n" ;
}
print "OK\n";
xslt_free($xh);
$t2 = time();
$op_time = $t2 - $t1;
if($op_time > $want_time)
print "This test took more than $want_time seconds. Either you have a very slow / busy machine, or there's something very wrong with the speed. Your time: $op_time";
?>
--EXPECT--
OK

View file

@ -1,89 +0,0 @@
--TEST--
xslt_set_object function
--SKIPIF--
<?php
include("skipif.inc");
if(!function_exists('xslt_set_object')) {
die("skip function xslt_set_object() not available");
}
?>
--INI--
magic_quotes_runtime=0
--FILE--
<?php
error_reporting(E_ALL);
class XSLTTester
{
var $_success = false;
var $_success2 = false;
function XSLTTester()
{}
// this function will register this object as the
// callback object.
function test1($xmlfile,$xslfile)
{
$xh = xslt_create();
xslt_set_object($xh,$this);
$handlers = array('get_all'=> 'handle_getall');
xslt_set_scheme_handlers($xh,$handlers);
$res = xslt_process($xh,$xmlfile,$xslfile);
xslt_free($xh);
return 1;
}
// this function will pass this object as in set_scheme_handler
function test2($xmlfile,$xslfile)
{
$xh = xslt_create();
$handlers = array('get_all'=> array(&$this,'handle_getall2'));
xslt_set_scheme_handlers($xh,$handlers);
$res = xslt_process($xh,$xmlfile,$xslfile);
xslt_free($xh);
return 1;
}
function handle_getall($xh,$scheme,$rest)
{
$this->_success = true;
$rest = substr($rest,2);
return implode('', file('ext/xslt/tests/'.$rest));
}
function handle_getall2($xh,$scheme,$rest)
{
$this->_success2 = true;
$rest = substr($rest,2);
return implode('', file('ext/xslt/tests/'.$rest));
}
function testSucceeded()
{
return $this->_success;
}
function test2Succeeded()
{
return $this->_success2;
}
}
$xmlfile = 'ext/xslt/tests/test.xml';
$xslfile = 'ext/xslt/tests/xslt_set_object.xsl';
$testobj = new XSLTTester();
$testobj->test1($xmlfile,$xslfile);
$testobj->test2($xmlfile,$xslfile);
if ($testobj->testSucceeded())
print "OK\n";
else
print "FAILED\n";
if ($testobj->test2Succeeded())
print "OK\n";
else
print "FAILED\n";
?>
--EXPECT--
OK
OK

View file

@ -1,3 +0,0 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="http://param.xsl" />
</xsl:stylesheet>

View file

@ -1,20 +0,0 @@
--TEST--
Set a non-existing scheme handler
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php
function bar()
{
return 1;
}
$xh = xslt_create();
$xmlstring = '<foo><barred /></foo>';
$xslstring = '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/1999/XSL/Transform"><xsl:for-each select="/"><xsl:value-of select="document(\'bogus://foo\')" /></xsl:for-each></xsl:stylesheet>';
xslt_set_scheme_handlers($xh, array('get_all' => 'foo'));
$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmlstring, '/_xsl' => $xslstring));
xslt_free($xh);
echo("OK");
?>
--EXPECT--
OK

View file

@ -1,57 +0,0 @@
--TEST--
Override Sablotron file handler
--SKIPIF--
<?php
include("skipif.inc");
if(!defined("XSLT_SABOPT_FILES_TO_HANDLER")) {
die("skip Sab CVS > 20021031 needed");
}
?>
--INI--
magic_quotes_runtime=0
--FILE--
<?php
function handle_files_all($xh, $proto, $rest_uri)
{
$error = "Cannot resolve $proto:$rest_uri on handle $xh";
if($proto != 'file')
return $error;
$rest_uri = substr($rest_uri, 2); // strip protocol separators //
if(substr($rest_uri, 0, 1) == '/')
{
return (file_exists($rest_uri)) ? implode('', file($rest_uri)) : $error;
}
else
{
$f = dirname(__FILE__) . '/' . $rest_uri;
return (file_exists($f)) ? implode('', file($f)) : $error;
}
}
$xh = xslt_create();
xslt_setopt($xh, XSLT_SABOPT_FILES_TO_HANDLER);
$xmlstring='<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE qa SYSTEM "file://qa.dtd">
<qa>
<test type="simple">PHP QA</test>
</qa>';
$xslstring='<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" omit-xml-declaration="yes" encoding="ISO-8859-1" />
<xsl:param name="insertion">Test failed</xsl:param>
<xsl:template match="/qa">
<xsl:apply-templates select="test" />
</xsl:template>
<xsl:template match="test">
<xsl:value-of select="concat(@type, \': \', .)" />
</xsl:template>
</xsl:stylesheet>';
xslt_set_scheme_handlers($xh, array('get_all' => 'handle_files_all'));
$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmlstring, '/_xsl' => $xslstring));
echo $result;
xslt_free($xh);
?>
--EXPECT--
simple: PHP QA

View file

@ -1,47 +0,0 @@
--TEST--
Core dump when returning FALSE in a handler
--SKIPIF--
<?php
include("skipif.inc");
if(!defined("XSLT_SABOPT_FILES_TO_HANDLER")) {
die("skip Sablotron CVS > 20021031 needed");
}
?>
--INI--
magic_quotes_runtime=0
--FILE--
<?php
function handle_files_all($xh, $proto, $rest_uri)
{
return FALSE;
}
$xh = xslt_create();
xslt_setopt($xh, XSLT_SABOPT_FILES_TO_HANDLER);
$xmlstring='<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE qa SYSTEM "file://qa.dtd">
<qa>
<test type="simple">PHP QA</test>
</qa>';
$xslstring='<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" omit-xml-declaration="yes" encoding="ISO-8859-1" />
<xsl:param name="insertion">Test failed</xsl:param>
<xsl:template match="/qa">
<xsl:apply-templates select="test" />
</xsl:template>
<xsl:template match="test">
<xsl:value-of select="concat(@type, \': \', .)" />
</xsl:template>
</xsl:stylesheet>';
xslt_set_scheme_handlers($xh, array('get_all' => 'handle_files_all'));
/* This is intended to be silent!
* The result is known to be invalid, but if it doesn't core dump, the test
* has succeeded. */
$result = @xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmlstring, '/_xsl' => $xslstring));
echo "OK";
xslt_free($xh);
?>
--EXPECT--
OK

View file

@ -1,60 +0,0 @@
--TEST--
xslt_setopt function and public entities
--SKIPIF--
<?php
include("skipif.inc");
if(!function_exists('xslt_setopt')) {
die("skip function xslt_setopt() is not available\n");
}
?>
--INI--
magic_quotes_runtime=0
--FILE--
<?php
error_reporting(E_ALL);
$xmlfile = dirname(__FILE__).'/public.xml';
$xslfile = dirname(__FILE__).'/args.xsl';
$xh = xslt_create();
// Tell Sablotron to process public entities
xslt_setopt($xh, XSLT_SABOPT_PARSE_PUBLIC_ENTITIES);
$result = xslt_process($xh, $xmlfile, $xslfile);
print "$result\n";
$xslstring = implode('', file($xslfile));
$xslstring = str_replace('method="text"', 'method="html"', $xslstring);
$xslstring = str_replace('<xsl:value-of select="." />', '<html><head><title>foo</title></head><body><p><xsl:value-of select="." /></p></body></html>', $xslstring);
// DEBUG: print $xslstring;
xslt_setopt($xh, XSLT_SABOPT_PARSE_PUBLIC_ENTITIES | XSLT_SABOPT_DISABLE_ADDING_META);
var_dump(xslt_process($xh, $xmlfile, 'arg:/_xsl', NULL, array('/_xsl' => $xslstring)));
xslt_setopt($xh, XSLT_SABOPT_PARSE_PUBLIC_ENTITIES);
var_dump(xslt_process($xh, $xmlfile, 'arg:/_xsl', NULL, array('/_xsl' => $xslstring)));
// DEBUG: print "$result_meta\n";
xslt_free($xh);
?>
--EXPECT--
PHP QA®
string(95) "<html>
<head>
<title>foo</title>
</head>
<body>
<p>PHP QA®</p>
</body>
</html>
"
string(172) "<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>foo</title>
</head>
<body>
<p>PHP QA®</p>
</body>
</html>
"

View file

@ -1,276 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Sterling Hughes <sterling@php.net> |
+----------------------------------------------------------------------+
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_xslt.h"
#if HAVE_XSLT
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#define XSLT_DEBUG 0
/* {{{ xslt_debug()
Output a debug message if debugging is enabled */
extern void xslt_debug(char *function_name, char *format, ...)
{
#if DEBUG
va_list argv;
char buffer[1024];
va_start(argv, format);
vsnprintf(buffer, sizeof(buffer) - 1, format, argv);
va_end(argv);
buffer[sizeof(buffer) - 1] = '\0';
php_printf("<b>XSLT Debug</b>: %s: %s<br />\n",
function_name, buffer);
#endif
}
/* }}} */
/* {{{ find_xslt_argument()
Find and return an xslt argument from the argument buffer */
static char *_find_xslt_argument(const char **argv, const char *key)
{
char **ptr; /* Pointer to the passed char ** array */
char *return_value = NULL; /* Value to return from the function */
if (! argv)
return NULL;
/* Loop through the array searching for the value */
ptr = (char **) argv;
while (*ptr) {
/* If we have a match, save the value and exit out */
if (! strcmp(*ptr, key)) {
return_value = estrdup(*ptr);
break;
}
++ptr;
}
return return_value;
}
/* }}} */
/* {{{ xslt_make_array()
Make an XSLT array (char **) from a zval array (HashTable *) */
extern void xslt_make_array(zval **zarr, char ***carr)
{
zval **current;
HashTable *arr;
int idx = 0;
TSRMLS_FETCH();
/* Skip a warning, when 'NULL' is provided as argument */
if ( Z_TYPE_PP(zarr) == IS_NULL)
return;
arr = HASH_OF(*zarr);
if (! arr) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid argument or parameter array");
return;
}
*carr = emalloc(((zend_hash_num_elements(arr) * 2) + 1) * sizeof(char *));
for (zend_hash_internal_pointer_reset(arr);
zend_hash_get_current_data(arr, (void **) &current) == SUCCESS;
zend_hash_move_forward(arr)) {
char *string_key = NULL;
ulong num_key;
int type;
SEPARATE_ZVAL(current);
convert_to_string_ex(current);
type = zend_hash_get_current_key(arr, &string_key, &num_key, 0);
if (type == HASH_KEY_IS_LONG) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid key value for argument or parameter array");
/* Make the next index NULL, so it signals the end of the array
this will protect against invalid arrays, like:
array('foo'=>'bar', 'foobarred', 'oops') */
(*carr)[idx] = NULL;
return;
}
(*carr)[idx++] = estrdup(string_key);
(*carr)[idx++] = estrndup(Z_STRVAL_PP(current), Z_STRLEN_PP(current));
}
(*carr)[idx] = NULL;
}
/* }}} */
/* {{{ xslt_free_array()
Free an xslt array built by xslt_make_array() */
extern void xslt_free_array(char **arr)
{
char **ptr = arr;
while (*ptr != NULL) {
efree(*ptr);
ptr++;
}
efree(arr);
}
/* }}} */
/* {{{ xslt_parse_arguments()
Parse an XSLT argument buffer */
extern xslt_args *xslt_parse_arguments(char *xml,
char *xsl,
char *result,
char **argv)
{
xslt_args *return_value; /* The value to return from the function */
return_value = emalloc(sizeof(xslt_args));
/* The xml argument */
if (! strncasecmp(xml, "arg:", 4)) {
char *key = xml + 5;
return_value->xml.type = XSLT_IS_DATA;
return_value->xml.ptr = _find_xslt_argument((const char **) argv,
(const char *) key);
}
else {
return_value->xml.type = XSLT_IS_FILE;
return_value->xml.ptr = estrdup(xml);
}
/* The xslt arguments */
if (! strncasecmp(xsl, "arg:", 4)) {
char *key = xsl + 5;
return_value->xsl.type = XSLT_IS_DATA;
return_value->xsl.ptr = _find_xslt_argument((const char **) argv,
(const char *) key);
}
else {
return_value->xsl.type = XSLT_IS_FILE;
return_value->xsl.ptr = estrdup(xsl);
}
/* The result argument */
if (! strncasecmp(result, "arg:", 4)) {
char *key = result + 5;
return_value->result.type = XSLT_IS_DATA;
return_value->result.ptr = _find_xslt_argument((const char **) argv,
(const char *) key);
}
else {
return_value->result.type = XSLT_IS_FILE;
return_value->result.ptr = estrdup(result);
}
return return_value;
}
/* }}} */
/* {{{ free_xslt_arguments()
Free's an XSLT argument list returned from parse_xslt_arguments() */
extern void xslt_free_arguments(xslt_args *to_free)
{
if (to_free->xml.ptr) {
efree(to_free->xml.ptr);
}
if (to_free->xsl.ptr) {
efree(to_free->xsl.ptr);
}
if (to_free->result.ptr) {
efree(to_free->result.ptr);
}
efree(to_free);
}
/* }}} */
/* {{{ call_xslt_function()
Call an XSLT handler */
extern void xslt_call_function(char *name,
zval *function,
zval *object,
int argc,
zval **user_args,
zval **retval)
{
zval ***argv; /* Argument container, maps around for call_user_function_ex() */
int error; /* Error container */
int idx; /* Idx, when looping through and free'ing the arguments */
TSRMLS_FETCH(); /* For TS mode, fetch the executor globals */
argv = emalloc(argc * sizeof(zval **));
for (idx = 0; idx < argc; idx++) {
argv[idx] = &user_args[idx];
}
/* Call the function (with object when appropriate)*/
if (object == NULL)
{
error = call_user_function_ex(EG(function_table),
NULL, function,
retval, argc, argv, 0, NULL TSRMLS_CC);
}
else
{
error = call_user_function_ex(EG(function_table),
&object, function,
retval, argc, argv, 0, NULL TSRMLS_CC);
}
if (error == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the %s handler: %s",
name, Z_STRVAL_P(function));
}
/* Cleanup arguments */
for (idx = 0; idx < argc; idx++) {
/* Decrease refcount and free if refcount is <= 0 */
zval_ptr_dtor(argv[idx]);
}
efree(argv);
}
/* }}} */
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/

View file

@ -1,115 +0,0 @@
# Microsoft Developer Studio Project File - Name="xslt" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=xslt - 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 "xslt.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 "xslt.mak" CFG="xslt - Win32 Debug_TS"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "xslt - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "xslt - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "xslt - Win32 Release_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release_TS"
# PROP BASE Intermediate_Dir "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 Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XSLT_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\win32" /I "C:\Program Files\Sablot-0.96\include" /D "COMPILE_DL_XSLT" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_XSLT=1 /D "HAVE_SABLOT_BACKEND" /D "HAVE_SABLOT_SET_ENCODING" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "NDEBUG"
# ADD RSC /l 0x407 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 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 /dll /machine:I386
# ADD LINK32 kernel32.lib php4ts.lib sablot.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_xslt.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"C:\Program Files\Sablot-0.96\lib"
!ELSEIF "$(CFG)" == "xslt - Win32 Debug_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug_TS"
# PROP BASE Intermediate_Dir "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 Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XSLT_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D COMPILE_DL_XSLT=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_XSLT=1 /D "HAVE_SABLOT_BACKEND" /D "HAVE_SABLOT_SET_ENCODING" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "_DEBUG"
# ADD RSC /l 0x407 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 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 /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib php4ts_debug.lib sablot.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_xslt.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
!ENDIF
# Begin Target
# Name "xslt - Win32 Release_TS"
# Name "xslt - Win32 Debug_TS"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\sablot.c
# End Source File
# Begin Source File
SOURCE=.\xslt.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\php_sablot.h
# End Source File
# Begin Source File
SOURCE=.\php_xslt.h
# End Source File
# End Group
# End Target
# End Project