X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=intl%2Fplural.c;h=5f73b403f21a241f8095f4f93c4649036ba44807;hp=5f415ce12bdda1f71006cecba7e83b9b331ee3c6;hb=2ac2bb6e436cef59dcbb88031b276aa81a109785;hpb=cfd46a622a446af8a5fa286637cd88259f1b50a5 diff --git a/intl/plural.c b/intl/plural.c index 5f415ce..5f73b40 100644 --- a/intl/plural.c +++ b/intl/plural.c @@ -19,7 +19,7 @@ #line 1 "plural.y" /* Expression parsing for plural form selection. - Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 2000-2001, 2003, 2005 Free Software Foundation, Inc. Written by Ulrich Drepper , 2000. This program is free software; you can redistribute it and/or modify it @@ -34,13 +34,14 @@ You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* The bison generated parser uses alloca. AIX 3 forces us to put this - declaration at the beginning of the file. The declaration in bison's - skeleton file comes too late. This must come before - because may include arbitrary system headers. */ +/* For bison < 2.0, the bison generated parser uses alloca. AIX 3 forces us + to put this declaration at the beginning of the file. The declaration in + bison's skeleton file comes too late. This must come before + because may include arbitrary system headers. + This can go away once the AM_INTL_SUBDIR macro requires bison >= 2.0. */ #if defined _AIX && !defined __GNUC__ #pragma alloca #endif @@ -49,24 +50,21 @@ # include #endif +#include #include -#include "gettextP.h" - -/* Names for the libintl functions are a problem. They must not clash - with existing names and they should follow ANSI C. But this source - code is also used in GNU C Library where the names have a __ - prefix. So we have to make a difference here. */ -#ifdef _LIBC -# define FREE_EXPRESSION __gettext_free_exp -#else -# define FREE_EXPRESSION gettext_free_exp__ -# define __gettextparse gettextparse__ +#include +#include "plural-exp.h" + +/* The main function generated by the parser is called __gettextparse, + but we want it to be called PLURAL_PARSE. */ +#ifndef _LIBC +# define __gettextparse PLURAL_PARSE #endif #define YYLEX_PARAM &((struct parse_args *) arg)->cp #define YYPARSE_PARAM arg -#line 53 "plural.y" +#line 51 "plural.y" #ifndef YYSTYPE typedef union { unsigned long int num; @@ -76,31 +74,16 @@ typedef union { # define YYSTYPE yystype # define YYSTYPE_IS_TRIVIAL 1 #endif -#line 59 "plural.y" +#line 57 "plural.y" /* Prototypes for local functions. */ -static struct expression *new_exp PARAMS ((int nargs, enum operator op, - struct expression * const *args)); -static inline struct expression *new_exp_0 PARAMS ((enum operator op)); -static inline struct expression *new_exp_1 PARAMS ((enum operator op, - struct expression *right)); -static struct expression *new_exp_2 PARAMS ((enum operator op, - struct expression *left, - struct expression *right)); -static inline struct expression *new_exp_3 PARAMS ((enum operator op, - struct expression *bexp, - struct expression *tbranch, - struct expression *fbranch)); -static int yylex PARAMS ((YYSTYPE *lval, const char **pexp)); -static void yyerror PARAMS ((const char *str)); +static int yylex (YYSTYPE *lval, const char **pexp); +static void yyerror (const char *str); /* Allocation of expressions. */ static struct expression * -new_exp (nargs, op, args) - int nargs; - enum operator op; - struct expression * const *args; +new_exp (int nargs, enum operator op, struct expression * const *args) { int i; struct expression *newp; @@ -129,16 +112,13 @@ new_exp (nargs, op, args) } static inline struct expression * -new_exp_0 (op) - enum operator op; +new_exp_0 (enum operator op) { return new_exp (0, op, NULL); } static inline struct expression * -new_exp_1 (op, right) - enum operator op; - struct expression *right; +new_exp_1 (enum operator op, struct expression *right) { struct expression *args[1]; @@ -147,10 +127,7 @@ new_exp_1 (op, right) } static struct expression * -new_exp_2 (op, left, right) - enum operator op; - struct expression *left; - struct expression *right; +new_exp_2 (enum operator op, struct expression *left, struct expression *right) { struct expression *args[2]; @@ -160,11 +137,8 @@ new_exp_2 (op, left, right) } static inline struct expression * -new_exp_3 (op, bexp, tbranch, fbranch) - enum operator op; - struct expression *bexp; - struct expression *tbranch; - struct expression *fbranch; +new_exp_3 (enum operator op, struct expression *bexp, + struct expression *tbranch, struct expression *fbranch) { struct expression *args[3]; @@ -240,8 +214,8 @@ static const short yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const short yyrline[] = { - 0, 178, 186, 190, 194, 198, 202, 206, 210, 214, - 218, 222, 227 + 0, 152, 160, 164, 168, 172, 176, 180, 184, 188, + 192, 196, 201 }; #endif @@ -324,7 +298,7 @@ static const short yycheck[] = #define YYPURE 1 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/sw/share/bison/bison.simple" +#line 3 "bison.simple" /* Skeleton output parser for bison, @@ -637,7 +611,7 @@ yystpcpy (yydest, yysrc) # endif #endif -#line 315 "/sw/share/bison/bison.simple" +#line 315 "bison.simple" /* The user can define YYPARSE_PARAM as the name of an argument to be passed @@ -1031,7 +1005,7 @@ yyreduce: switch (yyn) { case 1: -#line 179 "plural.y" +#line 153 "plural.y" { if (yyvsp[0].exp == NULL) YYABORT; @@ -1039,75 +1013,75 @@ case 1: } break; case 2: -#line 187 "plural.y" +#line 161 "plural.y" { yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp); } break; case 3: -#line 191 "plural.y" +#line 165 "plural.y" { yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp); } break; case 4: -#line 195 "plural.y" +#line 169 "plural.y" { yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp); } break; case 5: -#line 199 "plural.y" +#line 173 "plural.y" { yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); } break; case 6: -#line 203 "plural.y" +#line 177 "plural.y" { yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); } break; case 7: -#line 207 "plural.y" +#line 181 "plural.y" { yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); } break; case 8: -#line 211 "plural.y" +#line 185 "plural.y" { yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); } break; case 9: -#line 215 "plural.y" +#line 189 "plural.y" { yyval.exp = new_exp_1 (lnot, yyvsp[0].exp); } break; case 10: -#line 219 "plural.y" +#line 193 "plural.y" { yyval.exp = new_exp_0 (var); } break; case 11: -#line 223 "plural.y" +#line 197 "plural.y" { if ((yyval.exp = new_exp_0 (num)) != NULL) yyval.exp->val.num = yyvsp[0].num; } break; case 12: -#line 228 "plural.y" +#line 202 "plural.y" { yyval.exp = yyvsp[-1].exp; } break; } -#line 705 "/sw/share/bison/bison.simple" +#line 705 "bison.simple" yyvsp -= yylen; @@ -1338,13 +1312,12 @@ yyreturn: #endif return yyresult; } -#line 233 "plural.y" +#line 207 "plural.y" void internal_function -FREE_EXPRESSION (exp) - struct expression *exp; +FREE_EXPRESSION (struct expression *exp) { if (exp == NULL) return; @@ -1370,9 +1343,7 @@ FREE_EXPRESSION (exp) static int -yylex (lval, pexp) - YYSTYPE *lval; - const char **pexp; +yylex (YYSTYPE *lval, const char **pexp) { const char *exp = *pexp; int result; @@ -1515,8 +1486,7 @@ yylex (lval, pexp) static void -yyerror (str) - const char *str; +yyerror (const char *str) { /* Do nothing. We don't print error messages here. */ }