Skip to content

Commit

Permalink
gettext: update gettext.h from 0.22.5
Browse files Browse the repository at this point in the history
  • Loading branch information
emcrisostomo committed Dec 26, 2024
1 parent bf90478 commit 3fc8685
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 50 deletions.
68 changes: 43 additions & 25 deletions fswatch/src/gettext.h
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
/* Convenience header for conditional use of GNU <libintl.h>.
Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2016 Free Software
Foundation, Inc.
Copyright (C) 1995-2024 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */

#ifndef _LIBGETTEXT_H
#define _LIBGETTEXT_H 1

/* NLS can be disabled through the configure --disable-nls option. */
#if ENABLE_NLS

/* NLS can be disabled through the configure --disable-nls option
or through "#define ENABLE NLS 0" before including this file. */
#if defined ENABLE_NLS && ENABLE_NLS

/* Get declarations of GNU message catalog functions. */
# include <libintl.h>
Expand All @@ -44,19 +45,19 @@
as well because people using "gettext.h" will not include <libintl.h>,
and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
is OK. */
#if defined(__sun)
# include <locale.h>
#endif
# if defined(__sun)
# include <locale.h>
# endif

/* Many header files from the libstdc++ coming with g++ 3.3 or newer include
<libintl.h>, which chokes if dcgettext is defined as a macro. So include
it now, to make later inclusions of <libintl.h> a NOP. */
#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
# include <cstdlib>
# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H
# include <libintl.h>
# if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
# include <cstdlib>
# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H
# include <libintl.h>
# endif
# endif
#endif

/* Disabled NLS.
The casts to 'const char *' serve the purpose of producing warnings
Expand Down Expand Up @@ -92,12 +93,14 @@

#endif


/* Prefer gnulib's setlocale override over libintl's setlocale override. */
#ifdef GNULIB_defined_setlocale
# undef setlocale
# define setlocale rpl_setlocale
#endif


/* A pseudo function call that serves as a marker for the automated
extraction of messages, but does not call gettext(). The run-time
translation is done at a different place in the code.
Expand All @@ -107,13 +110,17 @@
initializer for static 'char[]' or 'const char[]' variables. */
#define gettext_noop(String) String


/* The separator between msgctxt and msgid in a .mo file. */
#define GETTEXT_CONTEXT_GLUE "\004"

/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a
MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be
short and rarely need to change.
The letter 'p' stands for 'particular' or 'special'. */

#include <locale.h> /* for LC_MESSAGES */

#ifdef DEFAULT_TEXT_DOMAIN
# define pgettext(Msgctxt, Msgid) \
pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
Expand All @@ -137,7 +144,7 @@
#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \
npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category)

#ifdef __GNUC__
#if defined __GNUC__ || defined __clang__
__inline
#else
#ifdef __cplusplus
Expand All @@ -156,7 +163,7 @@ pgettext_aux (const char *domain,
return translation;
}

#ifdef __GNUC__
#if defined __GNUC__ || defined __clang__
__inline
#else
#ifdef __cplusplus
Expand All @@ -177,29 +184,39 @@ npgettext_aux (const char *domain,
return translation;
}


/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID
can be arbitrary expressions. But for string literals these macros are
less efficient than those above. */

#include <string.h>
#include <string.h> /* for memcpy */

/* GNULIB_NO_VLA can be defined to disable use of VLAs even if supported.
This relates to the -Wvla and -Wvla-larger-than warnings, enabled in
the default GCC many warnings set. This allows programs to disable use
of VLAs, which may be unintended, or may be awkward to support portably,
or may have security implications due to non-deterministic stack usage. */

#if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
/* || __STDC_VERSION__ >= 199901L */ )
#if (!defined GNULIB_NO_VLA \
&& (((__GNUC__ >= 3 || defined __clang__) \
&& !defined __STRICT_ANSI__ && !defined __cplusplus) \
/* || (__STDC_VERSION__ == 199901L && !defined __HP_cc)
|| (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ ))
# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1
#else
# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0
#endif

#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
#include <stdlib.h>
# include <stdlib.h> /* for malloc, free */
#endif

#define pgettext_expr(Msgctxt, Msgid) \
dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES)
#define dpgettext_expr(Domainname, Msgctxt, Msgid) \
dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)

