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.

113 lines
4.0 KiB

  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2006 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. typedef struct {
  34. zval *stream_context;
  35. smart_str error_buffer;
  36. zend_llist *error_list;
  37. } php_libxml_globals;
  38. typedef struct _php_libxml_ref_obj {
  39. void *ptr;
  40. int refcount;
  41. void *doc_props;
  42. } php_libxml_ref_obj;
  43. typedef struct _php_libxml_node_ptr {
  44. xmlNodePtr node;
  45. int refcount;
  46. void *_private;
  47. } php_libxml_node_ptr;
  48. typedef struct _php_libxml_node_object {
  49. zend_object std;
  50. php_libxml_node_ptr *node;
  51. php_libxml_ref_obj *document;
  52. HashTable *properties;
  53. } php_libxml_node_object;
  54. typedef void * (*php_libxml_export_node) (zval *object TSRMLS_DC);
  55. PHP_FUNCTION(libxml_set_streams_context);
  56. PHP_FUNCTION(libxml_use_internal_errors);
  57. PHP_FUNCTION(libxml_get_last_error);
  58. PHP_FUNCTION(libxml_clear_errors);
  59. PHP_FUNCTION(libxml_get_errors);
  60. int php_libxml_increment_node_ptr(php_libxml_node_object *object, xmlNodePtr node, void *private_data TSRMLS_DC);
  61. int php_libxml_decrement_node_ptr(php_libxml_node_object *object TSRMLS_DC);
  62. PHP_LIBXML_API int php_libxml_increment_doc_ref(php_libxml_node_object *object, xmlDocPtr docp TSRMLS_DC);
  63. PHP_LIBXML_API int php_libxml_decrement_doc_ref(php_libxml_node_object *object TSRMLS_DC);
  64. PHP_LIBXML_API xmlNodePtr php_libxml_import_node(zval *object TSRMLS_DC);
  65. PHP_LIBXML_API int php_libxml_register_export(zend_class_entry *ce, php_libxml_export_node export_function);
  66. /* When an explicit freeing of node and children is required */
  67. void php_libxml_node_free_resource(xmlNodePtr node TSRMLS_DC);
  68. /* When object dtor is called as node may still be referenced */
  69. void php_libxml_node_decrement_resource(php_libxml_node_object *object TSRMLS_DC);
  70. PHP_LIBXML_API void php_libxml_error_handler(void *ctx, const char *msg, ...);
  71. void php_libxml_ctx_warning(void *ctx, const char *msg, ...);
  72. void php_libxml_ctx_error(void *ctx, const char *msg, ...);
  73. PHP_LIBXML_API int php_libxml_xmlCheckUTF8(const unsigned char *s);
  74. PHP_LIBXML_API zval *php_libxml_switch_context(zval *context TSRMLS_DC);
  75. PHP_LIBXML_API void php_libxml_issue_error(int level, const char *msg TSRMLS_DC);
  76. /* Init/shutdown functions*/
  77. PHP_LIBXML_API void php_libxml_initialize();
  78. PHP_LIBXML_API void php_libxml_shutdown();
  79. #ifdef ZTS
  80. #define LIBXML(v) TSRMG(libxml_globals_id, php_libxml_globals *, v)
  81. #else
  82. #define LIBXML(v) (libxml_globals.v)
  83. #endif
  84. #else /* HAVE_LIBXML */
  85. #define libxml_module_ptr NULL
  86. #endif
  87. #define phpext_libxml_ptr libxml_module_ptr
  88. #endif /* PHP_LIBXML_H */
  89. /*
  90. * Local variables:
  91. * tab-width: 4
  92. * c-basic-offset: 4
  93. * End:
  94. */