From b59616d00a1f7a18da14ffb5b4d91f142b1d68bb Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Mon, 8 Mar 2010 00:11:45 +0100 Subject: [PATCH] bug #196: Added parsing of share variables, it includes RUNNING_VMS, USED_CPU, USED_MEMORY... --- include/Host.h | 6 +- src/host/host_parser.c | 66 +++-- src/host/host_rank.cc | 434 ++++++++++++++++++++------------ src/host/host_rank.h | 47 ++-- src/host/host_rank.y | 78 +++++- src/host/host_requirements.cc | 376 +++++++++++++++------------ src/host/host_requirements.h | 47 ++-- src/template/template_parser.c | 72 ++++-- src/template/template_syntax.cc | 342 +++++++++++++------------ src/template/template_syntax.h | 53 ++-- src/vm/vm_var_parser.c | 76 ++++-- src/vm/vm_var_syntax.cc | 350 ++++++++++++++------------ src/vm/vm_var_syntax.h | 55 ++-- 13 files changed, 1177 insertions(+), 825 deletions(-) diff --git a/include/Host.h b/include/Host.h index 7b1a252166..5507cbbb4b 100644 --- a/include/Host.h +++ b/include/Host.h @@ -283,7 +283,11 @@ public: * * */ - + int get_share_running_vms() + { + return host_share.running_vms; + } + int get_share_disk_usage() { return host_share.disk_usage; diff --git a/src/host/host_parser.c b/src/host/host_parser.c index 5a649660f8..4accae72dd 100644 --- a/src/host/host_parser.c +++ b/src/host/host_parser.c @@ -28,7 +28,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 34 +#define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -211,13 +211,6 @@ extern FILE *host_in, *host_out; #define unput(c) yyunput( c, (yytext_ptr) ) -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - * Given that the standard has decreed that size_t exists since 1989, - * I guess we can afford to depend on it. Manoj. - */ - #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; @@ -516,7 +509,7 @@ char *host_text; /* See the License for the specific language governing permissions and */ /* limitations under the License. */ /* -------------------------------------------------------------------------- */ -#line 19 "host_parser.l" +#line 18 "host_parser.l" #include #include #include @@ -530,7 +523,7 @@ char *host_text; #define YY_USER_ACTION llocp->first_line = host_lineno; \ llocp->first_column = llocp->last_column; \ llocp->last_column += host_leng; -#line 535 "host_parser.c" +#line 527 "host_parser.c" #define INITIAL 0 @@ -548,6 +541,35 @@ char *host_text; static int yy_init_globals (void ); +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int host_lex_destroy (void ); + +int host_get_debug (void ); + +void host_set_debug (int debug_flag ); + +YY_EXTRA_TYPE host_get_extra (void ); + +void host_set_extra (YY_EXTRA_TYPE user_defined ); + +FILE *host_get_in (void ); + +void host_set_in (FILE * in_str ); + +FILE *host_get_out (void ); + +void host_set_out (FILE * out_str ); + +int host_get_leng (void ); + +char *host_get_text (void ); + +int host_get_lineno (void ); + +void host_set_lineno (int line_number ); + /* Macros after this point can all be overridden by user definitions in * section 1. */ @@ -681,11 +703,11 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 39 "host_parser.l" +#line 38 "host_parser.l" /* --- Tokens --- */ -#line 690 "host_parser.c" +#line 711 "host_parser.c" if ( !(yy_init) ) { @@ -780,26 +802,26 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 42 "host_parser.l" +#line 41 "host_parser.l" { return *host_text;} YY_BREAK /* --- Strings, also quoted form --- */ case 2: YY_RULE_SETUP -#line 46 "host_parser.l" +#line 45 "host_parser.l" { lvalp->val_str = strdup(host_text); return STRING;} YY_BREAK case 3: YY_RULE_SETUP -#line 49 "host_parser.l" +#line 48 "host_parser.l" { lvalp->val_str = NULL; return STRING;} YY_BREAK case 4: /* rule 4 can match eol */ YY_RULE_SETUP -#line 52 "host_parser.l" +#line 51 "host_parser.l" { lvalp->val_str = strdup(host_text+1); lvalp->val_str[host_leng-2] = '\0'; return STRING;} @@ -807,28 +829,28 @@ YY_RULE_SETUP /* --- Numbers --- */ case 5: YY_RULE_SETUP -#line 57 "host_parser.l" +#line 56 "host_parser.l" { lvalp->val_int = atoi(host_text); return INTEGER;} YY_BREAK case 6: YY_RULE_SETUP -#line 60 "host_parser.l" +#line 59 "host_parser.l" { lvalp->val_float = atof(host_text); return FLOAT;} YY_BREAK /* --- blanks --- */ case 7: YY_RULE_SETUP -#line 64 "host_parser.l" +#line 63 "host_parser.l" YY_BREAK case 8: YY_RULE_SETUP -#line 66 "host_parser.l" +#line 65 "host_parser.l" ECHO; YY_BREAK -#line 833 "host_parser.c" +#line 854 "host_parser.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1797,7 +1819,7 @@ void host_free (void * ptr ) #define YYTABLES_NAME "yytables" -#line 66 "host_parser.l" +#line 65 "host_parser.l" diff --git a/src/host/host_rank.cc b/src/host/host_rank.cc index 9987a05693..a353006530 100644 --- a/src/host/host_rank.cc +++ b/src/host/host_rank.cc @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ + +/* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +28,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -47,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,40 +54,29 @@ /* Pure parsers. */ #define YYPURE 1 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Using locations. */ #define YYLSP_NEEDED 1 /* Substitute the variable and function names. */ -#define yyparse host_rank_parse -#define yylex host_rank_lex -#define yyerror host_rank_error -#define yylval host_rank_lval -#define yychar host_rank_char -#define yydebug host_rank_debug -#define yynerrs host_rank_nerrs -#define yylloc host_rank_lloc - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - INTEGER = 258, - STRING = 259, - FLOAT = 260 - }; -#endif -/* Tokens. */ -#define INTEGER 258 -#define STRING 259 -#define FLOAT 260 - - - +#define yyparse host_rank_parse +#define yylex host_rank_lex +#define yyerror host_rank_error +#define yylval host_rank_lval +#define yychar host_rank_char +#define yydebug host_rank_debug +#define yynerrs host_rank_nerrs +#define yylloc host_rank_lloc /* Copy the first part of user declarations. */ -#line 18 "host_rank.y" + +/* Line 189 of yacc.c */ +#line 17 "host_rank.y" #include #include @@ -122,6 +110,9 @@ int host_rank_parse(Host * host, int& result, char ** errmsg); +/* Line 189 of yacc.c */ +#line 115 "host_rank.cc" + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -140,20 +131,40 @@ int host_rank_parse(Host * host, int& result, char ** errmsg); # define YYTOKEN_TABLE 0 #endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + INTEGER = 258, + STRING = 259, + FLOAT = 260 + }; +#endif + + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 55 "host_rank.y" { + +/* Line 214 of yacc.c */ +#line 54 "host_rank.y" + char * val_str; int val_int; float val_float; -} -/* Line 187 of yacc.c. */ -#line 153 "host_rank.cc" - YYSTYPE; + + + +/* Line 214 of yacc.c */ +#line 164 "host_rank.cc" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED @@ -173,8 +184,8 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 178 "host_rank.cc" +/* Line 264 of yacc.c */ +#line 189 "host_rank.cc" #ifdef short # undef short @@ -249,14 +260,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -338,9 +349,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - YYLTYPE yyls; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ @@ -375,12 +386,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -462,8 +473,8 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 77, 77, 78, 81, 85, 86, 87, 88, 89, - 90, 91, 92 + 0, 76, 76, 77, 80, 156, 157, 158, 159, 160, + 161, 162, 163 }; #endif @@ -754,17 +765,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, host, result, error_ms #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -802,11 +816,11 @@ yy_reduce_print (yyvsp, yylsp, yyrule, host, result, error_msg) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) , &(yylsp[(yyi + 1) - (yynrhs)]) , host, result, error_msg); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -1094,10 +1108,8 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, host, result, error_msg) break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1116,10 +1128,9 @@ int yyparse (); - -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1145,24 +1156,59 @@ yyparse (host, result, error_msg) #endif #endif { - /* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; -/* Location data for the look-ahead symbol. */ +/* Location data for the lookahead symbol. */ YYLTYPE yylloc; - int yystate; + /* Number of syntax errors so far. */ + int yynerrs; + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2]; + + YYSIZE_T yystacksize; + int yyn; int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + YYLTYPE yyloc; + #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; @@ -1170,63 +1216,37 @@ YYLTYPE yylloc; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; - - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2]; - #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) - YYSIZE_T yystacksize = YYINITDEPTH; - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - YYLTYPE yyloc; - /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yyls = yylsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; yylsp = yyls; + #if YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; - yylloc.first_column = yylloc.last_column = 0; + yylloc.first_column = yylloc.last_column = 1; #endif goto yysetstate; @@ -1265,6 +1285,7 @@ YYLTYPE yylloc; &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); + yyls = yyls1; yyss = yyss1; yyvs = yyvs1; @@ -1286,9 +1307,9 @@ YYLTYPE yylloc; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - YYSTACK_RELOCATE (yyls); + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1309,6 +1330,9 @@ YYLTYPE yylloc; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -1317,16 +1341,16 @@ YYLTYPE yylloc; yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1358,20 +1382,16 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -1412,66 +1432,161 @@ yyreduce: switch (yyn) { case 2: -#line 77 "host_rank.y" + +/* Line 1455 of yacc.c */ +#line 76 "host_rank.y" { result = static_cast((yyvsp[(1) - (1)].val_float));;} break; case 3: -#line 78 "host_rank.y" + +/* Line 1455 of yacc.c */ +#line 77 "host_rank.y" { result = 0; ;} break; case 4: -#line 81 "host_rank.y" + +/* Line 1455 of yacc.c */ +#line 80 "host_rank.y" { string val; - host->get_template_attribute((yyvsp[(1) - (1)].val_str),val); - (yyval.val_float) = val.empty() ? 0.0 : atof(val.c_str()); - free((yyvsp[(1) - (1)].val_str)); ;} + string attr((yyvsp[(1) - (1)].val_str)); + + if (attr == "RUNNING_VMS") + { + (yyval.val_float) = static_cast + (host->get_share_running_vms()); + } + else if (attr == "ALLOCATED_MEMORY") + { + (yyval.val_float) = static_cast + (host->get_share_mem_usage()); + } + else if (attr == "ALLOCATED_CPU") + { + (yyval.val_float) = static_cast + (host->get_share_cpu_usage()); + } + else if (attr == "ALLOCATED_DISK") + { + (yyval.val_float) = static_cast + (host->get_share_disk_usage()); + } + else if (attr == "USED_MEMORY") + { + (yyval.val_float) = static_cast + (host->get_share_used_mem()); + } + else if (attr == "USED_CPU") + { + (yyval.val_float) = static_cast + (host->get_share_used_cpu()); + } + else if (attr == "USED_DISK") + { + (yyval.val_float) = static_cast + (host->get_share_used_disk()); + } + else if (attr == "FREE_MEMORY") + { + (yyval.val_float) = static_cast + (host->get_share_free_mem()); + } + else if (attr == "FREE_CPU") + { + (yyval.val_float) = static_cast + (host->get_share_free_cpu()); + } + else if (attr == "FREE_DISK") + { + (yyval.val_float) = static_cast + (host->get_share_free_disk()); + } + else if (attr == "MAX_MEMORY") + { + (yyval.val_float) = static_cast + (host->get_share_max_mem()); + } + else if (attr == "MAX_CPU") + { + (yyval.val_float) = static_cast + (host->get_share_max_cpu()); + } + else if (attr == "MAX_DISK") + { + (yyval.val_float) = static_cast + (host->get_share_max_disk()); + } + else + { + host->get_template_attribute((yyvsp[(1) - (1)].val_str),val); + (yyval.val_float) = val.empty() ? 0.0 : atof(val.c_str()); + } + + free((yyvsp[(1) - (1)].val_str)); + ;} break; case 5: -#line 85 "host_rank.y" + +/* Line 1455 of yacc.c */ +#line 156 "host_rank.y" { (yyval.val_float) = (yyvsp[(1) - (1)].val_float); ;} break; case 6: -#line 86 "host_rank.y" + +/* Line 1455 of yacc.c */ +#line 157 "host_rank.y" { (yyval.val_float) = static_cast((yyvsp[(1) - (1)].val_int)); ;} break; case 7: -#line 87 "host_rank.y" + +/* Line 1455 of yacc.c */ +#line 158 "host_rank.y" { (yyval.val_float) = (yyvsp[(1) - (3)].val_float) + (yyvsp[(3) - (3)].val_float);;} break; case 8: -#line 88 "host_rank.y" + +/* Line 1455 of yacc.c */ +#line 159 "host_rank.y" { (yyval.val_float) = (yyvsp[(1) - (3)].val_float) - (yyvsp[(3) - (3)].val_float);;} break; case 9: -#line 89 "host_rank.y" + +/* Line 1455 of yacc.c */ +#line 160 "host_rank.y" { (yyval.val_float) = (yyvsp[(1) - (3)].val_float) * (yyvsp[(3) - (3)].val_float);;} break; case 10: -#line 90 "host_rank.y" + +/* Line 1455 of yacc.c */ +#line 161 "host_rank.y" { (yyval.val_float) = (yyvsp[(1) - (3)].val_float) / (yyvsp[(3) - (3)].val_float);;} break; case 11: -#line 91 "host_rank.y" + +/* Line 1455 of yacc.c */ +#line 162 "host_rank.y" { (yyval.val_float) = - (yyvsp[(2) - (2)].val_float);;} break; case 12: -#line 92 "host_rank.y" + +/* Line 1455 of yacc.c */ +#line 163 "host_rank.y" { (yyval.val_float) = (yyvsp[(2) - (3)].val_float);;} break; -/* Line 1267 of yacc.c. */ -#line 1475 "host_rank.cc" + +/* Line 1455 of yacc.c */ +#line 1590 "host_rank.cc" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1547,7 +1662,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -1564,7 +1679,7 @@ yyerrlab: } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -1622,14 +1737,11 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; yyerror_range[1] = yylloc; /* Using YYLLOC is tempting, but would change the location of - the look-ahead. YYLOC is available though. */ + the lookahead. YYLOC is available though. */ YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); *++yylsp = yyloc; @@ -1654,7 +1766,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -1665,7 +1777,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc, host, result, error_msg); /* Do not reclaim the symbols of the rule which action triggered @@ -1691,7 +1803,9 @@ yyreturn: } -#line 95 "host_rank.y" + +/* Line 1675 of yacc.c */ +#line 166 "host_rank.y" extern "C" void host_rank_error( diff --git a/src/host/host_rank.h b/src/host/host_rank.h index 954d6d595f..0218495b62 100644 --- a/src/host/host_rank.h +++ b/src/host/host_rank.h @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ + +/* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,10 +28,11 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -44,28 +44,28 @@ FLOAT = 260 }; #endif -/* Tokens. */ -#define INTEGER 258 -#define STRING 259 -#define FLOAT 260 - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 55 "host_rank.y" { + +/* Line 1676 of yacc.c */ +#line 54 "host_rank.y" + char * val_str; int val_int; float val_float; -} -/* Line 1489 of yacc.c. */ + + + +/* Line 1676 of yacc.c */ #line 65 "host_rank.hh" - YYSTYPE; +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif @@ -84,3 +84,4 @@ typedef struct YYLTYPE #endif + diff --git a/src/host/host_rank.y b/src/host/host_rank.y index 9814ab69f0..43084a2011 100644 --- a/src/host/host_rank.y +++ b/src/host/host_rank.y @@ -78,9 +78,81 @@ stmt: expr { result = static_cast($1);} ; expr: STRING { string val; - host->get_template_attribute($1,val); - $$ = val.empty() ? 0.0 : atof(val.c_str()); - free($1); } + string attr($1); + + if (attr == "RUNNING_VMS") + { + $$ = static_cast + (host->get_share_running_vms()); + } + else if (attr == "ALLOCATED_MEMORY") + { + $$ = static_cast + (host->get_share_mem_usage()); + } + else if (attr == "ALLOCATED_CPU") + { + $$ = static_cast + (host->get_share_cpu_usage()); + } + else if (attr == "ALLOCATED_DISK") + { + $$ = static_cast + (host->get_share_disk_usage()); + } + else if (attr == "USED_MEMORY") + { + $$ = static_cast + (host->get_share_used_mem()); + } + else if (attr == "USED_CPU") + { + $$ = static_cast + (host->get_share_used_cpu()); + } + else if (attr == "USED_DISK") + { + $$ = static_cast + (host->get_share_used_disk()); + } + else if (attr == "FREE_MEMORY") + { + $$ = static_cast + (host->get_share_free_mem()); + } + else if (attr == "FREE_CPU") + { + $$ = static_cast + (host->get_share_free_cpu()); + } + else if (attr == "FREE_DISK") + { + $$ = static_cast + (host->get_share_free_disk()); + } + else if (attr == "MAX_MEMORY") + { + $$ = static_cast + (host->get_share_max_mem()); + } + else if (attr == "MAX_CPU") + { + $$ = static_cast + (host->get_share_max_cpu()); + } + else if (attr == "MAX_DISK") + { + $$ = static_cast + (host->get_share_max_disk()); + } + else + { + host->get_template_attribute($1,val); + $$ = val.empty() ? 0.0 : atof(val.c_str()); + } + + free($1); + } | FLOAT { $$ = $1; } | INTEGER { $$ = static_cast($1); } | expr '+' expr { $$ = $1 + $3;} diff --git a/src/host/host_requirements.cc b/src/host/host_requirements.cc index 4b73b96e66..d62eda1064 100644 --- a/src/host/host_requirements.cc +++ b/src/host/host_requirements.cc @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ + +/* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +28,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -47,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,40 +54,29 @@ /* Pure parsers. */ #define YYPURE 1 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Using locations. */ #define YYLSP_NEEDED 1 /* Substitute the variable and function names. */ -#define yyparse host_requirements_parse -#define yylex host_requirements_lex -#define yyerror host_requirements_error -#define yylval host_requirements_lval -#define yychar host_requirements_char -#define yydebug host_requirements_debug -#define yynerrs host_requirements_nerrs -#define yylloc host_requirements_lloc - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - INTEGER = 258, - STRING = 259, - FLOAT = 260 - }; -#endif -/* Tokens. */ -#define INTEGER 258 -#define STRING 259 -#define FLOAT 260 - - - +#define yyparse host_requirements_parse +#define yylex host_requirements_lex +#define yyerror host_requirements_error +#define yylval host_requirements_lval +#define yychar host_requirements_char +#define yydebug host_requirements_debug +#define yynerrs host_requirements_nerrs +#define yylloc host_requirements_lloc /* Copy the first part of user declarations. */ -#line 18 "host_requirements.y" + +/* Line 189 of yacc.c */ +#line 17 "host_requirements.y" #include #include @@ -122,6 +110,9 @@ int host_requirements_parse(Host * host, bool& result, char ** errmsg); +/* Line 189 of yacc.c */ +#line 115 "host_requirements.cc" + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -140,20 +131,40 @@ int host_requirements_parse(Host * host, bool& result, char ** errmsg); # define YYTOKEN_TABLE 0 #endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + INTEGER = 258, + STRING = 259, + FLOAT = 260 + }; +#endif + + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 55 "host_requirements.y" { + +/* Line 214 of yacc.c */ +#line 54 "host_requirements.y" + char * val_str; int val_int; float val_float; -} -/* Line 187 of yacc.c. */ -#line 153 "host_requirements.cc" - YYSTYPE; + + + +/* Line 214 of yacc.c */ +#line 164 "host_requirements.cc" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED @@ -173,8 +184,8 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 178 "host_requirements.cc" +/* Line 264 of yacc.c */ +#line 189 "host_requirements.cc" #ifdef short # undef short @@ -249,14 +260,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -338,9 +349,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - YYLTYPE yyls; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ @@ -375,12 +386,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -465,8 +476,8 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 75, 75, 76, 79, 86, 93, 100, 107, 114, - 121, 128, 135, 143, 151, 152, 153, 154 + 0, 74, 74, 75, 78, 85, 92, 99, 106, 113, + 120, 127, 134, 142, 150, 151, 152, 153 }; #endif @@ -760,17 +771,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, host, result, error_ms #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -808,11 +822,11 @@ yy_reduce_print (yyvsp, yylsp, yyrule, host, result, error_msg) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) , &(yylsp[(yyi + 1) - (yynrhs)]) , host, result, error_msg); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -1100,10 +1114,8 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, host, result, error_msg) break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1122,10 +1134,9 @@ int yyparse (); - -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1151,24 +1162,59 @@ yyparse (host, result, error_msg) #endif #endif { - /* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; -/* Location data for the look-ahead symbol. */ +/* Location data for the lookahead symbol. */ YYLTYPE yylloc; - int yystate; + /* Number of syntax errors so far. */ + int yynerrs; + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2]; + + YYSIZE_T yystacksize; + int yyn; int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + YYLTYPE yyloc; + #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; @@ -1176,63 +1222,37 @@ YYLTYPE yylloc; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; - - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2]; - #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) - YYSIZE_T yystacksize = YYINITDEPTH; - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - YYLTYPE yyloc; - /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yyls = yylsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; yylsp = yyls; + #if YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; - yylloc.first_column = yylloc.last_column = 0; + yylloc.first_column = yylloc.last_column = 1; #endif goto yysetstate; @@ -1271,6 +1291,7 @@ YYLTYPE yylloc; &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); + yyls = yyls1; yyss = yyss1; yyvs = yyvs1; @@ -1292,9 +1313,9 @@ YYLTYPE yylloc; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - YYSTACK_RELOCATE (yyls); + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1315,6 +1336,9 @@ YYLTYPE yylloc; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -1323,16 +1347,16 @@ YYLTYPE yylloc; yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1364,20 +1388,16 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -1418,17 +1438,23 @@ yyreduce: switch (yyn) { case 2: -#line 75 "host_requirements.y" + +/* Line 1455 of yacc.c */ +#line 74 "host_requirements.y" { result=(yyvsp[(1) - (1)].val_int); ;} break; case 3: -#line 76 "host_requirements.y" + +/* Line 1455 of yacc.c */ +#line 75 "host_requirements.y" { result=true; ;} break; case 4: -#line 79 "host_requirements.y" + +/* Line 1455 of yacc.c */ +#line 78 "host_requirements.y" { int val; host->get_template_attribute((yyvsp[(1) - (3)].val_str),val); @@ -1438,7 +1464,9 @@ yyreduce: break; case 5: -#line 86 "host_requirements.y" + +/* Line 1455 of yacc.c */ +#line 85 "host_requirements.y" { int val; host->get_template_attribute((yyvsp[(1) - (4)].val_str),val); @@ -1448,7 +1476,9 @@ yyreduce: break; case 6: -#line 93 "host_requirements.y" + +/* Line 1455 of yacc.c */ +#line 92 "host_requirements.y" { int val; host->get_template_attribute((yyvsp[(1) - (3)].val_str),val); @@ -1458,7 +1488,9 @@ yyreduce: break; case 7: -#line 100 "host_requirements.y" + +/* Line 1455 of yacc.c */ +#line 99 "host_requirements.y" { int val; host->get_template_attribute((yyvsp[(1) - (3)].val_str),val); @@ -1468,7 +1500,9 @@ yyreduce: break; case 8: -#line 107 "host_requirements.y" + +/* Line 1455 of yacc.c */ +#line 106 "host_requirements.y" { string val; host->get_template_attribute((yyvsp[(1) - (3)].val_str),val); @@ -1478,7 +1512,9 @@ yyreduce: break; case 9: -#line 114 "host_requirements.y" + +/* Line 1455 of yacc.c */ +#line 113 "host_requirements.y" { string val; host->get_template_attribute((yyvsp[(1) - (4)].val_str),val); @@ -1488,7 +1524,9 @@ yyreduce: break; case 10: -#line 121 "host_requirements.y" + +/* Line 1455 of yacc.c */ +#line 120 "host_requirements.y" { string val; host->get_template_attribute((yyvsp[(1) - (3)].val_str),val); @@ -1498,7 +1536,9 @@ yyreduce: break; case 11: -#line 128 "host_requirements.y" + +/* Line 1455 of yacc.c */ +#line 127 "host_requirements.y" { string val; host->get_template_attribute((yyvsp[(1) - (3)].val_str),val); @@ -1508,7 +1548,9 @@ yyreduce: break; case 12: -#line 135 "host_requirements.y" + +/* Line 1455 of yacc.c */ +#line 134 "host_requirements.y" { string val; host->get_template_attribute((yyvsp[(1) - (3)].val_str),val); @@ -1519,7 +1561,9 @@ yyreduce: break; case 13: -#line 143 "host_requirements.y" + +/* Line 1455 of yacc.c */ +#line 142 "host_requirements.y" { string val; host->get_template_attribute((yyvsp[(1) - (4)].val_str),val); @@ -1530,28 +1574,37 @@ yyreduce: break; case 14: -#line 151 "host_requirements.y" + +/* Line 1455 of yacc.c */ +#line 150 "host_requirements.y" { (yyval.val_int) = (yyvsp[(1) - (3)].val_int) && (yyvsp[(3) - (3)].val_int); ;} break; case 15: -#line 152 "host_requirements.y" + +/* Line 1455 of yacc.c */ +#line 151 "host_requirements.y" { (yyval.val_int) = (yyvsp[(1) - (3)].val_int) || (yyvsp[(3) - (3)].val_int); ;} break; case 16: -#line 153 "host_requirements.y" + +/* Line 1455 of yacc.c */ +#line 152 "host_requirements.y" { (yyval.val_int) = ! (yyvsp[(2) - (2)].val_int); ;} break; case 17: -#line 154 "host_requirements.y" + +/* Line 1455 of yacc.c */ +#line 153 "host_requirements.y" { (yyval.val_int) = (yyvsp[(2) - (3)].val_int); ;} break; -/* Line 1267 of yacc.c. */ -#line 1555 "host_requirements.cc" + +/* Line 1455 of yacc.c */ +#line 1608 "host_requirements.cc" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1627,7 +1680,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -1644,7 +1697,7 @@ yyerrlab: } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -1702,14 +1755,11 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; yyerror_range[1] = yylloc; /* Using YYLLOC is tempting, but would change the location of - the look-ahead. YYLOC is available though. */ + the lookahead. YYLOC is available though. */ YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); *++yylsp = yyloc; @@ -1734,7 +1784,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -1745,7 +1795,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc, host, result, error_msg); /* Do not reclaim the symbols of the rule which action triggered @@ -1771,7 +1821,9 @@ yyreturn: } -#line 157 "host_requirements.y" + +/* Line 1675 of yacc.c */ +#line 156 "host_requirements.y" extern "C" void host_requirements_error( diff --git a/src/host/host_requirements.h b/src/host/host_requirements.h index 8178da758d..4958488af2 100644 --- a/src/host/host_requirements.h +++ b/src/host/host_requirements.h @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ + +/* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,10 +28,11 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -44,28 +44,28 @@ FLOAT = 260 }; #endif -/* Tokens. */ -#define INTEGER 258 -#define STRING 259 -#define FLOAT 260 - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 55 "host_requirements.y" { + +/* Line 1676 of yacc.c */ +#line 54 "host_requirements.y" + char * val_str; int val_int; float val_float; -} -/* Line 1489 of yacc.c. */ + + + +/* Line 1676 of yacc.c */ #line 65 "host_requirements.hh" - YYSTYPE; +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif @@ -84,3 +84,4 @@ typedef struct YYLTYPE #endif + diff --git a/src/template/template_parser.c b/src/template/template_parser.c index 6aa990e389..9f76fa756c 100644 --- a/src/template/template_parser.c +++ b/src/template/template_parser.c @@ -28,7 +28,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 34 +#define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -211,13 +211,6 @@ extern FILE *template_in, *template_out; #define unput(c) yyunput( c, (yytext_ptr) ) -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - * Given that the standard has decreed that size_t exists since 1989, - * I guess we can afford to depend on it. Manoj. - */ - #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; @@ -542,7 +535,7 @@ char *template_text; /* See the License for the specific language governing permissions and */ /* limitations under the License. */ /* -------------------------------------------------------------------------- */ -#line 19 "template_parser.l" +#line 18 "template_parser.l" #include #include #include @@ -556,7 +549,7 @@ char *template_text; llocp->first_column = llocp->last_column; \ llocp->last_column += template_leng; -#line 561 "template_parser.c" +#line 553 "template_parser.c" #define INITIAL 0 #define VALUE 1 @@ -575,6 +568,35 @@ char *template_text; static int yy_init_globals (void ); +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int template_lex_destroy (void ); + +int template_get_debug (void ); + +void template_set_debug (int debug_flag ); + +YY_EXTRA_TYPE template_get_extra (void ); + +void template_set_extra (YY_EXTRA_TYPE user_defined ); + +FILE *template_get_in (void ); + +void template_set_in (FILE * in_str ); + +FILE *template_get_out (void ); + +void template_set_out (FILE * out_str ); + +int template_get_leng (void ); + +char *template_get_text (void ); + +int template_get_lineno (void ); + +void template_set_lineno (int line_number ); + /* Macros after this point can all be overridden by user definitions in * section 1. */ @@ -708,13 +730,13 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 41 "template_parser.l" +#line 40 "template_parser.l" /* ------------------------------------------------------------------------- */ /* Comments (lines with an starting #), and empty lines */ /* ------------------------------------------------------------------------- */ -#line 719 "template_parser.c" +#line 740 "template_parser.c" if ( !(yy_init) ) { @@ -810,13 +832,13 @@ do_action: /* This label is used only to access EOF actions. */ case 1: /* rule 1 can match eol */ YY_RULE_SETUP -#line 46 "template_parser.l" +#line 45 "template_parser.l" ; YY_BREAK case 2: /* rule 2 can match eol */ YY_RULE_SETUP -#line 47 "template_parser.l" +#line 46 "template_parser.l" ; YY_BREAK /* ------------------------------------------------------------------------- */ @@ -824,7 +846,7 @@ YY_RULE_SETUP /* ------------------------------------------------------------------------- */ case 3: YY_RULE_SETUP -#line 52 "template_parser.l" +#line 51 "template_parser.l" { lvalp->val_str = strdup(template_text); return VARIABLE;} YY_BREAK /* ------------------------------------------------------------------------ */ @@ -834,31 +856,31 @@ YY_RULE_SETUP /* ------------------------------------------------------------------------ */ case 4: YY_RULE_SETUP -#line 59 "template_parser.l" +#line 58 "template_parser.l" { BEGIN VALUE; return EQUAL;} YY_BREAK case 5: /* rule 5 can match eol */ YY_RULE_SETUP -#line 61 "template_parser.l" +#line 60 "template_parser.l" { return EQUAL_EMPTY;} YY_BREAK case 6: /* rule 6 can match eol */ YY_RULE_SETUP -#line 63 "template_parser.l" +#line 62 "template_parser.l" { return COMMA;} YY_BREAK case 7: /* rule 7 can match eol */ YY_RULE_SETUP -#line 65 "template_parser.l" +#line 64 "template_parser.l" { return CBRACKET;} YY_BREAK case 8: /* rule 8 can match eol */ YY_RULE_SETUP -#line 67 "template_parser.l" +#line 66 "template_parser.l" { BEGIN(INITIAL); return OBRACKET;} YY_BREAK /* ------------------------------------------------------------------------ */ @@ -869,7 +891,7 @@ YY_RULE_SETUP case 9: /* rule 9 can match eol */ YY_RULE_SETUP -#line 74 "template_parser.l" +#line 73 "template_parser.l" { lvalp->val_str = strdup(template_text+1); lvalp->val_str[template_leng-2] = '\0'; BEGIN(INITIAL); return STRING; } @@ -881,16 +903,16 @@ YY_RULE_SETUP */ case 10: YY_RULE_SETUP -#line 83 "template_parser.l" +#line 82 "template_parser.l" { lvalp->val_str = strdup(template_text); BEGIN(INITIAL); return STRING;} YY_BREAK case 11: YY_RULE_SETUP -#line 85 "template_parser.l" +#line 84 "template_parser.l" ECHO; YY_BREAK -#line 895 "template_parser.c" +#line 916 "template_parser.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(VALUE): yyterminate(); @@ -1860,7 +1882,7 @@ void template_free (void * ptr ) #define YYTABLES_NAME "yytables" -#line 85 "template_parser.l" +#line 84 "template_parser.l" diff --git a/src/template/template_syntax.cc b/src/template/template_syntax.cc index 2afa9c479a..e810414ca3 100644 --- a/src/template/template_syntax.cc +++ b/src/template/template_syntax.cc @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ + +/* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +28,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -47,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,48 +54,29 @@ /* Pure parsers. */ #define YYPURE 1 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Using locations. */ #define YYLSP_NEEDED 1 /* Substitute the variable and function names. */ -#define yyparse template_parse -#define yylex template_lex -#define yyerror template_error -#define yylval template_lval -#define yychar template_char -#define yydebug template_debug -#define yynerrs template_nerrs -#define yylloc template_lloc - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - EQUAL = 258, - COMMA = 259, - OBRACKET = 260, - CBRACKET = 261, - EQUAL_EMPTY = 262, - STRING = 263, - VARIABLE = 264 - }; -#endif -/* Tokens. */ -#define EQUAL 258 -#define COMMA 259 -#define OBRACKET 260 -#define CBRACKET 261 -#define EQUAL_EMPTY 262 -#define STRING 263 -#define VARIABLE 264 - - - +#define yyparse template_parse +#define yylex template_lex +#define yyerror template_error +#define yylval template_lval +#define yychar template_char +#define yydebug template_debug +#define yynerrs template_nerrs +#define yylloc template_lloc /* Copy the first part of user declarations. */ -#line 18 "template_syntax.y" + +/* Line 189 of yacc.c */ +#line 17 "template_syntax.y" #include #include @@ -128,6 +108,9 @@ int template_parse(Template * tmpl, char ** errmsg); static string& unescape (string &str); +/* Line 189 of yacc.c */ +#line 113 "template_syntax.cc" + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -146,19 +129,43 @@ static string& unescape (string &str); # define YYTOKEN_TABLE 0 #endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + EQUAL = 258, + COMMA = 259, + OBRACKET = 260, + CBRACKET = 261, + EQUAL_EMPTY = 262, + STRING = 263, + VARIABLE = 264 + }; +#endif + + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 52 "template_syntax.y" { + +/* Line 214 of yacc.c */ +#line 51 "template_syntax.y" + char * val_str; void * val_attr; -} -/* Line 187 of yacc.c. */ -#line 158 "template_syntax.cc" - YYSTYPE; + + + +/* Line 214 of yacc.c */ +#line 165 "template_syntax.cc" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED @@ -178,8 +185,8 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 183 "template_syntax.cc" +/* Line 264 of yacc.c */ +#line 190 "template_syntax.cc" #ifdef short # undef short @@ -254,14 +261,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -343,9 +350,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - YYLTYPE yyls; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ @@ -380,12 +387,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -466,7 +473,7 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 72, 72, 73, 76, 89, 103, 117, 133 + 0, 71, 71, 72, 75, 88, 102, 116, 132 }; #endif @@ -750,17 +757,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, tmpl, error_msg) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -797,11 +807,11 @@ yy_reduce_print (yyvsp, yylsp, yyrule, tmpl, error_msg) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) , &(yylsp[(yyi + 1) - (yynrhs)]) , tmpl, error_msg); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -1087,10 +1097,8 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, tmpl, error_msg) break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1109,10 +1117,9 @@ int yyparse (); - -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1137,24 +1144,59 @@ yyparse (tmpl, error_msg) #endif #endif { - /* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; -/* Location data for the look-ahead symbol. */ +/* Location data for the lookahead symbol. */ YYLTYPE yylloc; - int yystate; + /* Number of syntax errors so far. */ + int yynerrs; + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2]; + + YYSIZE_T yystacksize; + int yyn; int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + YYLTYPE yyloc; + #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; @@ -1162,63 +1204,37 @@ YYLTYPE yylloc; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; - - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2]; - #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) - YYSIZE_T yystacksize = YYINITDEPTH; - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - YYLTYPE yyloc; - /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yyls = yylsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; yylsp = yyls; + #if YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; - yylloc.first_column = yylloc.last_column = 0; + yylloc.first_column = yylloc.last_column = 1; #endif goto yysetstate; @@ -1257,6 +1273,7 @@ YYLTYPE yylloc; &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); + yyls = yyls1; yyss = yyss1; yyvs = yyvs1; @@ -1278,9 +1295,9 @@ YYLTYPE yylloc; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - YYSTACK_RELOCATE (yyls); + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1301,6 +1318,9 @@ YYLTYPE yylloc; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -1309,16 +1329,16 @@ YYLTYPE yylloc; yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1350,20 +1370,16 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -1404,7 +1420,9 @@ yyreduce: switch (yyn) { case 4: -#line 77 "template_syntax.y" + +/* Line 1455 of yacc.c */ +#line 76 "template_syntax.y" { Attribute * pattr; string name((yyvsp[(1) - (3)].val_str)); @@ -1420,7 +1438,9 @@ yyreduce: break; case 5: -#line 90 "template_syntax.y" + +/* Line 1455 of yacc.c */ +#line 89 "template_syntax.y" { Attribute * pattr; string name((yyvsp[(1) - (5)].val_str)); @@ -1437,7 +1457,9 @@ yyreduce: break; case 6: -#line 104 "template_syntax.y" + +/* Line 1455 of yacc.c */ +#line 103 "template_syntax.y" { Attribute * pattr; string name((yyvsp[(1) - (2)].val_str)); @@ -1452,7 +1474,9 @@ yyreduce: break; case 7: -#line 118 "template_syntax.y" + +/* Line 1455 of yacc.c */ +#line 117 "template_syntax.y" { map* vattr; string name((yyvsp[(1) - (3)].val_str)); @@ -1471,7 +1495,9 @@ yyreduce: break; case 8: -#line 134 "template_syntax.y" + +/* Line 1455 of yacc.c */ +#line 133 "template_syntax.y" { string name((yyvsp[(3) - (5)].val_str)); string value((yyvsp[(5) - (5)].val_str)); @@ -1490,8 +1516,9 @@ yyreduce: break; -/* Line 1267 of yacc.c. */ -#line 1495 "template_syntax.cc" + +/* Line 1455 of yacc.c */ +#line 1522 "template_syntax.cc" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1567,7 +1594,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -1584,7 +1611,7 @@ yyerrlab: } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -1642,14 +1669,11 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; yyerror_range[1] = yylloc; /* Using YYLLOC is tempting, but would change the location of - the look-ahead. YYLOC is available though. */ + the lookahead. YYLOC is available though. */ YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); *++yylsp = yyloc; @@ -1674,7 +1698,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -1685,7 +1709,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc, tmpl, error_msg); /* Do not reclaim the symbols of the rule which action triggered @@ -1711,7 +1735,9 @@ yyreturn: } -#line 150 "template_syntax.y" + +/* Line 1675 of yacc.c */ +#line 149 "template_syntax.y" string& unescape (string &str) diff --git a/src/template/template_syntax.h b/src/template/template_syntax.h index a2aeba6e7d..584fb9da38 100644 --- a/src/template/template_syntax.h +++ b/src/template/template_syntax.h @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ + +/* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,10 +28,11 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -48,31 +48,27 @@ VARIABLE = 264 }; #endif -/* Tokens. */ -#define EQUAL 258 -#define COMMA 259 -#define OBRACKET 260 -#define CBRACKET 261 -#define EQUAL_EMPTY 262 -#define STRING 263 -#define VARIABLE 264 - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 52 "template_syntax.y" { + +/* Line 1676 of yacc.c */ +#line 51 "template_syntax.y" + char * val_str; void * val_attr; -} -/* Line 1489 of yacc.c. */ -#line 72 "template_syntax.hh" - YYSTYPE; + + + +/* Line 1676 of yacc.c */ +#line 68 "template_syntax.hh" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif @@ -91,3 +87,4 @@ typedef struct YYLTYPE #endif + diff --git a/src/vm/vm_var_parser.c b/src/vm/vm_var_parser.c index 450f703c8f..6083651844 100644 --- a/src/vm/vm_var_parser.c +++ b/src/vm/vm_var_parser.c @@ -28,7 +28,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 34 +#define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -211,13 +211,6 @@ extern FILE *vm_var_in, *vm_var_out; #define unput(c) yyunput( c, (yytext_ptr) ) -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - * Given that the standard has decreed that size_t exists since 1989, - * I guess we can afford to depend on it. Manoj. - */ - #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; @@ -525,7 +518,7 @@ char *vm_var_text; /* See the License for the specific language governing permissions and */ /* limitations under the License. */ /* -------------------------------------------------------------------------- */ -#line 19 "vm_var_parser.l" +#line 18 "vm_var_parser.l" #include #include #include @@ -539,7 +532,7 @@ char *vm_var_text; llocp->first_column = llocp->last_column; \ llocp->last_column += vm_var_leng; -#line 544 "vm_var_parser.c" +#line 536 "vm_var_parser.c" #define INITIAL 0 #define VAR 1 @@ -558,6 +551,35 @@ char *vm_var_text; static int yy_init_globals (void ); +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int vm_var_lex_destroy (void ); + +int vm_var_get_debug (void ); + +void vm_var_set_debug (int debug_flag ); + +YY_EXTRA_TYPE vm_var_get_extra (void ); + +void vm_var_set_extra (YY_EXTRA_TYPE user_defined ); + +FILE *vm_var_get_in (void ); + +void vm_var_set_in (FILE * in_str ); + +FILE *vm_var_get_out (void ); + +void vm_var_set_out (FILE * out_str ); + +int vm_var_get_leng (void ); + +char *vm_var_get_text (void ); + +int vm_var_get_lineno (void ); + +void vm_var_set_lineno (int line_number ); + /* Macros after this point can all be overridden by user definitions in * section 1. */ @@ -691,7 +713,7 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 39 "vm_var_parser.l" +#line 38 "vm_var_parser.l" /* ------------------------------------------------------------------------- */ @@ -702,7 +724,7 @@ YY_DECL /* $NUM.CONTEXT_VARIABLE */ /* ------------------------------------------------------------------------- */ -#line 707 "vm_var_parser.c" +#line 728 "vm_var_parser.c" if ( !(yy_init) ) { @@ -797,65 +819,65 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 49 "vm_var_parser.l" +#line 48 "vm_var_parser.l" { BEGIN VAR;} YY_BREAK case 2: YY_RULE_SETUP -#line 51 "vm_var_parser.l" +#line 50 "vm_var_parser.l" { return EQUAL;} YY_BREAK case 3: YY_RULE_SETUP -#line 52 "vm_var_parser.l" +#line 51 "vm_var_parser.l" { return COMMA;} YY_BREAK case 4: YY_RULE_SETUP -#line 53 "vm_var_parser.l" +#line 52 "vm_var_parser.l" { return OBRACKET;} YY_BREAK case 5: YY_RULE_SETUP -#line 54 "vm_var_parser.l" +#line 53 "vm_var_parser.l" { return CBRACKET;} YY_BREAK case 6: YY_RULE_SETUP -#line 56 "vm_var_parser.l" +#line 55 "vm_var_parser.l" { vm_var_text[vm_var_leng-1] = '\0'; lvalp->val_int = atoi(vm_var_text); return INTEGER;} YY_BREAK case 7: YY_RULE_SETUP -#line 59 "vm_var_parser.l" +#line 58 "vm_var_parser.l" { lvalp->val_str = strdup(vm_var_text); return VARIABLE;} YY_BREAK case 8: /* rule 8 can match eol */ YY_RULE_SETUP -#line 61 "vm_var_parser.l" +#line 60 "vm_var_parser.l" { lvalp->val_str = strdup(vm_var_text+1); lvalp->val_str[vm_var_leng-2] = '\0'; return STRING;} YY_BREAK case 9: YY_RULE_SETUP -#line 65 "vm_var_parser.l" +#line 64 "vm_var_parser.l" { lvalp->val_char = '\0'; return EOA;} YY_BREAK case 10: YY_RULE_SETUP -#line 67 "vm_var_parser.l" +#line 66 "vm_var_parser.l" { lvalp->val_char = *vm_var_text; BEGIN(INITIAL); return EOA;} YY_BREAK case YY_STATE_EOF(VAR): -#line 70 "vm_var_parser.l" +#line 69 "vm_var_parser.l" { lvalp->val_char = '\0'; BEGIN(INITIAL); return EOA;} @@ -866,15 +888,15 @@ case YY_STATE_EOF(VAR): case 11: /* rule 11 can match eol */ YY_RULE_SETUP -#line 78 "vm_var_parser.l" +#line 77 "vm_var_parser.l" { lvalp->val_str = strdup(vm_var_text); return RSTRING;} YY_BREAK case 12: YY_RULE_SETUP -#line 80 "vm_var_parser.l" +#line 79 "vm_var_parser.l" ECHO; YY_BREAK -#line 879 "vm_var_parser.c" +#line 900 "vm_var_parser.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1843,7 +1865,7 @@ void vm_var_free (void * ptr ) #define YYTABLES_NAME "yytables" -#line 80 "vm_var_parser.l" +#line 79 "vm_var_parser.l" diff --git a/src/vm/vm_var_syntax.cc b/src/vm/vm_var_syntax.cc index 05608c0f45..268b04d309 100644 --- a/src/vm/vm_var_syntax.cc +++ b/src/vm/vm_var_syntax.cc @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ + +/* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +28,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -47,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,52 +54,29 @@ /* Pure parsers. */ #define YYPURE 1 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Using locations. */ #define YYLSP_NEEDED 1 /* Substitute the variable and function names. */ -#define yyparse vm_var_parse -#define yylex vm_var_lex -#define yyerror vm_var_error -#define yylval vm_var_lval -#define yychar vm_var_char -#define yydebug vm_var_debug -#define yynerrs vm_var_nerrs -#define yylloc vm_var_lloc - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - EQUAL = 258, - COMMA = 259, - OBRACKET = 260, - CBRACKET = 261, - EOA = 262, - STRING = 263, - VARIABLE = 264, - RSTRING = 265, - INTEGER = 266 - }; -#endif -/* Tokens. */ -#define EQUAL 258 -#define COMMA 259 -#define OBRACKET 260 -#define CBRACKET 261 -#define EOA 262 -#define STRING 263 -#define VARIABLE 264 -#define RSTRING 265 -#define INTEGER 266 - - - +#define yyparse vm_var_parse +#define yylex vm_var_lex +#define yyerror vm_var_error +#define yylval vm_var_lval +#define yychar vm_var_char +#define yydebug vm_var_debug +#define yynerrs vm_var_nerrs +#define yylloc vm_var_lloc /* Copy the first part of user declarations. */ -#line 18 "vm_var_syntax.y" + +/* Line 189 of yacc.c */ +#line 17 "vm_var_syntax.y" #include #include @@ -245,6 +221,9 @@ error_name: +/* Line 189 of yacc.c */ +#line 226 "vm_var_syntax.cc" + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -263,20 +242,46 @@ error_name: # define YYTOKEN_TABLE 0 #endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + EQUAL = 258, + COMMA = 259, + OBRACKET = 260, + CBRACKET = 261, + EOA = 262, + STRING = 263, + VARIABLE = 264, + RSTRING = 265, + INTEGER = 266 + }; +#endif + + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 167 "vm_var_syntax.y" { + +/* Line 214 of yacc.c */ +#line 166 "vm_var_syntax.y" + char * val_str; int val_int; char val_char; -} -/* Line 187 of yacc.c. */ -#line 276 "vm_var_syntax.cc" - YYSTYPE; + + + +/* Line 214 of yacc.c */ +#line 281 "vm_var_syntax.cc" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED @@ -296,8 +301,8 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 301 "vm_var_syntax.cc" +/* Line 264 of yacc.c */ +#line 306 "vm_var_syntax.cc" #ifdef short # undef short @@ -372,14 +377,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -461,9 +466,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - YYLTYPE yyls; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ @@ -498,12 +503,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -582,9 +587,9 @@ static const yytype_int8 yyrhs[] = }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = +static const yytype_uint8 yyrline[] = { - 0, 191, 191, 192, 195, 200, 215, 233, 256 + 0, 190, 190, 191, 194, 199, 214, 232, 255 }; #endif @@ -880,17 +885,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, vm, vm_id, parsed, err #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -929,11 +937,11 @@ yy_reduce_print (yyvsp, yylsp, yyrule, vm, vm_id, parsed, errmsg) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) , &(yylsp[(yyi + 1) - (yynrhs)]) , vm, vm_id, parsed, errmsg); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -1223,10 +1231,8 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, vm, vm_id, parsed, errmsg) break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1245,10 +1251,9 @@ int yyparse (); - -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1275,24 +1280,59 @@ yyparse (vm, vm_id, parsed, errmsg) #endif #endif { - /* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; -/* Location data for the look-ahead symbol. */ +/* Location data for the lookahead symbol. */ YYLTYPE yylloc; - int yystate; + /* Number of syntax errors so far. */ + int yynerrs; + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2]; + + YYSIZE_T yystacksize; + int yyn; int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + YYLTYPE yyloc; + #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; @@ -1300,63 +1340,37 @@ YYLTYPE yylloc; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; - - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2]; - #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) - YYSIZE_T yystacksize = YYINITDEPTH; - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - YYLTYPE yyloc; - /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yyls = yylsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; yylsp = yyls; + #if YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; - yylloc.first_column = yylloc.last_column = 0; + yylloc.first_column = yylloc.last_column = 1; #endif goto yysetstate; @@ -1395,6 +1409,7 @@ YYLTYPE yylloc; &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); + yyls = yyls1; yyss = yyss1; yyvs = yyvs1; @@ -1416,9 +1431,9 @@ YYLTYPE yylloc; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - YYSTACK_RELOCATE (yyls); + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1439,6 +1454,9 @@ YYLTYPE yylloc; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -1447,16 +1465,16 @@ YYLTYPE yylloc; yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1488,20 +1506,16 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -1542,7 +1556,9 @@ yyreduce: switch (yyn) { case 4: -#line 196 "vm_var_syntax.y" + +/* Line 1455 of yacc.c */ +#line 195 "vm_var_syntax.y" { (*parsed) << (yyvsp[(1) - (1)].val_str); free((yyvsp[(1) - (1)].val_str)); @@ -1550,7 +1566,9 @@ yyreduce: break; case 5: -#line 201 "vm_var_syntax.y" + +/* Line 1455 of yacc.c */ +#line 200 "vm_var_syntax.y" { string name((yyvsp[(1) - (2)].val_str)); @@ -1568,7 +1586,9 @@ yyreduce: break; case 6: -#line 216 "vm_var_syntax.y" + +/* Line 1455 of yacc.c */ +#line 215 "vm_var_syntax.y" { string name((yyvsp[(1) - (5)].val_str)); string vname((yyvsp[(3) - (5)].val_str)); @@ -1589,7 +1609,9 @@ yyreduce: break; case 7: -#line 234 "vm_var_syntax.y" + +/* Line 1455 of yacc.c */ +#line 233 "vm_var_syntax.y" { string name((yyvsp[(1) - (9)].val_str)); string vname((yyvsp[(3) - (9)].val_str)); @@ -1615,7 +1637,9 @@ yyreduce: break; case 8: -#line 257 "vm_var_syntax.y" + +/* Line 1455 of yacc.c */ +#line 256 "vm_var_syntax.y" { string name("CONTEXT"); string vname((yyvsp[(2) - (3)].val_str)); @@ -1634,8 +1658,9 @@ yyreduce: break; -/* Line 1267 of yacc.c. */ -#line 1639 "vm_var_syntax.cc" + +/* Line 1455 of yacc.c */ +#line 1664 "vm_var_syntax.cc" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1711,7 +1736,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -1728,7 +1753,7 @@ yyerrlab: } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -1786,14 +1811,11 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; yyerror_range[1] = yylloc; /* Using YYLLOC is tempting, but would change the location of - the look-ahead. YYLOC is available though. */ + the lookahead. YYLOC is available though. */ YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); *++yylsp = yyloc; @@ -1818,7 +1840,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -1829,7 +1851,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc, vm, vm_id, parsed, errmsg); /* Do not reclaim the symbols of the rule which action triggered @@ -1855,7 +1877,9 @@ yyreturn: } -#line 273 "vm_var_syntax.y" + +/* Line 1675 of yacc.c */ +#line 272 "vm_var_syntax.y" extern "C" void vm_var_error( diff --git a/src/vm/vm_var_syntax.h b/src/vm/vm_var_syntax.h index d33fb79e0d..5ef69dd31a 100644 --- a/src/vm/vm_var_syntax.h +++ b/src/vm/vm_var_syntax.h @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ + +/* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,10 +28,11 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -50,34 +50,28 @@ INTEGER = 266 }; #endif -/* Tokens. */ -#define EQUAL 258 -#define COMMA 259 -#define OBRACKET 260 -#define CBRACKET 261 -#define EOA 262 -#define STRING 263 -#define VARIABLE 264 -#define RSTRING 265 -#define INTEGER 266 - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 167 "vm_var_syntax.y" { + +/* Line 1676 of yacc.c */ +#line 166 "vm_var_syntax.y" + char * val_str; int val_int; char val_char; -} -/* Line 1489 of yacc.c. */ -#line 77 "vm_var_syntax.hh" - YYSTYPE; + + + +/* Line 1676 of yacc.c */ +#line 71 "vm_var_syntax.hh" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif @@ -96,3 +90,4 @@ typedef struct YYLTYPE #endif +