summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib/com_err/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/heimdal/lib/com_err/parse.c')
-rw-r--r--source4/heimdal/lib/com_err/parse.c265
1 files changed, 156 insertions, 109 deletions
diff --git a/source4/heimdal/lib/com_err/parse.c b/source4/heimdal/lib/com_err/parse.c
index a426613303..b2b0fc1090 100644
--- a/source4/heimdal/lib/com_err/parse.c
+++ b/source4/heimdal/lib/com_err/parse.c
@@ -8,17 +8,29 @@ static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
#define YYBYACC 1
#define YYMAJOR 1
#define YYMINOR 9
-#define YYPATCH 20070509
+#define YYPATCH 20100216
-#define YYEMPTY (-1)
-#define yyclearin (yychar = YYEMPTY)
-#define yyerrok (yyerrflag = 0)
-#define YYRECOVERING (yyerrflag != 0)
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
-extern int yyparse(void);
-
-static int yygrowstack(void);
#define YYPREFIX "yy"
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+#ifdef YYPARSE_PARAM_TYPE
+#define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+#else
+#define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+#endif
+#else
+#define YYPARSE_DECL() yyparse(void)
+#endif /* YYPARSE_PARAM */
+
+extern int YYPARSE_DECL();
+
#line 2 ""
/*
* Copyright (c) 1998 - 2000 Kungliga Tekniska Högskolan
@@ -67,12 +79,15 @@ extern char *yytext;
#define alloca(x) malloc(x)
#endif
-#line 51 ""
+#define YYMALLOC malloc
+#define YYFREE free
+
+#line 54 ""
typedef union {
char *string;
int number;
} YYSTYPE;
-#line 76 ""
+#line 90 ""
#define ET 257
#define INDEX 258
#define PREFIX 259
@@ -82,37 +97,37 @@ typedef union {
#define STRING 263
#define NUMBER 264
#define YYERRCODE 256
-short yylhs[] = { -1,
+static const short yylhs[] = { -1,
0, 0, 1, 1, 3, 4, 4, 2, 2, 5,
5, 5, 5, 5,
};
-short yylen[] = { 2,
+static const short yylen[] = { 2,
0, 2, 2, 1, 2, 2, 3, 1, 2, 2,
2, 1, 4, 1,
};
-short yydefred[] = { 0,
+static const short yydefred[] = { 0,
0, 0, 0, 0, 0, 4, 0, 5, 0, 0,
0, 14, 0, 8, 3, 7, 10, 11, 0, 9,
0, 13,
};
-short yydgoto[] = { 3,
+static const short yydgoto[] = { 3,
4, 13, 5, 6, 14,
};
-short yysindex[] = { -247,
+static const short yysindex[] = { -247,
-263, -258, 0, -256, -245, 0, -250, 0, -249, -246,
-244, 0, -256, 0, 0, 0, 0, 0, -28, 0,
-243, 0,
};
-short yyrindex[] = { 18,
+static const short yyrindex[] = { 18,
0, 0, 0, 0, 0, 0, -251, 0, 0, 1,
0, 0, 21, 0, 0, 0, 0, 0, 0, 0,
0, 0,
};
-short yygindex[] = { 0,
+static const short yygindex[] = { 0,
0, 0, 0, 17, 10,
};
#define YYTABLESIZE 263
-short yytable[] = { 7,
+static const short yytable[] = { 7,
12, 9, 10, 11, 8, 12, 6, 6, 6, 1,
6, 1, 16, 2, 17, 21, 18, 1, 19, 22,
2, 15, 20, 0, 0, 0, 0, 0, 0, 0,
@@ -141,7 +156,7 @@ short yytable[] = { 7,
0, 0, 0, 0, 0, 0, 0, 0, 12, 12,
12, 0, 12,
};
-short yycheck[] = { 263,
+static const short yycheck[] = { 263,
0, 258, 259, 260, 263, 262, 258, 259, 260, 257,
262, 257, 263, 261, 264, 44, 263, 0, 263, 263,
0, 5, 13, -1, -1, -1, -1, -1, -1, -1,
@@ -176,7 +191,8 @@ short yycheck[] = { 263,
#endif
#define YYMAXTOKEN 264
#if YYDEBUG
-char *yyname[] = {
+static const char *yyname[] = {
+
"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -186,7 +202,7 @@ char *yyname[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"ET","INDEX","PREFIX","EC",
"ID","END","STRING","NUMBER",
};
-char *yyrule[] = {
+static const char *yyrule[] = {
"$accept : file",
"file :",
"file : header statements",
@@ -202,6 +218,7 @@ char *yyrule[] = {
"statement : PREFIX",
"statement : EC STRING ',' STRING",
"statement : END",
+
};
#endif
#if YYDEBUG
@@ -225,19 +242,26 @@ char *yyrule[] = {
int yydebug;
int yynerrs;
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+
+#define YYPURE 0
+
int yyerrflag;
int yychar;
-short *yyssp;
-YYSTYPE *yyvsp;
YYSTYPE yyval;
YYSTYPE yylval;
/* variables for the parser stack */
-static short *yyss;
-static short *yysslim;
-static YYSTYPE *yyvs;
-static int yystacksize;
-#line 141 ""
+static YYSTACKDATA yystack;
+#line 144 ""
static long
name2number(const char *str)
@@ -267,55 +291,70 @@ name2number(const char *str)
void
yyerror (char *s)
{
- error_message ("%s\n", s);
+ lex_error_message ("%s\n", s);
}
-#line 273 ""
+#line 296 ""
/* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack(void)
+static int yygrowstack(YYSTACKDATA *data)
{
- int newsize, i;
+ int i;
+ unsigned newsize;
short *newss;
YYSTYPE *newvs;
- if ((newsize = yystacksize) == 0)
+ if ((newsize = data->stacksize) == 0)
newsize = YYINITSTACKSIZE;
else if (newsize >= YYMAXDEPTH)
return -1;
else if ((newsize *= 2) > YYMAXDEPTH)
newsize = YYMAXDEPTH;
- i = yyssp - yyss;
- newss = (yyss != 0)
- ? (short *)realloc(yyss, newsize * sizeof(*newss))
+ i = data->s_mark - data->s_base;
+ newss = (data->s_base != 0)
+ ? (short *)realloc(data->s_base, newsize * sizeof(*newss))
: (short *)malloc(newsize * sizeof(*newss));
if (newss == 0)
return -1;
- yyss = newss;
- yyssp = newss + i;
- newvs = (yyvs != 0)
- ? (YYSTYPE *)realloc(yyvs, newsize * sizeof(*newvs))
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (data->l_base != 0)
+ ? (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs))
: (YYSTYPE *)malloc(newsize * sizeof(*newvs));
if (newvs == 0)
return -1;
- yyvs = newvs;
- yyvsp = newvs + i;
- yystacksize = newsize;
- yysslim = yyss + newsize - 1;
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
return 0;
}
-#define YYABORT goto yyabort
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif
+
+#define YYABORT goto yyabort
#define YYREJECT goto yyabort
#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
+#define YYERROR goto yyerrlab
+
int
-yyparse(void)
+YYPARSE_DECL()
{
- register int yym, yyn, yystate;
+ int yym, yyn, yystate;
#if YYDEBUG
- register const char *yys;
+ const char *yys;
if ((yys = getenv("YYDEBUG")) != 0)
{
@@ -328,11 +367,17 @@ yyparse(void)
yynerrs = 0;
yyerrflag = 0;
yychar = YYEMPTY;
+ yystate = 0;
- if (yyss == NULL && yygrowstack()) goto yyoverflow;
- yyssp = yyss;
- yyvsp = yyvs;
- *yyssp = yystate = 0;
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+ yystate = 0;
+ *yystack.s_mark = 0;
yyloop:
if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
@@ -358,12 +403,13 @@ yyloop:
printf("%sdebug: state %d, shifting to state %d\n",
YYPREFIX, yystate, yytable[yyn]);
#endif
- if (yyssp >= yysslim && yygrowstack())
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
{
goto yyoverflow;
}
- *++yyssp = yystate = yytable[yyn];
- *++yyvsp = yylval;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
yychar = YYEMPTY;
if (yyerrflag > 0) --yyerrflag;
goto yyloop;
@@ -378,9 +424,7 @@ yyloop:
yyerror("syntax error");
-#ifdef lint
goto yyerrlab;
-#endif
yyerrlab:
++yynerrs;
@@ -391,20 +435,21 @@ yyinrecovery:
yyerrflag = 3;
for (;;)
{
- if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
+ if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
{
#if YYDEBUG
if (yydebug)
printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
+ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
#endif
- if (yyssp >= yysslim && yygrowstack())
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
{
goto yyoverflow;
}
- *++yyssp = yystate = yytable[yyn];
- *++yyvsp = yylval;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
goto yyloop;
}
else
@@ -412,11 +457,11 @@ yyinrecovery:
#if YYDEBUG
if (yydebug)
printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yyssp);
+ YYPREFIX, *yystack.s_mark);
#endif
- if (yyssp <= yyss) goto yyabort;
- --yyssp;
- --yyvsp;
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+ --yystack.s_mark;
+ --yystack.l_mark;
}
}
}
@@ -445,53 +490,53 @@ yyreduce:
#endif
yym = yylen[yyn];
if (yym)
- yyval = yyvsp[1-yym];
+ yyval = yystack.l_mark[1-yym];
else
memset(&yyval, 0, sizeof yyval);
switch (yyn)
{
case 5:
-#line 71 ""
-{
- id_str = yyvsp[0].string;
+#line 74 ""
+ {
+ id_str = yystack.l_mark[0].string;
}
break;
case 6:
-#line 77 ""
-{
- base_id = name2number(yyvsp[0].string);
- strlcpy(name, yyvsp[0].string, sizeof(name));
- free(yyvsp[0].string);
+#line 80 ""
+ {
+ base_id = name2number(yystack.l_mark[0].string);
+ strlcpy(name, yystack.l_mark[0].string, sizeof(name));
+ free(yystack.l_mark[0].string);
}
break;
case 7:
-#line 83 ""
-{
- base_id = name2number(yyvsp[-1].string);
- strlcpy(name, yyvsp[0].string, sizeof(name));
- free(yyvsp[-1].string);
- free(yyvsp[0].string);
+#line 86 ""
+ {
+ base_id = name2number(yystack.l_mark[-1].string);
+ strlcpy(name, yystack.l_mark[0].string, sizeof(name));
+ free(yystack.l_mark[-1].string);
+ free(yystack.l_mark[0].string);
}
break;
case 10:
-#line 96 ""
-{
- number = yyvsp[0].number;
+#line 99 ""
+ {
+ number = yystack.l_mark[0].number;
}
break;
case 11:
-#line 100 ""
-{
+#line 103 ""
+ {
free(prefix);
- asprintf (&prefix, "%s_", yyvsp[0].string);
+ asprintf (&prefix, "%s_", yystack.l_mark[0].string);
if (prefix == NULL)
errx(1, "malloc");
- free(yyvsp[0].string);
+ free(yystack.l_mark[0].string);
}
break;
case 12:
-#line 108 ""
-{
+#line 111 ""
+ {
prefix = realloc(prefix, 1);
if (prefix == NULL)
errx(1, "malloc");
@@ -499,8 +544,8 @@ case 12:
}
break;
case 13:
-#line 115 ""
-{
+#line 118 ""
+ {
struct error_code *ec = malloc(sizeof(*ec));
if (ec == NULL)
@@ -509,28 +554,28 @@ case 13:
ec->next = NULL;
ec->number = number;
if(prefix && *prefix != '\0') {
- asprintf (&ec->name, "%s%s", prefix, yyvsp[-2].string);
+ asprintf (&ec->name, "%s%s", prefix, yystack.l_mark[-2].string);
if (ec->name == NULL)
errx(1, "malloc");
- free(yyvsp[-2].string);
+ free(yystack.l_mark[-2].string);
} else
- ec->name = yyvsp[-2].string;
- ec->string = yyvsp[0].string;
+ ec->name = yystack.l_mark[-2].string;
+ ec->string = yystack.l_mark[0].string;
APPEND(codes, ec);
number++;
}
break;
case 14:
-#line 135 ""
-{
+#line 138 ""
+ {
YYACCEPT;
}
break;
-#line 530 ""
+#line 574 ""
}
- yyssp -= yym;
- yystate = *yyssp;
- yyvsp -= yym;
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
yym = yylhs[yyn];
if (yystate == 0 && yym == 0)
{
@@ -540,8 +585,8 @@ break;
state %d\n", YYPREFIX, YYFINAL);
#endif
yystate = YYFINAL;
- *++yyssp = YYFINAL;
- *++yyvsp = yyval;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
if (yychar < 0)
{
if ((yychar = yylex()) < 0) yychar = 0;
@@ -567,22 +612,24 @@ break;
#if YYDEBUG
if (yydebug)
printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yyssp, yystate);
+to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
#endif
- if (yyssp >= yysslim && yygrowstack())
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
{
goto yyoverflow;
}
- *++yyssp = yystate;
- *++yyvsp = yyval;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
goto yyloop;
yyoverflow:
yyerror("yacc stack overflow");
yyabort:
+ yyfreestack(&yystack);
return (1);
yyaccept:
+ yyfreestack(&yystack);
return (0);
}