#ifdef __GNUC__
#if defined __GNUC__ || defined __clang__
__inline
#else
#ifdef __cplusplus
Expand Down Expand Up @@ -246,7 +263,7 @@ dcpgettext_expr (const char *domain,
#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)

#ifdef __GNUC__
#if defined __GNUC__ || defined __clang__
__inline
#else
#ifdef __cplusplus
Expand Down Expand Up @@ -289,4 +306,5 @@ dcnpgettext_expr (const char *domain,
return (n == 1 ? msgid : msgid_plural);
}


#endif /* _LIBGETTEXT_H */
68 changes: 43 additions & 25 deletions libfswatch/src/libfswatch/gettext.h
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
/* Convenience header for conditional use of GNU <libintl.h>.
Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2016 Free Software
Foundation, Inc.
Copyright (C) 1995-2024 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */

#ifndef _LIBGETTEXT_H
#define _LIBGETTEXT_H 1

/* NLS can be disabled through the configure --disable-nls option. */
#if ENABLE_NLS

/* NLS can be disabled through the configure --disable-nls option
or through "#define ENABLE NLS 0" before including this file. */
#if defined ENABLE_NLS && ENABLE_NLS

/* Get declarations of GNU message catalog functions. */
# include <libintl.h>
Expand All @@ -44,19 +45,19 @@
as well because people using "gettext.h" will not include <libintl.h>,
and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
is OK. */
#if defined(__sun)
# include <locale.h>
#endif
# if defined(__sun)
# include <locale.h>
# endif

/* Many header files from the libstdc++ coming with g++ 3.3 or newer include
<libintl.h>, which chokes if dcgettext is defined as a macro. So include
it now, to make later inclusions of <libintl.h> a NOP. */
#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
# include <cstdlib>
# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H
# include <libintl.h>
# if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
# include <cstdlib>
# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H
# include <libintl.h>
# endif
# endif
#endif

/* Disabled NLS.
The casts to 'const char *' serve the purpose of producing warnings
Expand Down Expand Up @@ -92,12 +93,14 @@

#endif


/* Prefer gnulib's setlocale override over libintl's setlocale override. */
#ifdef GNULIB_defined_setlocale
# undef setlocale
# define setlocale rpl_setlocale
#endif


/* A pseudo function call that serves as a marker for the automated
extraction of messages, but does not call gettext(). The run-time
translation is done at a different place in the code.
Expand All @@ -107,13 +110,17 @@
initializer for static 'char[]' or 'const char[]' variables. */
#define gettext_noop(String) String


/* The separator between msgctxt and msgid in a .mo file. */
#define GETTEXT_CONTEXT_GLUE "\004"

/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a
MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be
short and rarely need to change.
The letter 'p' stands for 'particular' or 'special'. */

#include <locale.h> /* for LC_MESSAGES */

#ifdef DEFAULT_TEXT_DOMAIN
# define pgettext(Msgctxt, Msgid) \
pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
Expand All @@ -137,7 +144,7 @@
#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \
npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category)

#ifdef __GNUC__
#if defined __GNUC__ || defined __clang__
__inline
#else
#ifdef __cplusplus
Expand All @@ -156,7 +163,7 @@ pgettext_aux (const char *domain,
return translation;
}

#ifdef __GNUC__
#if defined __GNUC__ || defined __clang__
__inline
#else
#ifdef __cplusplus
Expand All @@ -177,29 +184,39 @@ npgettext_aux (const char *domain,
return translation;
}


/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID
can be arbitrary expressions. But for string literals these macros are
less efficient than those above. */

#include <string.h>
#include <string.h> /* for memcpy */

/* GNULIB_NO_VLA can be defined to disable use of VLAs even if supported.
This relates to the -Wvla and -Wvla-larger-than warnings, enabled in
the default GCC many warnings set. This allows programs to disable use
of VLAs, which may be unintended, or may be awkward to support portably,
or may have security implications due to non-deterministic stack usage. */

#if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
/* || __STDC_VERSION__ >= 199901L */ )
#if (!defined GNULIB_NO_VLA \
&& (((__GNUC__ >= 3 || defined __clang__) \
&& !defined __STRICT_ANSI__ && !defined __cplusplus) \
/* || (__STDC_VERSION__ == 199901L && !defined __HP_cc)
|| (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ ))
# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1
#else
# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0
#endif

#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
#include <stdlib.h>
# include <stdlib.h> /* for malloc, free */
#endif

#define pgettext_expr(Msgctxt, Msgid) \
dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES)
#define dpgettext_expr(Domainname, Msgctxt, Msgid) \
dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)

#ifdef __GNUC__
#if defined __GNUC__ || defined __clang__
__inline
#else
#ifdef __cplusplus
Expand Down Expand Up @@ -246,7 +263,7 @@ dcpgettext_expr (const char *domain,
#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)

#ifdef __GNUC__
#if defined __GNUC__ || defined __clang__
__inline
#else
#ifdef __cplusplus
Expand Down Expand Up @@ -289,4 +306,5 @@ dcnpgettext_expr (const char *domain,
return (n == 1 ? msgid : msgid_plural);
}


#endif /* _LIBGETTEXT_H */

0 comments on commit 3fc8685

Please sign in to comment.