You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
4.1 KiB

19 years ago
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2008 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. | Authors: Shane Caraveo <shane@php.net> |
  16. | Wez Furlong <wez@thebrainroom.com> |
  17. +----------------------------------------------------------------------+
  18. */
  19. /* $Id$ */
  20. #ifndef PHP_LIBXML_H
  21. #define PHP_LIBXML_H
  22. #if HAVE_LIBXML
  23. extern zend_module_entry libxml_module_entry;
  24. #define libxml_module_ptr &libxml_module_entry
  25. #ifdef PHP_WIN32
  26. #define PHP_LIBXML_API __declspec(dllexport)
  27. #else
  28. #define PHP_LIBXML_API
  29. #endif
  30. #include "ext/standard/php_smart_str.h"
  31. #include <libxml/tree.h>
  32. #define LIBXML_SAVE_NOEMPTYTAG 1<<2
  33. ZEND_BEGIN_MODULE_GLOBALS(libxml)
  34. zval *stream_context;
  35. smart_str error_buffer;
  36. zend_llist *error_list;
  37. ZEND_END_MODULE_GLOBALS(libxml)
  38. typedef struct _libxml_doc_props {
  39. int formatoutput;
  40. int validateonparse;
  41. int resolveexternals;
  42. int preservewhitespace;
  43. int substituteentities;
  44. int stricterror;
  45. int recover;
  46. HashTable *classmap;
  47. } libxml_doc_props;
  48. typedef struct _php_libxml_ref_obj {
  49. void *ptr;
  50. int refcount;
  51. libxml_doc_props *doc_props;
  52. } php_libxml_ref_obj;
  53. typedef struct _php_libxml_node_ptr {
  54. xmlNodePtr node;
  55. int refcount;
  56. void *_private;
  57. } php_libxml_node_ptr;
  58. typedef struct _php_libxml_node_object {
  59. zend_object std;
  60. php_libxml_node_ptr *node;
  61. php_libxml_ref_obj *document;
  62. HashTable *properties;
  63. } php_libxml_node_object;
  64. typedef void * (*php_libxml_export_node) (zval *object TSRMLS_DC);
  65. PHP_LIBXML_API int php_libxml_increment_node_ptr(php_libxml_node_object *object, xmlNodePtr node, void *private_data TSRMLS_DC);
  66. PHP_LIBXML_API int php_libxml_decrement_node_ptr(php_libxml_node_object *object TSRMLS_DC);
  67. PHP_LIBXML_API int php_libxml_increment_doc_ref(php_libxml_node_object *object, xmlDocPtr docp TSRMLS_DC);
  68. PHP_LIBXML_API int php_libxml_decrement_doc_ref(php_libxml_node_object *object TSRMLS_DC);
  69. PHP_LIBXML_API xmlNodePtr php_libxml_import_node(zval *object TSRMLS_DC);
  70. PHP_LIBXML_API int php_libxml_register_export(zend_class_entry *ce, php_libxml_export_node export_function);
  71. /* When an explicit freeing of node and children is required */
  72. void php_libxml_node_free_resource(xmlNodePtr node TSRMLS_DC);
  73. /* When object dtor is called as node may still be referenced */
  74. void php_libxml_node_decrement_resource(php_libxml_node_object *object TSRMLS_DC);
  75. PHP_LIBXML_API void php_libxml_error_handler(void *ctx, const char *msg, ...);
  76. void php_libxml_ctx_warning(void *ctx, const char *msg, ...);
  77. void php_libxml_ctx_error(void *ctx, const char *msg, ...);
  78. PHP_LIBXML_API int php_libxml_xmlCheckUTF8(const unsigned char *s);
  79. PHP_LIBXML_API zval *php_libxml_switch_context(zval *context TSRMLS_DC);
  80. PHP_LIBXML_API void php_libxml_issue_error(int level, const char *msg TSRMLS_DC);
  81. /* Init/shutdown functions*/
  82. PHP_LIBXML_API void php_libxml_initialize(void);
  83. PHP_LIBXML_API void php_libxml_shutdown(void);
  84. #ifdef ZTS
  85. #define LIBXML(v) TSRMG(libxml_globals_id, zend_libxml_globals *, v)
  86. #else
  87. #define LIBXML(v) (libxml_globals.v)
  88. #endif
  89. #else /* HAVE_LIBXML */
  90. #define libxml_module_ptr NULL
  91. #endif
  92. #define phpext_libxml_ptr libxml_module_ptr
  93. #endif /* PHP_LIBXML_H */
  94. /*
  95. * Local variables:
  96. * tab-width: 4
  97. * c-basic-offset: 4
  98. * End:
  99. */