[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 40/55: Handle newlib C library's langinfo constant names
From: |
Andy Wingo |
Subject: |
[Guile-commits] 40/55: Handle newlib C library's langinfo constant names |
Date: |
Thu, 23 May 2019 11:52:43 -0400 (EDT) |
wingo pushed a commit to branch master
in repository guile.
commit 69bc964d7bbba896b425f24a899627ad35713af4
Author: Michael Gran <address@hidden>
Date: Sat Feb 23 16:33:50 2019 -0800
Handle newlib C library's langinfo constant names
The newlib C library (used in Cygwin) has alternative names for
nl_langinfo GNU extensions
* configure.ac (_NL_NUMERIC_GROUPING): new test
* libguile/i18n.c (INT_CURR_SYMBOL, MON_DECIMAL_POINT, MON_THOUSANDS_SEP)
(MON_GROUPING, POSITIVE_SIGN, NEGATIVE_SIGN, GROUPING, INT_FRAC_DIGITS)
(FRAC_DIGITS, P_CS_PRECEDES, P_SEP_BY_SPACE, N_CS_PRECEDES,
N_SEP_BY_SPACE)
(P_SIGN_POSN, N_SIGN_POSN, INT_P_CS_PRECEDES, INT_P_SEP_BY_SPACE)
(INT_N_CS_PRECEDES, INT_N_SEP_BY_SPACE, INT_P_SIGN_POSN, INT_N_SIGN_POSN)
[HAVE_DECL__NL_NUMERIC_GROUPING]: map to newlib C constants, when present
---
configure.ac | 3 +++
libguile/i18n.c | 27 ++++++++++++++++++++++++++-
2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 8f77138..0899035 100644
--- a/configure.ac
+++ b/configure.ac
@@ -492,6 +492,9 @@ AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10
ctermid \
strcoll strcoll_l strtod_l strtol_l newlocale uselocale utimensat \
sched_getaffinity sched_setaffinity sendfile])
+# The newlib C library uses _NL_ prefixed locale langinfo constants.
+AC_CHECK_DECLS([_NL_NUMERIC_GROUPING], [], [], [[#include <langinfo.h>]])
+
# Reasons for testing:
# netdb.h - not in mingw
# sys/param.h - not in mingw
diff --git a/libguile/i18n.c b/libguile/i18n.c
index 65cfbc7..fa7a9bd 100644
--- a/libguile/i18n.c
+++ b/libguile/i18n.c
@@ -1,4 +1,4 @@
-/* Copyright 2006-2014,2017-2018
+/* Copyright 2006-2014,2017-2019
Free Software Foundation, Inc.
This file is part of Guile.
@@ -80,6 +80,31 @@ setlocale (int category, const char *name)
}
#endif
+/* The newlib C library has alternative names for locale constants. */
+#if HAVE_DECL__NL_NUMERIC_GROUPING
+#define INT_CURR_SYMBOL _NL_MONETARY_INT_CURR_SYMBOL
+#define MON_DECIMAL_POINT _NL_MONETARY_MON_DECIMAL_POINT
+#define MON_THOUSANDS_SEP _NL_MONETARY_MON_THOUSANDS_SEP
+#define MON_GROUPING _NL_MONETARY_MON_GROUPING
+#define POSITIVE_SIGN _NL_MONETARY_POSITIVE_SIGN
+#define NEGATIVE_SIGN _NL_MONETARY_NEGATIVE_SIGN
+#define GROUPING _NL_NUMERIC_GROUPING
+#define INT_FRAC_DIGITS _NL_MONETARY_INT_FRAC_DIGITS
+#define FRAC_DIGITS _NL_MONETARY_FRAC_DIGITS
+#define P_CS_PRECEDES _NL_MONETARY_P_CS_PRECEDES
+#define P_SEP_BY_SPACE _NL_MONETARY_P_SEP_BY_SPACE
+#define N_CS_PRECEDES _NL_MONETARY_N_CS_PRECEDES
+#define N_SEP_BY_SPACE _NL_MONETARY_N_SEP_BY_SPACE
+#define P_SIGN_POSN _NL_MONETARY_P_SIGN_POSN
+#define N_SIGN_POSN _NL_MONETARY_N_SIGN_POSN
+#define INT_P_CS_PRECEDES _NL_MONETARY_INT_P_CS_PRECEDES
+#define INT_P_SEP_BY_SPACE _NL_MONETARY_INT_P_SEP_BY_SPACE
+#define INT_N_CS_PRECEDES _NL_MONETARY_INT_N_CS_PRECEDES
+#define INT_N_SEP_BY_SPACE _NL_MONETARY_INT_N_SEP_BY_SPACE
+#define INT_P_SIGN_POSN _NL_MONETARY_INT_P_SIGN_POSN
+#define INT_N_SIGN_POSN _NL_MONETARY_INT_N_SIGN_POSN
+#endif
+
/* Helper stringification macro. */
#define SCM_I18N_STRINGIFY(_name) # _name
- [Guile-commits] 46/55: Fix gc.test "after-gc-hook gets called" failures., (continued)
- [Guile-commits] 46/55: Fix gc.test "after-gc-hook gets called" failures., Andy Wingo, 2019/05/23
- [Guile-commits] 55/55: Update iconv.m4 from gnulib., Andy Wingo, 2019/05/23
- [Guile-commits] 50/55: Fix indentation in scm_sum., Andy Wingo, 2019/05/23
- [Guile-commits] 48/55: Add 'scm_c_make_char' and use it where appropriate., Andy Wingo, 2019/05/23
- [Guile-commits] 07/55: Improve the documentation for 'nil?'., Andy Wingo, 2019/05/23
- [Guile-commits] 17/55: Fix typo in strings.h., Andy Wingo, 2019/05/23
- [Guile-commits] 18/55: scm_seed_to_random_state: Support wide string arguments., Andy Wingo, 2019/05/23
- [Guile-commits] 35/55: Remove redefinition of when & unless in snarf-check-and-output-texi, Andy Wingo, 2019/05/23
- [Guile-commits] 41/55: Make locale monetary conversion tests be less strict on terminal whitespace, Andy Wingo, 2019/05/23
- [Guile-commits] 39/55: Add a fallback value for the locale-monetary-decimal-point, Andy Wingo, 2019/05/23
- [Guile-commits] 40/55: Handle newlib C library's langinfo constant names,
Andy Wingo <=
- [Guile-commits] 19/55: SRFI-19: Fix TAI->UTC conversions, leap second handling, etc., Andy Wingo, 2019/05/23