This source file includes following definitions.
- php_dom_obj_from_obj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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 void *ptr;
31 php_libxml_ref_obj *document;
32 HashTable *prop_handler;
33 zend_object std;
34 } dom_object;
35
36 static inline dom_object *php_dom_obj_from_obj(zend_object *obj) {
37 return (dom_object*)((char*)(obj) - XtOffsetOf(dom_object, std));
38 }
39
40 #define Z_DOMOBJ_P(zv) php_dom_obj_from_obj(Z_OBJ_P((zv)))
41
42 #ifdef PHP_WIN32
43 # ifdef DOM_EXPORTS
44 # define PHP_DOM_EXPORT __declspec(dllexport)
45 # elif !defined(DOM_LOCAL_DEFINES)
46 # define PHP_DOM_EXPORT __declspec(dllimport)
47 # else
48 # define PHP_DOM_EXPORT
49 # endif
50 #elif defined(__GNUC__) && __GNUC__ >= 4
51 # define PHP_DOM_EXPORT __attribute__ ((visibility("default")))
52 #elif defined(PHPAPI)
53 # define PHP_DOM_EXPORT PHPAPI
54 #else
55 # define PHP_DOM_EXPORT
56 #endif
57
58 PHP_DOM_EXPORT extern zend_class_entry *dom_node_class_entry;
59 PHP_DOM_EXPORT dom_object *php_dom_object_get_data(xmlNodePtr obj);
60 PHP_DOM_EXPORT zend_bool php_dom_create_object(xmlNodePtr obj, zval* return_value, dom_object *domobj);
61 PHP_DOM_EXPORT xmlNodePtr dom_object_get_node(dom_object *obj);
62
63 #define DOM_XMLNS_NAMESPACE \
64 (const xmlChar *) "http://www.w3.org/2000/xmlns/"
65
66 #define NODE_GET_OBJ(__ptr, __id, __prtype, __intern) { \
67 __intern = Z_LIBXML_NODE_P(__id); \
68 if (__intern->node == NULL || !(__ptr = (__prtype)__intern->node->node)) { \
69 php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", \
70 ZSTR_VAL(__intern->std.ce->name));\
71 RETURN_NULL();\
72 } \
73 }
74
75 #define DOC_GET_OBJ(__ptr, __id, __prtype, __intern) { \
76 __intern = Z_LIBXML_NODE_P(__id); \
77 if (__intern->document != NULL) { \
78 if (!(__ptr = (__prtype)__intern->document->ptr)) { \
79 php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", __intern->std.ce->name);\
80 RETURN_NULL();\
81 } \
82 } \
83 }
84
85 #define DOM_RET_OBJ(obj, ret, domobject) \
86 *ret = php_dom_create_object(obj, return_value, domobject)
87
88 #define DOM_GET_THIS(zval) \
89 if (NULL == (zval = getThis())) { \
90 php_error_docref(NULL, E_WARNING, "Underlying object missing"); \
91 RETURN_FALSE; \
92 }
93
94 #define DOM_GET_THIS_OBJ(__ptr, __id, __prtype, __intern) \
95 DOM_GET_THIS(__id); \
96 DOM_GET_OBJ(__ptr, __id, __prtype, __intern);
97
98 #endif
99
100
101
102
103
104
105
106
107