iconv.in.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /* A GNU-like <iconv.h>.
  2. Copyright (C) 2007-2021 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU Lesser General Public License as published by
  5. the Free Software Foundation; either version 2, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public License
  12. along with this program; if not, see <https://www.gnu.org/licenses/>. */
  13. #ifndef _@GUARD_PREFIX@_ICONV_H
  14. #if __GNUC__ >= 3
  15. @PRAGMA_SYSTEM_HEADER@
  16. #endif
  17. @PRAGMA_COLUMNS@
  18. /* The include_next requires a split double-inclusion guard. */
  19. #@INCLUDE_NEXT@ @NEXT_ICONV_H@
  20. #ifndef _@GUARD_PREFIX@_ICONV_H
  21. #define _@GUARD_PREFIX@_ICONV_H
  22. /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
  23. /* The definition of _GL_ARG_NONNULL is copied here. */
  24. /* The definition of _GL_WARN_ON_USE is copied here. */
  25. #if @GNULIB_ICONV@
  26. # if @REPLACE_ICONV_OPEN@
  27. /* An iconv_open wrapper that supports the IANA standardized encoding names
  28. ("ISO-8859-1" etc.) as far as possible. */
  29. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  30. # define iconv_open rpl_iconv_open
  31. # endif
  32. _GL_FUNCDECL_RPL (iconv_open, iconv_t,
  33. (const char *tocode, const char *fromcode)
  34. _GL_ARG_NONNULL ((1, 2)));
  35. _GL_CXXALIAS_RPL (iconv_open, iconv_t,
  36. (const char *tocode, const char *fromcode));
  37. # else
  38. _GL_CXXALIAS_SYS (iconv_open, iconv_t,
  39. (const char *tocode, const char *fromcode));
  40. # endif
  41. _GL_CXXALIASWARN (iconv_open);
  42. #elif defined GNULIB_POSIXCHECK
  43. # undef iconv_open
  44. # if HAVE_RAW_DECL_ICONV_OPEN
  45. _GL_WARN_ON_USE (iconv_open, "iconv_open is not working correctly everywhere - "
  46. "use gnulib module iconv for portability");
  47. # endif
  48. #endif
  49. #if @REPLACE_ICONV_UTF@
  50. /* Special constants for supporting UTF-{16,32}{BE,LE} encodings.
  51. Not public. */
  52. # define _ICONV_UTF8_UTF16BE (iconv_t)(-161)
  53. # define _ICONV_UTF8_UTF16LE (iconv_t)(-162)
  54. # define _ICONV_UTF8_UTF32BE (iconv_t)(-163)
  55. # define _ICONV_UTF8_UTF32LE (iconv_t)(-164)
  56. # define _ICONV_UTF16BE_UTF8 (iconv_t)(-165)
  57. # define _ICONV_UTF16LE_UTF8 (iconv_t)(-166)
  58. # define _ICONV_UTF32BE_UTF8 (iconv_t)(-167)
  59. # define _ICONV_UTF32LE_UTF8 (iconv_t)(-168)
  60. #endif
  61. #if @GNULIB_ICONV@
  62. # if @REPLACE_ICONV@
  63. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  64. # define iconv rpl_iconv
  65. # endif
  66. _GL_FUNCDECL_RPL (iconv, size_t,
  67. (iconv_t cd,
  68. @ICONV_CONST@ char **restrict inbuf,
  69. size_t *restrict inbytesleft,
  70. char **restrict outbuf, size_t *restrict outbytesleft));
  71. _GL_CXXALIAS_RPL (iconv, size_t,
  72. (iconv_t cd,
  73. @ICONV_CONST@ char **restrict inbuf,
  74. size_t *restrict inbytesleft,
  75. char **restrict outbuf, size_t *restrict outbytesleft));
  76. # else
  77. /* Need to cast, because on some versions of Solaris, ICONV_CONST does
  78. not have the right value for C++. */
  79. _GL_CXXALIAS_SYS_CAST (iconv, size_t,
  80. (iconv_t cd,
  81. @ICONV_CONST@ char **restrict inbuf,
  82. size_t *restrict inbytesleft,
  83. char **restrict outbuf, size_t *restrict outbytesleft));
  84. # endif
  85. _GL_CXXALIASWARN (iconv);
  86. # ifndef ICONV_CONST
  87. # define ICONV_CONST @ICONV_CONST@
  88. # endif
  89. #elif defined GNULIB_POSIXCHECK
  90. # undef iconv
  91. # if HAVE_RAW_DECL_ICONV
  92. _GL_WARN_ON_USE (iconv, "iconv is not working correctly everywhere - "
  93. "use gnulib module iconv for portability");
  94. # endif
  95. #endif
  96. #if @GNULIB_ICONV@
  97. # if @REPLACE_ICONV@
  98. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  99. # define iconv_close rpl_iconv_close
  100. # endif
  101. _GL_FUNCDECL_RPL (iconv_close, int, (iconv_t cd));
  102. _GL_CXXALIAS_RPL (iconv_close, int, (iconv_t cd));
  103. # else
  104. _GL_CXXALIAS_SYS (iconv_close, int, (iconv_t cd));
  105. # endif
  106. _GL_CXXALIASWARN (iconv_close);
  107. #endif
  108. #endif /* _@GUARD_PREFIX@_ICONV_H */
  109. #endif /* _@GUARD_PREFIX@_ICONV_H */