[Top][All Lists]

[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.


I have installed the following change in the "maint" branch.

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.
    * 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:
+The @code{int} value returned by this @code{yyerror} is ignored.
+The implementation of Yacc library's @code{main} function is:
+int main (void)
+  setlocale (LC_ALL, "");
+  return yyparse ();
address@hidden example
+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:
 int yyparse (void);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]