php_iconv.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2016 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. /* $Id$ */
  20. #ifndef PHP_ICONV_H
  21. #define PHP_ICONV_H
  22. #ifdef PHP_WIN32
  23. # ifdef PHP_ICONV_EXPORTS
  24. # define PHP_ICONV_API __declspec(dllexport)
  25. # else
  26. # define PHP_ICONV_API __declspec(dllimport)
  27. # endif
  28. #elif defined(__GNUC__) && __GNUC__ >= 4
  29. # define PHP_ICONV_API __attribute__ ((visibility("default")))
  30. #else
  31. # define PHP_ICONV_API
  32. #endif
  33. #ifdef PHP_ATOM_INC
  34. #include "ext/iconv/php_have_iconv.h"
  35. #include "ext/iconv/php_have_libiconv.h"
  36. #include "ext/iconv/php_iconv_aliased_libiconv.h"
  37. #include "ext/iconv/php_have_glibc_iconv.h"
  38. #include "ext/iconv/php_have_bsd_iconv.h"
  39. #include "ext/iconv/php_have_ibm_iconv.h"
  40. #include "ext/iconv/php_iconv_supports_errno.h"
  41. #include "ext/iconv/php_php_iconv_impl.h"
  42. #include "ext/iconv/php_php_iconv_h_path.h"
  43. #endif
  44. #ifdef HAVE_ICONV
  45. extern zend_module_entry iconv_module_entry;
  46. #define iconv_module_ptr &iconv_module_entry
  47. PHP_MINIT_FUNCTION(miconv);
  48. PHP_MSHUTDOWN_FUNCTION(miconv);
  49. PHP_MINFO_FUNCTION(miconv);
  50. PHP_NAMED_FUNCTION(php_if_iconv);
  51. PHP_FUNCTION(ob_iconv_handler);
  52. PHP_FUNCTION(iconv_get_encoding);
  53. PHP_FUNCTION(iconv_set_encoding);
  54. PHP_FUNCTION(iconv_strlen);
  55. PHP_FUNCTION(iconv_substr);
  56. PHP_FUNCTION(iconv_strpos);
  57. PHP_FUNCTION(iconv_strrpos);
  58. PHP_FUNCTION(iconv_mime_encode);
  59. PHP_FUNCTION(iconv_mime_decode);
  60. PHP_FUNCTION(iconv_mime_decode_headers);
  61. ZEND_BEGIN_MODULE_GLOBALS(iconv)
  62. char *input_encoding;
  63. char *internal_encoding;
  64. char *output_encoding;
  65. ZEND_END_MODULE_GLOBALS(iconv)
  66. #ifdef ZTS
  67. # define ICONVG(v) TSRMG(iconv_globals_id, zend_iconv_globals *, v)
  68. #else
  69. # define ICONVG(v) (iconv_globals.v)
  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, char **out, size_t *out_len, 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. */