1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-04 17:47:00 +03:00

Merge branch 'bug-1738'

This commit is contained in:
Ruben S. Montero 2013-02-01 12:26:47 +01:00
commit aea1961ff8
11 changed files with 470 additions and 444 deletions

View File

@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 2.6.5. */
/* A Bison parser, made by GNU Bison 2.7. */
/* Bison implementation for Yacc-like parsers in C
@ -44,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "2.6.5"
#define YYBISON_VERSION "2.7"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@ -70,7 +70,7 @@
#define yylloc template__lloc
/* Copy the first part of user declarations. */
/* Line 360 of yacc.c */
/* Line 371 of yacc.c */
#line 17 "template_syntax.y"
#include <iostream>
@ -122,7 +122,7 @@ extern "C"
}
/* Line 360 of yacc.c */
/* Line 371 of yacc.c */
#line 127 "template_syntax.cc"
# ifndef YY_NULL
@ -173,14 +173,14 @@ extern int template__debug;
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
/* Line 376 of yacc.c */
/* Line 387 of yacc.c */
#line 74 "template_syntax.y"
char * val_str;
void * val_attr;
/* Line 376 of yacc.c */
/* Line 387 of yacc.c */
#line 185 "template_syntax.cc"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
@ -220,7 +220,7 @@ int template__parse ();
/* Copy the second part of user declarations. */
/* Line 379 of yacc.c */
/* Line 390 of yacc.c */
#line 225 "template_syntax.cc"
#ifdef short
@ -695,14 +695,46 @@ while (YYID (0))
#ifndef YY_LOCATION_PRINT
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
# define YY_LOCATION_PRINT(File, Loc) \
do { \
fprintf (File, "%d.%d", (Loc).first_line, (Loc).first_column); \
if ((Loc).first_line < (Loc).last_line) \
fprintf (File, "-%d.%d", (Loc).last_line, (Loc).last_column - 1); \
else if ((Loc).first_column < (Loc).last_column - 1) \
fprintf (File, "-%d", (Loc).last_column - 1); \
} while (0)
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
__attribute__((__unused__))
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static unsigned
yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
#else
static unsigned
yy_location_print_ (yyo, yylocp)
FILE *yyo;
YYLTYPE const * const yylocp;
#endif
{
unsigned res = 0;
int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
if (0 <= yylocp->first_line)
{
res += fprintf (yyo, "%d", yylocp->first_line);
if (0 <= yylocp->first_column)
res += fprintf (yyo, ".%d", yylocp->first_column);
}
if (0 <= yylocp->last_line)
{
if (yylocp->first_line < yylocp->last_line)
{
res += fprintf (yyo, "-%d", yylocp->last_line);
if (0 <= end_col)
res += fprintf (yyo, ".%d", end_col);
}
else if (0 <= end_col && yylocp->first_column < end_col)
res += fprintf (yyo, "-%d", end_col);
}
return res;
}
# define YY_LOCATION_PRINT(File, Loc) \
yy_location_print_ (File, &(Loc))
# else
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
# endif
@ -780,7 +812,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, mc, tmpl, error_
switch (yytype)
{
default:
break;
break;
}
}
@ -1032,7 +1064,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
{
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
YYSIZE_T yysize1;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULL;
@ -1095,11 +1126,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
break;
}
yyarg[yycount++] = yytname[yyx];
yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
}
}
}
@ -1119,10 +1152,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
# undef YYCASE_
}
yysize1 = yysize + yystrlen (yyformat);
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
if (*yymsg_alloc < yysize)
{
@ -1190,7 +1225,7 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, mc, tmpl, error_msg)
{
default:
break;
break;
}
}
@ -1243,6 +1278,11 @@ int yychar;
static YYSTYPE yyval_default;
# define YY_INITIAL_VALUE(Value) = Value
#endif
static YYLTYPE yyloc_default
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
= { 1, 1, 1, 1 }
# endif
;
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
@ -1255,11 +1295,7 @@ static YYSTYPE yyval_default;
YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
/* Location data for the lookahead symbol. */
YYLTYPE yylloc
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
= { 1, 1, 1, 1 }
# endif
;
YYLTYPE yylloc = yyloc_default;
/* Number of syntax errors so far. */
@ -1516,7 +1552,7 @@ yyreduce:
switch (yyn)
{
case 6:
/* Line 1778 of yacc.c */
/* Line 1792 of yacc.c */
#line 103 "template_syntax.y"
{
Attribute * pattr;
@ -1530,7 +1566,7 @@ yyreduce:
break;
case 7:
/* Line 1778 of yacc.c */
/* Line 1792 of yacc.c */
#line 113 "template_syntax.y"
{
Attribute * pattr;
@ -1547,7 +1583,7 @@ yyreduce:
break;
case 8:
/* Line 1778 of yacc.c */
/* Line 1792 of yacc.c */
#line 126 "template_syntax.y"
{
Attribute * pattr;
@ -1561,7 +1597,7 @@ yyreduce:
break;
case 9:
/* Line 1778 of yacc.c */
/* Line 1792 of yacc.c */
#line 138 "template_syntax.y"
{
map<string,string>* vattr;
@ -1578,7 +1614,7 @@ yyreduce:
break;
case 10:
/* Line 1778 of yacc.c */
/* Line 1792 of yacc.c */
#line 151 "template_syntax.y"
{
string name((yyvsp[(3) - (5)].val_str));
@ -1595,8 +1631,8 @@ yyreduce:
break;
/* Line 1778 of yacc.c */
#line 1600 "template_syntax.cc"
/* Line 1792 of yacc.c */
#line 1636 "template_syntax.cc"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@ -1834,7 +1870,7 @@ yyreturn:
}
/* Line 2041 of yacc.c */
/* Line 2055 of yacc.c */
#line 164 "template_syntax.y"

View File

@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 2.6.5. */
/* A Bison parser, made by GNU Bison 2.7. */
/* Bison interface for Yacc-like parsers in C
@ -60,14 +60,14 @@ extern int template__debug;
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
/* Line 2042 of yacc.c */
/* Line 2058 of yacc.c */
#line 74 "template_syntax.y"
char * val_str;
void * val_attr;
/* Line 2042 of yacc.c */
/* Line 2058 of yacc.c */
#line 72 "template_syntax.hh"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1

View File

@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 2.6.5. */
/* A Bison parser, made by GNU Bison 2.7. */
/* Bison implementation for Yacc-like parsers in C
@ -44,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "2.6.5"
#define YYBISON_VERSION "2.7"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@ -70,7 +70,7 @@
#define yylloc vm_file_var__lloc
/* Copy the first part of user declarations. */
/* Line 360 of yacc.c */
/* Line 371 of yacc.c */
#line 17 "vm_file_var_syntax.y"
#include <iostream>
@ -217,7 +217,7 @@ int get_image_path(VirtualMachine * vm,
/* -------------------------------------------------------------------------- */
/* Line 360 of yacc.c */
/* Line 371 of yacc.c */
#line 222 "vm_file_var_syntax.cc"
# ifndef YY_NULL
@ -270,7 +270,7 @@ extern int vm_file_var__debug;
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
/* Line 376 of yacc.c */
/* Line 387 of yacc.c */
#line 170 "vm_file_var_syntax.y"
char * val_str;
@ -278,7 +278,7 @@ typedef union YYSTYPE
char val_char;
/* Line 376 of yacc.c */
/* Line 387 of yacc.c */
#line 283 "vm_file_var_syntax.cc"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
@ -318,7 +318,7 @@ int vm_file_var__parse ();
/* Copy the second part of user declarations. */
/* Line 379 of yacc.c */
/* Line 390 of yacc.c */
#line 323 "vm_file_var_syntax.cc"
#ifdef short
@ -789,14 +789,46 @@ while (YYID (0))
#ifndef YY_LOCATION_PRINT
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
# define YY_LOCATION_PRINT(File, Loc) \
do { \
fprintf (File, "%d.%d", (Loc).first_line, (Loc).first_column); \
if ((Loc).first_line < (Loc).last_line) \
fprintf (File, "-%d.%d", (Loc).last_line, (Loc).last_column - 1); \
else if ((Loc).first_column < (Loc).last_column - 1) \
fprintf (File, "-%d", (Loc).last_column - 1); \
} while (0)
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
__attribute__((__unused__))
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static unsigned
yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
#else
static unsigned
yy_location_print_ (yyo, yylocp)
FILE *yyo;
YYLTYPE const * const yylocp;
#endif
{
unsigned res = 0;
int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
if (0 <= yylocp->first_line)
{
res += fprintf (yyo, "%d", yylocp->first_line);
if (0 <= yylocp->first_column)
res += fprintf (yyo, ".%d", yylocp->first_column);
}
if (0 <= yylocp->last_line)
{
if (yylocp->first_line < yylocp->last_line)
{
res += fprintf (yyo, "-%d", yylocp->last_line);
if (0 <= end_col)
res += fprintf (yyo, ".%d", end_col);
}
else if (0 <= end_col && yylocp->first_column < end_col)
res += fprintf (yyo, "-%d", end_col);
}
return res;
}
# define YY_LOCATION_PRINT(File, Loc) \
yy_location_print_ (File, &(Loc))
# else
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
# endif
@ -876,7 +908,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, mc, vm, img_ids,
switch (yytype)
{
default:
break;
break;
}
}
@ -1130,7 +1162,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
{
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
YYSIZE_T yysize1;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULL;
@ -1193,11 +1224,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
break;
}
yyarg[yycount++] = yytname[yyx];
yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
}
}
}
@ -1217,10 +1250,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
# undef YYCASE_
}
yysize1 = yysize + yystrlen (yyformat);
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
if (*yymsg_alloc < yysize)
{
@ -1290,7 +1325,7 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, mc, vm, img_ids, errmsg)
{
default:
break;
break;
}
}
@ -1344,6 +1379,11 @@ int yychar;
static YYSTYPE yyval_default;
# define YY_INITIAL_VALUE(Value) = Value
#endif
static YYLTYPE yyloc_default
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
= { 1, 1, 1, 1 }
# endif
;
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
@ -1356,11 +1396,7 @@ static YYSTYPE yyval_default;
YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
/* Location data for the lookahead symbol. */
YYLTYPE yylloc
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
= { 1, 1, 1, 1 }
# endif
;
YYLTYPE yylloc = yyloc_default;
/* Number of syntax errors so far. */
@ -1617,7 +1653,7 @@ yyreduce:
switch (yyn)
{
case 4:
/* Line 1778 of yacc.c */
/* Line 1792 of yacc.c */
#line 200 "vm_file_var_syntax.y"
{
string file((yyvsp[(1) - (7)].val_str));
@ -1639,7 +1675,7 @@ yyreduce:
break;
case 5:
/* Line 1778 of yacc.c */
/* Line 1792 of yacc.c */
#line 218 "vm_file_var_syntax.y"
{
string file((yyvsp[(1) - (11)].val_str));
@ -1664,8 +1700,8 @@ yyreduce:
break;
/* Line 1778 of yacc.c */
#line 1669 "vm_file_var_syntax.cc"
/* Line 1792 of yacc.c */
#line 1705 "vm_file_var_syntax.cc"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@ -1903,7 +1939,7 @@ yyreturn:
}
/* Line 2041 of yacc.c */
/* Line 2055 of yacc.c */
#line 239 "vm_file_var_syntax.y"

View File

@ -1,19 +1,19 @@
/* A Bison parser, made by GNU Bison 2.6.5. */
/* A Bison parser, made by GNU Bison 2.7. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
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 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, see <http://www.gnu.org/licenses/>. */
@ -26,7 +26,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. */
@ -62,7 +62,7 @@ extern int vm_file_var__debug;
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
/* Line 2042 of yacc.c */
/* Line 2058 of yacc.c */
#line 170 "vm_file_var_syntax.y"
char * val_str;
@ -70,7 +70,7 @@ typedef union YYSTYPE
char val_char;
/* Line 2042 of yacc.c */
/* Line 2058 of yacc.c */
#line 75 "vm_file_var_syntax.hh"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1

View File

@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 2.6.5. */
/* A Bison parser, made by GNU Bison 2.7. */
/* Bison implementation for Yacc-like parsers in C
@ -44,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "2.6.5"
#define YYBISON_VERSION "2.7"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@ -70,7 +70,7 @@
#define yylloc vm_var__lloc
/* Copy the first part of user declarations. */
/* Line 360 of yacc.c */
/* Line 371 of yacc.c */
#line 17 "vm_var_syntax.y"
#include <iostream>
@ -463,7 +463,7 @@ void insert_vector(VirtualMachine * vm,
/* -------------------------------------------------------------------------- */
/* Line 360 of yacc.c */
/* Line 371 of yacc.c */
#line 468 "vm_var_syntax.cc"
# ifndef YY_NULL
@ -516,7 +516,7 @@ extern int vm_var__debug;
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
/* Line 376 of yacc.c */
/* Line 387 of yacc.c */
#line 416 "vm_var_syntax.y"
char * val_str;
@ -524,7 +524,7 @@ typedef union YYSTYPE
char val_char;
/* Line 376 of yacc.c */
/* Line 387 of yacc.c */
#line 529 "vm_var_syntax.cc"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
@ -564,7 +564,7 @@ int vm_var__parse ();
/* Copy the second part of user declarations. */
/* Line 379 of yacc.c */
/* Line 390 of yacc.c */
#line 569 "vm_var_syntax.cc"
#ifdef short
@ -1035,14 +1035,46 @@ while (YYID (0))
#ifndef YY_LOCATION_PRINT
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
# define YY_LOCATION_PRINT(File, Loc) \
do { \
fprintf (File, "%d.%d", (Loc).first_line, (Loc).first_column); \
if ((Loc).first_line < (Loc).last_line) \
fprintf (File, "-%d.%d", (Loc).last_line, (Loc).last_column - 1); \
else if ((Loc).first_column < (Loc).last_column - 1) \
fprintf (File, "-%d", (Loc).last_column - 1); \
} while (0)
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
__attribute__((__unused__))
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static unsigned
yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
#else
static unsigned
yy_location_print_ (yyo, yylocp)
FILE *yyo;
YYLTYPE const * const yylocp;
#endif
{
unsigned res = 0;
int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
if (0 <= yylocp->first_line)
{
res += fprintf (yyo, "%d", yylocp->first_line);
if (0 <= yylocp->first_column)
res += fprintf (yyo, ".%d", yylocp->first_column);
}
if (0 <= yylocp->last_line)
{
if (yylocp->first_line < yylocp->last_line)
{
res += fprintf (yyo, "-%d", yylocp->last_line);
if (0 <= end_col)
res += fprintf (yyo, ".%d", end_col);
}
else if (0 <= end_col && yylocp->first_column < end_col)
res += fprintf (yyo, "-%d", end_col);
}
return res;
}
# define YY_LOCATION_PRINT(File, Loc) \
yy_location_print_ (File, &(Loc))
# else
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
# endif
@ -1122,7 +1154,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, mc, vm, parsed,
switch (yytype)
{
default:
break;
break;
}
}
@ -1376,7 +1408,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
{
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
YYSIZE_T yysize1;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULL;
@ -1439,11 +1470,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
break;
}
yyarg[yycount++] = yytname[yyx];
yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
}
}
}
@ -1463,10 +1496,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
# undef YYCASE_
}
yysize1 = yysize + yystrlen (yyformat);
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
if (*yymsg_alloc < yysize)
{
@ -1536,7 +1571,7 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, mc, vm, parsed, errmsg)
{
default:
break;
break;
}
}
@ -1590,6 +1625,11 @@ int yychar;
static YYSTYPE yyval_default;
# define YY_INITIAL_VALUE(Value) = Value
#endif
static YYLTYPE yyloc_default
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
= { 1, 1, 1, 1 }
# endif
;
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
@ -1602,11 +1642,7 @@ static YYSTYPE yyval_default;
YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
/* Location data for the lookahead symbol. */
YYLTYPE yylloc
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
= { 1, 1, 1, 1 }
# endif
;
YYLTYPE yylloc = yyloc_default;
/* Number of syntax errors so far. */
@ -1863,7 +1899,7 @@ yyreduce:
switch (yyn)
{
case 4:
/* Line 1778 of yacc.c */
/* Line 1792 of yacc.c */
#line 445 "vm_var_syntax.y"
{
(*parsed) << (yyvsp[(1) - (1)].val_str);
@ -1871,7 +1907,7 @@ yyreduce:
break;
case 5:
/* Line 1778 of yacc.c */
/* Line 1792 of yacc.c */
#line 449 "vm_var_syntax.y"
{
string name((yyvsp[(1) - (2)].val_str));
@ -1888,7 +1924,7 @@ yyreduce:
break;
case 6:
/* Line 1778 of yacc.c */
/* Line 1792 of yacc.c */
#line 462 "vm_var_syntax.y"
{
string name((yyvsp[(1) - (5)].val_str));
@ -1907,7 +1943,7 @@ yyreduce:
break;
case 7:
/* Line 1778 of yacc.c */
/* Line 1792 of yacc.c */
#line 477 "vm_var_syntax.y"
{
string name((yyvsp[(1) - (9)].val_str));
@ -1929,8 +1965,8 @@ yyreduce:
break;
/* Line 1778 of yacc.c */
#line 1934 "vm_var_syntax.cc"
/* Line 1792 of yacc.c */
#line 1970 "vm_var_syntax.cc"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@ -2168,7 +2204,7 @@ yyreturn:
}
/* Line 2041 of yacc.c */
/* Line 2055 of yacc.c */
#line 495 "vm_var_syntax.y"

View File

@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 2.6.5. */
/* A Bison parser, made by GNU Bison 2.7. */
/* Bison interface for Yacc-like parsers in C
@ -62,7 +62,7 @@ extern int vm_var__debug;
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
/* Line 2042 of yacc.c */
/* Line 2058 of yacc.c */
#line 416 "vm_var_syntax.y"
char * val_str;
@ -70,7 +70,7 @@ typedef union YYSTYPE
char val_char;
/* Line 2042 of yacc.c */
/* Line 2058 of yacc.c */
#line 75 "vm_var_syntax.hh"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1

View File

@ -514,8 +514,8 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
0, 100, 100, 101, 104, 136, 137, 138, 139, 140,
141, 142, 143
0, 100, 100, 101, 104, 132, 133, 134, 135, 136,
137, 138, 139
};
#endif
@ -1577,26 +1577,22 @@ yyreduce:
#line 104 "expr_arith.y"
{ float val = 0.0;
ostringstream xpath_t;
ostringstream xpath_s;
ostringstream xpath_c;
vector<string> results;
xpath_t << "/HOST/TEMPLATE/" << (yyvsp[(1) - (1)].val_str);
xpath_s << "/HOST/HOST_SHARE/" << (yyvsp[(1) - (1)].val_str);
xpath_c << "/HOST/CLUSTER_TEMPLATE/" << (yyvsp[(1) - (1)].val_str);
results = (*oxml)[xpath_t.str().c_str()];
if (results.size() == 0)
if ((yyvsp[(1) - (1)].val_str)[0] == '/')
{
results = (*oxml)[xpath_s.str().c_str()];
results = (*oxml)[(yyvsp[(1) - (1)].val_str)];
}
if (results.size() == 0)
else
{
results = (*oxml)[xpath_c.str().c_str()];
ostringstream xpath_t;
xpath_t << "/HOST/TEMPLATE/" << (yyvsp[(1) - (1)].val_str)
<< "|/HOST/HOST_SHARE/" << (yyvsp[(1) - (1)].val_str)
<< "|/HOST/" << (yyvsp[(1) - (1)].val_str)
<< "|/HOST/CLUSTER_TEMPLATE/" << (yyvsp[(1) - (1)].val_str);
results = (*oxml)[xpath_t.str().c_str()];
}
if (results.size() != 0)
@ -1611,55 +1607,55 @@ yyreduce:
case 5:
/* Line 1792 of yacc.c */
#line 136 "expr_arith.y"
#line 132 "expr_arith.y"
{ (yyval.val_float) = (yyvsp[(1) - (1)].val_float); }
break;
case 6:
/* Line 1792 of yacc.c */
#line 137 "expr_arith.y"
#line 133 "expr_arith.y"
{ (yyval.val_float) = static_cast<float>((yyvsp[(1) - (1)].val_int)); }
break;
case 7:
/* Line 1792 of yacc.c */
#line 138 "expr_arith.y"
#line 134 "expr_arith.y"
{ (yyval.val_float) = (yyvsp[(1) - (3)].val_float) + (yyvsp[(3) - (3)].val_float);}
break;
case 8:
/* Line 1792 of yacc.c */
#line 139 "expr_arith.y"
#line 135 "expr_arith.y"
{ (yyval.val_float) = (yyvsp[(1) - (3)].val_float) - (yyvsp[(3) - (3)].val_float);}
break;
case 9:
/* Line 1792 of yacc.c */
#line 140 "expr_arith.y"
#line 136 "expr_arith.y"
{ (yyval.val_float) = (yyvsp[(1) - (3)].val_float) * (yyvsp[(3) - (3)].val_float);}
break;
case 10:
/* Line 1792 of yacc.c */
#line 141 "expr_arith.y"
#line 137 "expr_arith.y"
{ (yyval.val_float) = (yyvsp[(1) - (3)].val_float) / (yyvsp[(3) - (3)].val_float);}
break;
case 11:
/* Line 1792 of yacc.c */
#line 142 "expr_arith.y"
#line 138 "expr_arith.y"
{ (yyval.val_float) = - (yyvsp[(2) - (2)].val_float);}
break;
case 12:
/* Line 1792 of yacc.c */
#line 143 "expr_arith.y"
#line 139 "expr_arith.y"
{ (yyval.val_float) = (yyvsp[(2) - (3)].val_float);}
break;
/* Line 1792 of yacc.c */
#line 1663 "expr_arith.cc"
#line 1659 "expr_arith.cc"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@ -1898,7 +1894,7 @@ yyreturn:
/* Line 2055 of yacc.c */
#line 146 "expr_arith.y"
#line 142 "expr_arith.y"
extern "C" void expr_arith__error(

View File

@ -100,29 +100,25 @@ extern "C"
stmt: expr { result = static_cast<int>($1);}
| { result = 0; }
;
//TODO Pass Xpath base for search
expr: STRING { float val = 0.0;
ostringstream xpath_t;
ostringstream xpath_s;
ostringstream xpath_c;
expr: STRING { float val = 0.0;
vector<string> results;
xpath_t << "/HOST/TEMPLATE/" << $1;
xpath_s << "/HOST/HOST_SHARE/" << $1;
xpath_c << "/HOST/CLUSTER_TEMPLATE/" << $1;
results = (*oxml)[xpath_t.str().c_str()];
if (results.size() == 0)
if ($1[0] == '/')
{
results = (*oxml)[xpath_s.str().c_str()];
results = (*oxml)[$1];
}
if (results.size() == 0)
else
{
results = (*oxml)[xpath_c.str().c_str()];
ostringstream xpath_t;
xpath_t << "/HOST/TEMPLATE/" << $1
<< "|/HOST/HOST_SHARE/" << $1
<< "|/HOST/" << $1
<< "|/HOST/CLUSTER_TEMPLATE/" << $1;
results = (*oxml)[xpath_t.str().c_str()];
}
if (results.size() != 0)

View File

@ -123,15 +123,17 @@ extern "C"
}
}
void get_xml_attribute(ObjectXML * oxml, const char* attr, int& val);
int get_xml_attribute(ObjectXML * oxml, const char* attr, int& val);
void get_xml_attribute(ObjectXML * oxml, const char* attr, float& val);
int get_xml_attribute(ObjectXML * oxml, const char* attr, float& val);
void get_xml_attribute(ObjectXML * oxml, const char* attr, string& val);
int get_xml_attribute(ObjectXML * oxml, const char* attr, string& val);
void get_xml_values(ObjectXML * oxml, const char* attr, vector<string>& results);
/* Line 371 of yacc.c */
#line 135 "expr_bool.cc"
#line 137 "expr_bool.cc"
# ifndef YY_NULL
# if defined __cplusplus && 201103L <= __cplusplus
@ -178,7 +180,7 @@ extern int expr_bool__debug;
typedef union YYSTYPE
{
/* Line 387 of yacc.c */
#line 83 "expr_bool.y"
#line 85 "expr_bool.y"
char * val_str;
int val_int;
@ -186,7 +188,7 @@ typedef union YYSTYPE
/* Line 387 of yacc.c */
#line 190 "expr_bool.cc"
#line 192 "expr_bool.cc"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
@ -226,7 +228,7 @@ int expr_bool__parse ();
/* Copy the second part of user declarations. */
/* Line 390 of yacc.c */
#line 230 "expr_bool.cc"
#line 232 "expr_bool.cc"
#ifdef short
# undef short
@ -522,8 +524,8 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
0, 103, 103, 104, 107, 112, 117, 122, 127, 132,
137, 142, 147, 152, 157, 158, 159, 160
0, 105, 105, 106, 109, 114, 119, 124, 129, 134,
139, 144, 149, 154, 159, 160, 161, 162
};
#endif
@ -1573,133 +1575,133 @@ yyreduce:
{
case 2:
/* Line 1792 of yacc.c */
#line 103 "expr_bool.y"
#line 105 "expr_bool.y"
{ result=(yyvsp[(1) - (1)].val_int); }
break;
case 3:
/* Line 1792 of yacc.c */
#line 104 "expr_bool.y"
#line 106 "expr_bool.y"
{ result=true; }
break;
case 4:
/* Line 1792 of yacc.c */
#line 107 "expr_bool.y"
{ int val;
#line 109 "expr_bool.y"
{ int val, rc;
get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
(yyval.val_int) = val == (yyvsp[(3) - (3)].val_int);}
rc = get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
(yyval.val_int) = (rc == 0 && val == (yyvsp[(3) - (3)].val_int));}
break;
case 5:
/* Line 1792 of yacc.c */
#line 112 "expr_bool.y"
{ int val;
#line 114 "expr_bool.y"
{ int val, rc;
get_xml_attribute(oxml,(yyvsp[(1) - (4)].val_str),val);
(yyval.val_int) = val != (yyvsp[(4) - (4)].val_int);}
rc = get_xml_attribute(oxml,(yyvsp[(1) - (4)].val_str),val);
(yyval.val_int) = (rc == 0 && val != (yyvsp[(4) - (4)].val_int));}
break;
case 6:
/* Line 1792 of yacc.c */
#line 117 "expr_bool.y"
{ int val;
#line 119 "expr_bool.y"
{ int val, rc;
get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
(yyval.val_int) = val > (yyvsp[(3) - (3)].val_int);}
rc = get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
(yyval.val_int) = (rc == 0 && val > (yyvsp[(3) - (3)].val_int));}
break;
case 7:
/* Line 1792 of yacc.c */
#line 122 "expr_bool.y"
{ int val;
#line 124 "expr_bool.y"
{ int val, rc;
get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
(yyval.val_int) = val < (yyvsp[(3) - (3)].val_int);}
rc = get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
(yyval.val_int) = (rc == 0 && val < (yyvsp[(3) - (3)].val_int));}
break;
case 8:
/* Line 1792 of yacc.c */
#line 127 "expr_bool.y"
{ float val;
#line 129 "expr_bool.y"
{ float val, rc;
get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
(yyval.val_int) = val == (yyvsp[(3) - (3)].val_float);}
rc = get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
(yyval.val_int) = (rc == 0 && val == (yyvsp[(3) - (3)].val_float));}
break;
case 9:
/* Line 1792 of yacc.c */
#line 132 "expr_bool.y"
{ float val;
#line 134 "expr_bool.y"
{ float val, rc;
get_xml_attribute(oxml,(yyvsp[(1) - (4)].val_str),val);
(yyval.val_int) = val != (yyvsp[(4) - (4)].val_float);}
rc = get_xml_attribute(oxml,(yyvsp[(1) - (4)].val_str),val);
(yyval.val_int) = (rc == 0 && val != (yyvsp[(4) - (4)].val_float));}
break;
case 10:
/* Line 1792 of yacc.c */
#line 137 "expr_bool.y"
{ float val;
#line 139 "expr_bool.y"
{ float val, rc;
get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
(yyval.val_int) = val > (yyvsp[(3) - (3)].val_float);}
rc = get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
(yyval.val_int) = (rc == 0 && val > (yyvsp[(3) - (3)].val_float));}
break;
case 11:
/* Line 1792 of yacc.c */
#line 142 "expr_bool.y"
{ float val;
#line 144 "expr_bool.y"
{ float val, rc;
get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
(yyval.val_int) = val < (yyvsp[(3) - (3)].val_float);}
rc = get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
(yyval.val_int) = (rc == 0 && val < (yyvsp[(3) - (3)].val_float));}
break;
case 12:
/* Line 1792 of yacc.c */
#line 147 "expr_bool.y"
{ string val;
#line 149 "expr_bool.y"
{ string val; int rc;
get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
(yyval.val_int) = (val.empty() || (yyvsp[(3) - (3)].val_str)==0) ? false : fnmatch((yyvsp[(3) - (3)].val_str),val.c_str(),0)==0;}
rc = get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
(yyval.val_int) = (rc != 0 || (yyvsp[(3) - (3)].val_str)==0) ? false : fnmatch((yyvsp[(3) - (3)].val_str),val.c_str(),0)==0;}
break;
case 13:
/* Line 1792 of yacc.c */
#line 152 "expr_bool.y"
{ string val;
#line 154 "expr_bool.y"
{ string val; int rc;
get_xml_attribute(oxml,(yyvsp[(1) - (4)].val_str),val);
(yyval.val_int) = (val.empty() || (yyvsp[(4) - (4)].val_str)==0) ? false : fnmatch((yyvsp[(4) - (4)].val_str),val.c_str(),0)!=0;}
rc = get_xml_attribute(oxml,(yyvsp[(1) - (4)].val_str),val);
(yyval.val_int) = (rc != 0 || (yyvsp[(4) - (4)].val_str)==0) ? false : fnmatch((yyvsp[(4) - (4)].val_str),val.c_str(),0)!=0;}
break;
case 14:
/* Line 1792 of yacc.c */
#line 157 "expr_bool.y"
#line 159 "expr_bool.y"
{ (yyval.val_int) = (yyvsp[(1) - (3)].val_int) && (yyvsp[(3) - (3)].val_int); }
break;
case 15:
/* Line 1792 of yacc.c */
#line 158 "expr_bool.y"
#line 160 "expr_bool.y"
{ (yyval.val_int) = (yyvsp[(1) - (3)].val_int) || (yyvsp[(3) - (3)].val_int); }
break;
case 16:
/* Line 1792 of yacc.c */
#line 159 "expr_bool.y"
#line 161 "expr_bool.y"
{ (yyval.val_int) = ! (yyvsp[(2) - (2)].val_int); }
break;
case 17:
/* Line 1792 of yacc.c */
#line 160 "expr_bool.y"
#line 162 "expr_bool.y"
{ (yyval.val_int) = (yyvsp[(2) - (3)].val_int); }
break;
/* Line 1792 of yacc.c */
#line 1703 "expr_bool.cc"
#line 1705 "expr_bool.cc"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@ -1938,7 +1940,7 @@ yyreturn:
/* Line 2055 of yacc.c */
#line 163 "expr_bool.y"
#line 165 "expr_bool.y"
extern "C" void expr_bool__error(
@ -1969,127 +1971,88 @@ extern "C" void expr_bool__error(
result = false;
}
void get_xml_attribute(ObjectXML * oxml, const char* attr, int& val)
void get_xml_values(ObjectXML * oxml, const char* attr, vector<string> &results)
{
if (attr[0] == '/')
{
results = (*oxml)[attr];
}
else
{
ostringstream xpath;
xpath << "/HOST/TEMPLATE/" << attr
<< "|/HOST/HOST_SHARE/" << attr
<< "|/HOST/" << attr
<< "|/HOST/CLUSTER_TEMPLATE/" << attr;
results = (*oxml)[xpath.str().c_str()];
}
}
int get_xml_attribute(ObjectXML * oxml, const char* attr, int& val)
{
val = 0;
//TODO: pass xpath base
vector<string> results;
ostringstream xpath_t;
xpath_t << "/HOST/TEMPLATE/" << attr;
results = (*oxml)[xpath_t.str().c_str()];
if (results.size() == 0)
{
ostringstream xpath_s;
xpath_s << "/HOST/HOST_SHARE/" << attr;
results = (*oxml)[xpath_s.str().c_str()];
if (results.size() == 0)
{
ostringstream xpath_h;
xpath_h << "/HOST/" << attr;
results = (*oxml)[xpath_h.str().c_str()];
if (results.size() == 0)
{
xpath_h.str("");
xpath_h << "/HOST/CLUSTER_TEMPLATE/" << attr;
results = (*oxml)[xpath_h.str().c_str()];
}
}
}
get_xml_values(oxml, attr, results);
if (results.size() != 0)
{
istringstream iss(results[0]);
iss >> val;
if (iss.fail())
{
val = 0;
return -1;
}
return 0;
}
return -1;
}
void get_xml_attribute(ObjectXML * oxml, const char* attr, float& val)
int get_xml_attribute(ObjectXML * oxml, const char* attr, float& val)
{
val = 0.0;
//TODO: pass xpath base
ostringstream xpath_t;
vector<string> results;
xpath_t << "/HOST/TEMPLATE/" << attr;
results = (*oxml)[xpath_t.str().c_str()];
if (results.size() == 0)
{
ostringstream xpath_s;
xpath_s << "/HOST/HOST_SHARE/" << attr;
results = (*oxml)[xpath_s.str().c_str()];
if (results.size() == 0)
{
ostringstream xpath_h;
xpath_h << "/HOST/" << attr;
results = (*oxml)[xpath_h.str().c_str()];
if (results.size() == 0)
{
xpath_h.str("");
xpath_h << "/HOST/CLUSTER_TEMPLATE/" << attr;
results = (*oxml)[xpath_h.str().c_str()];
}
}
}
get_xml_values(oxml, attr, results);
if (results.size() != 0)
{
istringstream iss(results[0]);
iss >> val;
if (iss.fail())
{
val = 0;
return -1;
}
return 0;
}
return -1;
}
void get_xml_attribute(ObjectXML * oxml, const char* attr, string& val)
int get_xml_attribute(ObjectXML * oxml, const char* attr, string& val)
{
val = "";
//TODO: pass xpath base
ostringstream xpath_t;
vector<string> results;
xpath_t << "/HOST/TEMPLATE/" << attr;
results = (*oxml)[xpath_t.str().c_str()];
if (results.size() == 0)
{
ostringstream xpath_s;
xpath_s << "/HOST/HOST_SHARE/" << attr;
results = (*oxml)[xpath_s.str().c_str()];
if (results.size() == 0)
{
ostringstream xpath_h;
xpath_h << "/HOST/" << attr;
results = (*oxml)[xpath_h.str().c_str()];
if (results.size() == 0)
{
xpath_h.str("");
xpath_h << "/HOST/CLUSTER_TEMPLATE/" << attr;
results = (*oxml)[xpath_h.str().c_str()];
}
}
}
get_xml_values(oxml, attr, results);
if (results.size() != 0)
{
val = results[0];
return 0;
}
return -1;
}

View File

@ -57,7 +57,7 @@ extern int expr_bool__debug;
typedef union YYSTYPE
{
/* Line 2058 of yacc.c */
#line 83 "expr_bool.y"
#line 85 "expr_bool.y"
char * val_str;
int val_int;

View File

@ -65,11 +65,13 @@ extern "C"
}
}
void get_xml_attribute(ObjectXML * oxml, const char* attr, int& val);
int get_xml_attribute(ObjectXML * oxml, const char* attr, int& val);
void get_xml_attribute(ObjectXML * oxml, const char* attr, float& val);
int get_xml_attribute(ObjectXML * oxml, const char* attr, float& val);
void get_xml_attribute(ObjectXML * oxml, const char* attr, string& val);
int get_xml_attribute(ObjectXML * oxml, const char* attr, string& val);
void get_xml_values(ObjectXML * oxml, const char* attr, vector<string>& results);
%}
@ -104,55 +106,55 @@ stmt: expr { result=$1; }
| { result=true; } /* TRUE BY DEFAULT, ON EMPTY STRINGS */
;
expr: STRING '=' INTEGER { int val;
expr: STRING '=' INTEGER { int val, rc;
get_xml_attribute(oxml,$1,val);
$$ = val == $3;}
rc = get_xml_attribute(oxml,$1,val);
$$ = (rc == 0 && val == $3);}
| STRING '!' '=' INTEGER { int val;
| STRING '!' '=' INTEGER { int val, rc;
get_xml_attribute(oxml,$1,val);
$$ = val != $4;}
rc = get_xml_attribute(oxml,$1,val);
$$ = (rc == 0 && val != $4);}
| STRING '>' INTEGER { int val;
| STRING '>' INTEGER { int val, rc;
get_xml_attribute(oxml,$1,val);
$$ = val > $3;}
rc = get_xml_attribute(oxml,$1,val);
$$ = (rc == 0 && val > $3);}
| STRING '<' INTEGER { int val;
| STRING '<' INTEGER { int val, rc;
get_xml_attribute(oxml,$1,val);
$$ = val < $3;}
rc = get_xml_attribute(oxml,$1,val);
$$ = (rc == 0 && val < $3);}
| STRING '=' FLOAT { float val;
| STRING '=' FLOAT { float val, rc;
get_xml_attribute(oxml,$1,val);
$$ = val == $3;}
rc = get_xml_attribute(oxml,$1,val);
$$ = (rc == 0 && val == $3);}
| STRING '!' '=' FLOAT { float val;
| STRING '!' '=' FLOAT { float val, rc;
get_xml_attribute(oxml,$1,val);
$$ = val != $4;}
rc = get_xml_attribute(oxml,$1,val);
$$ = (rc == 0 && val != $4);}
| STRING '>' FLOAT { float val;
| STRING '>' FLOAT { float val, rc;
get_xml_attribute(oxml,$1,val);
$$ = val > $3;}
rc = get_xml_attribute(oxml,$1,val);
$$ = (rc == 0 && val > $3);}
| STRING '<' FLOAT { float val;
| STRING '<' FLOAT { float val, rc;
get_xml_attribute(oxml,$1,val);
$$ = val < $3;}
rc = get_xml_attribute(oxml,$1,val);
$$ = (rc == 0 && val < $3);}
| STRING '=' STRING { string val;
| STRING '=' STRING { string val; int rc;
get_xml_attribute(oxml,$1,val);
$$ = (val.empty() || $3==0) ? false : fnmatch($3,val.c_str(),0)==0;}
rc = get_xml_attribute(oxml,$1,val);
$$ = (rc != 0 || $3==0) ? false : fnmatch($3,val.c_str(),0)==0;}
| STRING '!''=' STRING { string val;
| STRING '!''=' STRING { string val; int rc;
get_xml_attribute(oxml,$1,val);
$$ = (val.empty() || $4==0) ? false : fnmatch($4,val.c_str(),0)!=0;}
rc = get_xml_attribute(oxml,$1,val);
$$ = (rc != 0 || $4==0) ? false : fnmatch($4,val.c_str(),0)!=0;}
| expr '&' expr { $$ = $1 && $3; }
| expr '|' expr { $$ = $1 || $3; }
@ -190,127 +192,88 @@ extern "C" void expr_bool__error(
result = false;
}
void get_xml_attribute(ObjectXML * oxml, const char* attr, int& val)
void get_xml_values(ObjectXML * oxml, const char* attr, vector<string> &results)
{
if (attr[0] == '/')
{
results = (*oxml)[attr];
}
else
{
ostringstream xpath;
xpath << "/HOST/TEMPLATE/" << attr
<< "|/HOST/HOST_SHARE/" << attr
<< "|/HOST/" << attr
<< "|/HOST/CLUSTER_TEMPLATE/" << attr;
results = (*oxml)[xpath.str().c_str()];
}
}
int get_xml_attribute(ObjectXML * oxml, const char* attr, int& val)
{
val = 0;
//TODO: pass xpath base
vector<string> results;
ostringstream xpath_t;
xpath_t << "/HOST/TEMPLATE/" << attr;
results = (*oxml)[xpath_t.str().c_str()];
if (results.size() == 0)
{
ostringstream xpath_s;
xpath_s << "/HOST/HOST_SHARE/" << attr;
results = (*oxml)[xpath_s.str().c_str()];
if (results.size() == 0)
{
ostringstream xpath_h;
xpath_h << "/HOST/" << attr;
results = (*oxml)[xpath_h.str().c_str()];
if (results.size() == 0)
{
xpath_h.str("");
xpath_h << "/HOST/CLUSTER_TEMPLATE/" << attr;
results = (*oxml)[xpath_h.str().c_str()];
}
}
}
get_xml_values(oxml, attr, results);
if (results.size() != 0)
{
istringstream iss(results[0]);
iss >> val;
if (iss.fail())
{
val = 0;
return -1;
}
return 0;
}
return -1;
}
void get_xml_attribute(ObjectXML * oxml, const char* attr, float& val)
int get_xml_attribute(ObjectXML * oxml, const char* attr, float& val)
{
val = 0.0;
//TODO: pass xpath base
ostringstream xpath_t;
vector<string> results;
xpath_t << "/HOST/TEMPLATE/" << attr;
results = (*oxml)[xpath_t.str().c_str()];
if (results.size() == 0)
{
ostringstream xpath_s;
xpath_s << "/HOST/HOST_SHARE/" << attr;
results = (*oxml)[xpath_s.str().c_str()];
if (results.size() == 0)
{
ostringstream xpath_h;
xpath_h << "/HOST/" << attr;
results = (*oxml)[xpath_h.str().c_str()];
if (results.size() == 0)
{
xpath_h.str("");
xpath_h << "/HOST/CLUSTER_TEMPLATE/" << attr;
results = (*oxml)[xpath_h.str().c_str()];
}
}
}
get_xml_values(oxml, attr, results);
if (results.size() != 0)
{
istringstream iss(results[0]);
iss >> val;
if (iss.fail())
{
val = 0;
return -1;
}
return 0;
}
return -1;
}
void get_xml_attribute(ObjectXML * oxml, const char* attr, string& val)
int get_xml_attribute(ObjectXML * oxml, const char* attr, string& val)
{
val = "";
//TODO: pass xpath base
ostringstream xpath_t;
vector<string> results;
xpath_t << "/HOST/TEMPLATE/" << attr;
results = (*oxml)[xpath_t.str().c_str()];
if (results.size() == 0)
{
ostringstream xpath_s;
xpath_s << "/HOST/HOST_SHARE/" << attr;
results = (*oxml)[xpath_s.str().c_str()];
if (results.size() == 0)
{
ostringstream xpath_h;
xpath_h << "/HOST/" << attr;
results = (*oxml)[xpath_h.str().c_str()];
if (results.size() == 0)
{
xpath_h.str("");
xpath_h << "/HOST/CLUSTER_TEMPLATE/" << attr;
results = (*oxml)[xpath_h.str().c_str()];
}
}
}
get_xml_values(oxml, attr, results);
if (results.size() != 0)
{
val = results[0];
return 0;
}
return -1;
}