1 /*
2 +----------------------------------------------------------------------+
3 | PHP Version 7 |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 1997-2018 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 | Author: Rob Richards <rrichards@php.net> |
16 +----------------------------------------------------------------------+
17 */
18
19 #ifndef PHP_XMLREADER_H
20 #define PHP_XMLREADER_H
21
22 extern zend_module_entry xmlreader_module_entry;
23 #define phpext_xmlreader_ptr &xmlreader_module_entry
24
25 #include "php_version.h"
26 #define PHP_XMLREADER_VERSION PHP_VERSION
27
28 #ifdef ZTS
29 #include "TSRM.h"
30 #endif
31
32 #include "ext/libxml/php_libxml.h"
33 #include <libxml/xmlreader.h>
34
35 /* If xmlreader and dom both are compiled statically,
36 no DLL import should be used in xmlreader for dom symbols. */
37 #ifdef PHP_WIN32
38 # if defined(HAVE_DOM) && !defined(COMPILE_DL_DOM) && !defined(COMPILE_DL_XMLREADER)
39 # define DOM_LOCAL_DEFINES 1
40 # endif
41 #endif
42
43 typedef struct _xmlreader_object {
44 xmlTextReaderPtr ptr;
45 /* strings must be set in input buffer as copy is required */
46 xmlParserInputBufferPtr input;
47 void *schema;
48 HashTable *prop_handler;
49 zend_object std;
50 } xmlreader_object;
51
php_xmlreader_fetch_object(zend_object * obj)52 static inline xmlreader_object *php_xmlreader_fetch_object(zend_object *obj) {
53 return (xmlreader_object *)((char*)(obj) - XtOffsetOf(xmlreader_object, std));
54 }
55
56 #define Z_XMLREADER_P(zv) php_xmlreader_fetch_object(Z_OBJ_P((zv)))
57
58 PHP_MINIT_FUNCTION(xmlreader);
59 PHP_MSHUTDOWN_FUNCTION(xmlreader);
60 PHP_MINFO_FUNCTION(xmlreader);
61
62 #define REGISTER_XMLREADER_CLASS_CONST_LONG(const_name, value) \
63 zend_declare_class_constant_long(xmlreader_class_entry, const_name, sizeof(const_name)-1, (zend_long)value);
64
65 #ifdef ZTS
66 #define XMLREADER_G(v) TSRMG(xmlreader_globals_id, zend_xmlreader_globals *, v)
67 #else
68 #define XMLREADER_G(v) (xmlreader_globals.v)
69 #endif
70
71 #endif /* PHP_XMLREADER_H */
72
73 /*
74 * Local variables:
75 * tab-width: 4
76 * c-basic-offset: 4
77 * End:
78 * vim600: noet sw=4 ts=4 fdm=marker
79 * vim<600: noet sw=4 ts=4
80 */
81