2019-11-12 16:58:46 -05:00
|
|
|
/* Wrapper around <monetary.h>.
|
2024-01-05 01:13:32 -05:00
|
|
|
Copyright (C) 2017-2024 Free Software Foundation, Inc.
|
2019-11-12 16:58:46 -05:00
|
|
|
|
2022-08-03 05:13:31 -04:00
|
|
|
This file is free software: you can redistribute it and/or modify
|
|
|
|
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.
|
2019-11-12 16:58:46 -05:00
|
|
|
|
2022-08-03 05:13:31 -04:00
|
|
|
This file is distributed in the hope that it will be useful,
|
2019-11-12 16:58:46 -05:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2022-08-03 05:13:31 -04:00
|
|
|
GNU Lesser General Public License for more details.
|
2019-11-12 16:58:46 -05:00
|
|
|
|
2022-08-03 05:13:31 -04:00
|
|
|
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/>. */
|
2019-11-12 16:58:46 -05:00
|
|
|
|
|
|
|
#ifndef _@GUARD_PREFIX@_MONETARY_H
|
|
|
|
|
|
|
|
#if __GNUC__ >= 3
|
|
|
|
@PRAGMA_SYSTEM_HEADER@
|
|
|
|
#endif
|
|
|
|
@PRAGMA_COLUMNS@
|
|
|
|
|
|
|
|
/* The include_next requires a split double-inclusion guard. */
|
|
|
|
#if @HAVE_MONETARY_H@
|
|
|
|
# @INCLUDE_NEXT@ @NEXT_MONETARY_H@
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _@GUARD_PREFIX@_MONETARY_H
|
|
|
|
#define _@GUARD_PREFIX@_MONETARY_H
|
|
|
|
|
2024-01-05 01:13:32 -05:00
|
|
|
/* This file uses _GL_ATTRIBUTE_FORMAT, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
|
|
|
|
#if !_GL_CONFIG_H_INCLUDED
|
|
|
|
#error "Please include config.h first."
|
|
|
|
#endif
|
|
|
|
|
2019-11-12 16:58:46 -05:00
|
|
|
#if @GNULIB_STRFMON_L@
|
|
|
|
# if @HAVE_XLOCALE_H@
|
|
|
|
/* Get locale_t on Mac OS X 10.12. */
|
|
|
|
# include <xlocale.h>
|
|
|
|
# endif
|
|
|
|
/* Get locale_t on glibc 2.5. */
|
|
|
|
# include <locale.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Like in <stdio.h>. */
|
2021-01-11 21:05:31 -05:00
|
|
|
#ifndef _GL_ATTRIBUTE_FORMAT
|
|
|
|
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || defined __clang__
|
|
|
|
# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
|
|
|
|
# else
|
|
|
|
# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
|
|
|
|
# endif
|
2019-11-12 16:58:46 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* _GL_ATTRIBUTE_FORMAT_STRFMON
|
|
|
|
indicates to GCC that the function takes a format string and arguments,
|
|
|
|
where the format string directives are the ones standardized by ISO C99
|
|
|
|
and POSIX. */
|
|
|
|
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
|
|
|
|
# define _GL_ATTRIBUTE_FORMAT_STRFMON(formatstring_parameter, first_argument) \
|
|
|
|
_GL_ATTRIBUTE_FORMAT ((__gnu_strfmon__, formatstring_parameter, first_argument))
|
|
|
|
#elif __GNUC__ >= 3
|
|
|
|
# define _GL_ATTRIBUTE_FORMAT_STRFMON(formatstring_parameter, first_argument) \
|
|
|
|
_GL_ATTRIBUTE_FORMAT ((__strfmon__, formatstring_parameter, first_argument))
|
|
|
|
#else
|
|
|
|
# define _GL_ATTRIBUTE_FORMAT_STRFMON(formatstring_parameter, first_argument) /* empty */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
|
|
|
|
|
|
|
/* The definition of _GL_ARG_NONNULL is copied here. */
|
|
|
|
|
|
|
|
/* The definition of _GL_WARN_ON_USE is copied here. */
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if @GNULIB_STRFMON_L@
|
|
|
|
/* Converts a monetary value to a string.
|
|
|
|
See the POSIX:2008 specification
|
|
|
|
<https://pubs.opengroup.org/onlinepubs/9699919799/functions/strfmon_l.html. */
|
|
|
|
# if @REPLACE_STRFMON_L@
|
|
|
|
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
|
# define strfmon_l rpl_strfmon_l
|
|
|
|
# endif
|
2021-01-11 21:05:31 -05:00
|
|
|
_GL_FUNCDECL_RPL (strfmon_l, ssize_t,
|
|
|
|
(char *restrict s, size_t maxsize, locale_t locale,
|
|
|
|
const char *restrict format, ...)
|
|
|
|
_GL_ATTRIBUTE_FORMAT_STRFMON (4, 5)
|
|
|
|
_GL_ARG_NONNULL ((4)));
|
|
|
|
_GL_CXXALIAS_RPL (strfmon_l, ssize_t,
|
|
|
|
(char *restrict s, size_t maxsize, locale_t locale,
|
|
|
|
const char *restrict format, ...));
|
2019-11-12 16:58:46 -05:00
|
|
|
# else
|
|
|
|
# if @HAVE_STRFMON_L@
|
2021-01-11 21:05:31 -05:00
|
|
|
_GL_CXXALIAS_SYS (strfmon_l, ssize_t,
|
|
|
|
(char *restrict s, size_t maxsize, locale_t locale,
|
|
|
|
const char *restrict format, ...));
|
2019-11-12 16:58:46 -05:00
|
|
|
# endif
|
|
|
|
# endif
|
2020-01-08 16:36:10 -05:00
|
|
|
# if __GLIBC__ >= 2
|
2019-11-12 16:58:46 -05:00
|
|
|
_GL_CXXALIASWARN (strfmon_l);
|
2020-01-08 16:36:10 -05:00
|
|
|
# endif
|
2019-11-12 16:58:46 -05:00
|
|
|
#elif defined GNULIB_POSIXCHECK
|
|
|
|
# undef strfmon_l
|
|
|
|
# if HAVE_RAW_DECL_STRFMON_L
|
|
|
|
_GL_WARN_ON_USE (strfmon_l, "strfmon_l is buggy on older glibc systems - "
|
|
|
|
"use gnulib module chown for portability");
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _@GUARD_PREFIX@_MONETARY_H */
|
|
|
|
#endif /* _@GUARD_PREFIX@_MONETARY_H */
|