X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=intl%2Flibgnuintl.h.in;h=4176b44b77f8dc89cbfbc53e200a42bc929d484d;hb=84ddcd15cab7dc38bfad90348668c1bd5dc727f8;hp=afc21dad42d104391e7280902e5c11c849939681;hpb=4b8f9231090ada43f7e16987ec46ac7f45a914ec;p=pkg%2Fabook.git diff --git a/intl/libgnuintl.h.in b/intl/libgnuintl.h.in index afc21da..4176b44 100644 --- a/intl/libgnuintl.h.in +++ b/intl/libgnuintl.h.in @@ -1,5 +1,5 @@ /* Message catalogs for internationalization. - Copyright (C) 1995-1997, 2000-2004 Free Software Foundation, Inc. + Copyright (C) 1995-1997, 2000-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published @@ -13,13 +13,16 @@ You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _LIBINTL_H -#define _LIBINTL_H 1 +#define _LIBINTL_H 1 #include +#if (defined __APPLE__ && defined __MACH__) && @HAVE_NEWLOCALE@ +# include +#endif /* The LC_MESSAGES locale category is the category used by the functions gettext() and dgettext(). It is specified in POSIX, but not in ANSI C. @@ -52,6 +55,11 @@ extern "C" { #endif +/* Version number: (major<<16) + (minor<<8) + subminor */ +#define LIBINTL_VERSION 0x001201 +extern int libintl_version; + + /* We redirect the functions to those prefixed with "libintl_". This is necessary, because some systems define gettext/textdomain/... in the C library (namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer). @@ -83,7 +91,7 @@ extern "C" { If he doesn't, we choose the method. A third possible method is _INTL_REDIRECT_ASM, supported only by GCC. */ #if !(defined _INTL_REDIRECT_INLINE || defined _INTL_REDIRECT_MACROS) -# if __GNUC__ >= 2 && !defined __APPLE_CC__ && !defined __MINGW32__ && !(__GNUC__ == 2 && defined _AIX) && (defined __STDC__ || defined __cplusplus) +# if defined __GNUC__ && __GNUC__ >= 2 && !(defined __APPLE_CC__ && __APPLE_CC__ > 1) && !defined __MINGW32__ && !(__GNUC__ == 2 && defined _AIX) && (defined __STDC__ || defined __cplusplus) # define _INTL_REDIRECT_ASM # else # ifdef __cplusplus @@ -102,11 +110,21 @@ extern "C" { # define _INTL_ASM(cname) #endif +/* _INTL_MAY_RETURN_STRING_ARG(n) declares that the given function may return + its n-th argument literally. This enables GCC to warn for example about + printf (gettext ("foo %y")). */ +#if defined __GNUC__ && __GNUC__ >= 3 && !(defined __APPLE_CC__ && __APPLE_CC__ > 1 && defined __cplusplus) +# define _INTL_MAY_RETURN_STRING_ARG(n) __attribute__ ((__format_arg__ (n))) +#else +# define _INTL_MAY_RETURN_STRING_ARG(n) +#endif + /* Look up MSGID in the current default message catalog for the current LC_MESSAGES locale. If not found, returns MSGID itself (the default text). */ #ifdef _INTL_REDIRECT_INLINE -extern char *libintl_gettext (const char *__msgid); +extern char *libintl_gettext (const char *__msgid) + _INTL_MAY_RETURN_STRING_ARG (1); static inline char *gettext (const char *__msgid) { return libintl_gettext (__msgid); @@ -116,13 +134,15 @@ static inline char *gettext (const char *__msgid) # define gettext libintl_gettext #endif extern char *gettext (const char *__msgid) - _INTL_ASM (libintl_gettext); + _INTL_ASM (libintl_gettext) + _INTL_MAY_RETURN_STRING_ARG (1); #endif /* Look up MSGID in the DOMAINNAME message catalog for the current LC_MESSAGES locale. */ #ifdef _INTL_REDIRECT_INLINE -extern char *libintl_dgettext (const char *__domainname, const char *__msgid); +extern char *libintl_dgettext (const char *__domainname, const char *__msgid) + _INTL_MAY_RETURN_STRING_ARG (2); static inline char *dgettext (const char *__domainname, const char *__msgid) { return libintl_dgettext (__domainname, __msgid); @@ -132,16 +152,18 @@ static inline char *dgettext (const char *__domainname, const char *__msgid) # define dgettext libintl_dgettext #endif extern char *dgettext (const char *__domainname, const char *__msgid) - _INTL_ASM (libintl_dgettext); + _INTL_ASM (libintl_dgettext) + _INTL_MAY_RETURN_STRING_ARG (2); #endif /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY locale. */ #ifdef _INTL_REDIRECT_INLINE extern char *libintl_dcgettext (const char *__domainname, const char *__msgid, - int __category); + int __category) + _INTL_MAY_RETURN_STRING_ARG (2); static inline char *dcgettext (const char *__domainname, const char *__msgid, - int __category) + int __category) { return libintl_dcgettext (__domainname, __msgid, __category); } @@ -150,8 +172,9 @@ static inline char *dcgettext (const char *__domainname, const char *__msgid, # define dcgettext libintl_dcgettext #endif extern char *dcgettext (const char *__domainname, const char *__msgid, - int __category) - _INTL_ASM (libintl_dcgettext); + int __category) + _INTL_ASM (libintl_dcgettext) + _INTL_MAY_RETURN_STRING_ARG (2); #endif @@ -159,9 +182,10 @@ extern char *dcgettext (const char *__domainname, const char *__msgid, number N. */ #ifdef _INTL_REDIRECT_INLINE extern char *libintl_ngettext (const char *__msgid1, const char *__msgid2, - unsigned long int __n); + unsigned long int __n) + _INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2); static inline char *ngettext (const char *__msgid1, const char *__msgid2, - unsigned long int __n) + unsigned long int __n) { return libintl_ngettext (__msgid1, __msgid2, __n); } @@ -170,17 +194,19 @@ static inline char *ngettext (const char *__msgid1, const char *__msgid2, # define ngettext libintl_ngettext #endif extern char *ngettext (const char *__msgid1, const char *__msgid2, - unsigned long int __n) - _INTL_ASM (libintl_ngettext); + unsigned long int __n) + _INTL_ASM (libintl_ngettext) + _INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2); #endif /* Similar to `dgettext' but select the plural form corresponding to the number N. */ #ifdef _INTL_REDIRECT_INLINE extern char *libintl_dngettext (const char *__domainname, const char *__msgid1, - const char *__msgid2, unsigned long int __n); + const char *__msgid2, unsigned long int __n) + _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3); static inline char *dngettext (const char *__domainname, const char *__msgid1, - const char *__msgid2, unsigned long int __n) + const char *__msgid2, unsigned long int __n) { return libintl_dngettext (__domainname, __msgid1, __msgid2, __n); } @@ -189,20 +215,22 @@ static inline char *dngettext (const char *__domainname, const char *__msgid1, # define dngettext libintl_dngettext #endif extern char *dngettext (const char *__domainname, - const char *__msgid1, const char *__msgid2, - unsigned long int __n) - _INTL_ASM (libintl_dngettext); + const char *__msgid1, const char *__msgid2, + unsigned long int __n) + _INTL_ASM (libintl_dngettext) + _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3); #endif /* Similar to `dcgettext' but select the plural form corresponding to the number N. */ #ifdef _INTL_REDIRECT_INLINE extern char *libintl_dcngettext (const char *__domainname, - const char *__msgid1, const char *__msgid2, - unsigned long int __n, int __category); + const char *__msgid1, const char *__msgid2, + unsigned long int __n, int __category) + _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3); static inline char *dcngettext (const char *__domainname, - const char *__msgid1, const char *__msgid2, - unsigned long int __n, int __category) + const char *__msgid1, const char *__msgid2, + unsigned long int __n, int __category) { return libintl_dcngettext (__domainname, __msgid1, __msgid2, __n, __category); } @@ -211,12 +239,15 @@ static inline char *dcngettext (const char *__domainname, # define dcngettext libintl_dcngettext #endif extern char *dcngettext (const char *__domainname, - const char *__msgid1, const char *__msgid2, - unsigned long int __n, int __category) - _INTL_ASM (libintl_dcngettext); + const char *__msgid1, const char *__msgid2, + unsigned long int __n, int __category) + _INTL_ASM (libintl_dcngettext) + _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3); #endif +#ifndef IN_LIBGLOCALE + /* Set the current default message catalog to DOMAINNAME. If DOMAINNAME is null, return the current default. If DOMAINNAME is "", reset to the default of "messages". */ @@ -238,9 +269,9 @@ extern char *textdomain (const char *__domainname) in DIRNAME rather than in the system locale data base. */ #ifdef _INTL_REDIRECT_INLINE extern char *libintl_bindtextdomain (const char *__domainname, - const char *__dirname); + const char *__dirname); static inline char *bindtextdomain (const char *__domainname, - const char *__dirname) + const char *__dirname) { return libintl_bindtextdomain (__domainname, __dirname); } @@ -256,9 +287,9 @@ extern char *bindtextdomain (const char *__domainname, const char *__dirname) DOMAINNAME message catalog will be returned. */ #ifdef _INTL_REDIRECT_INLINE extern char *libintl_bind_textdomain_codeset (const char *__domainname, - const char *__codeset); + const char *__codeset); static inline char *bind_textdomain_codeset (const char *__domainname, - const char *__codeset) + const char *__codeset) { return libintl_bind_textdomain_codeset (__domainname, __codeset); } @@ -267,10 +298,12 @@ static inline char *bind_textdomain_codeset (const char *__domainname, # define bind_textdomain_codeset libintl_bind_textdomain_codeset #endif extern char *bind_textdomain_codeset (const char *__domainname, - const char *__codeset) + const char *__codeset) _INTL_ASM (libintl_bind_textdomain_codeset); #endif +#endif /* IN_LIBGLOCALE */ + /* Support for format strings with positions in *printf(), following the POSIX/XSI specification. @@ -286,52 +319,84 @@ extern char *bind_textdomain_codeset (const char *__domainname, #include /* Get va_list. */ -#if __STDC__ || defined __cplusplus || defined _MSC_VER +#if (defined __STDC__ && __STDC__) || defined __cplusplus || defined _MSC_VER # include #else # include #endif +#if !(defined fprintf && defined _GL_STDIO_H) /* don't override gnulib */ #undef fprintf #define fprintf libintl_fprintf extern int fprintf (FILE *, const char *, ...); +#endif +#if !(defined vfprintf && defined _GL_STDIO_H) /* don't override gnulib */ #undef vfprintf #define vfprintf libintl_vfprintf extern int vfprintf (FILE *, const char *, va_list); +#endif +#if !(defined printf && defined _GL_STDIO_H) /* don't override gnulib */ #undef printf +#if defined __NetBSD__ || defined __BEOS__ || defined __CYGWIN__ || defined __MINGW32__ +/* Don't break __attribute__((format(printf,M,N))). + This redefinition is only possible because the libc in NetBSD, Cygwin, + mingw does not have a function __printf__. + Alternatively, we could have done this redirection only when compiling with + __GNUC__, together with a symbol redirection: + extern int printf (const char *, ...) + __asm__ (#__USER_LABEL_PREFIX__ "libintl_printf"); + But doing it now would introduce a binary incompatibility with already + distributed versions of libintl on these systems. */ +# define libintl_printf __printf__ +#endif #define printf libintl_printf extern int printf (const char *, ...); +#endif +#if !(defined vprintf && defined _GL_STDIO_H) /* don't override gnulib */ #undef vprintf #define vprintf libintl_vprintf extern int vprintf (const char *, va_list); +#endif +#if !(defined sprintf && defined _GL_STDIO_H) /* don't override gnulib */ #undef sprintf #define sprintf libintl_sprintf extern int sprintf (char *, const char *, ...); +#endif +#if !(defined vsprintf && defined _GL_STDIO_H) /* don't override gnulib */ #undef vsprintf #define vsprintf libintl_vsprintf extern int vsprintf (char *, const char *, va_list); +#endif #if @HAVE_SNPRINTF@ +#if !(defined snprintf && defined _GL_STDIO_H) /* don't override gnulib */ #undef snprintf #define snprintf libintl_snprintf extern int snprintf (char *, size_t, const char *, ...); +#endif +#if !(defined vsnprintf && defined _GL_STDIO_H) /* don't override gnulib */ #undef vsnprintf #define vsnprintf libintl_vsnprintf extern int vsnprintf (char *, size_t, const char *, va_list); +#endif #endif #if @HAVE_ASPRINTF@ +#if !(defined asprintf && defined _GL_STDIO_H) /* don't override gnulib */ #undef asprintf #define asprintf libintl_asprintf extern int asprintf (char **, const char *, ...); +#endif +#if !(defined vasprintf && defined _GL_STDIO_H) /* don't override gnulib */ #undef vasprintf #define vasprintf libintl_vasprintf extern int vasprintf (char **, const char *, va_list); +#endif #endif @@ -363,6 +428,24 @@ extern int vswprintf (wchar_t *, size_t, const wchar_t *, va_list); #endif +/* Support for the locale chosen by the user. */ +#if (defined __APPLE__ && defined __MACH__) || defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ + +#undef setlocale +#define setlocale libintl_setlocale +extern char *setlocale (int, const char *); + +#if @HAVE_NEWLOCALE@ + +#undef newlocale +#define newlocale libintl_newlocale +extern locale_t newlocale (int, const char *, locale_t); + +#endif + +#endif + + /* Support for relocatable packages. */ /* Sets the original and the current installation prefix of the package. @@ -373,7 +456,7 @@ extern int vswprintf (wchar_t *, size_t, const wchar_t *, va_list); #define libintl_set_relocation_prefix libintl_set_relocation_prefix extern void libintl_set_relocation_prefix (const char *orig_prefix, - const char *curr_prefix); + const char *curr_prefix); #ifdef __cplusplus