php_iconv.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Copyright (c) The PHP Group |
  4. +----------------------------------------------------------------------+
  5. | This source file is subject to version 3.01 of the PHP license, |
  6. | that is bundled with this package in the file LICENSE, and is |
  7. | available through the world-wide-web at the following url: |
  8. | https://www.php.net/license/3_01.txt |
  9. | If you did not receive a copy of the PHP license and are unable to |
  10. | obtain it through the world-wide-web, please send a note to |
  11. | license@php.net so we can mail you a copy immediately. |
  12. +----------------------------------------------------------------------+
  13. | Authors: Rui Hirokawa <rui_hirokawa@ybb.ne.jp> |
  14. | Stig Bakken <ssb@php.net> |
  15. +----------------------------------------------------------------------+
  16. */
  17. #ifndef PHP_ICONV_H
  18. #define PHP_ICONV_H
  19. #ifdef PHP_WIN32
  20. # ifdef PHP_ICONV_EXPORTS
  21. # define PHP_ICONV_API __declspec(dllexport)
  22. # else
  23. # define PHP_ICONV_API __declspec(dllimport)
  24. # endif
  25. #elif defined(__GNUC__) && __GNUC__ >= 4
  26. # define PHP_ICONV_API __attribute__ ((visibility("default")))
  27. #else
  28. # define PHP_ICONV_API
  29. #endif
  30. #include "php_version.h"
  31. #define PHP_ICONV_VERSION PHP_VERSION
  32. #ifdef HAVE_ICONV
  33. extern zend_module_entry iconv_module_entry;
  34. #define iconv_module_ptr &iconv_module_entry
  35. PHP_MINIT_FUNCTION(miconv);
  36. PHP_MSHUTDOWN_FUNCTION(miconv);
  37. PHP_MINFO_FUNCTION(miconv);
  38. PHP_NAMED_FUNCTION(php_if_iconv);
  39. PHP_FUNCTION(ob_iconv_handler);
  40. PHP_FUNCTION(iconv_get_encoding);
  41. PHP_FUNCTION(iconv_set_encoding);
  42. PHP_FUNCTION(iconv_strlen);
  43. PHP_FUNCTION(iconv_substr);
  44. PHP_FUNCTION(iconv_strpos);
  45. PHP_FUNCTION(iconv_strrpos);
  46. PHP_FUNCTION(iconv_mime_encode);
  47. PHP_FUNCTION(iconv_mime_decode);
  48. PHP_FUNCTION(iconv_mime_decode_headers);
  49. ZEND_BEGIN_MODULE_GLOBALS(iconv)
  50. char *input_encoding;
  51. char *internal_encoding;
  52. char *output_encoding;
  53. ZEND_END_MODULE_GLOBALS(iconv)
  54. #define ICONVG(v) ZEND_MODULE_GLOBALS_ACCESSOR(iconv, v)
  55. #if defined(ZTS) && defined(COMPILE_DL_ICONV)
  56. ZEND_TSRMLS_CACHE_EXTERN()
  57. #endif
  58. #ifdef HAVE_IBM_ICONV
  59. # define ICONV_ASCII_ENCODING "IBM-850"
  60. # define ICONV_UCS4_ENCODING "UCS-4"
  61. #else
  62. # define ICONV_ASCII_ENCODING "ASCII"
  63. # define ICONV_UCS4_ENCODING "UCS-4LE"
  64. #endif
  65. #ifndef ICONV_CSNMAXLEN
  66. #define ICONV_CSNMAXLEN 64
  67. #endif
  68. /* {{{ typedef enum php_iconv_err_t */
  69. typedef enum _php_iconv_err_t {
  70. PHP_ICONV_ERR_SUCCESS = SUCCESS,
  71. PHP_ICONV_ERR_CONVERTER = 1,
  72. PHP_ICONV_ERR_WRONG_CHARSET = 2,
  73. PHP_ICONV_ERR_TOO_BIG = 3,
  74. PHP_ICONV_ERR_ILLEGAL_SEQ = 4,
  75. PHP_ICONV_ERR_ILLEGAL_CHAR = 5,
  76. PHP_ICONV_ERR_UNKNOWN = 6,
  77. PHP_ICONV_ERR_MALFORMED = 7,
  78. PHP_ICONV_ERR_ALLOC = 8,
  79. PHP_ICONV_ERR_OUT_BY_BOUNDS = 9
  80. } php_iconv_err_t;
  81. /* }}} */
  82. PHP_ICONV_API php_iconv_err_t php_iconv_string(const char * in_p, size_t in_len, zend_string **out, const char *out_charset, const char *in_charset);
  83. #else
  84. #define iconv_module_ptr NULL
  85. #endif /* HAVE_ICONV */
  86. #define phpext_iconv_ptr iconv_module_ptr
  87. #endif /* PHP_ICONV_H */