home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 22 / AACD 22.iso / AACD / Online / Apache / include / php / ext / xml / php_xml.h
Encoding:
C/C++ Source or Header  |  2000-10-29  |  4.2 KB  |  162 lines

  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 Sæther Bakken <ssb@fast.no>                            |
  16.    |          Thies C. Arntzen <thies@thieso.net>                         |
  17.    +----------------------------------------------------------------------+
  18. */
  19.  
  20. /* $Id: php_xml.h,v 1.14 2000/10/29 09:14:54 thies Exp $ */
  21.  
  22. #ifndef PHP_XML_H
  23. #define PHP_XML_H
  24.  
  25. #ifdef HAVE_LIBEXPAT
  26.  
  27. extern zend_module_entry xml_module_entry;
  28. #define xml_module_ptr &xml_module_entry
  29.  
  30. #else
  31.  
  32. #define xml_module_ptr NULL
  33.  
  34. #endif
  35.  
  36. #if defined(HAVE_LIBEXPAT) && defined(PHP_XML_INTERNAL)
  37.  
  38. #include <xmltok.h>
  39. #include <xmlparse.h>
  40.  
  41. #ifdef PHP_WIN32
  42. #define PHP_XML_API __declspec(dllexport)
  43. #else
  44. #define PHP_XML_API
  45. #endif
  46.  
  47.  
  48. #ifdef XML_UNICODE
  49. #error "UTF-16 Unicode support not implemented!"
  50. #endif
  51.  
  52. typedef struct {
  53.     XML_Char *default_encoding;
  54. } php_xml_globals;
  55.  
  56. typedef struct {
  57.     int index;
  58.     int case_folding;
  59.     XML_Parser parser;
  60.     XML_Char *target_encoding;
  61.     zval *startElementHandler;
  62.     zval *endElementHandler;
  63.     zval *characterDataHandler;
  64.     zval *processingInstructionHandler;
  65.     zval *defaultHandler;
  66.     zval *unparsedEntityDeclHandler;
  67.     zval *notationDeclHandler;
  68.     zval *externalEntityRefHandler;
  69.     zval *unknownEncodingHandler;
  70.  
  71.     zval *object;
  72.  
  73.     zval *data;
  74.     zval *info;
  75.     int level;
  76.     int toffset;
  77.     int curtag;
  78.     pval **ctag;
  79.     char **ltags;
  80.     int lastwasopen;
  81.     int skipwhite;
  82.     
  83.     XML_Char *baseURI;
  84. } xml_parser;
  85.  
  86.  
  87. typedef struct {
  88.     XML_Char *name;
  89.     char (*decoding_function)(unsigned short);
  90.     unsigned short (*encoding_function)(unsigned char);
  91. } xml_encoding;
  92.  
  93.  
  94. enum php_xml_option {
  95.     PHP_XML_OPTION_CASE_FOLDING = 1,
  96.     PHP_XML_OPTION_TARGET_ENCODING,
  97.     PHP_XML_OPTION_SKIP_TAGSTART,
  98.     PHP_XML_OPTION_SKIP_WHITE
  99. };
  100.  
  101. #define RETURN_OUT_OF_MEMORY \
  102.     php_error(E_WARNING, "Out of memory");\
  103.     RETURN_FALSE
  104.  
  105. /* for xml_parse_into_struct */
  106.     
  107. #define XML_MAXLEVEL 255 /* XXX this should be dynamic */
  108.     
  109. PHP_FUNCTION(xml_parser_create);
  110. PHP_FUNCTION(xml_set_object);
  111. PHP_FUNCTION(xml_set_element_handler);
  112. PHP_FUNCTION(xml_set_character_data_handler);
  113. PHP_FUNCTION(xml_set_processing_instruction_handler);
  114. PHP_FUNCTION(xml_set_default_handler);
  115. PHP_FUNCTION(xml_set_unparsed_entity_decl_handler);
  116. PHP_FUNCTION(xml_set_notation_decl_handler);
  117. PHP_FUNCTION(xml_set_external_entity_ref_handler);
  118. PHP_FUNCTION(xml_parse);
  119. PHP_FUNCTION(xml_get_error_code);
  120. PHP_FUNCTION(xml_error_string);
  121. PHP_FUNCTION(xml_get_current_line_number);
  122. PHP_FUNCTION(xml_get_current_column_number);
  123. PHP_FUNCTION(xml_get_current_byte_index);
  124. PHP_FUNCTION(xml_parser_free);
  125. PHP_FUNCTION(xml_parser_set_option);
  126. PHP_FUNCTION(xml_parser_get_option);
  127. PHP_FUNCTION(utf8_encode);
  128. PHP_FUNCTION(utf8_decode);
  129. PHP_FUNCTION(xml_parse_into_struct);
  130.  
  131. PHPAPI char *_xml_zval_strdup(zval *val);
  132. PHPAPI char *xml_utf8_decode(const XML_Char *, int, int *, const XML_Char *);
  133.  
  134. #endif /* HAVE_LIBEXPAT */
  135.  
  136. #define phpext_xml_ptr xml_module_ptr
  137.  
  138. #ifdef ZTS
  139. #define XMLLS_D php_xml_globals *xml_globals
  140. #define XMLLS_DC , PSLS_D
  141. #define XMLLS_C xml_globals
  142. #define XMLLS_CC , XMLLS_C
  143. #define XML(v) (xml_globals->v)
  144. #define XMLLS_FETCH() php_xml_globals *xml_globals = ts_resource(xml_globals_id)
  145. #else
  146. #define XMLLS_D
  147. #define XMLLS_DC
  148. #define XMLLS_C
  149. #define XMLLS_CC
  150. #define XML(v) (xml_globals.v)
  151. #define XMLLS_FETCH()
  152. #endif
  153.  
  154. #endif /* PHP_XML_H */
  155.  
  156. /*
  157.  * Local variables:
  158.  * tab-width: 4
  159.  * c-basic-offset: 4
  160.  * End:
  161.  */
  162.