libintl.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. /* Message catalogs for internationalization.
  2. Copyright (C) 1995-1997, 2000-2016, 2018-2020 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.1 of the License, or
  6. (at your option) 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 _LIBINTL_H
  14. #define _LIBINTL_H 1
  15. #include <locale.h>
  16. #if (defined __APPLE__ && defined __MACH__) && 0
  17. # include <xlocale.h>
  18. #endif
  19. /* The LC_MESSAGES locale category is the category used by the functions
  20. gettext() and dgettext(). It is specified in POSIX, but not in ANSI C.
  21. On systems that don't define it, use an arbitrary value instead.
  22. On Solaris, <locale.h> defines __LOCALE_H (or _LOCALE_H in Solaris 2.5)
  23. then includes <libintl.h> (i.e. this file!) and then only defines
  24. LC_MESSAGES. To avoid a redefinition warning, don't define LC_MESSAGES
  25. in this case. */
  26. #if !defined LC_MESSAGES && !(defined __LOCALE_H || (defined _LOCALE_H && defined __sun))
  27. # define LC_MESSAGES 1729
  28. #endif
  29. /* We define an additional symbol to signal that we use the GNU
  30. implementation of gettext. */
  31. #define __USE_GNU_GETTEXT 1
  32. /* Provide information about the supported file formats. Returns the
  33. maximum minor revision number supported for a given major revision. */
  34. #define __GNU_GETTEXT_SUPPORTED_REVISION(major) \
  35. ((major) == 0 || (major) == 1 ? 1 : -1)
  36. /* Resolve a platform specific conflict on DJGPP. GNU gettext takes
  37. precedence over _conio_gettext. */
  38. #ifdef __DJGPP__
  39. # undef gettext
  40. #endif
  41. #ifdef __cplusplus
  42. extern "C" {
  43. #endif
  44. /* Version number: (major<<16) + (minor<<8) + subminor */
  45. #define LIBINTL_VERSION 0x001500
  46. extern int libintl_version;
  47. /* We redirect the functions to those prefixed with "libintl_". This is
  48. necessary, because some systems define gettext/textdomain/... in the C
  49. library (namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer).
  50. If we used the unprefixed names, there would be cases where the
  51. definition in the C library would override the one in the libintl.so
  52. shared library. Recall that on ELF systems, the symbols are looked
  53. up in the following order:
  54. 1. in the executable,
  55. 2. in the shared libraries specified on the link command line, in order,
  56. 3. in the dependencies of the shared libraries specified on the link
  57. command line,
  58. 4. in the dlopen()ed shared libraries, in the order in which they were
  59. dlopen()ed.
  60. The definition in the C library would override the one in libintl.so if
  61. either
  62. * -lc is given on the link command line and -lintl isn't, or
  63. * -lc is given on the link command line before -lintl, or
  64. * libintl.so is a dependency of a dlopen()ed shared library but not
  65. linked to the executable at link time.
  66. Since Solaris gettext() behaves differently than GNU gettext(), this
  67. would be unacceptable.
  68. The redirection happens by default through macros in C, so that &gettext
  69. is independent of the compilation unit, but through inline functions in
  70. C++, in order not to interfere with the name mangling of class fields or
  71. class methods called 'gettext'. */
  72. /* The user can define _INTL_REDIRECT_INLINE or _INTL_REDIRECT_MACROS.
  73. If he doesn't, we choose the method. A third possible method is
  74. _INTL_REDIRECT_ASM, supported only by GCC. */
  75. #if !(defined _INTL_REDIRECT_INLINE || defined _INTL_REDIRECT_MACROS)
  76. # if defined __GNUC__ && __GNUC__ >= 2 && !(defined __APPLE_CC__ && __APPLE_CC__ > 1) && !defined __MINGW32__ && !(__GNUC__ == 2 && defined _AIX) && (defined __STDC__ || defined __cplusplus)
  77. # define _INTL_REDIRECT_ASM
  78. # else
  79. # ifdef __cplusplus
  80. # define _INTL_REDIRECT_INLINE
  81. # else
  82. # define _INTL_REDIRECT_MACROS
  83. # endif
  84. # endif
  85. #endif
  86. /* Auxiliary macros. */
  87. #ifdef _INTL_REDIRECT_ASM
  88. # define _INTL_ASM(cname) __asm__ (_INTL_ASMNAME (__USER_LABEL_PREFIX__, #cname))
  89. # define _INTL_ASMNAME(prefix,cnamestring) _INTL_STRINGIFY (prefix) cnamestring
  90. # define _INTL_STRINGIFY(prefix) #prefix
  91. #else
  92. # define _INTL_ASM(cname)
  93. #endif
  94. /* _INTL_MAY_RETURN_STRING_ARG(n) declares that the given function may return
  95. its n-th argument literally. This enables GCC to warn for example about
  96. printf (gettext ("foo %y")). */
  97. #if defined __GNUC__ && __GNUC__ >= 3 && !(defined __APPLE_CC__ && __APPLE_CC__ > 1 && !(defined __clang__ && __clang__ && __clang_major__ >= 3) && defined __cplusplus)
  98. # define _INTL_MAY_RETURN_STRING_ARG(n) __attribute__ ((__format_arg__ (n)))
  99. #else
  100. # define _INTL_MAY_RETURN_STRING_ARG(n)
  101. #endif
  102. /* Look up MSGID in the current default message catalog for the current
  103. LC_MESSAGES locale. If not found, returns MSGID itself (the default
  104. text). */
  105. #ifdef _INTL_REDIRECT_INLINE
  106. extern char *libintl_gettext (const char *__msgid)
  107. _INTL_MAY_RETURN_STRING_ARG (1);
  108. static inline
  109. _INTL_MAY_RETURN_STRING_ARG (1)
  110. char *gettext (const char *__msgid)
  111. {
  112. return libintl_gettext (__msgid);
  113. }
  114. #else
  115. #ifdef _INTL_REDIRECT_MACROS
  116. # define gettext libintl_gettext
  117. #endif
  118. extern char *gettext (const char *__msgid)
  119. _INTL_ASM (libintl_gettext)
  120. _INTL_MAY_RETURN_STRING_ARG (1);
  121. #endif
  122. /* Look up MSGID in the DOMAINNAME message catalog for the current
  123. LC_MESSAGES locale. */
  124. #ifdef _INTL_REDIRECT_INLINE
  125. extern char *libintl_dgettext (const char *__domainname, const char *__msgid)
  126. _INTL_MAY_RETURN_STRING_ARG (2);
  127. static inline
  128. _INTL_MAY_RETURN_STRING_ARG (2)
  129. char *dgettext (const char *__domainname, const char *__msgid)
  130. {
  131. return libintl_dgettext (__domainname, __msgid);
  132. }
  133. #else
  134. #ifdef _INTL_REDIRECT_MACROS
  135. # define dgettext libintl_dgettext
  136. #endif
  137. extern char *dgettext (const char *__domainname, const char *__msgid)
  138. _INTL_ASM (libintl_dgettext)
  139. _INTL_MAY_RETURN_STRING_ARG (2);
  140. #endif
  141. /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
  142. locale. */
  143. #ifdef _INTL_REDIRECT_INLINE
  144. extern char *libintl_dcgettext (const char *__domainname, const char *__msgid,
  145. int __category)
  146. _INTL_MAY_RETURN_STRING_ARG (2);
  147. static inline
  148. _INTL_MAY_RETURN_STRING_ARG (2)
  149. char *dcgettext (const char *__domainname, const char *__msgid, int __category)
  150. {
  151. return libintl_dcgettext (__domainname, __msgid, __category);
  152. }
  153. #else
  154. #ifdef _INTL_REDIRECT_MACROS
  155. # define dcgettext libintl_dcgettext
  156. #endif
  157. extern char *dcgettext (const char *__domainname, const char *__msgid,
  158. int __category)
  159. _INTL_ASM (libintl_dcgettext)
  160. _INTL_MAY_RETURN_STRING_ARG (2);
  161. #endif
  162. /* Similar to 'gettext' but select the plural form corresponding to the
  163. number N. */
  164. #ifdef _INTL_REDIRECT_INLINE
  165. extern char *libintl_ngettext (const char *__msgid1, const char *__msgid2,
  166. unsigned long int __n)
  167. _INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2);
  168. static inline
  169. _INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2)
  170. char *ngettext (const char *__msgid1, const char *__msgid2,
  171. unsigned long int __n)
  172. {
  173. return libintl_ngettext (__msgid1, __msgid2, __n);
  174. }
  175. #else
  176. #ifdef _INTL_REDIRECT_MACROS
  177. # define ngettext libintl_ngettext
  178. #endif
  179. extern char *ngettext (const char *__msgid1, const char *__msgid2,
  180. unsigned long int __n)
  181. _INTL_ASM (libintl_ngettext)
  182. _INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2);
  183. #endif
  184. /* Similar to 'dgettext' but select the plural form corresponding to the
  185. number N. */
  186. #ifdef _INTL_REDIRECT_INLINE
  187. extern char *libintl_dngettext (const char *__domainname, const char *__msgid1,
  188. const char *__msgid2, unsigned long int __n)
  189. _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
  190. static inline
  191. _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3)
  192. char *dngettext (const char *__domainname, const char *__msgid1,
  193. const char *__msgid2, unsigned long int __n)
  194. {
  195. return libintl_dngettext (__domainname, __msgid1, __msgid2, __n);
  196. }
  197. #else
  198. #ifdef _INTL_REDIRECT_MACROS
  199. # define dngettext libintl_dngettext
  200. #endif
  201. extern char *dngettext (const char *__domainname,
  202. const char *__msgid1, const char *__msgid2,
  203. unsigned long int __n)
  204. _INTL_ASM (libintl_dngettext)
  205. _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
  206. #endif
  207. /* Similar to 'dcgettext' but select the plural form corresponding to the
  208. number N. */
  209. #ifdef _INTL_REDIRECT_INLINE
  210. extern char *libintl_dcngettext (const char *__domainname,
  211. const char *__msgid1, const char *__msgid2,
  212. unsigned long int __n, int __category)
  213. _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
  214. static inline
  215. _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3)
  216. char *dcngettext (const char *__domainname,
  217. const char *__msgid1, const char *__msgid2,
  218. unsigned long int __n, int __category)
  219. {
  220. return libintl_dcngettext (__domainname, __msgid1, __msgid2, __n, __category);
  221. }
  222. #else
  223. #ifdef _INTL_REDIRECT_MACROS
  224. # define dcngettext libintl_dcngettext
  225. #endif
  226. extern char *dcngettext (const char *__domainname,
  227. const char *__msgid1, const char *__msgid2,
  228. unsigned long int __n, int __category)
  229. _INTL_ASM (libintl_dcngettext)
  230. _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
  231. #endif
  232. /* Set the current default message catalog to DOMAINNAME.
  233. If DOMAINNAME is null, return the current default.
  234. If DOMAINNAME is "", reset to the default of "messages". */
  235. #ifdef _INTL_REDIRECT_INLINE
  236. extern char *libintl_textdomain (const char *__domainname);
  237. static inline char *textdomain (const char *__domainname)
  238. {
  239. return libintl_textdomain (__domainname);
  240. }
  241. #else
  242. #ifdef _INTL_REDIRECT_MACROS
  243. # define textdomain libintl_textdomain
  244. #endif
  245. extern char *textdomain (const char *__domainname)
  246. _INTL_ASM (libintl_textdomain);
  247. #endif
  248. /* Specify that the DOMAINNAME message catalog will be found
  249. in DIRNAME rather than in the system locale data base. */
  250. #ifdef _INTL_REDIRECT_INLINE
  251. extern char *libintl_bindtextdomain (const char *__domainname,
  252. const char *__dirname);
  253. static inline char *bindtextdomain (const char *__domainname,
  254. const char *__dirname)
  255. {
  256. return libintl_bindtextdomain (__domainname, __dirname);
  257. }
  258. #else
  259. #ifdef _INTL_REDIRECT_MACROS
  260. # define bindtextdomain libintl_bindtextdomain
  261. #endif
  262. extern char *bindtextdomain (const char *__domainname, const char *__dirname)
  263. _INTL_ASM (libintl_bindtextdomain);
  264. #endif
  265. #if defined _WIN32 && !defined __CYGWIN__
  266. /* Specify that the DOMAINNAME message catalog will be found
  267. in WDIRNAME rather than in the system locale data base. */
  268. #ifdef _INTL_REDIRECT_INLINE
  269. extern wchar_t *libintl_wbindtextdomain (const char *__domainname,
  270. const wchar_t *__wdirname);
  271. static inline wchar_t *wbindtextdomain (const char *__domainname,
  272. const wchar_t *__wdirname)
  273. {
  274. return libintl_wbindtextdomain (__domainname, __wdirname);
  275. }
  276. #else
  277. #ifdef _INTL_REDIRECT_MACROS
  278. # define wbindtextdomain libintl_wbindtextdomain
  279. #endif
  280. extern wchar_t *wbindtextdomain (const char *__domainname,
  281. const wchar_t *__wdirname)
  282. _INTL_ASM (libintl_wbindtextdomain);
  283. #endif
  284. #endif
  285. /* Specify the character encoding in which the messages from the
  286. DOMAINNAME message catalog will be returned. */
  287. #ifdef _INTL_REDIRECT_INLINE
  288. extern char *libintl_bind_textdomain_codeset (const char *__domainname,
  289. const char *__codeset);
  290. static inline char *bind_textdomain_codeset (const char *__domainname,
  291. const char *__codeset)
  292. {
  293. return libintl_bind_textdomain_codeset (__domainname, __codeset);
  294. }
  295. #else
  296. #ifdef _INTL_REDIRECT_MACROS
  297. # define bind_textdomain_codeset libintl_bind_textdomain_codeset
  298. #endif
  299. extern char *bind_textdomain_codeset (const char *__domainname,
  300. const char *__codeset)
  301. _INTL_ASM (libintl_bind_textdomain_codeset);
  302. #endif
  303. /* Support for format strings with positions in *printf(), following the
  304. POSIX/XSI specification.
  305. Note: These replacements for the *printf() functions are visible only
  306. in source files that #include <libintl.h> or #include "gettext.h".
  307. Packages that use *printf() in source files that don't refer to _()
  308. or gettext() but for which the format string could be the return value
  309. of _() or gettext() need to add this #include. Oh well. */
  310. #if !0
  311. #include <stdio.h>
  312. #include <stddef.h>
  313. /* Get va_list. */
  314. #if (defined __STDC__ && __STDC__) || defined __cplusplus || defined _MSC_VER
  315. # include <stdarg.h>
  316. #else
  317. # include <varargs.h>
  318. #endif
  319. #if !(defined fprintf && defined _GL_STDIO_H) /* don't override gnulib */
  320. #undef fprintf
  321. #define fprintf libintl_fprintf
  322. extern int fprintf (FILE *, const char *, ...);
  323. # if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
  324. namespace std { using ::libintl_fprintf; }
  325. # endif
  326. #endif
  327. #if !(defined vfprintf && defined _GL_STDIO_H) /* don't override gnulib */
  328. #undef vfprintf
  329. #define vfprintf libintl_vfprintf
  330. extern int vfprintf (FILE *, const char *, va_list);
  331. # if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
  332. namespace std { using ::libintl_vfprintf; }
  333. # endif
  334. #endif
  335. #if !(defined printf && defined _GL_STDIO_H) /* don't override gnulib */
  336. #undef printf
  337. #if defined __NetBSD__ || defined __BEOS__ || defined __CYGWIN__ || defined __MINGW32__
  338. /* Don't break __attribute__((format(printf,M,N))).
  339. This redefinition is only possible because the libc in NetBSD, Cygwin,
  340. mingw does not have a function __printf__.
  341. Alternatively, we could have done this redirection only when compiling with
  342. __GNUC__, together with a symbol redirection:
  343. extern int printf (const char *, ...)
  344. __asm__ (#__USER_LABEL_PREFIX__ "libintl_printf");
  345. But doing it now would introduce a binary incompatibility with already
  346. distributed versions of libintl on these systems. */
  347. # define libintl_printf __printf__
  348. #endif
  349. #define printf libintl_printf
  350. extern int printf (const char *, ...);
  351. # if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
  352. namespace std { using ::libintl_printf; }
  353. # endif
  354. #endif
  355. #if !(defined vprintf && defined _GL_STDIO_H) /* don't override gnulib */
  356. #undef vprintf
  357. #define vprintf libintl_vprintf
  358. extern int vprintf (const char *, va_list);
  359. # if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
  360. namespace std { using ::libintl_vprintf; }
  361. # endif
  362. #endif
  363. #if !(defined sprintf && defined _GL_STDIO_H) /* don't override gnulib */
  364. #undef sprintf
  365. #define sprintf libintl_sprintf
  366. extern int sprintf (char *, const char *, ...);
  367. # if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
  368. namespace std { using ::libintl_sprintf; }
  369. # endif
  370. #endif
  371. #if !(defined vsprintf && defined _GL_STDIO_H) /* don't override gnulib */
  372. #undef vsprintf
  373. #define vsprintf libintl_vsprintf
  374. extern int vsprintf (char *, const char *, va_list);
  375. # if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
  376. namespace std { using ::libintl_vsprintf; }
  377. # endif
  378. #endif
  379. #if 1
  380. #if !(defined snprintf && defined _GL_STDIO_H) /* don't override gnulib */
  381. #undef snprintf
  382. #define snprintf libintl_snprintf
  383. extern int snprintf (char *, size_t, const char *, ...);
  384. # if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
  385. namespace std { using ::libintl_snprintf; }
  386. # endif
  387. #endif
  388. #if !(defined vsnprintf && defined _GL_STDIO_H) /* don't override gnulib */
  389. #undef vsnprintf
  390. #define vsnprintf libintl_vsnprintf
  391. extern int vsnprintf (char *, size_t, const char *, va_list);
  392. # if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
  393. namespace std { using ::libintl_vsnprintf; }
  394. # endif
  395. #endif
  396. #endif
  397. #if 1
  398. #if !(defined asprintf && defined _GL_STDIO_H) /* don't override gnulib */
  399. #undef asprintf
  400. #define asprintf libintl_asprintf
  401. extern int asprintf (char **, const char *, ...);
  402. # if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
  403. namespace std { using ::libintl_asprintf; }
  404. # endif
  405. #endif
  406. #if !(defined vasprintf && defined _GL_STDIO_H) /* don't override gnulib */
  407. #undef vasprintf
  408. #define vasprintf libintl_vasprintf
  409. extern int vasprintf (char **, const char *, va_list);
  410. # if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
  411. namespace std { using ::libintl_vasprintf; }
  412. # endif
  413. #endif
  414. #endif
  415. #if 1
  416. #undef fwprintf
  417. #define fwprintf libintl_fwprintf
  418. extern int fwprintf (FILE *, const wchar_t *, ...);
  419. # if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
  420. namespace std { using ::libintl_fwprintf; }
  421. # endif
  422. #undef vfwprintf
  423. #define vfwprintf libintl_vfwprintf
  424. extern int vfwprintf (FILE *, const wchar_t *, va_list);
  425. # if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
  426. namespace std { using ::libintl_vfwprintf; }
  427. # endif
  428. #undef wprintf
  429. #define wprintf libintl_wprintf
  430. extern int wprintf (const wchar_t *, ...);
  431. # if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
  432. namespace std { using ::libintl_wprintf; }
  433. # endif
  434. #undef vwprintf
  435. #define vwprintf libintl_vwprintf
  436. extern int vwprintf (const wchar_t *, va_list);
  437. # if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
  438. namespace std { using ::libintl_vwprintf; }
  439. # endif
  440. #undef swprintf
  441. #define swprintf libintl_swprintf
  442. extern int swprintf (wchar_t *, size_t, const wchar_t *, ...);
  443. # if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
  444. namespace std { using ::libintl_swprintf; }
  445. # endif
  446. #undef vswprintf
  447. #define vswprintf libintl_vswprintf
  448. extern int vswprintf (wchar_t *, size_t, const wchar_t *, va_list);
  449. # if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
  450. namespace std { using ::libintl_vswprintf; }
  451. # endif
  452. #endif
  453. #endif
  454. /* Support for retrieving the name of a locale_t object. */
  455. #if 0
  456. #ifndef GNULIB_defined_newlocale /* don't override gnulib */
  457. #undef newlocale
  458. #define newlocale libintl_newlocale
  459. extern locale_t newlocale (int, const char *, locale_t);
  460. #endif
  461. #ifndef GNULIB_defined_duplocale /* don't override gnulib */
  462. #undef duplocale
  463. #define duplocale libintl_duplocale
  464. extern locale_t duplocale (locale_t);
  465. #endif
  466. #ifndef GNULIB_defined_freelocale /* don't override gnulib */
  467. #undef freelocale
  468. #define freelocale libintl_freelocale
  469. extern void freelocale (locale_t);
  470. #endif
  471. #endif
  472. /* Support for the locale chosen by the user. */
  473. #if (defined __APPLE__ && defined __MACH__) || defined _WIN32 || defined __CYGWIN__
  474. #ifndef GNULIB_defined_setlocale /* don't override gnulib */
  475. #undef setlocale
  476. #define setlocale libintl_setlocale
  477. extern char *setlocale (int, const char *);
  478. #endif
  479. #if 0
  480. #undef newlocale
  481. #define newlocale libintl_newlocale
  482. /* Declare newlocale() only if the system headers define the 'locale_t' type. */
  483. #if !(defined __CYGWIN__ && !defined LC_ALL_MASK)
  484. extern locale_t newlocale (int, const char *, locale_t);
  485. #endif
  486. #endif
  487. #endif
  488. /* Support for relocatable packages. */
  489. /* Sets the original and the current installation prefix of the package.
  490. Relocation simply replaces a pathname starting with the original prefix
  491. by the corresponding pathname with the current prefix instead. Both
  492. prefixes should be directory names without trailing slash (i.e. use ""
  493. instead of "/"). */
  494. #define libintl_set_relocation_prefix libintl_set_relocation_prefix
  495. extern void
  496. libintl_set_relocation_prefix (const char *orig_prefix,
  497. const char *curr_prefix);
  498. #ifdef __cplusplus
  499. }
  500. #endif
  501. #endif /* libintl.h */