xref: /php-src/ext/xmlreader/php_xmlreader.h (revision b3700e29)
1 /*
2   +----------------------------------------------------------------------+
3   | Copyright (c) The PHP Group                                          |
4   +----------------------------------------------------------------------+
5   | This source file is subject to version 3.01 of the PHP license,      |
6   | that is bundled with this package in the file LICENSE, and is        |
7   | available through the world-wide-web at the following url:           |
8   | https://www.php.net/license/3_01.txt                                 |
9   | If you did not receive a copy of the PHP license and are unable to   |
10   | obtain it through the world-wide-web, please send a note to          |
11   | license@php.net so we can mail you a copy immediately.               |
12   +----------------------------------------------------------------------+
13   | Author: Rob Richards <rrichards@php.net>                             |
14   +----------------------------------------------------------------------+
15 */
16 
17 #ifndef PHP_XMLREADER_H
18 #define PHP_XMLREADER_H
19 
20 extern zend_module_entry xmlreader_module_entry;
21 #define phpext_xmlreader_ptr &xmlreader_module_entry
22 
23 #include "php_version.h"
24 #define PHP_XMLREADER_VERSION PHP_VERSION
25 
26 #ifdef ZTS
27 #include "TSRM.h"
28 #endif
29 
30 #include "ext/libxml/php_libxml.h"
31 #include <libxml/xmlreader.h>
32 
33 /* If xmlreader and dom both are compiled statically,
34    no DLL import should be used in xmlreader for dom symbols. */
35 #ifdef PHP_WIN32
36 # if defined(HAVE_DOM) && !defined(COMPILE_DL_DOM) && !defined(COMPILE_DL_XMLREADER)
37 #  define DOM_LOCAL_DEFINES 1
38 # endif
39 #endif
40 
41 typedef struct _xmlreader_object {
42 	xmlTextReaderPtr ptr;
43 	/* strings must be set in input buffer as copy is required */
44 	xmlParserInputBufferPtr input;
45 	void *schema;
46 	zend_object  std;
47 } xmlreader_object;
48 
php_xmlreader_fetch_object(zend_object * obj)49 static inline xmlreader_object *php_xmlreader_fetch_object(zend_object *obj) {
50 	return (xmlreader_object *)((char*)(obj) - XtOffsetOf(xmlreader_object, std));
51 }
52 
53 #define Z_XMLREADER_P(zv) php_xmlreader_fetch_object(Z_OBJ_P((zv)))
54 
55 PHP_MINIT_FUNCTION(xmlreader);
56 PHP_MSHUTDOWN_FUNCTION(xmlreader);
57 PHP_MINFO_FUNCTION(xmlreader);
58 
59 #endif	/* PHP_XMLREADER_H */
60