18#ifndef PHP_XML_COMMON_H
19#define PHP_XML_COMMON_H
36#define Z_DOMOBJ_P(zv) php_dom_obj_from_obj(Z_OBJ_P((zv)))
40# define PHP_DOM_EXPORT __declspec(dllexport)
41# elif !defined(DOM_LOCAL_DEFINES)
42# define PHP_DOM_EXPORT __declspec(dllimport)
44# define PHP_DOM_EXPORT
46#elif defined(__GNUC__) && __GNUC__ >= 4
47# define PHP_DOM_EXPORT __attribute__ ((visibility("default")))
49# define PHP_DOM_EXPORT PHPAPI
51# define PHP_DOM_EXPORT
59#define NODE_GET_OBJ(__ptr, __id, __prtype, __intern) { \
60 __intern = Z_LIBXML_NODE_P(__id); \
61 if (UNEXPECTED(__intern->node == NULL)) { \
62 php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", \
63 ZSTR_VAL(Z_OBJCE_P(__zv)->name));\
66 __ptr = (__prtype)__intern->node->node; \
69#define DOC_GET_OBJ(__ptr, __id, __prtype, __intern) { \
70 __intern = Z_LIBXML_NODE_P(__id); \
71 if (EXPECTED(__intern->document != NULL)) { \
72 __ptr = (__prtype)__intern->document->ptr); \
76#define DOM_RET_OBJ(obj, domobject) \
77 php_dom_create_object(obj, return_value, domobject)
79#define DOM_GET_THIS_OBJ(__ptr, __id, __prtype, __intern) \
81 DOM_GET_OBJ(__ptr, __id, __prtype, __intern);
92static zend_always_inline xmlNodePtr php_dom_next_in_tree_order(
const xmlNode *nodep,
const xmlNode *basep)
95 return nodep->children;
103 nodep = nodep->parent;
104 if (nodep == basep) {
109 zend_throw_error(
NULL,
"Current node in traversal is not in the document. Please report this as a bug in php-src.");
112 }
while (nodep->next ==
NULL);
117static zend_always_inline bool php_dom_follow_spec_doc_ref(
const php_libxml_ref_obj *document)
119 return document !=
NULL && document->class_type == PHP_LIBXML_CLASS_MODERN;
125 return php_dom_follow_spec_doc_ref(intern->
document);
PHP_DOM_EXPORT zend_class_entry * dom_node_class_entry
php_libxml_ref_obj * document
PHP_DOM_EXPORT xmlNodePtr dom_object_get_node(dom_object *obj)
struct _dom_object dom_object
PHP_DOM_EXPORT dom_object * php_dom_object_get_data(xmlNodePtr obj)
libxml_doc_props * dom_doc_propsptr
PHP_DOM_EXPORT bool php_dom_create_object(xmlNodePtr obj, zval *return_value, dom_object *domobj)
ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format,...)
#define zend_always_inline
#define XtOffsetOf(s_type, field)
#define UNEXPECTED(condition)
struct _zend_class_entry zend_class_entry
struct _zend_object zend_object
struct _zend_array HashTable