[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Building and testing Bison 3.0.2 with MinGW [3/5]
From: |
Eli Zaretskii |
Subject: |
Building and testing Bison 3.0.2 with MinGW [3/5] |
Date: |
Tue, 07 Oct 2014 21:14:36 +0300 |
A coupe of tests failed and revealed a problem with l10n: the Windows
'setlocale' doesn't cater to the LC_* environment variables, so
isprint returns values that are not necessarily consistent with the
locale that Bison is instructed to use (the test in question sets
LC_ALL=C). Here's a patch to fix that:
--- src/main.c~0 2014-10-07 08:45:06 +0300
+++ src/main.c 2014-10-07 09:53:07 +0300
@@ -58,7 +58,32 @@ int
main (int argc, char *argv[])
{
set_program_name (argv[0]);
+#ifdef __MINGW32__
+ /* The Windows 'setlocale' doesn't look at the environment
+ variables, so do it here by hand. */
+ {
+ char const *cp = getenv ("LC_ALL");
+
+ if (!cp)
+ cp = getenv ("LANG");
+ if (cp)
+ setlocale (LC_ALL, cp);
+ else
+ setlocale (LC_ALL, "");
+ if ((cp = getenv ("LC_COLLATE")) != NULL)
+ setlocale (LC_COLLATE, cp);
+ if ((cp = getenv ("LC_CTYPE")) != NULL)
+ setlocale (LC_CTYPE, cp);
+ if ((cp = getenv ("LC_NUMERIC")) != NULL)
+ setlocale (LC_NUMERIC, cp);
+ if ((cp = getenv ("LC_MONETARY")) != NULL)
+ setlocale (LC_MONETARY, cp);
+ if ((cp = getenv ("LC_TIME")) != NULL)
+ setlocale (LC_TIME, cp);
+ }
+#else /* !__MINGW32__ */
setlocale (LC_ALL, "");
+#endif
(void) bindtextdomain (PACKAGE, LOCALEDIR);
(void) bindtextdomain ("bison-runtime", LOCALEDIR);
(void) textdomain (PACKAGE);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Building and testing Bison 3.0.2 with MinGW [3/5],
Eli Zaretskii <=