Annotation of embedaddon/php/ext/dom/xml_common.h, revision 1.1
1.1 ! misho 1: /*
! 2: +----------------------------------------------------------------------+
! 3: | PHP Version 5 |
! 4: +----------------------------------------------------------------------+
! 5: | Copyright (c) 1997-2012 The PHP Group |
! 6: +----------------------------------------------------------------------+
! 7: | This source file is subject to version 3.01 of the PHP license, |
! 8: | that is bundled with this package in the file LICENSE, and is |
! 9: | available through the world-wide-web at the following url: |
! 10: | http://www.php.net/license/3_01.txt |
! 11: | If you did not receive a copy of the PHP license and are unable to |
! 12: | obtain it through the world-wide-web, please send a note to |
! 13: | license@php.net so we can mail you a copy immediately. |
! 14: +----------------------------------------------------------------------+
! 15: | Authors: Christian Stocker <chregu@php.net> |
! 16: | Rob Richards <rrichards@php.net> |
! 17: +----------------------------------------------------------------------+
! 18: */
! 19:
! 20: /* $Id: xml_common.h 321634 2012-01-01 13:15:04Z felipe $ */
! 21:
! 22: #ifndef PHP_XML_COMMON_H
! 23: #define PHP_XML_COMMON_H
! 24:
! 25: #include "ext/libxml/php_libxml.h"
! 26:
! 27: typedef libxml_doc_props *dom_doc_propsptr;
! 28:
! 29: typedef struct _dom_object {
! 30: zend_object std;
! 31: void *ptr;
! 32: php_libxml_ref_obj *document;
! 33: HashTable *prop_handler;
! 34: zend_object_handle handle;
! 35: } dom_object;
! 36:
! 37: #ifdef PHP_WIN32
! 38: # ifdef PHPAPI
! 39: # undef PHPAPI
! 40: # endif
! 41: # ifdef DOM_EXPORTS
! 42: # define PHPAPI __declspec(dllexport)
! 43: # else
! 44: # define PHPAPI __declspec(dllimport)
! 45: # endif /* DOM_EXPORTS */
! 46: #elif defined(__GNUC__) && __GNUC__ >= 4
! 47: # ifdef PHPAPI
! 48: # undef PHPAPI
! 49: # endif
! 50: # define PHPAPI __attribute__ ((visibility("default")))
! 51: #endif /* PHP_WIN32 */
! 52:
! 53: #define PHP_DOM_EXPORT PHPAPI
! 54:
! 55: PHP_DOM_EXPORT extern zend_class_entry *dom_node_class_entry;
! 56: PHP_DOM_EXPORT dom_object *php_dom_object_get_data(xmlNodePtr obj);
! 57: PHP_DOM_EXPORT zval *php_dom_create_object(xmlNodePtr obj, int *found, zval *in, zval* return_value, dom_object *domobj TSRMLS_DC);
! 58: PHP_DOM_EXPORT xmlNodePtr dom_object_get_node(dom_object *obj);
! 59:
! 60: #define DOM_XMLNS_NAMESPACE \
! 61: (const xmlChar *) "http://www.w3.org/2000/xmlns/"
! 62:
! 63: #define NODE_GET_OBJ(__ptr, __id, __prtype, __intern) { \
! 64: __intern = (php_libxml_node_object *)zend_object_store_get_object(__id TSRMLS_CC); \
! 65: if (__intern->node == NULL || !(__ptr = (__prtype)__intern->node->node)) { \
! 66: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't fetch %s", __intern->std.ce->name);\
! 67: RETURN_NULL();\
! 68: } \
! 69: }
! 70:
! 71: #define DOC_GET_OBJ(__ptr, __id, __prtype, __intern) { \
! 72: __intern = (php_libxml_node_object *)zend_object_store_get_object(__id TSRMLS_CC); \
! 73: if (__intern->document != NULL) { \
! 74: if (!(__ptr = (__prtype)__intern->document->ptr)) { \
! 75: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't fetch %s", __intern->std.ce->name);\
! 76: RETURN_NULL();\
! 77: } \
! 78: } \
! 79: }
! 80:
! 81: #define DOM_RET_OBJ_EX(obj, ret, domobject) \
! 82: if (!php_dom_create_object(obj, ret, NULL, return_value, domobject TSRMLS_CC)) { \
! 83: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object"); \
! 84: RETURN_FALSE; \
! 85: }
! 86:
! 87: #define DOM_RET_OBJ(zval, obj, ret, domobject) DOM_RET_OBJ_EX(obj, ret, domobject)
! 88:
! 89: #define DOM_GET_THIS(zval) \
! 90: if (NULL == (zval = getThis())) { \
! 91: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Underlying object missing"); \
! 92: RETURN_FALSE; \
! 93: }
! 94:
! 95: #define DOM_GET_THIS_OBJ(__ptr, __id, __prtype, __intern) \
! 96: DOM_GET_THIS(__id); \
! 97: DOM_GET_OBJ(__ptr, __id, __prtype, __intern);
! 98:
! 99: #endif
! 100:
! 101: /*
! 102: * Local variables:
! 103: * tab-width: 4
! 104: * c-basic-offset: 4
! 105: * End:
! 106: * vim600: noet sw=4 ts=4 fdm=marker
! 107: * vim<600: noet sw=4 ts=4
! 108: */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>