php_iconv.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 7 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2018 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: Rui Hirokawa <rui_hirokawa@ybb.ne.jp> |
  16. | Stig Bakken <ssb@php.net> |
  17. +----------------------------------------------------------------------+
  18. */
  19. #ifndef PHP_ICONV_H
  20. #define PHP_ICONV_H
  21. #ifdef PHP_WIN32
  22. # ifdef PHP_ICONV_EXPORTS
  23. # define PHP_ICONV_API __declspec(dllexport)
  24. # else
  25. # define PHP_ICONV_API __declspec(dllimport)
  26. # endif
  27. #elif defined(__GNUC__) && __GNUC__ >= 4
  28. # define PHP_ICONV_API __attribute__ ((visibility("default")))
  29. #else
  30. # define PHP_ICONV_API
  31. #endif
  32. #include "php_version.h"
  33. #define PHP_ICONV_VERSION PHP_VERSION
  34. #ifdef PHP_ATOM_INC
  35. #include "ext/iconv/php_have_iconv.h"
  36. #include "ext/iconv/php_have_libiconv.h"
  37. #include "ext/iconv/php_iconv_aliased_libiconv.h"
  38. #include "ext/iconv/php_have_glibc_iconv.h"
  39. #include "ext/iconv/php_have_bsd_iconv.h"
  40. #include "ext/iconv/php_have_ibm_iconv.h"
  41. #include "ext/iconv/php_iconv_supports_errno.h"
  42. #include "ext/iconv/php_php_iconv_impl.h"
  43. #include "ext/iconv/php_php_iconv_h_path.h"
  44. #endif
  45. #ifdef HAVE_ICONV
  46. extern zend_module_entry iconv_module_entry;
  47. #define iconv_module_ptr &iconv_module_entry
  48. PHP_MINIT_FUNCTION(miconv);
  49. PHP_MSHUTDOWN_FUNCTION(miconv);
  50. PHP_MINFO_FUNCTION(miconv);
  51. PHP_NAMED_FUNCTION(php_if_iconv);
  52. PHP_FUNCTION(ob_iconv_handler);
  53. PHP_FUNCTION(iconv_get_encoding);
  54. PHP_FUNCTION(iconv_set_encoding);
  55. PHP_FUNCTION(iconv_strlen);
  56. PHP_FUNCTION(iconv_substr);
  57. PHP_FUNCTION(iconv_strpos);
  58. PHP_FUNCTION(iconv_strrpos);
  59. PHP_FUNCTION(iconv_mime_encode);
  60. PHP_FUNCTION(iconv_mime_decode);
  61. PHP_FUNCTION(iconv_mime_decode_headers);
  62. ZEND_BEGIN_MODULE_GLOBALS(iconv)
  63. char *input_encoding;
  64. char *internal_encoding;
  65. char *output_encoding;
  66. ZEND_END_MODULE_GLOBALS(iconv)
  67. #define ICONVG(v) ZEND_MODULE_GLOBALS_ACCESSOR(iconv, v)
  68. #if defined(ZTS) && defined(COMPILE_DL_ICONV)
  69. ZEND_TSRMLS_CACHE_EXTERN()
  70. #endif
  71. #ifdef HAVE_IBM_ICONV
  72. # define ICONV_ASCII_ENCODING "IBM-850"
  73. # define ICONV_UCS4_ENCODING "UCS-4"
  74. #else
  75. # define ICONV_ASCII_ENCODING "ASCII"
  76. # define ICONV_UCS4_ENCODING "UCS-4LE"
  77. #endif
  78. #ifndef ICONV_CSNMAXLEN
  79. #define ICONV_CSNMAXLEN 64
  80. #endif
  81. /* {{{ typedef enum php_iconv_err_t */
  82. typedef enum _php_iconv_err_t {
  83. PHP_ICONV_ERR_SUCCESS = SUCCESS,
  84. PHP_ICONV_ERR_CONVERTER = 1,
  85. PHP_ICONV_ERR_WRONG_CHARSET = 2,
  86. PHP_ICONV_ERR_TOO_BIG = 3,
  87. PHP_ICONV_ERR_ILLEGAL_SEQ = 4,
  88. PHP_ICONV_ERR_ILLEGAL_CHAR = 5,
  89. PHP_ICONV_ERR_UNKNOWN = 6,
  90. PHP_ICONV_ERR_MALFORMED = 7,
  91. PHP_ICONV_ERR_ALLOC = 8
  92. } php_iconv_err_t;
  93. /* }}} */
  94. 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);
  95. #else
  96. #define iconv_module_ptr NULL
  97. #endif /* HAVE_ICONV */
  98. #define phpext_iconv_ptr iconv_module_ptr
  99. #endif /* PHP_ICONV_H */
  100. /*
  101. * Local variables:
  102. * tab-width: 4
  103. * c-basic-offset: 4
  104. * End:
  105. */