From: Bruno Haible Date: Thu, 7 Jun 2007 19:51:32 +0000 (+0000) Subject: A few more macros so that localename.c can be shared with gnulib. X-Git-Tag: v0.17~344 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42f9fa6d5b583414a3f26d85683cc236f3a9a0ea;p=thirdparty%2Fgettext.git A few more macros so that localename.c can be shared with gnulib. --- diff --git a/gettext-runtime/intl/ChangeLog b/gettext-runtime/intl/ChangeLog index 847cc0588..2966f06eb 100644 --- a/gettext-runtime/intl/ChangeLog +++ b/gettext-runtime/intl/ChangeLog @@ -1,3 +1,16 @@ +2007-06-07 Bruno Haible + + * gettextP.h (gl_locale_name_canonicalize, gl_locale_name_posix, + gl_locale_name_default, gl_locale_name): New macros. + (_nl_locale_name_canonicalize): New declaration. + * localename.c: Include config.h unconditionally. Include gettextP.h or + localename.h. + (gl_locale_name_canonicalize): Renamed from + _nl_locale_name_canonicalize. Make static except in libintl. + (gl_locale_name_posix): Renamed from _nl_locale_name_posix. + (gl_locale_name_default): Renamed from _nl_locale_name_default. + (gl_locale_name): Renamed from _nl_locale_name. + 2007-05-28 Bruno Haible * libintl.rc: New file. diff --git a/gettext-runtime/intl/gettextP.h b/gettext-runtime/intl/gettextP.h index bba3c2ea8..fe18a442f 100644 --- a/gettext-runtime/intl/gettextP.h +++ b/gettext-runtime/intl/gettextP.h @@ -1,5 +1,5 @@ /* Header describing internals of libintl library. - Copyright (C) 1995-1999, 2000-2006 Free Software Foundation, Inc. + Copyright (C) 1995-1999, 2000-2007 Free Software Foundation, Inc. Written by Ulrich Drepper , 1995. This program is free software; you can redistribute it and/or modify it @@ -219,10 +219,16 @@ extern LIBINTL_DLL_EXPORTED int _nl_msg_cat_cntr; #endif #ifndef _LIBC -const char *_nl_language_preferences_default (void); -const char *_nl_locale_name_posix (int category, const char *categoryname); -const char *_nl_locale_name_default (void); -const char *_nl_locale_name (int category, const char *categoryname); +extern const char *_nl_language_preferences_default (void); +# define gl_locale_name_canonicalize _nl_locale_name_canonicalize +extern void _nl_locale_name_canonicalize (char *name); +# define gl_locale_name_posix _nl_locale_name_posix +extern const char *_nl_locale_name_posix (int category, + const char *categoryname); +# define gl_locale_name_default _nl_locale_name_default +extern const char *_nl_locale_name_default (void); +# define gl_locale_name _nl_locale_name_default +extern const char *_nl_locale_name (int category, const char *categoryname); #endif struct loaded_l10nfile *_nl_find_domain (const char *__dirname, char *__locale, diff --git a/gettext-runtime/intl/localename.c b/gettext-runtime/intl/localename.c index 95133b0b1..af4c229a3 100644 --- a/gettext-runtime/intl/localename.c +++ b/gettext-runtime/intl/localename.c @@ -1,5 +1,5 @@ -/* Determine the current selected locale. - Copyright (C) 1995-1999, 2000-2006 Free Software Foundation, Inc. +/* Determine name of the currently selected locale. + Copyright (C) 1995-1999, 2000-2007 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 @@ -20,8 +20,13 @@ /* Win32 code written by Tor Lillqvist . */ /* MacOS X code written by Bruno Haible . */ -#ifdef HAVE_CONFIG_H -# include +#include + +/* Specification. */ +#ifdef IN_LIBINTL +# include "gettextP.h" +#else +# include "localename.h" #endif #include @@ -700,8 +705,11 @@ NAME is a sufficiently large buffer. On input, it contains the MacOS X locale name. On output, it contains the Unix locale name. */ +# if !defined IN_LIBINTL +static +# endif void -_nl_locale_name_canonicalize (char *name) +gl_locale_name_canonicalize (char *name) { /* This conversion is based on a posting by Deborah GoldSmith on 2005-03-08, @@ -984,7 +992,7 @@ _nl_locale_name_canonicalize (char *name) The result must not be freed; it is statically allocated. */ const char * -_nl_locale_name_posix (int category, const char *categoryname) +gl_locale_name_posix (int category, const char *categoryname) { /* Use the POSIX methods of looking to 'LC_ALL', 'LC_xxx', and 'LANG'. On some systems this can be done by the 'setlocale' function itself. */ @@ -1011,7 +1019,7 @@ _nl_locale_name_posix (int category, const char *categoryname) } const char * -_nl_locale_name_default (void) +gl_locale_name_default (void) { /* POSIX:2001 says: "All implementations shall define a locale as the default locale, to be @@ -1051,7 +1059,7 @@ _nl_locale_name_default (void) if (CFStringGetCString (name, namebuf, sizeof(namebuf), kCFStringEncodingASCII)) { - _nl_locale_name_canonicalize (namebuf); + gl_locale_name_canonicalize (namebuf); cached_localename = strdup (namebuf); } CFRelease (locale); @@ -1064,7 +1072,7 @@ _nl_locale_name_default (void) && CFStringGetCString ((CFStringRef)value, namebuf, sizeof(namebuf), kCFStringEncodingASCII)) { - _nl_locale_name_canonicalize (namebuf); + gl_locale_name_canonicalize (namebuf); cached_localename = strdup (namebuf); } # endif @@ -1487,13 +1495,13 @@ _nl_locale_name_default (void) } const char * -_nl_locale_name (int category, const char *categoryname) +gl_locale_name (int category, const char *categoryname) { const char *retval; - retval = _nl_locale_name_posix (category, categoryname); + retval = gl_locale_name_posix (category, categoryname); if (retval != NULL) return retval; - return _nl_locale_name_default (); + return gl_locale_name_default (); }