[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Locale and default main
From: |
Akim Demaille |
Subject: |
Re: Locale and default main |
Date: |
Mon, 12 Jan 2015 11:38:31 +0100 |
> Le 27 nov. 2014 à 09:39, Nicolas Bedon <address@hidden> a écrit :
>
> Hi,
>
> It seems to me that the default main in the Yacc library (gcc option -ly) for
> bison fixes the locale for its execution according to the configuration of
> the host, whereas the default main generated by bison (no -ly gcc option)
> does not. This difference of behaviours should be documented somewhere in the
> bison manual. I suggest to add, in the documentation, a description of both
> default main functions.
Hi!
I have installed the following change in the "maint" branch.
Thanks!
commit 9a91e7f24626da71bb4b5f0bd76159f34ba2b6f6
Author: Akim Demaille <address@hidden>
Date: Mon Jan 12 11:34:42 2015 +0100
doc: liby's main arms the internationalization
Reported by Nicolas Bedon.
<https://lists.gnu.org/archive/html/bug-bison/2014-11/msg00005.html>
* doc/bison.texi (Yacc Library): Document the call the setlocale.
diff --git a/THANKS b/THANKS
index 4fc9984..b984910 100644
--- a/THANKS
+++ b/THANKS
@@ -95,6 +95,7 @@ Mike Sullivan address@hidden
Neil Booth address@hidden
Nelson H. F. Beebe address@hidden
Nick Bowler address@hidden
+Nicolas Bedon address@hidden
Nicolas Burrus address@hidden
Nicolas Tisserand address@hidden
Noah Friedman address@hidden
diff --git a/doc/bison.texi b/doc/bison.texi
index d402215..1a2b169 100644
--- a/doc/bison.texi
+++ b/doc/bison.texi
@@ -10382,9 +10382,23 @@ declare @code{yyerror} as follows:
int yyerror (char const *);
@end example
-Bison ignores the @code{int} value returned by this @code{yyerror}.
-If you use the Yacc library's @code{main} function, your
address@hidden function should have the following type signature:
address@hidden
+The @code{int} value returned by this @code{yyerror} is ignored.
+
+The implementation of Yacc library's @code{main} function is:
+
address@hidden
+int main (void)
address@hidden
+ setlocale (LC_ALL, "");
+ return yyparse ();
address@hidden
address@hidden example
+
address@hidden
+so if you use it, the internationalization support is enabled (e.g., error
+messages are translated), and your @code{yyparse} function should have the
+following type signature:
@example
int yyparse (void);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Locale and default main,
Akim Demaille <=