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.

154 lines
4.1 KiB

25 years ago
25 years ago
26 years ago
27 years ago
27 years ago
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 4 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2002 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 2.02 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available at through the world-wide-web at |
  10. | http://www.php.net/license/2_02.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: Stig Sther Bakken <ssb@fast.no> |
  16. | Thies C. Arntzen <thies@thieso.net> |
  17. +----------------------------------------------------------------------+
  18. */
  19. /* $Id$ */
  20. #ifndef PHP_XML_H
  21. #define PHP_XML_H
  22. #ifdef HAVE_LIBEXPAT
  23. extern zend_module_entry xml_module_entry;
  24. #define xml_module_ptr &xml_module_entry
  25. #else
  26. #define xml_module_ptr NULL
  27. #endif
  28. #if defined(PHP_XML_INTERNAL)
  29. #include <expat.h>
  30. #ifdef PHP_WIN32
  31. #define PHP_XML_API __declspec(dllexport)
  32. #else
  33. #define PHP_XML_API
  34. #endif
  35. #ifdef XML_UNICODE
  36. #error "UTF-16 Unicode support not implemented!"
  37. #endif
  38. typedef struct {
  39. XML_Char *default_encoding;
  40. } php_xml_globals;
  41. typedef struct {
  42. int index;
  43. int case_folding;
  44. XML_Parser parser;
  45. XML_Char *target_encoding;
  46. zval *startElementHandler;
  47. zval *endElementHandler;
  48. zval *characterDataHandler;
  49. zval *processingInstructionHandler;
  50. zval *defaultHandler;
  51. zval *unparsedEntityDeclHandler;
  52. zval *notationDeclHandler;
  53. zval *externalEntityRefHandler;
  54. zval *unknownEncodingHandler;
  55. zval *startNamespaceDeclHandler;
  56. zval *endNamespaceDeclHandler;
  57. zval *object;
  58. zval *data;
  59. zval *info;
  60. int level;
  61. int toffset;
  62. int curtag;
  63. pval **ctag;
  64. char **ltags;
  65. int lastwasopen;
  66. int skipwhite;
  67. XML_Char *baseURI;
  68. } xml_parser;
  69. typedef struct {
  70. XML_Char *name;
  71. char (*decoding_function)(unsigned short);
  72. unsigned short (*encoding_function)(unsigned char);
  73. } xml_encoding;
  74. enum php_xml_option {
  75. PHP_XML_OPTION_CASE_FOLDING = 1,
  76. PHP_XML_OPTION_TARGET_ENCODING,
  77. PHP_XML_OPTION_SKIP_TAGSTART,
  78. PHP_XML_OPTION_SKIP_WHITE
  79. };
  80. #define RETURN_OUT_OF_MEMORY \
  81. php_error(E_WARNING, "Out of memory");\
  82. RETURN_FALSE
  83. /* for xml_parse_into_struct */
  84. #define XML_MAXLEVEL 255 /* XXX this should be dynamic */
  85. PHP_FUNCTION(xml_parser_create);
  86. PHP_FUNCTION(xml_parser_create_ns);
  87. PHP_FUNCTION(xml_set_object);
  88. PHP_FUNCTION(xml_set_element_handler);
  89. PHP_FUNCTION(xml_set_character_data_handler);
  90. PHP_FUNCTION(xml_set_processing_instruction_handler);
  91. PHP_FUNCTION(xml_set_default_handler);
  92. PHP_FUNCTION(xml_set_unparsed_entity_decl_handler);
  93. PHP_FUNCTION(xml_set_notation_decl_handler);
  94. PHP_FUNCTION(xml_set_external_entity_ref_handler);
  95. PHP_FUNCTION(xml_set_start_namespace_decl_handler);
  96. PHP_FUNCTION(xml_set_end_namespace_decl_handler);
  97. PHP_FUNCTION(xml_parse);
  98. PHP_FUNCTION(xml_get_error_code);
  99. PHP_FUNCTION(xml_error_string);
  100. PHP_FUNCTION(xml_get_current_line_number);
  101. PHP_FUNCTION(xml_get_current_column_number);
  102. PHP_FUNCTION(xml_get_current_byte_index);
  103. PHP_FUNCTION(xml_parser_free);
  104. PHP_FUNCTION(xml_parser_set_option);
  105. PHP_FUNCTION(xml_parser_get_option);
  106. PHP_FUNCTION(utf8_encode);
  107. PHP_FUNCTION(utf8_decode);
  108. PHP_FUNCTION(xml_parse_into_struct);
  109. PHPAPI char *_xml_zval_strdup(zval *val);
  110. PHPAPI char *xml_utf8_decode(const XML_Char *, int, int *, const XML_Char *);
  111. #endif /* HAVE_LIBEXPAT */
  112. #define phpext_xml_ptr xml_module_ptr
  113. #ifdef ZTS
  114. #define XML(v) TSRMG(xml_globals_id, php_xml_globals *, v)
  115. #else
  116. #define XML(v) (xml_globals.v)
  117. #endif
  118. #endif /* PHP_XML_H */
  119. /*
  120. * Local variables:
  121. * tab-width: 4
  122. * c-basic-offset: 4
  123. * End:
  124. */