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.

161 lines
4.2 KiB

27 years ago
27 years ago
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP version 4.0 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997, 1998, 1999, 2000 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@digicol.de> |
  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(HAVE_LIBEXPAT) && defined(PHP_XML_INTERNAL)
  29. #include <xmltok.h>
  30. #include <xmlparse.h>
  31. #ifdef PHP_WIN32
  32. #define PHP_XML_API __declspec(dllexport)
  33. #else
  34. #define PHP_XML_API
  35. #endif
  36. #ifdef XML_UNICODE
  37. #error "UTF-16 Unicode support not implemented!"
  38. #endif
  39. typedef struct {
  40. XML_Char *default_encoding;
  41. } php_xml_globals;
  42. typedef struct {
  43. int index;
  44. int case_folding;
  45. XML_Parser parser;
  46. XML_Char *target_encoding;
  47. zval *startElementHandler;
  48. zval *endElementHandler;
  49. zval *characterDataHandler;
  50. zval *processingInstructionHandler;
  51. zval *defaultHandler;
  52. zval *unparsedEntityDeclHandler;
  53. zval *notationDeclHandler;
  54. zval *externalEntityRefHandler;
  55. zval *unknownEncodingHandler;
  56. zval *object;
  57. zval *data;
  58. zval *info;
  59. int level;
  60. int toffset;
  61. int curtag;
  62. pval **ctag;
  63. char **ltags;
  64. int lastwasopen;
  65. int skipwhite;
  66. XML_Char *baseURI;
  67. } xml_parser;
  68. typedef struct {
  69. XML_Char *name;
  70. char (*decoding_function)(unsigned short);
  71. unsigned short (*encoding_function)(unsigned char);
  72. } xml_encoding;
  73. enum php_xml_option {
  74. PHP_XML_OPTION_CASE_FOLDING = 1,
  75. PHP_XML_OPTION_TARGET_ENCODING,
  76. PHP_XML_OPTION_SKIP_TAGSTART,
  77. PHP_XML_OPTION_SKIP_WHITE
  78. };
  79. #define RETURN_OUT_OF_MEMORY \
  80. php_error(E_WARNING, "Out of memory");\
  81. RETURN_FALSE
  82. /* for xml_parse_into_struct */
  83. #define XML_MAXLEVEL 255 /* XXX this should be dynamic */
  84. PHP_FUNCTION(xml_parser_create);
  85. PHP_FUNCTION(xml_set_object);
  86. PHP_FUNCTION(xml_set_element_handler);
  87. PHP_FUNCTION(xml_set_character_data_handler);
  88. PHP_FUNCTION(xml_set_processing_instruction_handler);
  89. PHP_FUNCTION(xml_set_default_handler);
  90. PHP_FUNCTION(xml_set_unparsed_entity_decl_handler);
  91. PHP_FUNCTION(xml_set_notation_decl_handler);
  92. PHP_FUNCTION(xml_set_external_entity_ref_handler);
  93. PHP_FUNCTION(xml_parse);
  94. PHP_FUNCTION(xml_get_error_code);
  95. PHP_FUNCTION(xml_error_string);
  96. PHP_FUNCTION(xml_get_current_line_number);
  97. PHP_FUNCTION(xml_get_current_column_number);
  98. PHP_FUNCTION(xml_get_current_byte_index);
  99. PHP_FUNCTION(xml_parser_free);
  100. PHP_FUNCTION(xml_parser_set_option);
  101. PHP_FUNCTION(xml_parser_get_option);
  102. PHP_FUNCTION(utf8_encode);
  103. PHP_FUNCTION(utf8_decode);
  104. PHP_FUNCTION(xml_parse_into_struct);
  105. PHPAPI char *_xml_zval_strdup(zval *val);
  106. PHPAPI char *xml_utf8_decode(const XML_Char *, int, int *, const XML_Char *);
  107. #endif /* HAVE_LIBEXPAT */
  108. #define phpext_xml_ptr xml_module_ptr
  109. #ifdef ZTS
  110. #define XMLLS_D php_xml_globals *xml_globals
  111. #define XMLLS_DC , PSLS_D
  112. #define XMLLS_C xml_globals
  113. #define XMLLS_CC , XMLLS_C
  114. #define XML(v) (xml_globals->v)
  115. #define XMLLS_FETCH() php_xml_globals *xml_globals = ts_resource(xml_globals_id)
  116. #else
  117. #define XMLLS_D
  118. #define XMLLS_DC
  119. #define XMLLS_C
  120. #define XMLLS_CC
  121. #define XML(v) (xml_globals.v)
  122. #define XMLLS_FETCH()
  123. #endif
  124. #endif /* PHP_XML_H */
  125. /*
  126. * Local variables:
  127. * tab-width: 4
  128. * c-basic-offset: 4
  129. * End:
  130. */