mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-10 01:17:40 +03:00
feature #189: Moved attribute parsing to VirtualMachine class (get rid of cross references). Added Requirements parsing and initial vnc_port generation
This commit is contained in:
parent
88e97aca68
commit
28e9d41ab1
@ -619,23 +619,6 @@ public:
|
||||
*/
|
||||
int parse_template_attribute(const string& attribute,
|
||||
string& parsed);
|
||||
|
||||
/**
|
||||
* Parse a string and substitute variables (e.g. $NAME) using the VM
|
||||
* template values (blocking-free version for cross references):
|
||||
* @param vm_id ID of the VM used to substitute the variables
|
||||
* @param attribute, the string to be parsed
|
||||
* @param parsed, the resulting parsed string
|
||||
* @param error_msg, string describing the syntax error
|
||||
* @return 0 on success.
|
||||
*/
|
||||
static int parse_template_attribute(int vm_id,
|
||||
const string& attribute,
|
||||
string& parsed,
|
||||
char ** error_msg)
|
||||
{
|
||||
return parse_attribute(0,vm_id,attribute,parsed,error_msg);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// States
|
||||
@ -982,23 +965,25 @@ private:
|
||||
static pthread_mutex_t lex_mutex;
|
||||
|
||||
/**
|
||||
* Parse a string and substitute variables (e.g. $NAME) using template
|
||||
* values:
|
||||
* @param vm pointer to VirtualMachine if not 0 the template of that VM
|
||||
* will be used.
|
||||
* @param vm_id ID of the VM used to substitute the variables, used if vm
|
||||
* is 0
|
||||
* @param attribute, the string to be parsed
|
||||
* @param parsed, the resulting parsed string
|
||||
* @param error_msg, string describing the syntax error
|
||||
* @return 0 on success.
|
||||
*/
|
||||
static int parse_attribute(VirtualMachine * vm,
|
||||
int vm_id,
|
||||
const string& attribute,
|
||||
string& parsed,
|
||||
char ** error_msg);
|
||||
|
||||
* Parse the "CONTEXT" attribute of the template by substituting
|
||||
* $VARIABLE, $VARIABLE[ATTR] and $VARIABLE[ATTR, ATTR = VALUE]
|
||||
* @return 0 on success
|
||||
*/
|
||||
int parse_context();
|
||||
|
||||
/**
|
||||
* Parse the "REQUIREMENTS" attribute of the template by substituting
|
||||
* $VARIABLE, $VARIABLE[ATTR] and $VARIABLE[ATTR, ATTR = VALUE]
|
||||
* @return 0 on success
|
||||
*/
|
||||
int parse_requirements();
|
||||
|
||||
/**
|
||||
* Parse the "GRAPHICS" attribute and generates a default PORT if not
|
||||
* defined
|
||||
*/
|
||||
void parse_graphics();
|
||||
|
||||
protected:
|
||||
|
||||
//**************************************************************************
|
||||
|
@ -155,20 +155,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
* Generate context file to be sourced upon VM booting
|
||||
* @param vm_id, ID of the VM to generate context for
|
||||
* @param attr, the template CONTEXT attribute (the first one)
|
||||
*/
|
||||
void generate_context(int vm_id, Attribute * attr);
|
||||
|
||||
/**
|
||||
* Generate a parsed requirements string
|
||||
* @param vm_id, ID of the VM to generate context for
|
||||
* @param attr, the template REQUIREMENTS attribute (the first one)
|
||||
*/
|
||||
void generate_requirements(int vm_id, Attribute * attr);
|
||||
|
||||
/**
|
||||
* Factory method to produce VM objects
|
||||
* @return a pointer to the new VM
|
||||
|
@ -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;
|
||||
@ -531,7 +524,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 528 "host_parser.c"
|
||||
|
||||
#define INITIAL 0
|
||||
|
||||
@ -549,6 +542,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.
|
||||
*/
|
||||
@ -686,7 +708,7 @@ YY_DECL
|
||||
|
||||
/* --- Tokens --- */
|
||||
|
||||
#line 690 "host_parser.c"
|
||||
#line 712 "host_parser.c"
|
||||
|
||||
if ( !(yy_init) )
|
||||
{
|
||||
@ -829,7 +851,7 @@ YY_RULE_SETUP
|
||||
#line 66 "host_parser.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 833 "host_parser.c"
|
||||
#line 855 "host_parser.c"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
yyterminate();
|
||||
|
||||
|
@ -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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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,39 +54,28 @@
|
||||
/* 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 189 of yacc.c */
|
||||
#line 18 "host_rank.y"
|
||||
|
||||
#include <iostream>
|
||||
@ -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 55 "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); \
|
||||
} \
|
||||
@ -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,16 +1432,22 @@ yyreduce:
|
||||
switch (yyn)
|
||||
{
|
||||
case 2:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 77 "host_rank.y"
|
||||
{ result = static_cast<int>((yyvsp[(1) - (1)].val_float));;}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 78 "host_rank.y"
|
||||
{ result = 0; ;}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 81 "host_rank.y"
|
||||
{ string val;
|
||||
host->get_template_attribute((yyvsp[(1) - (1)].val_str),val);
|
||||
@ -1430,48 +1456,65 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 5:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 85 "host_rank.y"
|
||||
{ (yyval.val_float) = (yyvsp[(1) - (1)].val_float); ;}
|
||||
break;
|
||||
|
||||
case 6:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 86 "host_rank.y"
|
||||
{ (yyval.val_float) = static_cast<float>((yyvsp[(1) - (1)].val_int)); ;}
|
||||
break;
|
||||
|
||||
case 7:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 87 "host_rank.y"
|
||||
{ (yyval.val_float) = (yyvsp[(1) - (3)].val_float) + (yyvsp[(3) - (3)].val_float);;}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 88 "host_rank.y"
|
||||
{ (yyval.val_float) = (yyvsp[(1) - (3)].val_float) - (yyvsp[(3) - (3)].val_float);;}
|
||||
break;
|
||||
|
||||
case 9:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 89 "host_rank.y"
|
||||
{ (yyval.val_float) = (yyvsp[(1) - (3)].val_float) * (yyvsp[(3) - (3)].val_float);;}
|
||||
break;
|
||||
|
||||
case 10:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 90 "host_rank.y"
|
||||
{ (yyval.val_float) = (yyvsp[(1) - (3)].val_float) / (yyvsp[(3) - (3)].val_float);;}
|
||||
break;
|
||||
|
||||
case 11:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 91 "host_rank.y"
|
||||
{ (yyval.val_float) = - (yyvsp[(2) - (2)].val_float);;}
|
||||
break;
|
||||
|
||||
case 12:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 92 "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 1518 "host_rank.cc"
|
||||
default: break;
|
||||
}
|
||||
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
|
||||
@ -1547,7 +1590,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 +1607,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 +1665,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 +1694,7 @@ yyabortlab:
|
||||
yyresult = 1;
|
||||
goto yyreturn;
|
||||
|
||||
#ifndef yyoverflow
|
||||
#if !defined(yyoverflow) || YYERROR_VERBOSE
|
||||
/*-------------------------------------------------.
|
||||
| yyexhaustedlab -- memory exhaustion comes here. |
|
||||
`-------------------------------------------------*/
|
||||
@ -1665,7 +1705,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,6 +1731,8 @@ yyreturn:
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Line 1675 of yacc.c */
|
||||
#line 95 "host_rank.y"
|
||||
|
||||
|
||||
|
@ -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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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 55 "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
|
||||
|
||||
|
||||
|
||||
|
@ -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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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,39 +54,28 @@
|
||||
/* 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 189 of yacc.c */
|
||||
#line 18 "host_requirements.y"
|
||||
|
||||
#include <iostream>
|
||||
@ -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 55 "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); \
|
||||
} \
|
||||
@ -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,16 +1438,22 @@ yyreduce:
|
||||
switch (yyn)
|
||||
{
|
||||
case 2:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 75 "host_requirements.y"
|
||||
{ result=(yyvsp[(1) - (1)].val_int); ;}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 76 "host_requirements.y"
|
||||
{ result=true; ;}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 79 "host_requirements.y"
|
||||
{ int val;
|
||||
|
||||
@ -1438,6 +1464,8 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 5:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 86 "host_requirements.y"
|
||||
{ int val;
|
||||
|
||||
@ -1448,6 +1476,8 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 6:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 93 "host_requirements.y"
|
||||
{ int val;
|
||||
|
||||
@ -1458,6 +1488,8 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 7:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 100 "host_requirements.y"
|
||||
{ int val;
|
||||
|
||||
@ -1468,6 +1500,8 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 8:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 107 "host_requirements.y"
|
||||
{ string val;
|
||||
|
||||
@ -1478,6 +1512,8 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 9:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 114 "host_requirements.y"
|
||||
{ string val;
|
||||
|
||||
@ -1488,6 +1524,8 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 10:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 121 "host_requirements.y"
|
||||
{ string val;
|
||||
|
||||
@ -1498,6 +1536,8 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 11:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 128 "host_requirements.y"
|
||||
{ string val;
|
||||
|
||||
@ -1508,6 +1548,8 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 12:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 135 "host_requirements.y"
|
||||
{ string val;
|
||||
|
||||
@ -1519,6 +1561,8 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 13:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 143 "host_requirements.y"
|
||||
{ string val;
|
||||
|
||||
@ -1530,28 +1574,37 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 14:
|
||||
|
||||
/* 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 15:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 152 "host_requirements.y"
|
||||
{ (yyval.val_int) = (yyvsp[(1) - (3)].val_int) || (yyvsp[(3) - (3)].val_int); ;}
|
||||
break;
|
||||
|
||||
case 16:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 153 "host_requirements.y"
|
||||
{ (yyval.val_int) = ! (yyvsp[(2) - (2)].val_int); ;}
|
||||
break;
|
||||
|
||||
case 17:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 154 "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,6 +1821,8 @@ yyreturn:
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Line 1675 of yacc.c */
|
||||
#line 157 "host_requirements.y"
|
||||
|
||||
|
||||
|
@ -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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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 55 "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
|
||||
|
||||
|
||||
|
||||
|
@ -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;
|
||||
@ -557,7 +550,7 @@ char *template_text;
|
||||
llocp->first_column = llocp->last_column; \
|
||||
llocp->last_column += template_leng;
|
||||
|
||||
#line 561 "template_parser.c"
|
||||
#line 554 "template_parser.c"
|
||||
|
||||
#define INITIAL 0
|
||||
#define VALUE 1
|
||||
@ -576,6 +569,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.
|
||||
*/
|
||||
@ -715,7 +737,7 @@ YY_DECL
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Comments (lines with an starting #), and empty lines */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#line 719 "template_parser.c"
|
||||
#line 741 "template_parser.c"
|
||||
|
||||
if ( !(yy_init) )
|
||||
{
|
||||
@ -891,7 +913,7 @@ YY_RULE_SETUP
|
||||
#line 85 "template_parser.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 895 "template_parser.c"
|
||||
#line 917 "template_parser.c"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
case YY_STATE_EOF(VALUE):
|
||||
yyterminate();
|
||||
|
@ -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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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,47 +54,28 @@
|
||||
/* 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 189 of yacc.c */
|
||||
#line 18 "template_syntax.y"
|
||||
|
||||
#include <iostream>
|
||||
@ -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 52 "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); \
|
||||
} \
|
||||
@ -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,6 +1420,8 @@ yyreduce:
|
||||
switch (yyn)
|
||||
{
|
||||
case 4:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 77 "template_syntax.y"
|
||||
{
|
||||
Attribute * pattr;
|
||||
@ -1420,6 +1438,8 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 5:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 90 "template_syntax.y"
|
||||
{
|
||||
Attribute * pattr;
|
||||
@ -1437,6 +1457,8 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 6:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 104 "template_syntax.y"
|
||||
{
|
||||
Attribute * pattr;
|
||||
@ -1452,6 +1474,8 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 7:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 118 "template_syntax.y"
|
||||
{
|
||||
map<string,string>* vattr;
|
||||
@ -1471,6 +1495,8 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 8:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 134 "template_syntax.y"
|
||||
{
|
||||
string name((yyvsp[(3) - (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,6 +1735,8 @@ yyreturn:
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Line 1675 of yacc.c */
|
||||
#line 150 "template_syntax.y"
|
||||
|
||||
|
||||
|
@ -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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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 52 "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
|
||||
|
||||
|
||||
|
||||
|
@ -313,6 +313,26 @@ int VirtualMachine::insert(SqliteDB * db)
|
||||
goto error_leases;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Parse the context & requirements
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
rc = parse_context();
|
||||
|
||||
if ( rc != 0 )
|
||||
{
|
||||
goto error_context;
|
||||
}
|
||||
|
||||
rc = parse_requirements();
|
||||
|
||||
if ( rc != 0 )
|
||||
{
|
||||
goto error_requirements;
|
||||
}
|
||||
|
||||
parse_graphics();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Insert the template first, so we get a valid template ID. Then the VM
|
||||
// ------------------------------------------------------------------------
|
||||
@ -347,6 +367,162 @@ error_leases:
|
||||
Nebula::log("ONE",Log::ERROR, "Could not get network lease for VM");
|
||||
release_network_leases();
|
||||
return -1;
|
||||
|
||||
error_context:
|
||||
Nebula::log("ONE",Log::ERROR, "Could not parse CONTEXT for VM");
|
||||
release_network_leases();
|
||||
return -1;
|
||||
|
||||
error_requirements:
|
||||
Nebula::log("ONE",Log::ERROR, "Could not parse REQUIREMENTS for VM");
|
||||
release_network_leases();
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int VirtualMachine::parse_context()
|
||||
{
|
||||
int rc, num;
|
||||
|
||||
vector<Attribute *> array_context;
|
||||
VectorAttribute * context;
|
||||
|
||||
string * str;
|
||||
string parsed;
|
||||
|
||||
num = vm_template.remove("CONTEXT", array_context);
|
||||
|
||||
if ( num == 0 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
context = dynamic_cast<VectorAttribute *>(array_context[0]);
|
||||
|
||||
if ( context == 0 )
|
||||
{
|
||||
Nebula::log("ONE",Log::ERROR, "Wrong format for CONTEXT attribute");
|
||||
return -1;
|
||||
}
|
||||
|
||||
str = context->marshall(" @^_^@ ");
|
||||
|
||||
if (str == 0)
|
||||
{
|
||||
Nebula::log("ONE",Log::ERROR, "Can not marshall CONTEXT");
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = parse_template_attribute(*str,parsed);
|
||||
|
||||
if ( rc == 0 )
|
||||
{
|
||||
VectorAttribute * context_parsed;
|
||||
|
||||
context_parsed = new VectorAttribute("CONTEXT");
|
||||
context_parsed->unmarshall(parsed," @^_^@ ");
|
||||
|
||||
vm_template.set(context_parsed);
|
||||
}
|
||||
|
||||
/* --- Delete old context attributes --- */
|
||||
|
||||
for (int i = 0; i < num ; i++)
|
||||
{
|
||||
if (array_context[i] != 0)
|
||||
{
|
||||
delete array_context[i];
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void VirtualMachine::parse_graphics()
|
||||
{
|
||||
int num;
|
||||
|
||||
vector<Attribute *> array_graphics;
|
||||
VectorAttribute * graphics;
|
||||
|
||||
num = vm_template.get("GRAPHICS", array_graphics);
|
||||
|
||||
if ( num == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
graphics = dynamic_cast<VectorAttribute * >(array_graphics[0]);
|
||||
|
||||
if ( graphics == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string port = graphics->vector_value("PORT");
|
||||
|
||||
if ( port.empty() )
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
oss << ( 5900 + oid );
|
||||
graphics->replace("PORT", oss.str());
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int VirtualMachine::parse_requirements()
|
||||
{
|
||||
int rc, num;
|
||||
|
||||
vector<Attribute *> array_reqs;
|
||||
SingleAttribute * reqs;
|
||||
|
||||
string parsed;
|
||||
|
||||
num = vm_template.remove("REQUIREMENTS", array_reqs);
|
||||
|
||||
if ( num == 0 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
reqs = dynamic_cast<SingleAttribute *>(array_reqs[0]);
|
||||
|
||||
if ( reqs == 0 )
|
||||
{
|
||||
Nebula::log("ONE",Log::ERROR,"Wrong format for REQUIREMENTS attribute");
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = parse_template_attribute(reqs->value(),parsed);
|
||||
|
||||
if ( rc == 0 )
|
||||
{
|
||||
SingleAttribute * reqs_parsed;
|
||||
|
||||
reqs_parsed = new SingleAttribute("REQUIREMENTS",parsed);
|
||||
vm_template.set(reqs_parsed);
|
||||
}
|
||||
|
||||
/* --- Delete old requirements attributes --- */
|
||||
|
||||
for (int i = 0; i < num ; i++)
|
||||
{
|
||||
if (array_reqs[i] != 0)
|
||||
{
|
||||
delete array_reqs[i];
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@ -565,26 +741,26 @@ void VirtualMachine::cp_history()
|
||||
|
||||
void VirtualMachine::cp_previous_history()
|
||||
{
|
||||
History * htmp;
|
||||
History * htmp;
|
||||
|
||||
if ( previous_history == 0 || history == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( previous_history == 0 || history == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
htmp = new History(oid,
|
||||
history->seq + 1,
|
||||
previous_history->hid,
|
||||
previous_history->hostname,
|
||||
previous_history->vm_dir,
|
||||
previous_history->vmm_mad_name,
|
||||
previous_history->tm_mad_name);
|
||||
htmp = new History(oid,
|
||||
history->seq + 1,
|
||||
previous_history->hid,
|
||||
previous_history->hostname,
|
||||
previous_history->vm_dir,
|
||||
previous_history->vmm_mad_name,
|
||||
previous_history->tm_mad_name);
|
||||
|
||||
delete previous_history;
|
||||
delete previous_history;
|
||||
|
||||
previous_history = history;
|
||||
previous_history = history;
|
||||
|
||||
history = htmp;
|
||||
history = htmp;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@ -834,28 +1010,6 @@ int VirtualMachine::generate_context(string &files)
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int VirtualMachine::parse_template_attribute(const string& attribute,
|
||||
string& parsed)
|
||||
{
|
||||
int rc;
|
||||
char * err = 0;
|
||||
|
||||
rc = parse_attribute(this,-1,attribute,parsed,&err);
|
||||
|
||||
if ( rc != 0 && err != 0 )
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
oss << "Error parsing: " << attribute << ". " << err;
|
||||
log("VM",Log::ERROR,oss);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
pthread_mutex_t VirtualMachine::lex_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
extern "C"
|
||||
@ -863,7 +1017,6 @@ extern "C"
|
||||
typedef struct yy_buffer_state * YY_BUFFER_STATE;
|
||||
|
||||
int vm_var_parse (VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream * parsed,
|
||||
char ** errmsg);
|
||||
|
||||
@ -876,18 +1029,14 @@ extern "C"
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int VirtualMachine::parse_attribute(VirtualMachine * vm,
|
||||
int vm_id,
|
||||
const string& attribute,
|
||||
string& parsed,
|
||||
char ** error_msg)
|
||||
int VirtualMachine::parse_template_attribute(const string& attribute,
|
||||
string& parsed)
|
||||
{
|
||||
YY_BUFFER_STATE str_buffer = 0;
|
||||
const char * str;
|
||||
int rc;
|
||||
ostringstream oss_parsed;
|
||||
|
||||
*error_msg = 0;
|
||||
char * error_msg = 0;
|
||||
|
||||
pthread_mutex_lock(&lex_mutex);
|
||||
|
||||
@ -899,20 +1048,30 @@ int VirtualMachine::parse_attribute(VirtualMachine * vm,
|
||||
goto error_yy;
|
||||
}
|
||||
|
||||
rc = vm_var_parse(vm,vm_id,&oss_parsed,error_msg);
|
||||
rc = vm_var_parse(this,&oss_parsed,&error_msg);
|
||||
|
||||
vm_var__delete_buffer(str_buffer);
|
||||
|
||||
vm_var_lex_destroy();
|
||||
|
||||
pthread_mutex_unlock(&lex_mutex);
|
||||
|
||||
if ( rc != 0 && error_msg != 0 )
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
oss << "Error parsing: " << attribute << ". " << error_msg;
|
||||
log("VM",Log::ERROR,oss);
|
||||
|
||||
free(error_msg);
|
||||
}
|
||||
|
||||
parsed = oss_parsed.str();
|
||||
|
||||
return rc;
|
||||
|
||||
error_yy:
|
||||
*error_msg=strdup("Error setting scan buffer");
|
||||
log("VM",Log::ERROR,"Error setting scan buffer");
|
||||
pthread_mutex_unlock(&lex_mutex);
|
||||
return -1;
|
||||
}
|
||||
@ -922,10 +1081,10 @@ error_yy:
|
||||
|
||||
ostream& operator<<(ostream& os, const VirtualMachine& vm)
|
||||
{
|
||||
string vm_str;
|
||||
|
||||
os << vm.to_xml(vm_str);
|
||||
|
||||
string vm_str;
|
||||
|
||||
os << vm.to_xml(vm_str);
|
||||
|
||||
return os;
|
||||
};
|
||||
|
||||
@ -933,48 +1092,50 @@ ostream& operator<<(ostream& os, const VirtualMachine& vm)
|
||||
|
||||
string& VirtualMachine::to_xml(string& xml) const
|
||||
{
|
||||
string template_xml;
|
||||
|
||||
string template_xml;
|
||||
string history_xml;
|
||||
|
||||
ostringstream oss;
|
||||
|
||||
oss << "<VM>"
|
||||
<< "<ID>" << oid << "</ID>"
|
||||
<< "<UID>" << uid << "</UID>"
|
||||
<< "<NAME>" << name << "</NAME>"
|
||||
<< "<LAST_POLL>" << last_poll << "</LAST_POLL>"
|
||||
<< "<STATE>" << state << "</STATE>"
|
||||
<< "<LCM_STATE>" << lcm_state << "</LCM_STATE>"
|
||||
<< "<STIME>" << stime << "</STIME>"
|
||||
<< "<ETIME>" << etime << "</ETIME>"
|
||||
<< "<DEPLOY_ID>" << deploy_id << "</DEPLOY_ID>"
|
||||
<< "<MEMORY>" << memory << "</MEMORY>"
|
||||
<< "<CPU>" << cpu << "</CPU>"
|
||||
<< "<NET_TX>" << net_tx << "</NET_TX>"
|
||||
<< "<NET_RX>" << net_rx << "</NET_RX>"
|
||||
<< vm_template.to_xml(template_xml);
|
||||
ostringstream oss;
|
||||
|
||||
oss << "<VM>"
|
||||
<< "<ID>" << oid << "</ID>"
|
||||
<< "<UID>" << uid << "</UID>"
|
||||
<< "<NAME>" << name << "</NAME>"
|
||||
<< "<LAST_POLL>" << last_poll << "</LAST_POLL>"
|
||||
<< "<STATE>" << state << "</STATE>"
|
||||
<< "<LCM_STATE>" << lcm_state << "</LCM_STATE>"
|
||||
<< "<STIME>" << stime << "</STIME>"
|
||||
<< "<ETIME>" << etime << "</ETIME>"
|
||||
<< "<DEPLOY_ID>" << deploy_id << "</DEPLOY_ID>"
|
||||
<< "<MEMORY>" << memory << "</MEMORY>"
|
||||
<< "<CPU>" << cpu << "</CPU>"
|
||||
<< "<NET_TX>" << net_tx << "</NET_TX>"
|
||||
<< "<NET_RX>" << net_rx << "</NET_RX>"
|
||||
<< vm_template.to_xml(template_xml);
|
||||
|
||||
if ( hasHistory() )
|
||||
{
|
||||
oss << history->to_xml(history_xml);
|
||||
}
|
||||
oss << "</VM>";
|
||||
|
||||
xml = oss.str();
|
||||
|
||||
return xml;
|
||||
|
||||
oss << "</VM>";
|
||||
|
||||
xml = oss.str();
|
||||
|
||||
return xml;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
string& VirtualMachine::to_str(string& str) const
|
||||
{
|
||||
string template_str;
|
||||
string template_str;
|
||||
string history_str;
|
||||
|
||||
ostringstream oss;
|
||||
|
||||
oss<< "ID : " << oid << endl
|
||||
ostringstream oss;
|
||||
|
||||
oss<< "ID : " << oid << endl
|
||||
<< "UID : " << uid << endl
|
||||
<< "NAME : " << name << endl
|
||||
<< "STATE : " << state << endl
|
||||
@ -994,9 +1155,9 @@ string& VirtualMachine::to_str(string& str) const
|
||||
oss << "Last History Record" << endl << history->to_str(history_str);
|
||||
}
|
||||
|
||||
str = oss.str();
|
||||
str = oss.str();
|
||||
|
||||
return str;
|
||||
return str;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -158,10 +158,7 @@ int VirtualMachinePool::allocate (
|
||||
string name;
|
||||
|
||||
char * error_msg;
|
||||
int rc, num_context, num_reqs;
|
||||
|
||||
vector<Attribute *> context;
|
||||
vector<Attribute *> reqs;
|
||||
int rc;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Build a new Virtual Machine object
|
||||
@ -180,7 +177,7 @@ int VirtualMachinePool::allocate (
|
||||
vm->uid = uid;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Parse template and keep CONTEXT and REQUIREMENTS apart
|
||||
// Parse template
|
||||
// ------------------------------------------------------------------------
|
||||
rc = vm->vm_template.parse(stemplate,&error_msg);
|
||||
|
||||
@ -195,9 +192,6 @@ int VirtualMachinePool::allocate (
|
||||
return -2;
|
||||
}
|
||||
|
||||
num_context = vm->vm_template.remove("CONTEXT",context);
|
||||
num_reqs = vm->vm_template.remove("REQUIREMENTS",reqs);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Insert the Object in the pool
|
||||
// ------------------------------------------------------------------------
|
||||
@ -209,40 +203,6 @@ int VirtualMachinePool::allocate (
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Insert parsed context in the VM template and clean-up
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( num_context > 0)
|
||||
{
|
||||
generate_context(*oid,context[0]);
|
||||
|
||||
for (int i = 0; i < num_context ; i++)
|
||||
{
|
||||
if (context[i] != 0)
|
||||
{
|
||||
delete context[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Parse the Requirements
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( num_reqs > 0 )
|
||||
{
|
||||
generate_requirements(*oid,reqs[0]);
|
||||
|
||||
for (int i = 0; i < num_reqs ; i++)
|
||||
{
|
||||
if (reqs[i] != 0)
|
||||
{
|
||||
delete reqs[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -282,126 +242,3 @@ int VirtualMachinePool::get_pending(
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void VirtualMachinePool::generate_context(int vm_id, Attribute * attr)
|
||||
{
|
||||
VirtualMachine * vm;
|
||||
VectorAttribute * context_parsed;
|
||||
VectorAttribute * context;
|
||||
|
||||
string * str;
|
||||
string parsed;
|
||||
|
||||
int rc;
|
||||
|
||||
char * error_msg;
|
||||
|
||||
context = dynamic_cast<VectorAttribute *>(attr);
|
||||
|
||||
if (context == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
str = context->marshall(" @^_^@ ");
|
||||
|
||||
if (str == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
rc = VirtualMachine::parse_template_attribute(vm_id,*str,parsed,&error_msg);
|
||||
|
||||
if ( rc != 0 )
|
||||
{
|
||||
if (error_msg != 0)
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
oss << error_msg << ": " << *str;
|
||||
free(error_msg);
|
||||
|
||||
Nebula::log("ONE", Log::ERROR, oss);
|
||||
}
|
||||
|
||||
delete str;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
delete str;
|
||||
|
||||
context_parsed = new VectorAttribute("CONTEXT");
|
||||
context_parsed->unmarshall(parsed," @^_^@ ");
|
||||
|
||||
vm = get(vm_id,true);
|
||||
|
||||
if ( vm == 0 )
|
||||
{
|
||||
delete context_parsed;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( vm->insert_template_attribute(db,context_parsed) != 0 )
|
||||
{
|
||||
delete context_parsed;
|
||||
}
|
||||
|
||||
vm->unlock();
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void VirtualMachinePool::generate_requirements(int vm_id, Attribute * attr)
|
||||
{
|
||||
SingleAttribute * reqs;
|
||||
string parsed;
|
||||
char * error_msg;
|
||||
int rc;
|
||||
|
||||
SingleAttribute * reqs_parsed;
|
||||
VirtualMachine * vm;
|
||||
|
||||
reqs = dynamic_cast<SingleAttribute *>(attr);
|
||||
|
||||
if (reqs == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
rc = VirtualMachine::parse_template_attribute(vm_id,reqs->value(),
|
||||
parsed,&error_msg);
|
||||
|
||||
if ( rc != 0 )
|
||||
{
|
||||
if (error_msg != 0)
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
oss << error_msg << ": " << reqs->value();
|
||||
free(error_msg);
|
||||
|
||||
Nebula::log("ONE", Log::ERROR, oss);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
reqs_parsed = new SingleAttribute("REQUIREMENTS",parsed);
|
||||
|
||||
vm = get(vm_id,true);
|
||||
|
||||
if ( vm == 0 )
|
||||
{
|
||||
delete reqs_parsed;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( vm->insert_template_attribute(db,reqs_parsed) != 0 )
|
||||
{
|
||||
delete reqs_parsed;
|
||||
}
|
||||
|
||||
vm->unlock();
|
||||
}
|
||||
|
@ -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;
|
||||
@ -399,8 +392,8 @@ static void yy_fatal_error (yyconst char msg[] );
|
||||
*yy_cp = '\0'; \
|
||||
(yy_c_buf_p) = yy_cp;
|
||||
|
||||
#define YY_NUM_RULES 12
|
||||
#define YY_END_OF_BUFFER 13
|
||||
#define YY_NUM_RULES 11
|
||||
#define YY_END_OF_BUFFER 12
|
||||
/* This struct is not used in this scanner,
|
||||
but its presence is necessary. */
|
||||
struct yy_trans_info
|
||||
@ -408,12 +401,11 @@ struct yy_trans_info
|
||||
flex_int32_t yy_verify;
|
||||
flex_int32_t yy_nxt;
|
||||
};
|
||||
static yyconst flex_int16_t yy_accept[33] =
|
||||
static yyconst flex_int16_t yy_accept[30] =
|
||||
{ 0,
|
||||
0, 0, 0, 0, 13, 11, 1, 10, 10, 12,
|
||||
10, 9, 3, 7, 2, 7, 4, 5, 11, 0,
|
||||
3, 2, 5, 0, 8, 3, 6, 7, 7, 2,
|
||||
4, 0
|
||||
0, 0, 0, 0, 12, 10, 1, 9, 9, 11,
|
||||
9, 8, 3, 6, 2, 4, 5, 10, 0, 3,
|
||||
2, 5, 0, 7, 3, 6, 2, 4, 0
|
||||
} ;
|
||||
|
||||
static yyconst flex_int32_t yy_ec[256] =
|
||||
@ -422,16 +414,16 @@ static yyconst flex_int32_t yy_ec[256] =
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 2, 1, 4, 1, 5, 1, 1, 1, 1,
|
||||
1, 1, 1, 6, 1, 7, 1, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 1, 1, 1,
|
||||
9, 1, 1, 1, 10, 10, 10, 10, 10, 10,
|
||||
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
|
||||
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
|
||||
11, 1, 12, 1, 10, 1, 10, 10, 10, 10,
|
||||
1, 1, 1, 6, 1, 1, 1, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 1, 1, 1,
|
||||
8, 1, 1, 1, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
9, 1, 10, 1, 7, 1, 7, 7, 7, 7,
|
||||
|
||||
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
|
||||
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
|
||||
10, 10, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
@ -448,52 +440,49 @@ static yyconst flex_int32_t yy_ec[256] =
|
||||
1, 1, 1, 1, 1
|
||||
} ;
|
||||
|
||||
static yyconst flex_int32_t yy_meta[13] =
|
||||
static yyconst flex_int32_t yy_meta[11] =
|
||||
{ 0,
|
||||
1, 1, 1, 1, 2, 1, 1, 3, 1, 3,
|
||||
1, 1
|
||||
1, 1, 1, 1, 2, 1, 1, 1, 1, 1
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_base[37] =
|
||||
static yyconst flex_int16_t yy_base[33] =
|
||||
{ 0,
|
||||
36, 35, 0, 0, 39, 0, 42, 42, 11, 42,
|
||||
34, 42, 35, 17, 30, 0, 24, 42, 0, 0,
|
||||
20, 19, 42, 15, 42, 16, 42, 0, 0, 14,
|
||||
13, 42, 27, 30, 33, 11
|
||||
29, 28, 0, 0, 32, 0, 35, 35, 9, 35,
|
||||
27, 35, 28, 22, 26, 25, 35, 0, 0, 24,
|
||||
23, 35, 20, 35, 16, 9, 12, 11, 35, 19,
|
||||
11, 21
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_def[37] =
|
||||
static yyconst flex_int16_t yy_def[33] =
|
||||
{ 0,
|
||||
33, 33, 32, 3, 32, 34, 32, 32, 32, 32,
|
||||
35, 32, 32, 32, 32, 36, 32, 32, 34, 9,
|
||||
32, 32, 32, 35, 32, 32, 32, 14, 36, 32,
|
||||
32, 0, 32, 32, 32, 32
|
||||
30, 30, 29, 3, 29, 31, 29, 29, 29, 29,
|
||||
32, 29, 29, 29, 29, 29, 29, 31, 9, 29,
|
||||
29, 29, 32, 29, 29, 29, 29, 29, 0, 29,
|
||||
29, 29
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_nxt[55] =
|
||||
static yyconst flex_int16_t yy_nxt[46] =
|
||||
{ 0,
|
||||
8, 9, 10, 11, 12, 13, 8, 14, 15, 16,
|
||||
17, 18, 20, 29, 31, 30, 21, 26, 25, 22,
|
||||
30, 26, 23, 27, 28, 31, 29, 6, 6, 6,
|
||||
19, 30, 19, 24, 24, 24, 26, 25, 32, 7,
|
||||
7, 5, 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
32, 32, 32, 32
|
||||
8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
|
||||
19, 18, 28, 27, 20, 26, 21, 25, 22, 6,
|
||||
6, 23, 23, 24, 27, 25, 28, 27, 26, 25,
|
||||
24, 29, 7, 7, 5, 29, 29, 29, 29, 29,
|
||||
29, 29, 29, 29, 29
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_chk[55] =
|
||||
static yyconst flex_int16_t yy_chk[46] =
|
||||
{ 0,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 9, 36, 31, 30, 9, 26, 24, 9,
|
||||
22, 21, 9, 14, 14, 17, 14, 33, 33, 33,
|
||||
34, 15, 34, 35, 35, 35, 13, 11, 5, 2,
|
||||
1, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
32, 32, 32, 32
|
||||
9, 31, 28, 27, 9, 26, 9, 25, 9, 30,
|
||||
30, 32, 32, 23, 21, 20, 16, 15, 14, 13,
|
||||
11, 5, 2, 1, 29, 29, 29, 29, 29, 29,
|
||||
29, 29, 29, 29, 29
|
||||
} ;
|
||||
|
||||
/* Table of booleans, true if rule could match eol. */
|
||||
static yyconst flex_int32_t yy_rule_can_match_eol[13] =
|
||||
static yyconst flex_int32_t yy_rule_can_match_eol[12] =
|
||||
{ 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, };
|
||||
0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, };
|
||||
|
||||
static yy_state_type yy_last_accepting_state;
|
||||
static char *yy_last_accepting_cpos;
|
||||
@ -540,7 +529,7 @@ char *vm_var_text;
|
||||
llocp->first_column = llocp->last_column; \
|
||||
llocp->last_column += vm_var_leng;
|
||||
|
||||
#line 544 "vm_var_parser.c"
|
||||
#line 533 "vm_var_parser.c"
|
||||
|
||||
#define INITIAL 0
|
||||
#define VAR 1
|
||||
@ -559,6 +548,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.
|
||||
*/
|
||||
@ -703,7 +721,7 @@ YY_DECL
|
||||
/* $NUM.CONTEXT_VARIABLE */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#line 707 "vm_var_parser.c"
|
||||
#line 725 "vm_var_parser.c"
|
||||
|
||||
if ( !(yy_init) )
|
||||
{
|
||||
@ -756,13 +774,13 @@ yy_match:
|
||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 33 )
|
||||
if ( yy_current_state >= 30 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
++yy_cp;
|
||||
}
|
||||
while ( yy_base[yy_current_state] != 42 );
|
||||
while ( yy_base[yy_current_state] != 35 );
|
||||
|
||||
yy_find_action:
|
||||
yy_act = yy_accept[yy_current_state];
|
||||
@ -824,33 +842,26 @@ YY_RULE_SETUP
|
||||
case 6:
|
||||
YY_RULE_SETUP
|
||||
#line 56 "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"
|
||||
{ lvalp->val_str = strdup(vm_var_text);
|
||||
return VARIABLE;}
|
||||
YY_BREAK
|
||||
case 8:
|
||||
/* rule 8 can match eol */
|
||||
case 7:
|
||||
/* rule 7 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 61 "vm_var_parser.l"
|
||||
#line 59 "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:
|
||||
case 8:
|
||||
YY_RULE_SETUP
|
||||
#line 65 "vm_var_parser.l"
|
||||
#line 63 "vm_var_parser.l"
|
||||
{ lvalp->val_char = '\0';
|
||||
return EOA;}
|
||||
YY_BREAK
|
||||
case 10:
|
||||
case 9:
|
||||
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;}
|
||||
@ -864,18 +875,18 @@ case YY_STATE_EOF(VAR):
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Just copy the string verbatim till we find a variable (starts with $) */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
case 11:
|
||||
/* rule 11 can match eol */
|
||||
case 10:
|
||||
/* rule 10 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 78 "vm_var_parser.l"
|
||||
{ lvalp->val_str = strdup(vm_var_text); return RSTRING;}
|
||||
YY_BREAK
|
||||
case 12:
|
||||
case 11:
|
||||
YY_RULE_SETUP
|
||||
#line 80 "vm_var_parser.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 879 "vm_var_parser.c"
|
||||
#line 890 "vm_var_parser.c"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
yyterminate();
|
||||
|
||||
@ -1167,7 +1178,7 @@ static int yy_get_next_buffer (void)
|
||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 33 )
|
||||
if ( yy_current_state >= 30 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
@ -1195,11 +1206,11 @@ static int yy_get_next_buffer (void)
|
||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 33 )
|
||||
if ( yy_current_state >= 30 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
yy_is_jam = (yy_current_state == 32);
|
||||
yy_is_jam = (yy_current_state == 29);
|
||||
|
||||
return yy_is_jam ? 0 : yy_current_state;
|
||||
}
|
||||
|
@ -53,20 +53,20 @@
|
||||
<VAR>\[[[:blank:]]* { return OBRACKET;}
|
||||
<VAR>[[:blank:]]*\] { return CBRACKET;}
|
||||
|
||||
<VAR>[[:digit:]]+\. { yytext[yyleng-1] = '\0';
|
||||
lvalp->val_int = atoi(yytext);
|
||||
return INTEGER;}
|
||||
<VAR>[[:alnum:]_]+ { lvalp->val_str = strdup(yytext);
|
||||
return VARIABLE;}
|
||||
|
||||
<VAR>\"[^\"]*\" { lvalp->val_str = strdup(yytext+1);
|
||||
lvalp->val_str[yyleng-2] = '\0';
|
||||
return STRING;}
|
||||
|
||||
<VAR>\$ { lvalp->val_char = '\0';
|
||||
return EOA;}
|
||||
|
||||
<VAR>. { lvalp->val_char = *yytext;
|
||||
BEGIN(INITIAL);
|
||||
return EOA;}
|
||||
|
||||
<VAR><<EOF>> { lvalp->val_char = '\0';
|
||||
BEGIN(INITIAL);
|
||||
return EOA;}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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 124 "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
|
||||
|
||||
|
||||
|
||||
|
@ -38,8 +38,7 @@ extern "C"
|
||||
{
|
||||
void vm_var_error(
|
||||
YYLTYPE * llocp,
|
||||
VirtualMachine * vm,
|
||||
int vm_id,
|
||||
VirtualMachine * vm,
|
||||
ostringstream * parsed,
|
||||
char ** errmsg,
|
||||
const char * str);
|
||||
@ -47,7 +46,6 @@ void vm_var_error(
|
||||
int vm_var_lex (YYSTYPE *lvalp, YYLTYPE *llocp);
|
||||
|
||||
int vm_var_parse (VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream * parsed,
|
||||
char ** errmsg);
|
||||
}
|
||||
@ -56,71 +54,37 @@ int vm_var_parse (VirtualMachine * vm,
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void insert_single(VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream& parsed,
|
||||
const string& name)
|
||||
{
|
||||
VirtualMachine * tvm = vm;
|
||||
string value = "";
|
||||
|
||||
if ( vm == 0 )
|
||||
{
|
||||
Nebula& nd = Nebula::instance();
|
||||
|
||||
tvm = nd.get_vmpool()->get(vm_id,true);
|
||||
}
|
||||
|
||||
if ( tvm == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
tvm->get_template_attribute(name.c_str(),value);
|
||||
vm->get_template_attribute(name.c_str(),value);
|
||||
|
||||
parsed << value;
|
||||
|
||||
if ( vm == 0 )
|
||||
{
|
||||
tvm->unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void insert_vector(VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream& parsed,
|
||||
const string& name,
|
||||
const string& vname,
|
||||
const string& vvar,
|
||||
const string& vval)
|
||||
|
||||
{
|
||||
VirtualMachine * tvm = vm;
|
||||
|
||||
{
|
||||
vector<const Attribute*> values;
|
||||
const VectorAttribute * vattr = 0;
|
||||
|
||||
int num;
|
||||
string value = "";
|
||||
|
||||
if ( vm == 0 )
|
||||
{
|
||||
Nebula& nd = Nebula::instance();
|
||||
|
||||
tvm = nd.get_vmpool()->get(vm_id,true);
|
||||
}
|
||||
|
||||
if ( tvm == 0 )
|
||||
|
||||
if ( ( num = vm->get_template_attribute(name.c_str(),values) ) <= 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ( num = tvm->get_template_attribute(name.c_str(),values) ) <= 0 )
|
||||
{
|
||||
goto error_name;
|
||||
}
|
||||
|
||||
if ( vvar.empty() )
|
||||
{
|
||||
@ -128,7 +92,7 @@ void insert_vector(VirtualMachine * vm,
|
||||
}
|
||||
else
|
||||
{
|
||||
const VectorAttribute * tmp = 0;
|
||||
const VectorAttribute * tmp = 0;
|
||||
|
||||
for (int i=0 ; i < num ; i++)
|
||||
{
|
||||
@ -146,12 +110,6 @@ void insert_vector(VirtualMachine * vm,
|
||||
{
|
||||
parsed << vattr->vector_value(vname.c_str());
|
||||
}
|
||||
|
||||
error_name:
|
||||
if ( vm == 0 )
|
||||
{
|
||||
tvm->unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@ -160,7 +118,6 @@ error_name:
|
||||
%}
|
||||
|
||||
%parse-param {VirtualMachine * vm}
|
||||
%parse-param {int vm_id}
|
||||
%parse-param {ostringstream * parsed}
|
||||
%parse-param {char ** errmsg}
|
||||
|
||||
@ -203,7 +160,7 @@ vm_variable:RSTRING
|
||||
|
||||
VM_VAR_TO_UPPER(name);
|
||||
|
||||
insert_single(vm,vm_id,*parsed,name);
|
||||
insert_single(vm,*parsed,name);
|
||||
|
||||
if ( $2 != '\0' )
|
||||
{
|
||||
@ -220,7 +177,7 @@ vm_variable:RSTRING
|
||||
VM_VAR_TO_UPPER(name);
|
||||
VM_VAR_TO_UPPER(vname);
|
||||
|
||||
insert_vector(vm,vm_id,*parsed,name,vname,"","");
|
||||
insert_vector(vm,*parsed,name,vname,"","");
|
||||
|
||||
if ( $5 != '\0' )
|
||||
{
|
||||
@ -241,7 +198,7 @@ vm_variable:RSTRING
|
||||
VM_VAR_TO_UPPER(vname);
|
||||
VM_VAR_TO_UPPER(vvar);
|
||||
|
||||
insert_vector(vm,vm_id,*parsed,name,vname,vvar,vval);
|
||||
insert_vector(vm,*parsed,name,vname,vvar,vval);
|
||||
|
||||
if ( $9 != '\0' )
|
||||
{
|
||||
@ -253,29 +210,12 @@ vm_variable:RSTRING
|
||||
free($5);
|
||||
free($7);
|
||||
}
|
||||
| INTEGER VARIABLE EOA
|
||||
{
|
||||
string name("CONTEXT");
|
||||
string vname($2);
|
||||
|
||||
VM_VAR_TO_UPPER(vname);
|
||||
|
||||
insert_vector(0,$1,*parsed,name,vname,"","");
|
||||
|
||||
if ( $3 != '\0' )
|
||||
{
|
||||
(*parsed) << $3;
|
||||
}
|
||||
|
||||
free($2);
|
||||
}
|
||||
;
|
||||
%%
|
||||
|
||||
extern "C" void vm_var_error(
|
||||
YYLTYPE * llocp,
|
||||
VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream * parsed,
|
||||
char ** error_msg,
|
||||
const char * str)
|
||||
|
Loading…
Reference in New Issue
Block a user