Annotation of embedaddon/php/ext/dom/xml_common.h, revision 1.1.1.3

1.1       misho       1: /*
                      2:   +----------------------------------------------------------------------+
                      3:   | PHP Version 5                                                        |
                      4:   +----------------------------------------------------------------------+
1.1.1.3 ! misho       5:   | Copyright (c) 1997-2013 The PHP Group                                |
1.1       misho       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: 
1.1.1.2   misho      20: /* $Id$ */
1.1       misho      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);
1.1.1.2   misho      57: PHP_DOM_EXPORT zval *php_dom_create_object(xmlNodePtr obj, int *found, zval* return_value, dom_object *domobj TSRMLS_DC);
1.1       misho      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: 
1.1.1.2   misho      81: #define DOM_RET_OBJ(obj, ret, domobject) \
                     82:        if (!php_dom_create_object(obj, ret, return_value, domobject TSRMLS_CC)) { \
1.1       misho      83:                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object"); \
                     84:                RETURN_FALSE; \
                     85:        }
                     86: 
                     87: #define DOM_GET_THIS(zval) \
                     88:        if (NULL == (zval = getThis())) { \
                     89:                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Underlying object missing"); \
                     90:                RETURN_FALSE; \
                     91:        }
                     92: 
                     93: #define DOM_GET_THIS_OBJ(__ptr, __id, __prtype, __intern) \
                     94:        DOM_GET_THIS(__id); \
                     95:        DOM_GET_OBJ(__ptr, __id, __prtype, __intern);
                     96: 
                     97: #endif
                     98: 
                     99: /*
                    100:  * Local variables:
                    101:  * tab-width: 4
                    102:  * c-basic-offset: 4
                    103:  * End:
                    104:  * vim600: noet sw=4 ts=4 fdm=marker
                    105:  * vim<600: noet sw=4 ts=4
                    106:  */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>