Build fixes for *NIX.

This commit is contained in:
Gunnar Beutner 2012-07-08 21:24:20 +02:00
parent 7fadf56ded
commit a71e5ca0d7
7 changed files with 284 additions and 352 deletions

View File

@ -32,6 +32,7 @@
#include <arpa/inet.h>
#include <pthread.h>
#include <signal.h>
#include <libgen.h>
void Sleep(unsigned long milliseconds);

View File

@ -179,7 +179,7 @@ string Utility::DirName(const string& path)
string result;
if (dir == NULL)
throw std::bad_alloc("strdup() failed");
throw std::bad_alloc();
#ifndef _WIN32
result = dirname(dir);
@ -209,7 +209,7 @@ string Utility::BaseName(const string& path)
string result;
if (dir == NULL)
throw std::bad_alloc("strdup() failed");
throw std::bad_alloc();
#ifndef _WIN32
result = basename(dir);

View File

@ -41,15 +41,16 @@ def processHost(host):
for element in host.getElementsByTagName("port"):
port = int(element.getAttribute("portid"))
protocol = element.getAttribute("protocol")
try:
serv = socket.getservbyport(port, "tcp")
serv = socket.getservbyport(port, protocol)
except:
serv = str(port)
print ""
print "\tservices[\"%s\"] = {" % (serv)
print "\t\tservice = \"tcp\","
print "\t\tservice = \"%s\"," % (protocol)
print ""
print "\t\tmacros = {"
print "\t\t\tport = %s" % (port)

View File

