You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2005/12/02 09:23:15 UTC
svn commit: r351632 - in /webservices/axis2/trunk/c/bindings: ./ php/
php/tests/
Author: samisa
Date: Fri Dec 2 00:23:02 2005
New Revision: 351632
URL: http://svn.apache.org/viewcvs?rev=351632&view=rev
Log: (empty)
Added:
webservices/axis2/trunk/c/bindings/
webservices/axis2/trunk/c/bindings/php/
webservices/axis2/trunk/c/bindings/php/.cvsignore
webservices/axis2/trunk/c/bindings/php/CREDITS
webservices/axis2/trunk/c/bindings/php/EXPERIMENTAL
webservices/axis2/trunk/c/bindings/php/axis2.c
webservices/axis2/trunk/c/bindings/php/axis2.php
webservices/axis2/trunk/c/bindings/php/axis2_ce.h
webservices/axis2/trunk/c/bindings/php/axis2_common.h
webservices/axis2/trunk/c/bindings/php/axis2_fe.h
webservices/axis2/trunk/c/bindings/php/axis2_properties.h
webservices/axis2/trunk/c/bindings/php/config.m4
webservices/axis2/trunk/c/bindings/php/config.w32
webservices/axis2/trunk/c/bindings/php/php_axis2.h
webservices/axis2/trunk/c/bindings/php/tests/
webservices/axis2/trunk/c/bindings/php/tests/001.phpt
webservices/axis2/trunk/c/bindings/php/xml_reader.c
Added: webservices/axis2/trunk/c/bindings/php/.cvsignore
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/.cvsignore?rev=351632&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/.cvsignore (added)
+++ webservices/axis2/trunk/c/bindings/php/.cvsignore Fri Dec 2 00:23:02 2005
@@ -0,0 +1,3 @@
+.deps
+*.lo
+*.la
Added: webservices/axis2/trunk/c/bindings/php/CREDITS
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/CREDITS?rev=351632&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/CREDITS (added)
+++ webservices/axis2/trunk/c/bindings/php/CREDITS Fri Dec 2 00:23:02 2005
@@ -0,0 +1 @@
+axis2
\ No newline at end of file
Added: webservices/axis2/trunk/c/bindings/php/EXPERIMENTAL
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/EXPERIMENTAL?rev=351632&view=auto
==============================================================================
(empty)
Added: webservices/axis2/trunk/c/bindings/php/axis2.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/axis2.c?rev=351632&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2.c (added)
+++ webservices/axis2/trunk/c/bindings/php/axis2.c Fri Dec 2 00:23:02 2005
@@ -0,0 +1,298 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2004 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: |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id: header,v 1.15 2004/01/08 16:46:52 sniper Exp $ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "php.h"
+#include "php_ini.h"
+#include "ext/standard/info.h"
+#include "php_axis2.h"
+#include "axis2_env.h"
+#include "axis2_error_default.h"
+#include "axis2_stream_default.h"
+#include "axis2_log_default.h"
+
+
+zend_object_value axis2_objects_new(zend_class_entry *class_type TSRMLS_DC );
+
+
+
+/* If you declare any globals in php_axis2.h uncomment this:
+*/
+ZEND_DECLARE_MODULE_GLOBALS(axis2)
+
+
+/* True global resources - no need for thread safety here */
+static int le_axis2;
+
+static zend_object_handlers axis2_object_handlers;
+
+/* {{{ axis2_functions[]
+ *
+ * Every user visible function must have an entry in axis2_functions[].
+ */
+function_entry axis2_functions[] = {
+ PHP_FE(axis2_helloworld, NULL)
+ {NULL, NULL, NULL} /* Must be the last line in axis2_functions[] */
+};
+/* }}} */
+
+/* {{{ axis2_module_entry
+ */
+zend_module_entry axis2_module_entry = {
+#if ZEND_MODULE_API_NO >= 20010901
+ STANDARD_MODULE_HEADER,
+#endif
+ "axis2",
+ axis2_functions,
+ PHP_MINIT(axis2),
+ PHP_MSHUTDOWN(axis2),
+ PHP_RINIT(axis2), /* Replace with NULL if there's nothing to do at request start */
+ PHP_RSHUTDOWN(axis2), /* Replace with NULL if there's nothing to do at request end */
+ PHP_MINFO(axis2),
+#if ZEND_MODULE_API_NO >= 20010901
+ "0.1", /* Replace with version number for your extension */
+#endif
+ STANDARD_MODULE_PROPERTIES
+};
+/* }}} */
+
+#ifdef COMPILE_DL_AXIS2
+ZEND_GET_MODULE(axis2)
+#endif
+
+/* {{{ PHP_INI
+ */
+/* Remove comments and fill if you need to have entries in php.ini
+PHP_INI_BEGIN()
+ STD_PHP_INI_ENTRY("axis2.global_value", "42", PHP_INI_ALL, OnUpdateLong, global_value, zend_axis2_globals, axis2_globals)
+ STD_PHP_INI_ENTRY("axis2.global_string", "foobar", PHP_INI_ALL, OnUpdateString, global_string, zend_axis2_globals, axis2_globals)
+PHP_INI_END()
+*/
+/* }}} */
+
+/* {{{ php_axis2_init_globals
+ */
+
+static void php_axis2_init_globals(zend_axis2_globals *axis2_globals)
+{
+ axis2_allocator_t *allocator = NULL;
+ axis2_error_t *err = NULL;
+ axis2_log_t *log = NULL;
+ axis2_stream_t *stream = NULL;
+ axis2_env_t *environment = NULL;
+ allocator = axis2_allocator_init (NULL);
+ log = axis2_log_create(allocator, NULL);
+ stream = axis2_stream_create(allocator, NULL);
+ err = axis2_error_create(allocator);
+
+ environment= axis2_env_create_with_error_stream_log(allocator, err,stream, log);
+
+ axis2_globals->global_value = 0;
+ axis2_globals->global_string = NULL;
+ axis2_globals->env = environment;
+ axis2_globals->allocator = allocator;
+}
+
+/* }}} */
+
+/* {{{ PHP_MINIT_FUNCTION
+ */
+PHP_MINIT_FUNCTION(axis2)
+{
+ zend_class_entry ce;
+
+ ZEND_INIT_MODULE_GLOBALS(axis2, php_axis2_init_globals, NULL);
+ /* If you have INI entries, uncomment these lines
+ REGISTER_INI_ENTRIES();
+ */
+
+
+ memcpy(&axis2_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ axis2_object_handlers.clone_obj = NULL;
+
+ REGISTER_AXIS2_CLASS(ce,"Axis2XMLReader",NULL, php_axis2_xml_reader_class_functions, axis2_xml_reader_class_entry);
+
+
+
+
+
+ REGISTER_LONG_CONSTANT("AXIS2_XML_READER_START_DOCUMENT", AXIS2_XML_READER_START_DOCUMENT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("AXIS2_XML_READER_START_ELEMENT", AXIS2_XML_READER_START_ELEMENT , CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("AXIS2_XML_READER_END_ELEMENT", AXIS2_XML_READER_END_ELEMENT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("AXIS2_XML_READER_SPACE", AXIS2_XML_READER_SPACE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("AXIS2_XML_READER_EMPTY_ELEMENT", AXIS2_XML_READER_EMPTY_ELEMENT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("AXIS2_XML_READER_CHARACTER", AXIS2_XML_READER_CHARACTER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("AXIS2_XML_READER_ENTITY_REFERANCE", AXIS2_XML_READER_ENTITY_REFERANCE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("AXIS2_XML_READER_COMMENT", AXIS2_XML_READER_COMMENT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("AXIS2_XML_READER_PROCESSING_INSTRUCTION", AXIS2_XML_READER_PROCESSING_INSTRUCTION, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("AXIS2_XML_READER_CDATA", AXIS2_XML_READER_CDATA, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("AXIS2_XML_READER_DOCUMENT_TYPE", AXIS2_XML_READER_DOCUMENT_TYPE, CONST_CS | CONST_PERSISTENT);
+
+
+
+ return SUCCESS;
+}
+/* }}} */
+
+/* {{{ PHP_MSHUTDOWN_FUNCTION
+ */
+PHP_MSHUTDOWN_FUNCTION(axis2)
+{
+ /* uncomment this line if you have INI entries
+ UNREGISTER_INI_ENTRIES();
+ */
+ php_axis2_destroy_env();
+ return SUCCESS;
+}
+/* }}} */
+
+
+
+void php_axis2_objects_free_storage(void *object TSRMLS_DC)
+{
+ axis2_object *intern = (axis2_object_ptr)object;
+ zend_hash_destroy(intern->std.properties);
+ FREE_HASHTABLE(intern->std.properties);
+
+ if(intern->node_list)
+ {
+ zend_hash_destroy(intern->node_list);
+ FREE_HASHTABLE(intern->node_list);
+
+ }
+ /*TODO individaul objects must be freed */
+ if(intern->ptr)
+ {
+
+
+ }
+
+
+}
+
+
+static zend_object_value axis2_objects_new(zend_class_entry *class_type TSRMLS_DC )
+{
+ zend_object_value retval;
+ axis2_object *intern = NULL;
+ zval *tmp = NULL;
+
+ intern = emalloc(sizeof(axis2_object));
+ intern->std.ce = class_type;
+ intern->std.in_get = 0;
+ intern->std.in_set = 0;
+
+ intern->ptr = NULL;
+ intern->prop_handler = NULL;
+ ALLOC_HASHTABLE(intern->std.properties);
+ zend_hash_init(intern->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
+ zend_hash_copy(intern->std.properties, &class_type->default_properties,
+ (copy_ctor_func_t)zval_add_ref, (void*)tmp, sizeof(zval *));
+ retval.handle = zend_objects_store_put(intern, NULL,
+ ( zend_objects_free_object_storage_t)php_axis2_objects_free_storage,NULL TSRMLS_CC);
+
+ intern->handle = retval.handle;
+ retval.handlers = &axis2_object_handlers;
+ return retval;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+/* Remove if there's nothing to do at request start */
+/* {{{ PHP_RINIT_FUNCTION
+ */
+PHP_RINIT_FUNCTION(axis2)
+{
+ return SUCCESS;
+}
+/* }}} */
+
+/* Remove if there's nothing to do at request end */
+/* {{{ PHP_RSHUTDOWN_FUNCTION
+ */
+PHP_RSHUTDOWN_FUNCTION(axis2)
+{
+ return SUCCESS;
+}
+/* }}} */
+
+/* {{{ PHP_MINFO_FUNCTION
+ */
+PHP_MINFO_FUNCTION(axis2)
+{
+ php_info_print_table_start();
+ php_info_print_table_header(2, "axis2 support", "enabled");
+ php_info_print_table_end();
+
+ /* Remove comments if you have entries in php.ini
+ DISPLAY_INI_ENTRIES();
+ */
+}
+/* }}} */
+
+
+
+
+
+/* {{{ proto string axis2_helloworld()
+ say welcome note */
+PHP_FUNCTION(axis2_helloworld)
+{
+ php_printf(" welcome axis2");
+}
+/* }}} */
+
+
+
+void php_axis2_destroy_env()
+{
+ TSRMLS_FETCH();
+ axis2_env_free(AXIS2_G(env));
+ AXIS2_G(env) = NULL;
+ AXIS2_G(allocator) = NULL;
+}
+
+axis2_env_t *php_axis2_get_env()
+{
+ TSRMLS_FETCH();
+ return AXIS2_G(env);
+}
+
+/*
+ * 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
+ */
Added: webservices/axis2/trunk/c/bindings/php/axis2.php
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/axis2.php?rev=351632&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2.php (added)
+++ webservices/axis2/trunk/c/bindings/php/axis2.php Fri Dec 2 00:23:02 2005
@@ -0,0 +1,19 @@
+<?
+if(!extension_loaded('axis2')) {
+ dl('axis2.' . PHP_SHLIB_SUFFIX);
+}
+$module = 'axis2';
+$functions = get_extension_funcs($module);
+echo "Functions available in the test extension:<br>\n";
+foreach($functions as $func) {
+ echo $func."<br>\n";
+}
+echo "<br>\n";
+$function = 'confirm_' . $module . '_compiled';
+if (extension_loaded($module)) {
+ $str = $function($module);
+} else {
+ $str = "Module $module is not compiled into PHP";
+}
+echo "$str\n";
+?>
Added: webservices/axis2/trunk/c/bindings/php/axis2_ce.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/axis2_ce.h?rev=351632&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2_ce.h (added)
+++ webservices/axis2/trunk/c/bindings/php/axis2_ce.h Fri Dec 2 00:23:02 2005
@@ -0,0 +1,16 @@
+#ifndef AXIS2_CE_H
+#define AXIS2_CE_H
+
+zend_class_entry *axis2_xml_reader_class_entry;
+zend_class_entry *axis2_xml_writer_class_entry;
+zend_class_entry *axis2_om_element_class_entry;
+zend_class_entry *axis2_om_comment_class_entry;
+zend_class_entry *axis2_om_text_class_entry;
+zend_class_entry *axis2_om_pi_entry;
+zend_class_entry *axis2_om_stax_builder_class_entry;
+zend_class_entry *axis2_om_document_class_entry;
+zend_class_entry *axis2_om_attribute_class_entry;
+zend_class_entry *axis2_om_namespace_class_entry;
+
+
+#endif /* AXIS2_CE_H */
\ No newline at end of file
Added: webservices/axis2/trunk/c/bindings/php/axis2_common.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/axis2_common.h?rev=351632&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2_common.h (added)
+++ webservices/axis2/trunk/c/bindings/php/axis2_common.h Fri Dec 2 00:23:02 2005
@@ -0,0 +1,53 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2004 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: |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id: header,v 1.15 2004/01/08 16:46:52 sniper Exp $ */
+
+#ifndef AXIS2_COMMON_H
+#define AXIS2_COMMON_H
+#include <axis2_om_node.h>
+#include <axis2_om_document.h>
+#include <axis2_om_stax_builder.h>
+
+typedef struct _axis2_om_node {
+ axis2_om_node_t *node;
+ axis2_om_document_t *doc;
+ axis2_om_stax_builder_t *builder;
+ int ref_count;
+}axis2_om_node;
+
+typedef struct _om_object{
+ void *ptr;
+ int obj_type;
+ int ref_count;
+}om_object;
+
+
+
+typedef axis2_om_node* axis2_om_node_ptr;
+typedef om_object* om_object_ptr;
+
+
+#define REGISTER_AXIS2_CLASS(ce, name, parent_ce, funcs, entry) \
+INIT_CLASS_ENTRY(ce, name, funcs); \
+ce.create_object = axis2_objects_new; \
+entry = zend_register_internal_class_ex(&ce, parent_ce, NULL TSRMLS_CC);
+
+
+
+#endif /* AXIS2_COMMON_H */
\ No newline at end of file
Added: webservices/axis2/trunk/c/bindings/php/axis2_fe.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/axis2_fe.h?rev=351632&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2_fe.h (added)
+++ webservices/axis2/trunk/c/bindings/php/axis2_fe.h Fri Dec 2 00:23:02 2005
@@ -0,0 +1,48 @@
+#ifndef AXIS2_FE_H
+#define AXIS2_FE_H
+
+extern zend_function_entry php_axis2_xml_reader_class_functions[];
+extern zend_function_entry php_axis2_xml_writer_class_functions[];
+extern zend_function_entry php_axis2_om_element_class_functions[];
+extern zend_function_entry php_axis2_om_comment_class_functions[];
+extern zend_function_entry php_axis2_om_text_class_functions[];
+extern zend_function_entry php_axis2_om_pi_class_functions[];
+extern zend_function_entry php_axis2_om_stax_builder_class_functions[];
+extern zend_function_entry php_axis2_om_document_class_functions[];
+extern zend_function_entry php_axis2_om_attribute_class_functions[];
+extern zend_function_entry php_axis2_om_namespace_class_functions[];
+
+/** axis2_xml_reader functions */
+PHP_METHOD(xml_reader, __construct);
+PHP_FUNCTION(axis2_xml_reader_next);
+PHP_FUNCTION(axis2_xml_reader_get_attribute_count);
+PHP_FUNCTION(axis2_xml_reader_get_attribute_name_by_number);
+PHP_FUNCTION(axis2_xml_reader_get_attribute_prefix_by_number);
+PHP_FUNCTION(axis2_xml_reader_get_attribute_namespace_by_number);
+PHP_FUNCTION(axis2_xml_reader_get_attribute_value_by_number);
+PHP_FUNCTION(axis2_xml_reader_get_name);
+PHP_FUNCTION(axis2_xml_reader_get_value);
+PHP_FUNCTION(axis2_xml_reader_get_prefix);
+PHP_FUNCTION(axis2_xml_reader_get_namespace_count);
+PHP_FUNCTION(axis2_xml_reader_get_namespace_uri_by_number);
+PHP_FUNCTION(axis2_xml_reader_get_namespace_prefix_by_number);
+PHP_FUNCTION(axis2_xml_reader_get_pi_target);
+PHP_FUNCTION(axis2_xml_reader_get_pi_data);
+
+
+typedef enum {
+
+ OM_ELEMENT = 0,
+ OM_NODE,
+ OM_PI,
+ OM_COMMENT,
+ OM_TEXT,
+ OM_DOCTYPE,
+ AXIS2_XML_READER,
+ AXIS2_XML_WRITER,
+ OM_DOCUMENT,
+ OM_STAX_BUILDER
+}om_obj_types;
+
+
+#endif /* AXIS2_FE_H */
\ No newline at end of file
Added: webservices/axis2/trunk/c/bindings/php/axis2_properties.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/axis2_properties.h?rev=351632&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2_properties.h (added)
+++ webservices/axis2/trunk/c/bindings/php/axis2_properties.h Fri Dec 2 00:23:02 2005
@@ -0,0 +1,4 @@
+#ifndef AXIS2_PROPERTIES_H
+#define AXIS2_PROPERTIES_H
+
+#endif /* AXIS2_PROPERTIES_H */
\ No newline at end of file
Added: webservices/axis2/trunk/c/bindings/php/config.m4
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/config.m4?rev=351632&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/config.m4 (added)
+++ webservices/axis2/trunk/c/bindings/php/config.m4 Fri Dec 2 00:23:02 2005
@@ -0,0 +1,63 @@
+dnl $Id$
+dnl config.m4 for extension axis2
+
+dnl Comments in this file start with the string 'dnl'.
+dnl Remove where necessary. This file will not work
+dnl without editing.
+
+dnl If your extension references something external, use with:
+
+dnl PHP_ARG_WITH(axis2, for axis2 support,
+dnl Make sure that the comment is aligned:
+dnl [ --with-axis2 Include axis2 support])
+
+dnl Otherwise use enable:
+
+dnl PHP_ARG_ENABLE(axis2, whether to enable axis2 support,
+dnl Make sure that the comment is aligned:
+dnl [ --enable-axis2 Enable axis2 support])
+
+if test "$PHP_AXIS2" != "no"; then
+ dnl Write more examples of tests here...
+
+ dnl # --with-axis2 -> check with-path
+ dnl SEARCH_PATH="/usr/local /usr" # you might want to change this
+ dnl SEARCH_FOR="/include/axis2.h" # you most likely want to change this
+ dnl if test -r $PHP_AXIS2/$SEARCH_FOR; then # path given as parameter
+ dnl AXIS2_DIR=$PHP_AXIS2
+ dnl else # search default path list
+ dnl AC_MSG_CHECKING([for axis2 files in default path])
+ dnl for i in $SEARCH_PATH ; do
+ dnl if test -r $i/$SEARCH_FOR; then
+ dnl AXIS2_DIR=$i
+ dnl AC_MSG_RESULT(found in $i)
+ dnl fi
+ dnl done
+ dnl fi
+ dnl
+ dnl if test -z "$AXIS2_DIR"; then
+ dnl AC_MSG_RESULT([not found])
+ dnl AC_MSG_ERROR([Please reinstall the axis2 distribution])
+ dnl fi
+
+ dnl # --with-axis2 -> add include path
+ dnl PHP_ADD_INCLUDE($AXIS2_DIR/include)
+
+ dnl # --with-axis2 -> check for lib and symbol presence
+ dnl LIBNAME=axis2 # you may want to change this
+ dnl LIBSYMBOL=axis2 # you most likely want to change this
+
+ dnl PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
+ dnl [
+ dnl PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $AXIS2_DIR/lib, AXIS2_SHARED_LIBADD)
+ dnl AC_DEFINE(HAVE_AXIS2LIB,1,[ ])
+ dnl ],[
+ dnl AC_MSG_ERROR([wrong axis2 lib version or lib not found])
+ dnl ],[
+ dnl -L$AXIS2_DIR/lib -lm -ldl
+ dnl ])
+ dnl
+ dnl PHP_SUBST(AXIS2_SHARED_LIBADD)
+
+ PHP_NEW_EXTENSION(axis2, axis2.c, $ext_shared)
+fi
Added: webservices/axis2/trunk/c/bindings/php/config.w32
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/config.w32?rev=351632&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/config.w32 (added)
+++ webservices/axis2/trunk/c/bindings/php/config.w32 Fri Dec 2 00:23:02 2005
@@ -0,0 +1,13 @@
+// $Id$
+// vim:ft=javascript
+
+// If your extension references something external, use ARG_WITH
+// ARG_WITH("axis2", "for axis2 support", "no");
+
+// Otherwise, use ARG_ENABLE
+// ARG_ENABLE("axis2", "enable axis2 support", "no");
+
+if (PHP_AXIS2 != "no") {
+ EXTENSION("axis2", "axis2.c");
+}
+
Added: webservices/axis2/trunk/c/bindings/php/php_axis2.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/php_axis2.h?rev=351632&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/php_axis2.h (added)
+++ webservices/axis2/trunk/c/bindings/php/php_axis2.h Fri Dec 2 00:23:02 2005
@@ -0,0 +1,111 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2004 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: |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id: header,v 1.15 2004/01/08 16:46:52 sniper Exp $ */
+
+#ifndef PHP_AXIS2_H
+#define PHP_AXIS2_H
+
+extern zend_module_entry axis2_module_entry;
+#define phpext_axis2_ptr &axis2_module_entry
+
+#ifdef PHP_WIN32
+#define PHP_AXIS2_API __declspec(dllexport)
+#else
+#define PHP_AXIS2_API
+#endif
+
+#ifdef ZTS
+#include "TSRM.h"
+#endif
+
+#include "axis2_ce.h"
+#include "axis2_fe.h"
+#include "axis2_common.h"
+
+#include <axis2.h>
+#include <axis2_env.h>
+
+
+
+
+
+PHP_MINIT_FUNCTION(axis2);
+PHP_MSHUTDOWN_FUNCTION(axis2);
+PHP_RINIT_FUNCTION(axis2);
+PHP_RSHUTDOWN_FUNCTION(axis2);
+PHP_MINFO_FUNCTION(axis2);
+
+PHP_FUNCTION(axis2_helloworld); /* For testing, remove later. */
+
+
+
+typedef struct axis2_object{
+ zend_object std;
+ void *ptr;
+ int obj_type;
+ HashTable *prop_handler;
+ zend_object_handle handle;
+ HashTable *node_list;
+}axis2_object;
+
+typedef axis2_object *axis2_object_ptr;
+
+void php_axis2_objects_free_storage(void *object TSRMLS_DC);
+void php_axis2_destroy_env();
+axis2_env_t *php_axis2_get_env();
+
+/*
+ Declare any global variables you may need between the BEGIN
+ and END macros here: */
+
+ZEND_BEGIN_MODULE_GLOBALS(axis2)
+ long global_value;
+ char *global_string;
+ axis2_env_t *env;
+ axis2_allocator_t *allocator;
+ZEND_END_MODULE_GLOBALS(axis2)
+
+
+/* In every utility function you add that needs to use variables
+ in php_axis2_globals, call TSRMLS_FETCH(); after declaring other
+ variables used by that function, or better yet, pass in TSRMLS_CC
+ after the last function argument and declare your utility function
+ with TSRMLS_DC after the last declared argument. Always refer to
+ the globals in your function as AXIS2_G(variable). You are
+ encouraged to rename these macros something shorter, see
+ examples in any other php module directory.
+*/
+
+#ifdef ZTS
+#define AXIS2_G(v) TSRMG(axis2_globals_id, zend_axis2_globals *, v)
+#else
+#define AXIS2_G(v) (axis2_globals.v)
+#endif
+
+#endif /* PHP_AXIS2_H */
+
+
+/*
+ * 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
+ */
Added: webservices/axis2/trunk/c/bindings/php/tests/001.phpt
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/tests/001.phpt?rev=351632&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/tests/001.phpt (added)
+++ webservices/axis2/trunk/c/bindings/php/tests/001.phpt Fri Dec 2 00:23:02 2005
@@ -0,0 +1,21 @@
+--TEST--
+Check for axis2 presence
+--SKIPIF--
+<?php if (!extension_loaded("axis2")) print "skip"; ?>
+--FILE--
+<?php
+echo "axis2 extension is available";
+/*
+ you can add regression tests for your extension here
+
+ the output of your test code has to be equal to the
+ text in the --EXPECT-- section below for the tests
+ to pass, differences between the output and the
+ expected text are interpreted as failure
+
+ see php5/README.TESTING for further information on
+ writing regression tests
+*/
+?>
+--EXPECT--
+axis2 extension is available
Added: webservices/axis2/trunk/c/bindings/php/xml_reader.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/xml_reader.c?rev=351632&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/xml_reader.c (added)
+++ webservices/axis2/trunk/c/bindings/php/xml_reader.c Fri Dec 2 00:23:02 2005
@@ -0,0 +1,422 @@
+
+#include "php.h"
+#include "php_axis2.h"
+#include "axis2_xml_reader.h"
+
+zend_function_entry php_axis2_xml_reader_class_functions[]=
+{
+ PHP_FALIAS(next, axis2_xml_reader_next, NULL)
+ PHP_FALIAS(getAttributeCount, axis2_xml_reader_get_attribute_count, NULL)
+ PHP_FALIAS(getAttributeName , axis2_xml_reader_get_attribute_name_by_number, NULL)
+ PHP_FALIAS(getAttributePrefix, axis2_xml_reader_get_attribute_prefix_by_number, NULL)
+ PHP_FALIAS(getAttributeNamespace, axis2_xml_reader_get_attribute_namespace_by_number, NULL)
+ PHP_FALIAS(getAttributeValue, axis2_xml_reader_get_attribute_value_by_number, NULL)
+ PHP_FALIAS(getName, axis2_xml_reader_get_name, NULL)
+ PHP_FALIAS(getValue, axis2_xml_reader_get_value, NULL)
+ PHP_FALIAS(getPrefix, axis2_xml_reader_get_prefix, NULL)
+ PHP_FALIAS(getNamespaceCount, axis2_xml_reader_get_namespace_count, NULL)
+ PHP_FALIAS(getNamespaceUri, axis2_xml_reader_get_namespace_uri_by_number, NULL)
+ PHP_FALIAS(getNamespacePrefix, axis2_xml_reader_get_namespace_prefix_by_number, NULL)
+ PHP_FALIAS(getPITarget , axis2_xml_reader_get_pi_target, NULL)
+ PHP_FALIAS(getPIData, axis2_xml_reader_get_pi_data, NULL)
+ PHP_ME(xml_reader, __construct, NULL, ZEND_ACC_PUBLIC)
+ {NULL, NULL, NULL}
+};
+
+PHP_METHOD(xml_reader , __construct)
+{
+ zval *object = NULL;
+ axis2_object_ptr axis2_obj = NULL;
+ om_object_ptr om_obj = NULL;
+ char *path;
+ int length;
+ axis2_env_t *env;
+
+
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, axis2_xml_reader_class_entry, &path, &length) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+ env = php_axis2_get_env();
+
+ om_obj = emalloc(sizeof(om_object));
+ om_obj->ptr = NULL;
+ om_obj->obj_type = AXIS2_XML_READER;
+ om_obj->ptr = axis2_xml_reader_create_for_file(&env, path, NULL);
+ om_obj->ref_count = 1;
+ if(om_obj->ptr == NULL)
+ {
+ php_printf("reader null");
+
+ }
+
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(object TSRMLS_CC);
+ axis2_obj->ptr = om_obj;
+
+}
+
+PHP_FUNCTION(axis2_xml_reader_next)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ long i = 0;
+
+ obj = getThis();
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ i = AXIS2_XML_READER_NEXT(reader, &env);
+ RETURN_LONG(i);
+}
+PHP_FUNCTION(axis2_xml_reader_get_attribute_count)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ int i = 0;
+
+ obj = getThis();
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ i = AXIS2_XML_READER_GET_ATTRIBUTE_COUNT(reader, &env);
+ RETURN_LONG(i);
+}
+PHP_FUNCTION(axis2_xml_reader_get_attribute_name_by_number)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ char *attr_name = NULL;
+ char *name;
+ long i = 0;
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &obj, axis2_xml_reader_class_entry, &i) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ attr_name = AXIS2_XML_READER_GET_ATTRIBUTE_NAME_BY_NUMBER(reader, &env, i);
+ if(!attr_name)
+ {
+ RETURN_NULL();
+ }
+ else
+ {
+ name = estrdup(attr_name);
+ AXIS2_XML_READER_XML_FREE(reader, &env, attr_name);
+ }
+ RETURN_STRING(name, 0);
+}
+PHP_FUNCTION(axis2_xml_reader_get_attribute_prefix_by_number)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ char *attr_prefix = NULL;
+ char *prefix;
+ long i = 0;
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &obj, axis2_xml_reader_class_entry, &i) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ attr_prefix = AXIS2_XML_READER_GET_ATTRIBUTE_PREFIX_BY_NUMBER(reader, &env, i);
+ if(!attr_prefix)
+ {
+ RETURN_NULL();
+ }
+ else
+ {
+ prefix = estrdup(attr_prefix);
+ AXIS2_XML_READER_XML_FREE(reader, &env, attr_prefix);
+ }
+ RETURN_STRING(prefix, 0);
+
+}
+PHP_FUNCTION(axis2_xml_reader_get_attribute_namespace_by_number)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ char *attr_ns_uri = NULL;
+ char *uri;
+ long i = 0;
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &obj, axis2_xml_reader_class_entry, &i) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ attr_ns_uri = AXIS2_XML_READER_GET_ATTRIBUTE_NAMESPACE_BY_NUMBER(reader, &env, i);
+ if(!attr_ns_uri)
+ {
+ RETURN_NULL();
+ }
+ else
+ {
+ uri = estrdup(attr_ns_uri);
+ AXIS2_XML_READER_XML_FREE(reader, &env, attr_ns_uri);
+ }
+ RETURN_STRING(uri, 0);
+}
+PHP_FUNCTION(axis2_xml_reader_get_attribute_value_by_number)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ char *attr_value = NULL;
+ char *value;
+ long i = 0;
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &obj, axis2_xml_reader_class_entry, &i) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ attr_value = AXIS2_XML_READER_GET_ATTRIBUTE_VALUE_BY_NUMBER(reader, &env, i);
+ if(!attr_value)
+ {
+ RETURN_NULL();
+ }
+ else
+ {
+ value = estrdup(attr_value);
+ AXIS2_XML_READER_XML_FREE(reader, &env, attr_value);
+ }
+ RETURN_STRING(value, 0);
+
+}
+PHP_FUNCTION(axis2_xml_reader_get_name)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ char *name = NULL;
+ char *na = NULL;
+
+ obj = getThis();
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ name = AXIS2_XML_READER_GET_NAME(reader, &env);
+ if(!name)
+ {
+ RETURN_NULL();
+ }
+ else
+ {
+ na = estrdup(name);
+ if(name)
+ AXIS2_XML_READER_XML_FREE(reader, &env, name);
+ }
+ RETURN_STRING(na, 0);
+
+}
+PHP_FUNCTION(axis2_xml_reader_get_value)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ char *value = NULL;
+ char *val = NULL;
+
+ obj = getThis();
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ value = AXIS2_XML_READER_GET_VALUE(reader, &env);
+ if(!value)
+ {
+ RETURN_NULL();
+ }
+ else
+ {
+ val = estrdup(value);
+ if(value)
+ AXIS2_XML_READER_XML_FREE(reader, &env, value);
+ }
+ RETURN_STRING(val, 0);
+
+}
+PHP_FUNCTION(axis2_xml_reader_get_prefix)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ char *prefix = NULL;
+ char *pre = NULL;
+
+ obj = getThis();
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ prefix = AXIS2_XML_READER_GET_PREFIX(reader, &env);
+ if(!prefix)
+ {
+ RETURN_NULL();
+ }
+ else
+ {
+ pre = estrdup(prefix);
+ if(prefix)
+ AXIS2_XML_READER_XML_FREE(reader, &env, prefix);
+ }
+ RETURN_STRING(pre, 0);
+
+}
+PHP_FUNCTION(axis2_xml_reader_get_namespace_count)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ long i =0;
+
+ obj = getThis();
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ i = AXIS2_XML_READER_GET_NAMESPACE_COUNT(reader, &env);
+ RETURN_LONG(i);
+
+}
+PHP_FUNCTION(axis2_xml_reader_get_namespace_uri_by_number)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ char *ns_uri = NULL;
+ char *uri = NULL;
+ long i = 0;
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &obj, axis2_xml_reader_class_entry, &i) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ ns_uri = AXIS2_XML_READER_GET_NAMESPACE_URI_BY_NUMBER(reader, &env, i);
+ if(!ns_uri)
+ {
+ RETURN_NULL();
+ }
+ else
+ {
+ uri = estrdup(ns_uri);
+ AXIS2_XML_READER_XML_FREE(reader, &env, ns_uri);
+ }
+ RETURN_STRING(uri, 0);
+
+}
+PHP_FUNCTION(axis2_xml_reader_get_namespace_prefix_by_number)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ char *ns_prefix = NULL;
+ char *prefix = NULL;
+ long i = 0;
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &obj, axis2_xml_reader_class_entry, &i) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ ns_prefix = AXIS2_XML_READER_GET_NAMESPACE_PREFIX_BY_NUMBER(reader, &env, i);
+ if(!ns_prefix)
+ {
+ RETURN_NULL();
+ }
+ else
+ {
+ prefix = estrdup(ns_prefix);
+ AXIS2_XML_READER_XML_FREE(reader, &env, ns_prefix);
+ }
+ RETURN_STRING(prefix, 0);
+}
+PHP_FUNCTION(axis2_xml_reader_get_pi_target)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ char *pi_target = NULL;
+ char *target = NULL;
+
+ obj = getThis();
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ pi_target = AXIS2_XML_READER_GET_PI_TARGET(reader, &env);
+ if(!pi_target)
+ {
+ RETURN_NULL();
+ }
+ else
+ {
+ target = estrdup(pi_target);
+ if(pi_target)
+ AXIS2_XML_READER_XML_FREE(reader, &env, pi_target);
+ }
+ RETURN_STRING(target, 0);
+
+}
+PHP_FUNCTION(axis2_xml_reader_get_pi_data)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ char *pi_data = NULL;
+ char *data = NULL;
+
+ obj = getThis();
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ pi_data = AXIS2_XML_READER_GET_PI_DATA(reader, &env);
+ if(!pi_data)
+ {
+ RETURN_NULL();
+ }
+ else
+ {
+ data = estrdup(pi_data);
+ if(pi_data)
+ AXIS2_XML_READER_XML_FREE(reader, &env, pi_data);
+ }
+ RETURN_STRING(data, 0);
+}
\ No newline at end of file