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.

104 lines
3.5 KiB

  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2004 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 3.0 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_0.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. #ifdef HAVE_LIBXML
  23. extern zend_module_entry libxml_module_entry;
  24. #define libxml_module_ptr &libxml_module_entry
  25. #else
  26. #define libxml_module_ptr NULL
  27. #endif
  28. #ifdef HAVE_LIBXML
  29. #ifdef PHP_WIN32
  30. #define PHP_LIBXML_API __declspec(dllexport)
  31. #else
  32. #define PHP_LIBXML_API
  33. #endif
  34. #include "ext/standard/php_smart_str.h"
  35. #include <libxml/tree.h>
  36. typedef struct {
  37. zval *stream_context;
  38. smart_str error_buffer;
  39. } php_libxml_globals;
  40. typedef struct _php_libxml_ref_obj {
  41. void *ptr;
  42. int refcount;
  43. void *doc_props;
  44. } php_libxml_ref_obj;
  45. typedef struct _php_libxml_node_ptr {
  46. xmlNodePtr node;
  47. int refcount;
  48. void *_private;
  49. } php_libxml_node_ptr;
  50. typedef struct _php_libxml_node_object {
  51. zend_object std;
  52. php_libxml_node_ptr *node;
  53. php_libxml_ref_obj *document;
  54. HashTable *properties;
  55. } php_libxml_node_object;
  56. typedef void * (*php_libxml_export_node) (zval *object TSRMLS_DC);
  57. PHP_FUNCTION(libxml_set_streams_context);
  58. int php_libxml_increment_node_ptr(php_libxml_node_object *object, xmlNodePtr node, void *private_data TSRMLS_DC);
  59. int php_libxml_decrement_node_ptr(php_libxml_node_object *object TSRMLS_DC);
  60. int php_libxml_increment_doc_ref(php_libxml_node_object *object, xmlDocPtr docp TSRMLS_DC);
  61. int php_libxml_decrement_doc_ref(php_libxml_node_object *object TSRMLS_DC);
  62. PHP_LIBXML_API xmlNodePtr php_libxml_import_node(zval *object TSRMLS_DC);
  63. PHP_LIBXML_API int php_libxml_register_export(zend_class_entry *ce, php_libxml_export_node export_function);
  64. /* When an explicit freeing of node and children is required */
  65. void php_libxml_node_free_resource(xmlNodePtr node TSRMLS_DC);
  66. /* When object dtor is called as node may still be referenced */
  67. void php_libxml_node_decrement_resource(php_libxml_node_object *object TSRMLS_DC);
  68. void php_libxml_error_handler(void *ctx, const char *msg, ...);
  69. void php_libxml_ctx_warning(void *ctx, const char *msg, ...);
  70. void php_libxml_ctx_error(void *ctx, const char *msg, ...);
  71. #endif /* HAVE_LIBXML */
  72. #define phpext_libxml_ptr libxml_module_ptr
  73. #ifdef ZTS
  74. #define LIBXML(v) TSRMG(libxml_globals_id, php_libxml_globals *, v)
  75. #else
  76. #define LIBXML(v) (libxml_globals.v)
  77. #endif
  78. PHP_LIBXML_API void php_libxml_initialize();
  79. PHP_LIBXML_API void php_libxml_shutdown();
  80. #endif /* PHP_LIBXML_H */
  81. /*
  82. * Local variables:
  83. * tab-width: 4
  84. * c-basic-offset: 4
  85. * End:
  86. */