@ -53,6 +53,7 @@ typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
#endif /* ! C99 */
/* Limits of integral types. */
#ifndef INT8_MIN
@ -83,8 +84,6 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
#endif /* ! C99 */
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
@ -158,15 +157,7 @@ typedef void* yyscan_t;
/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k.
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
* Ditto for the __ia64__ case accordingly.
*/
#define YY_BUF_SIZE 32768
#else
#define YY_BUF_SIZE 16384
#endif /* __ia64__ */
#endif
/* The state buf must be large enough to hold one state per character in the main buffer.
@ -383,9 +374,9 @@ static yyconst flex_int16_t yy_accept[72] =
{ 0,
0, 0, 0, 0, 24, 22, 21, 21, 22, 22,
22, 22, 22, 22, 9, 10, 7, 7, 7, 7,
7, 7, 17, 18, 21, 0, 20, 13, 11, 12,
15, 0, 14, 9, 7, 7, 7, 7, 7, 7,
17, 16, 8, 19, 7, 7, 7, 7, 7, 7,
7, 7, 17, 18, 21, 0, 8, 20, 13, 11,
12, 15, 0, 14, 9, 7, 7, 7, 7, 7,
7, 17, 16, 19, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 6, 7, 7, 7, 7, 2,
7, 7, 7, 7, 3, 7, 4, 7, 1, 5,
0
@ -425,69 +416,69 @@ static yyconst flex_int32_t yy_ec[256] =
static yyconst flex_int32_t yy_meta[28] =
{ 0,
1, 1, 2, 3, 1, 4, 1, 5, 1, 5,
1, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5
1, 1, 2, 1, 1, 3, 1, 4, 1, 4,
1, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4
} ;
static yyconst flex_int16_t yy_base[78] =
{ 0,
0, 0, 93, 92, 97, 100, 26, 28, 0, 0,
85, 84, 83, 26, 83, 100, 0, 78, 69, 67,
62, 74, 0, 78, 31, 82, 0, 100, 100, 100,
100, 0, 100, 75, 0, 59, 21, 68, 61, 61,
0, 100, 100, 0, 54, 58, 61, 64, 55, 58,
50, 46, 48, 50, 0, 55, 56, 52, 48, 0,
40, 50, 44, 32, 0, 25, 0, 22, 0, 0,
100, 39, 44, 49, 33, 54, 59
0, 0, 90, 89, 94, 97, 26, 28, 89, 0,
81, 80, 79, 26, 79, 97, 0, 74, 65, 63,
58, 70, 0, 74, 31, 78, 97, 0, 97, 97,
97, 97, 0, 97, 71, 0, 55, 21, 64, 57,
57, 0, 97, 0, 50, 54, 57, 60, 51, 54,
46, 42, 44, 46, 0, 51, 52, 48, 44, 0,
36, 46, 43, 31, 0, 28, 0, 24, 0, 0,
97, 39, 43, 47, 34, 51, 55
} ;
static yyconst flex_int16_t yy_def[78] =
{ 0,
71, 1, 72, 72, 71, 71, 71, 71, 73, 74,
71, 71, 71, 71, 71, 71, 75, 75, 75, 75,
75, 75, 76, 71, 71, 73, 74, 71, 71, 71,
71, 77, 71, 71, 75, 75, 75, 75, 75, 75,
76, 71, 71, 77, 75, 75, 75, 75, 75, 75,
75, 75, 76, 71, 71, 73, 71, 74, 71, 71,
71, 71, 77, 71, 71, 75, 75, 75, 75, 75,
75, 76, 71, 77, 75, 75, 75, 75, 75, 75,
75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
0, 71, 71, 71, 71, 71, 71
} ;
static yyconst flex_int16_t yy_nxt[128] =
static yyconst flex_int16_t yy_nxt[125] =
{ 0,
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 17, 17, 17, 17, 17, 19, 17,
20, 21, 22, 17, 17, 17, 17, 25, 25, 25,
25, 31, 25, 25, 32, 46, 33, 35, 47, 23,
23, 23, 23, 23, 26, 26, 70, 26, 26, 27,
69, 27, 27, 27, 41, 41, 41, 68, 41, 44,
67, 44, 44, 44, 66, 65, 64, 63, 62, 61,
60, 59, 58, 57, 56, 55, 54, 53, 52, 51,
50, 49, 48, 45, 34, 43, 42, 40, 39, 38,
37, 36, 34, 30, 29, 28, 71, 24, 24, 5,
25, 32, 25, 25, 33, 46, 34, 36, 47, 23,
23, 23, 23, 26, 26, 26, 26, 28, 70, 28,
28, 42, 42, 69, 42, 44, 68, 44, 44, 67,
66, 65, 64, 63, 62, 61, 60, 59, 58, 57,
56, 55, 54, 53, 52, 51, 50, 49, 48, 45,
35, 27, 43, 41, 40, 39, 38, 37, 35, 31,
30, 29, 27, 71, 24, 24, 5, 71, 71, 71,
71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
71, 71, 71, 71, 71, 71, 71
71, 71, 71, 71
} ;
static yyconst flex_int16_t yy_chk[128] =
static yyconst flex_int16_t yy_chk[125] =
{ 0,
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, 7, 7, 8,
8, 14, 25, 25, 14, 37, 14, 75, 37, 72,
72, 72, 72, 72, 73, 73, 68, 73, 73, 74,
66, 74, 74, 74, 76, 76, 76, 64, 76, 77,
63, 77, 77, 77, 62, 61, 59, 58, 57, 56,
54, 53, 52, 51, 50, 49, 48, 47, 46, 45,
40, 39, 38, 36, 34, 26, 24, 22, 21, 20,
19, 18, 15, 13, 12, 11, 5, 4, 3, 71,
8, 14, 25, 25, 14, 38, 14, 75, 38, 72,
72, 72, 72, 73, 73, 73, 73, 74, 68, 74,
74, 76, 76, 66, 76, 77, 64, 77, 77, 63,
62, 61, 59, 58, 57, 56, 54, 53, 52, 51,
50, 49, 48, 47, 46, 45, 41, 40, 39, 37,
35, 26, 24, 22, 21, 20, 19, 18, 15, 13,
12, 11, 9, 5, 4, 3, 71, 71, 71, 71,
71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
71, 71, 71, 71, 71, 71, 71
71, 71, 71, 71
} ;
/* Table of booleans, true if rule could match eol. */
@ -545,7 +536,7 @@ do { \
} while (0)
#define YY_NO_UNISTD_H 1
#line 549 "config_lexer.cc"
#line 540 "config_lexer.cc"
#define INITIAL 0
#define IN_C_COMMENT 1
@ -683,12 +674,7 @@ static int input (yyscan_t yyscanner );
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k */
#define YY_READ_BUF_SIZE 16384
#else
#define YY_READ_BUF_SIZE 8192
#endif /* __ia64__ */
#endif
/* Copy whatever the last rule matched to the standard output. */
@ -707,7 +693,7 @@ static int input (yyscan_t yyscanner );
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
size_t n; \
unsigned n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
@ -794,7 +780,7 @@ YY_DECL
#line 48 "config_lexer.ll"
#line 798 "config_lexer.cc"
#line 784 "config_lexer.cc"
yylval = yylval_param;
@ -1011,7 +997,7 @@ YY_RULE_SETUP
#line 79 "config_lexer.ll"
ECHO;
YY_BREAK
#line 1015 "config_lexer.cc"
#line 1001 "config_lexer.cc"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(IN_C_COMMENT):
yyterminate();
@ -1792,8 +1778,8 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
* scan from a @e copy of @a bytes.
* @param yybytes the byte buffer to scan
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
* @param bytes the byte buffer to scan
* @param len the number of bytes in the buffer pointed to by @a bytes.
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
*/

View File

@ -53,7 +53,7 @@ include return T_INCLUDE;
inherits return T_INHERITS;
null return T_NULL;
[a-zA-Z_][a-zA-Z0-9\-_]* { yylval->text = strdup(yytext); return T_IDENTIFIER; }
\"[^\"]+\" { yytext[yyleng-1] = '\0'; yylval->text = strdup(yytext + 1); return T_STRING; }
\"[^\"]*\" { yytext[yyleng-1] = '\0'; yylval->text = strdup(yytext + 1); return T_STRING; }
[0-9]+ { yylval->num = atoi(yytext); return T_NUMBER; }
= { yylval->op = OperatorSet; return T_EQUAL; }
\+= { yylval->op = OperatorPlus; return T_PLUS_EQUAL; }

View File

@ -1,8 +1,10 @@
/* A Bison parser, made by GNU Bison 2.5. */
/* Bison implementation for Yacc-like parsers in C
/* 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-2011 Free Software Foundation, Inc.
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
it under the terms of the GNU General Public License as published by
@ -44,7 +46,7 @@
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "2.5"
#define YYBISON_VERSION "2.4.1"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@ -66,8 +68,8 @@
/* Copy the first part of user declarations. */
/* Line 268 of yacc.c */
#line 71 "config_parser.cc"
/* Line 189 of yacc.c */
#line 73 "config_parser.cc"
/* Enabling traces. */
#ifndef YYDEBUG
@ -89,7 +91,7 @@
/* "%code requires" blocks. */
/* Line 288 of yacc.c */
/* Line 209 of yacc.c */
#line 1 "config_parser.yy"
/******************************************************************************
@ -120,8 +122,8 @@ using namespace icinga;
/* Line 288 of yacc.c */
#line 125 "config_parser.cc"
/* Line 209 of yacc.c */
#line 127 "config_parser.cc"
/* Tokens. */
#ifndef YYTOKENTYPE
@ -168,7 +170,7 @@ using namespace icinga;
typedef union YYSTYPE
{
/* Line 293 of yacc.c */
/* Line 214 of yacc.c */
#line 38 "config_parser.yy"
char *text;
@ -178,8 +180,8 @@ typedef union YYSTYPE
/* Line 293 of yacc.c */
#line 183 "config_parser.cc"
/* Line 214 of yacc.c */
#line 185 "config_parser.cc"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
@ -202,7 +204,7 @@ typedef struct YYLTYPE
/* Copy the second part of user declarations. */
/* Line 343 of yacc.c */
/* Line 264 of yacc.c */
#line 66 "config_parser.yy"
@ -237,8 +239,8 @@ void ConfigCompiler::Compile(void)
/* Line 343 of yacc.c */
#line 242 "config_parser.cc"
/* Line 264 of yacc.c */
#line 244 "config_parser.cc"
#ifdef short
# undef short
@ -288,7 +290,7 @@ typedef short int yytype_int16;
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS
# if YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(msgid) dgettext ("bison-runtime", msgid)
@ -341,11 +343,11 @@ YYID (yyi)
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# ifndef _STDLIB_H
# define _STDLIB_H 1
# endif
# endif
# endif
@ -368,24 +370,24 @@ YYID (yyi)
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
# if (defined __cplusplus && ! defined _STDLIB_H \
&& ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# ifndef _STDLIB_H
# define _STDLIB_H 1
# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
@ -416,7 +418,23 @@ union yyalloc
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+ 2 * YYSTACK_GAP_MAXIMUM)
# define YYCOPY_NEEDED 1
/* Copy COUNT objects from FROM to TO. The source and destination do
not overlap. */
# ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__
# define YYCOPY(To, From, Count) \
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
# else
# define YYCOPY(To, From, Count) \
do \
{ \
YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(To)[yyi] = (From)[yyi]; \
} \
while (YYID (0))
# endif
# endif
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
@ -436,26 +454,6 @@ union yyalloc
#endif
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
/* Copy COUNT objects from FROM to TO. The source and destination do
not overlap. */
# ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__
# define YYCOPY(To, From, Count) \
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
# else
# define YYCOPY(To, From, Count) \
do \
{ \
YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(To)[yyi] = (From)[yyi]; \
} \
while (YYID (0))
# endif
# endif
#endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
@ -599,8 +597,8 @@ static const yytype_uint8 yyr2[] =
0, 4, 1, 1, 2, 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
Performed when YYTABLE doesn't specify something else to do. Zero
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
STATE-NUM when YYTABLE doesn't specify something else to do. Zero
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
@ -645,7 +643,8 @@ static const yytype_int8 yypgoto[] =
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
number is the opposite. If YYTABLE_NINF, syntax error. */
number is the opposite. If zero, do what YYDEFACT says.
If YYTABLE_NINF, syntax error. */
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
@ -656,12 +655,6 @@ static const yytype_uint8 yytable[] =
61, 39, 40, 60, 23, 0, 0, 59, 26
};
#define yypact_value_is_default(yystate) \
((yystate) == (-45))
#define yytable_value_is_error(yytable_value) \
YYID (0)
static const yytype_int8 yycheck[] =
{
3, 4, 5, 7, 8, 9, 10, 11, 52, 0,
@ -696,18 +689,9 @@ static const yytype_uint8 yystos[] =
/* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. However,
YYFAIL appears to be in use. Nevertheless, it is formally deprecated
in Bison 2.4.2's NEWS entry, where a plan to phase it out is
discussed. */
Once GCC version 2 has supplanted version 1, this can go. */
#define YYFAIL goto yyerrlab
#if defined YYFAIL
/* This is here to suppress warnings from the GCC cpp's
-Wunused-macros. Normally we don't worry about that warning, but
some users do, and we want to make it easy for users to remove
YYFAIL uses, which will produce warnings from Bison 2.5. */
#endif
#define YYRECOVERING() (!!yyerrstatus)
@ -717,6 +701,7 @@ do \
{ \
yychar = (Token); \
yylval = (Value); \
yytoken = YYTRANSLATE (yychar); \
YYPOPSTACK (1); \
goto yybackup; \
} \
@ -763,7 +748,7 @@ while (YYID (0))
we won't break user code: when these are the locations we know. */
#ifndef YY_LOCATION_PRINT
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
# if YYLTYPE_IS_TRIVIAL
# define YY_LOCATION_PRINT(File, Loc) \
fprintf (File, "%d.%d-%d.%d", \
(Loc).first_line, (Loc).first_column, \
@ -972,6 +957,7 @@ int yydebug;
# define YYMAXDEPTH 10000
#endif
#if YYERROR_VERBOSE
@ -1074,142 +1060,115 @@ yytnamerr (char *yyres, const char *yystr)
}
# endif
/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
about the unexpected token YYTOKEN for the state stack whose top is
YYSSP.
Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
not large enough to hold the message. In that case, also set
*YYMSG_ALLOC to the required number of bytes. Return 2 if the
required number of bytes is too large to store. */
static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
/* Copy into YYRESULT an error message about the unexpected token
YYCHAR while in state YYSTATE. Return the number of bytes copied,
including the terminating null byte. If YYRESULT is null, do not
copy anything; just return the number of bytes that would be
copied. As a special case, return 0 if an ordinary "syntax error"
message will do. Return YYSIZE_MAXIMUM if overflow occurs during
size calculation. */
static YYSIZE_T
yysyntax_error (char *yyresult, int yystate, int yychar)
{
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
YYSIZE_T yysize1;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = 0;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
"expected"). */
int yycount = 0;
int yyn = yypact[yystate];
/* There are many possibilities here to consider:
- Assume YYFAIL is not used. It's too flawed to consider. See
<http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
for details. YYERROR is fine as it does not invoke this
function.
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
tokens because there are none.
- The only way there can be no lookahead present (in yychar) is if
this state is a consistent state with a default action. Thus,
detecting the absence of a lookahead is sufficient to determine
that there is no unexpected or expected token to report. In that
case, just report a simple "syntax error".
- Don't assume there isn't a lookahead just because this state is a
consistent state with a default action. There might have been a
previous inconsistent state, consistent state with a non-default
action, or user semantic action that manipulated yychar.
- Of course, the expected token list depends on states to have
correct lookahead information, and it depends on the parser not
to perform extra reductions after fetching a lookahead from the
scanner and before detecting a syntax error. Thus, state merging
(from LALR or IELR) and default reductions corrupt the expected
token list. However, the list is correct for canonical LR with
one exception: it will still contain any token that will not be
accepted due to an error action in a later state.
*/
if (yytoken != YYEMPTY)
if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
return 0;
else
{
int yyn = yypact[*yyssp];
yyarg[yycount++] = yytname[yytoken];
if (!yypact_value_is_default (yyn))
{
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. In other words, skip the first -YYN actions for
this state because they are default actions. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn + 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yyx;
int yytype = YYTRANSLATE (yychar);
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
YYSIZE_T yysize = yysize0;
YYSIZE_T yysize1;
int yysize_overflow = 0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
int yyx;
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
&& !yytable_value_is_error (yytable[yyx + yyn]))
{
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
yycount = 1;
yysize = yysize0;
break;
}
yyarg[yycount++] = yytname[yyx];
yysize1 = yysize + yytnamerr (0, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
}
# if 0
/* This is so xgettext sees the translatable formats that are
constructed on the fly. */
YY_("syntax error, unexpected %s");
YY_("syntax error, unexpected %s, expecting %s");
YY_("syntax error, unexpected %s, expecting %s or %s");
YY_("syntax error, unexpected %s, expecting %s or %s or %s");
YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
# endif
char *yyfmt;
char const *yyf;
static char const yyunexpected[] = "syntax error, unexpected %s";
static char const yyexpecting[] = ", expecting %s";
static char const yyor[] = " or %s";
char yyformat[sizeof yyunexpected
+ sizeof yyexpecting - 1
+ ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
* (sizeof yyor - 1))];
char const *yyprefix = yyexpecting;
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn + 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yycount = 1;
yyarg[0] = yytname[yytype];
yyfmt = yystpcpy (yyformat, yyunexpected);
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
{
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
yycount = 1;
yysize = yysize0;
yyformat[sizeof yyunexpected - 1] = '\0';
break;
}
yyarg[yycount++] = yytname[yyx];
yysize1 = yysize + yytnamerr (0, yytname[yyx]);
yysize_overflow |= (yysize1 < yysize);
yysize = yysize1;
yyfmt = yystpcpy (yyfmt, yyprefix);
yyprefix = yyor;
}
yyf = YY_(yyformat);
yysize1 = yysize + yystrlen (yyf);
yysize_overflow |= (yysize1 < yysize);
yysize = yysize1;
if (yysize_overflow)
return YYSIZE_MAXIMUM;
if (yyresult)
{
/* Avoid sprintf, as that infringes on the user's name space.
Don't have undefined behavior even if the translation
produced a string with the wrong number of "%s"s. */
char *yyp = yyresult;
int yyi = 0;
while ((*yyp = *yyf) != '\0')
{
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyf += 2;
}
else
{
yyp++;
yyf++;
}
}
}
return yysize;
}
switch (yycount)
{
# define YYCASE_(N, S) \
case N: \
yyformat = S; \
break
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
# undef YYCASE_
}
yysize1 = yysize + yystrlen (yyformat);
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
if (*yymsg_alloc < yysize)
{
*yymsg_alloc = 2 * yysize;
if (! (yysize <= *yymsg_alloc
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
return 1;
}
/* Avoid sprintf, as that infringes on the user's name space.
Don't have undefined behavior even if the translation
produced a string with the wrong number of "%s"s. */
{
char *yyp = *yymsg;
int yyi = 0;
while ((*yyp = *yyformat) != '\0')
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyformat += 2;
}
else
{
yyp++;
yyformat++;
}
}
return 0;
}
#endif /* YYERROR_VERBOSE */
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
@ -1246,7 +1205,6 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, context)
}
}
/* Prevent warnings from -Wmissing-prototypes. */
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
@ -1263,9 +1221,12 @@ int yyparse ();
#endif /* ! YYPARSE_PARAM */
/*----------.
| yyparse. |
`----------*/
/*-------------------------.
| yyparse or yypush_parse. |
`-------------------------*/
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
@ -1329,7 +1290,7 @@ YYLTYPE yylloc;
YYLTYPE *yylsp;
/* The locations where the error started and ended. */
YYLTYPE yyerror_range[3];
YYLTYPE yyerror_range[2];
YYSIZE_T yystacksize;
@ -1376,7 +1337,7 @@ YYLTYPE yylloc;
yyvsp = yyvs;
yylsp = yyls;
#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
#if YYLTYPE_IS_TRIVIAL
/* Initialize the default location before parsing starts. */
yylloc.first_line = yylloc.last_line = 1;
yylloc.first_column = yylloc.last_column = 1;
@ -1478,7 +1439,7 @@ yybackup:
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yypact_value_is_default (yyn))
if (yyn == YYPACT_NINF)
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
@ -1509,8 +1470,8 @@ yybackup:
yyn = yytable[yyn];
if (yyn <= 0)
{
if (yytable_value_is_error (yyn))
goto yyerrlab;
if (yyn == 0 || yyn == YYTABLE_NINF)
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
@ -1566,7 +1527,7 @@ yyreduce:
{
case 6:
/* Line 1806 of yacc.c */
/* Line 1455 of yacc.c */
#line 108 "config_parser.yy"
{
context->HandleInclude((yyvsp[(2) - (2)].text));
@ -1575,7 +1536,7 @@ yyreduce:
case 7:
/* Line 1806 of yacc.c */
/* Line 1455 of yacc.c */
#line 113 "config_parser.yy"
{
m_Abstract = false;
@ -1585,7 +1546,7 @@ yyreduce:
case 8:
/* Line 1806 of yacc.c */
/* Line 1455 of yacc.c */
#line 118 "config_parser.yy"
{
m_Item = boost::make_shared<ConfigItemBuilder>(yylloc);
@ -1596,7 +1557,7 @@ yyreduce:
case 9:
/* Line 1806 of yacc.c */
/* Line 1455 of yacc.c */
#line 124 "config_parser.yy"
{
Object::Ptr exprl_object = *(yyvsp[(8) - (8)].variant);
@ -1614,7 +1575,7 @@ yyreduce:
case 12:
/* Line 1806 of yacc.c */
/* Line 1455 of yacc.c */
#line 143 "config_parser.yy"
{
m_Abstract = true;
@ -1623,7 +1584,7 @@ yyreduce:
case 13:
/* Line 1806 of yacc.c */
/* Line 1455 of yacc.c */
#line 147 "config_parser.yy"
{
m_Local = true;
@ -1632,7 +1593,7 @@ yyreduce:
case 16:
/* Line 1806 of yacc.c */
/* Line 1455 of yacc.c */
#line 157 "config_parser.yy"
{
m_Item->AddParent((yyvsp[(1) - (1)].text));
@ -1642,7 +1603,7 @@ yyreduce:
case 19:
/* Line 1806 of yacc.c */
/* Line 1455 of yacc.c */
#line 168 "config_parser.yy"
{
m_ExpressionLists.push(boost::make_shared<ExpressionList>());
@ -1651,7 +1612,7 @@ yyreduce:
case 20:
/* Line 1806 of yacc.c */
/* Line 1455 of yacc.c */
#line 173 "config_parser.yy"
{
(yyval.variant) = new Variant(m_ExpressionLists.top());
@ -1661,7 +1622,7 @@ yyreduce:
case 26:
/* Line 1806 of yacc.c */
/* Line 1455 of yacc.c */
#line 188 "config_parser.yy"
{
Expression expr((yyvsp[(1) - (3)].text), (yyvsp[(2) - (3)].op), *(yyvsp[(3) - (3)].variant), yylloc);
@ -1674,7 +1635,7 @@ yyreduce:
case 27:
/* Line 1806 of yacc.c */
/* Line 1455 of yacc.c */
#line 196 "config_parser.yy"
{
Expression subexpr((yyvsp[(3) - (6)].text), (yyvsp[(5) - (6)].op), *(yyvsp[(6) - (6)].variant), yylloc);
@ -1693,7 +1654,7 @@ yyreduce:
case 28:
/* Line 1806 of yacc.c */
/* Line 1455 of yacc.c */
#line 210 "config_parser.yy"
{
Expression expr((yyvsp[(1) - (1)].text), OperatorSet, (yyvsp[(1) - (1)].text), yylloc);
@ -1705,7 +1666,7 @@ yyreduce:
case 33:
/* Line 1806 of yacc.c */
/* Line 1455 of yacc.c */
#line 223 "config_parser.yy"
{
(yyval.op) = (yyvsp[(1) - (1)].op);
@ -1714,7 +1675,7 @@ yyreduce:
case 34:
/* Line 1806 of yacc.c */
/* Line 1455 of yacc.c */
#line 229 "config_parser.yy"
{
(yyval.variant) = new Variant((yyvsp[(1) - (1)].text));
@ -1724,7 +1685,7 @@ yyreduce:
case 35:
/* Line 1806 of yacc.c */
/* Line 1455 of yacc.c */
#line 234 "config_parser.yy"
{
(yyval.variant) = new Variant((yyvsp[(1) - (1)].num));
@ -1733,7 +1694,7 @@ yyreduce:
case 36:
/* Line 1806 of yacc.c */
/* Line 1455 of yacc.c */
#line 238 "config_parser.yy"
{
(yyval.variant) = new Variant();
@ -1742,7 +1703,7 @@ yyreduce:
case 39:
/* Line 1806 of yacc.c */
/* Line 1455 of yacc.c */
#line 246 "config_parser.yy"
{
(yyval.variant) = (yyvsp[(1) - (1)].variant);
@ -1751,7 +1712,7 @@ yyreduce:
case 40:
/* Line 1806 of yacc.c */
/* Line 1455 of yacc.c */
#line 252 "config_parser.yy"
{
m_Array = boost::make_shared<Dictionary>();
@ -1760,7 +1721,7 @@ yyreduce:
case 41:
/* Line 1806 of yacc.c */
/* Line 1455 of yacc.c */
#line 257 "config_parser.yy"
{
(yyval.variant) = new Variant(m_Array);
@ -1770,7 +1731,7 @@ yyreduce:
case 42:
/* Line 1806 of yacc.c */
/* Line 1455 of yacc.c */
#line 264 "config_parser.yy"
{
m_Array->AddUnnamedProperty(*(yyvsp[(1) - (1)].variant));
@ -1780,21 +1741,10 @@ yyreduce:
/* Line 1806 of yacc.c */
#line 1785 "config_parser.cc"
/* Line 1455 of yacc.c */
#line 1746 "config_parser.cc"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
that yytoken be updated with the new translation. We take the
approach of translating immediately before every use of yytoken.
One alternative is translating here after every semantic action,
but that translation would be missed if the semantic action invokes
YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
incorrect destructor might then be invoked immediately. In the
case of YYERROR or YYBACKUP, subsequent parser actions might lead
to an incorrect destructor call or verbose syntax error message
before the lookahead is translated. */
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
YYPOPSTACK (yylen);
@ -1823,10 +1773,6 @@ yyreduce:
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
@ -1834,40 +1780,41 @@ yyerrlab:
#if ! YYERROR_VERBOSE
yyerror (&yylloc, context, YY_("syntax error"));
#else
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
yyssp, yytoken)
{
char const *yymsgp = YY_("syntax error");
int yysyntax_error_status;
yysyntax_error_status = YYSYNTAX_ERROR;
if (yysyntax_error_status == 0)
yymsgp = yymsg;
else if (yysyntax_error_status == 1)
{
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
if (!yymsg)
{
yymsg = yymsgbuf;
yymsg_alloc = sizeof yymsgbuf;
yysyntax_error_status = 2;
}
else
{
yysyntax_error_status = YYSYNTAX_ERROR;
yymsgp = yymsg;
}
}
yyerror (&yylloc, context, yymsgp);
if (yysyntax_error_status == 2)
goto yyexhaustedlab;
YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
{
YYSIZE_T yyalloc = 2 * yysize;
if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
yyalloc = YYSTACK_ALLOC_MAXIMUM;
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
yymsg = (char *) YYSTACK_ALLOC (yyalloc);
if (yymsg)
yymsg_alloc = yyalloc;
else
{
yymsg = yymsgbuf;
yymsg_alloc = sizeof yymsgbuf;
}
}
if (0 < yysize && yysize <= yymsg_alloc)
{
(void) yysyntax_error (yymsg, yystate, yychar);
yyerror (&yylloc, context, yymsg);
}
else
{
yyerror (&yylloc, context, YY_("syntax error"));
if (yysize != 0)
goto yyexhaustedlab;
}
}
# undef YYSYNTAX_ERROR
#endif
}
yyerror_range[1] = yylloc;
yyerror_range[0] = yylloc;
if (yyerrstatus == 3)
{
@ -1904,7 +1851,7 @@ yyerrorlab:
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
yyerror_range[1] = yylsp[1-yylen];
yyerror_range[0] = yylsp[1-yylen];
/* Do not reclaim the symbols of the rule which action triggered
this YYERROR. */
YYPOPSTACK (yylen);
@ -1923,7 +1870,7 @@ yyerrlab1:
for (;;)
{
yyn = yypact[yystate];
if (!yypact_value_is_default (yyn))
if (yyn != YYPACT_NINF)
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
@ -1938,7 +1885,7 @@ yyerrlab1:
if (yyssp == yyss)
YYABORT;
yyerror_range[1] = *yylsp;
yyerror_range[0] = *yylsp;
yydestruct ("Error: popping",
yystos[yystate], yyvsp, yylsp, context);
YYPOPSTACK (1);
@ -1948,10 +1895,10 @@ yyerrlab1:
*++yyvsp = yylval;
yyerror_range[2] = yylloc;
yyerror_range[1] = yylloc;
/* Using YYLLOC is tempting, but would change the location of
the lookahead. YYLOC is available though. */
YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
*++yylsp = yyloc;
/* Shift the error token. */
@ -1987,13 +1934,8 @@ yyexhaustedlab:
yyreturn:
if (yychar != YYEMPTY)
{
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
yytoken = YYTRANSLATE (yychar);
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval, &yylloc, context);
}
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval, &yylloc, context);
/* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
@ -2018,7 +1960,7 @@ yyreturn:
/* Line 2067 of yacc.c */
/* Line 1675 of yacc.c */
#line 277 "config_parser.yy"

View File

@ -1,8 +1,10 @@
/* A Bison parser, made by GNU Bison 2.5. */
/* Bison interface for Yacc-like parsers in C
/* 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-2011 Free Software Foundation, Inc.
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
it under the terms of the GNU General Public License as published by
@ -32,7 +34,7 @@
/* "%code requires" blocks. */
/* Line 2068 of yacc.c */
/* Line 1676 of yacc.c */
#line 1 "config_parser.yy"
/******************************************************************************
@ -63,8 +65,8 @@ using namespace icinga;
/* Line 2068 of yacc.c */
#line 68 "config_parser.h"
/* Line 1676 of yacc.c */
#line 70 "config_parser.h"
/* Tokens. */
#ifndef YYTOKENTYPE
@ -111,7 +113,7 @@ using namespace icinga;
typedef union YYSTYPE
{
/* Line 2068 of yacc.c */
/* Line 1676 of yacc.c */
#line 38 "config_parser.yy"
char *text;
@ -121,8 +123,8 @@ typedef union YYSTYPE
/* Line 2068 of yacc.c */
#line 126 "config_parser.h"
/* Line 1676 of yacc.c */
#line 128 "config_parser.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */