+2010-12-29 Thomas Dickey <tom@crayon>
+
+ * defs.h, skeleton.c:
+ add const qualifier to skeleton data, per NetBSD changes (report by Christos Zoulas)
+
+ * defs.h:
+ mark all of the error-functions as non-returning (report by Christos Zoulas)
+
+ * test/grammar.tab.c, test/pure_calc.tab.c, test/pure_error.tab.c, test/calc.tab.c, test/calc1.tab.c, test/calc2.tab.c, test/calc3.tab.c, test/code_calc.code.c, test/code_error.code.c, test/error.tab.c, test/ftp.tab.c:
+ regen
+
+ * skeleton.c:
+ use only realloc() rather than realloc+malloc, agree that systems needing this
+ are very rare (prompted by NetBSD change).
+
+ * test/ftp.tab.c: regen
+
+2010-12-29 Christos.Zoulas
+
+ * test/ftp.y:
+ improve example, which was stuck in 19XX and assumed file sizes were longs.
+
+2010-12-29 Thomas Dickey <tom@crayon>
+
+ * test/ftp.tab.c, test/grammar.tab.c, test/pure_calc.tab.c, test/pure_error.tab.c, test/calc.tab.c, test/calc1.tab.c, test/calc2.tab.c, test/calc3.tab.c, test/code_calc.code.c, test/code_error.code.c, test/error.tab.c:
+ regen
+
+ * test/pure_error.y, test/pure_calc.y, test/ftp.y, test/error.y, test/code_error.y, test/code_calc.y, test/calc.y, test/calc3.y, test/calc2.y, test/calc1.y:
+ use byacc's YYLEX_DECL/YYERROR_DECL symbols to prototype yylex/yyerror
+
+ * skeleton.c:
+ remove explicit prototype for yylex() via YYLEX_DECL() macro, since that
+ would prevent declaring yylex() static (request by Christos Zoulas).
+
+ * test/calc2.tab.c, test/calc3.tab.c: regen
+
+2010-12-29 Christos.Zoulas
+
+ * output.c: correct definition for YYERROR_DECL()
+
+2010-12-29 Thomas Dickey <tom@crayon>
+
+ * package/debian/changelog, package/byacc.spec, VERSION: bump
+
2010-12-26 Thomas Dickey <tom@crayon>
* defs.h, main.c:
-/* $Id: defs.h,v 1.31 2010/12/27 01:21:59 tom Exp $ */
+/* $Id: defs.h,v 1.33 2010/12/29 20:57:30 tom Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
extern int exit_code;
extern int pure_parser;
-extern const char *banner[];
-extern const char *xdecls[];
-extern const char *tables[];
-extern const char *hdr_defs[];
-extern const char *hdr_vars[];
-extern const char *body_1[];
-extern const char *body_vars[];
-extern const char *body_2[];
-extern const char *body_3[];
-extern const char *trailer[];
-extern const char *trailer_2[];
+extern const char *const banner[];
+extern const char *const xdecls[];
+extern const char *const tables[];
+extern const char *const hdr_defs[];
+extern const char *const hdr_vars[];
+extern const char *const body_1[];
+extern const char *const body_vars[];
+extern const char *const body_2[];
+extern const char *const body_3[];
+extern const char *const trailer[];
+extern const char *const trailer_2[];
extern char *code_file_name;
extern char *input_file_name;
/* error.c */
extern void default_action_warning(void);
-extern void dollar_error(int a_lineno, char *a_line, char *a_cptr);
+extern void dollar_error(int a_lineno, char *a_line, char *a_cptr) GCC_NORETURN;
extern void dollar_warning(int a_lineno, int i);
-extern void fatal(const char *msg);
-extern void illegal_character(char *c_cptr);
-extern void illegal_tag(int t_lineno, char *t_line, char *t_cptr);
-extern void no_grammar(void);
-extern void no_space(void);
-extern void open_error(const char *filename);
-extern void over_unionized(char *u_cptr);
+extern void fatal(const char *msg) GCC_NORETURN;
+extern void illegal_character(char *c_cptr) GCC_NORETURN;
+extern void illegal_tag(int t_lineno, char *t_line, char *t_cptr) GCC_NORETURN;
+extern void no_grammar(void) GCC_NORETURN;
+extern void no_space(void) GCC_NORETURN;
+extern void open_error(const char *filename) GCC_NORETURN;
+extern void over_unionized(char *u_cptr) GCC_NORETURN;
extern void prec_redeclared(void);
extern void reprec_warning(char *s);
extern void restarted_warning(void);
extern void retyped_warning(char *s);
extern void revalued_warning(char *s);
extern void syntax_error(int st_lineno, char *st_line, char *st_cptr) GCC_NORETURN;
-extern void terminal_lhs(int s_lineno);
-extern void terminal_start(char *s);
-extern void tokenized_start(char *s);
-extern void undefined_goal(char *s);
+extern void terminal_lhs(int s_lineno) GCC_NORETURN;
+extern void terminal_start(char *s) GCC_NORETURN;
+extern void tokenized_start(char *s) GCC_NORETURN;
+extern void undefined_goal(char *s) GCC_NORETURN;
extern void undefined_symbol_warning(char *s);
-extern void unexpected_EOF(void);
-extern void unknown_rhs(int i);
-extern void unterminated_action(int a_lineno, char *a_line, char *a_cptr);
-extern void unterminated_comment(int c_lineno, char *c_line, char *c_cptr);
-extern void unterminated_string(int s_lineno, char *s_line, char *s_cptr);
-extern void unterminated_text(int t_lineno, char *t_line, char *t_cptr);
-extern void unterminated_union(int u_lineno, char *u_line, char *u_cptr);
-extern void untyped_lhs(void);
-extern void untyped_rhs(int i, char *s);
-extern void used_reserved(char *s);
+extern void unexpected_EOF(void) GCC_NORETURN;
+extern void unknown_rhs(int i) GCC_NORETURN;
+extern void unterminated_action(int a_lineno, char *a_line, char *a_cptr) GCC_NORETURN;
+extern void unterminated_comment(int c_lineno, char *c_line, char *c_cptr) GCC_NORETURN;
+extern void unterminated_string(int s_lineno, char *s_line, char *s_cptr) GCC_NORETURN;
+extern void unterminated_text(int t_lineno, char *t_line, char *t_cptr) GCC_NORETURN;
+extern void unterminated_union(int u_lineno, char *u_line, char *u_cptr) GCC_NORETURN;
+extern void untyped_lhs(void) GCC_NORETURN;
+extern void untyped_rhs(int i, char *s) GCC_NORETURN;
+extern void used_reserved(char *s) GCC_NORETURN;
/* graph.c */
extern void graph(void);
extern void reader(void);
/* skeleton.c */
-extern void write_section(const char *section[]);
+extern void write_section(const char *const section[]);
/* verbose.c */
extern void verbose(void);
-/* $Id: output.c,v 1.37 2010/11/27 17:28:29 tom Exp $ */
+/* $Id: output.c,v 1.38 2010/12/29 18:35:38 Christos.Zoulas Exp $ */
#include "defs.h"
{
param *p;
- putl_code("#define YYERROR_DECL() yyerror(YYSTYPE *v, const char *s)\n");
+ fprintf(code_file, "#define YYERROR_DECL() yyerror(");
+ for (p = parse_param; p; p = p->next)
+ fprintf(code_file, "%s %s%s, ", p->type, p->name, p->type2);
+ putl_code("const char *s)\n");
puts_code("#define YYERROR_CALL(msg) yyerror(");
Summary: byacc - public domain Berkeley LALR Yacc parser generator
%define AppProgram byacc
-%define AppVersion 20101226
+%define AppVersion 20101229
%define UseProgram yacc
-# $XTermId: byacc.spec,v 1.7 2010/12/26 00:37:15 tom Exp $
+# $XTermId: byacc.spec,v 1.8 2010/12/29 18:03:14 tom Exp $
Name: %{AppProgram}
Version: %{AppVersion}
Release: 1
+byacc (20101229) unstable; urgency=low
+
+ * fixes from Christos Zoulos
+
+ -- Thomas E. Dickey <dickey@invisible-island.net> Wed, 29 Dec 2010 13:03:50 -0500
+
byacc (20101226) unstable; urgency=low
* portability fix for MinGW
-/* $Id: skeleton.c,v 1.27 2010/11/26 17:24:00 tom Exp $ */
+/* $Id: skeleton.c,v 1.30 2010/12/29 20:57:21 tom Exp $ */
#include "defs.h"
/* the body either are not useful outside of semantic actions or */
/* are conditional. */
-const char *banner[] =
+const char *const banner[] =
{
"#ifndef lint",
"static const char yysccsid[] = \"@(#)yaccpar 1.9 (Berkeley) 02/21/93\";",
0
};
-const char *xdecls[] =
+const char *const xdecls[] =
{
"extern int YYPARSE_DECL();",
- "extern int YYLEX_DECL();",
"",
0
};
-const char *tables[] =
+const char *const tables[] =
{
"extern short yylhs[];",
"extern short yylen[];",
0
};
-const char *hdr_defs[] =
+const char *const hdr_defs[] =
{
"/* define the initial stack-sizes */",
"#ifdef YYSTACKSIZE",
0
};
-const char *hdr_vars[] =
+const char *const hdr_vars[] =
{
"int yyerrflag;",
"int yychar;",
0
};
-const char *body_vars[] =
+const char *const body_vars[] =
{
" int yyerrflag;",
" int yychar;",
0
};
-const char *body_1[] =
+const char *const body_1[] =
{
"",
"#if YYDEBUG",
" newsize = YYMAXDEPTH;",
"",
" 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));",
+ " newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));",
" if (newss == 0)",
" return -1;",
"",
" 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));",
+ " newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));",
" if (newvs == 0)",
" return -1;",
"",
0
};
-const char *body_2[] =
+const char *const body_2[] =
{
" int yym, yyn, yystate;",
"#if YYDEBUG",
0
};
-const char *body_3[] =
+const char *const body_3[] =
{
"",
" goto yyerrlab;",
0
};
-const char *trailer[] =
+const char *const trailer[] =
{
" }",
" yystack.s_mark -= yym;",
0
};
-const char *trailer_2[] =
+const char *const trailer_2[] =
{
"",
"yyabort:",
};
void
-write_section(const char *section[])
+write_section(const char *const section[])
{
int c;
int i;
#define YYERROR_CALL(msg) yyerror(msg)
extern int YYPARSE_DECL();
-extern int YYLEX_DECL();
#define DIGIT 257
#define LETTER 258
#line 63 "calc.y"
/* start of programs */
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
int
main (void)
{
}
return( c );
}
-#line 340 "calc.tab.c"
+#line 344 "calc.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
newsize = YYMAXDEPTH;
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));
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
if (newss == 0)
return -1;
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));
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
if (newvs == 0)
return -1;
%% /* start of programs */
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
int
main (void)
{
INTERVAL vmul(double, double, INTERVAL);
INTERVAL vdiv(double, double, INTERVAL);
+
int dcheck(INTERVAL);
double dreg[26];
INTERVAL vreg[26];
-#line 27 "calc1.y"
+#line 28 "calc1.y"
#ifdef YYSTYPE
#undef YYSTYPE_IS_DECLARED
#define YYSTYPE_IS_DECLARED 1
INTERVAL vval;
} YYSTYPE;
#endif /* !YYSTYPE_IS_DECLARED */
-#line 135 "calc1.tab.c"
+#line 136 "calc1.tab.c"
/* compatibility with bison */
#ifdef YYPARSE_PARAM
/* compatibility with FreeBSD */
#define YYERROR_CALL(msg) yyerror(msg)
extern int YYPARSE_DECL();
-extern int YYLEX_DECL();
#define DREG 257
#define VREG 258
/* variables for the parser stack */
static YYSTACKDATA yystack;
-#line 172 "calc1.y"
+#line 173 "calc1.y"
/* beginning of subroutines section */
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
#define BSZ 50 /* buffer size for floating point numbers */
/* lexical analysis */
{
return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
}
-#line 477 "calc1.tab.c"
+#line 482 "calc1.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
newsize = YYMAXDEPTH;
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));
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
if (newss == 0)
return -1;
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));
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
if (newvs == 0)
return -1;
switch (yyn)
{
case 3:
-#line 53 "calc1.y"
+#line 54 "calc1.y"
{
(void) printf("%15.8f\n", yystack.l_mark[-1].dval);
}
break;
case 4:
-#line 57 "calc1.y"
+#line 58 "calc1.y"
{
(void) printf("(%15.8f, %15.8f)\n", yystack.l_mark[-1].vval.lo, yystack.l_mark[-1].vval.hi);
}
break;
case 5:
-#line 61 "calc1.y"
+#line 62 "calc1.y"
{
dreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].dval;
}
break;
case 6:
-#line 65 "calc1.y"
+#line 66 "calc1.y"
{
vreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].vval;
}
break;
case 7:
-#line 69 "calc1.y"
+#line 70 "calc1.y"
{
yyerrok;
}
break;
case 9:
-#line 76 "calc1.y"
+#line 77 "calc1.y"
{
yyval.dval = dreg[yystack.l_mark[0].ival];
}
break;
case 10:
-#line 80 "calc1.y"
+#line 81 "calc1.y"
{
yyval.dval = yystack.l_mark[-2].dval + yystack.l_mark[0].dval;
}
break;
case 11:
-#line 84 "calc1.y"
+#line 85 "calc1.y"
{
yyval.dval = yystack.l_mark[-2].dval - yystack.l_mark[0].dval;
}
break;
case 12:
-#line 88 "calc1.y"
+#line 89 "calc1.y"
{
yyval.dval = yystack.l_mark[-2].dval * yystack.l_mark[0].dval;
}
break;
case 13:
-#line 92 "calc1.y"
+#line 93 "calc1.y"
{
yyval.dval = yystack.l_mark[-2].dval / yystack.l_mark[0].dval;
}
break;
case 14:
-#line 96 "calc1.y"
+#line 97 "calc1.y"
{
yyval.dval = -yystack.l_mark[0].dval;
}
break;
case 15:
-#line 100 "calc1.y"
+#line 101 "calc1.y"
{
yyval.dval = yystack.l_mark[-1].dval;
}
break;
case 16:
-#line 106 "calc1.y"
+#line 107 "calc1.y"
{
yyval.vval.hi = yyval.vval.lo = yystack.l_mark[0].dval;
}
break;
case 17:
-#line 110 "calc1.y"
+#line 111 "calc1.y"
{
yyval.vval.lo = yystack.l_mark[-3].dval;
yyval.vval.hi = yystack.l_mark[-1].dval;
}
break;
case 18:
-#line 120 "calc1.y"
+#line 121 "calc1.y"
{
yyval.vval = vreg[yystack.l_mark[0].ival];
}
break;
case 19:
-#line 124 "calc1.y"
+#line 125 "calc1.y"
{
yyval.vval.hi = yystack.l_mark[-2].vval.hi + yystack.l_mark[0].vval.hi;
yyval.vval.lo = yystack.l_mark[-2].vval.lo + yystack.l_mark[0].vval.lo;
}
break;
case 20:
-#line 129 "calc1.y"
+#line 130 "calc1.y"
{
yyval.vval.hi = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.hi;
yyval.vval.lo = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.lo;
}
break;
case 21:
-#line 134 "calc1.y"
+#line 135 "calc1.y"
{
yyval.vval.hi = yystack.l_mark[-2].vval.hi - yystack.l_mark[0].vval.lo;
yyval.vval.lo = yystack.l_mark[-2].vval.lo - yystack.l_mark[0].vval.hi;
}
break;
case 22:
-#line 139 "calc1.y"
+#line 140 "calc1.y"
{
yyval.vval.hi = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.lo;
yyval.vval.lo = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.hi;
}
break;
case 23:
-#line 144 "calc1.y"
+#line 145 "calc1.y"
{
yyval.vval = vmul( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
}
break;
case 24:
-#line 148 "calc1.y"
+#line 149 "calc1.y"
{
yyval.vval = vmul (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
}
break;
case 25:
-#line 152 "calc1.y"
+#line 153 "calc1.y"
{
if (dcheck(yystack.l_mark[0].vval)) YYERROR;
yyval.vval = vdiv ( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
}
break;
case 26:
-#line 157 "calc1.y"
+#line 158 "calc1.y"
{
if (dcheck ( yystack.l_mark[0].vval )) YYERROR;
yyval.vval = vdiv (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
}
break;
case 27:
-#line 162 "calc1.y"
+#line 163 "calc1.y"
{
yyval.vval.hi = -yystack.l_mark[0].vval.lo;
yyval.vval.lo = -yystack.l_mark[0].vval.hi;
}
break;
case 28:
-#line 167 "calc1.y"
+#line 168 "calc1.y"
{
yyval.vval = yystack.l_mark[-1].vval;
}
break;
-#line 850 "calc1.tab.c"
+#line 851 "calc1.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
INTERVAL vmul(double, double, INTERVAL);
INTERVAL vdiv(double, double, INTERVAL);
+
int dcheck(INTERVAL);
double dreg[26];
%% /* beginning of subroutines section */
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
#define BSZ 50 /* buffer size for floating point numbers */
/* lexical analysis */
#endif
/* Parameters sent to yyerror. */
-#define YYERROR_DECL() yyerror(YYSTYPE *v, const char *s)
+#define YYERROR_DECL() yyerror(int regs[26], int * base, const char *s)
#define YYERROR_CALL(msg) yyerror(regs, base, msg)
extern int YYPARSE_DECL();
-extern int YYLEX_DECL();
#define DIGIT 257
#define LETTER 258
#line 65 "calc2.y"
/* start of programs */
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
int
main (void)
{
}
return( c );
}
-#line 340 "calc2.tab.c"
+#line 344 "calc2.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
newsize = YYMAXDEPTH;
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));
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
if (newss == 0)
return -1;
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));
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
if (newvs == 0)
return -1;
%% /* start of programs */
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
int
main (void)
{
#endif
/* Parameters sent to yyerror. */
-#define YYERROR_DECL() yyerror(YYSTYPE *v, const char *s)
+#define YYERROR_DECL() yyerror(int regs[26], int * base, const char *s)
#define YYERROR_CALL(msg) yyerror(regs, base, msg)
extern int YYPARSE_DECL();
-extern int YYLEX_DECL();
#define DIGIT 257
#define LETTER 258
#line 67 "calc3.y"
/* start of programs */
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
int
main (void)
{
}
return( c );
}
-#line 333 "calc3.tab.c"
+#line 337 "calc3.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
newsize = YYMAXDEPTH;
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));
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
if (newss == 0)
return -1;
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));
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
if (newvs == 0)
return -1;
%% /* start of programs */
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
int
main (void)
{
#define YYERROR_CALL(msg) yyerror(msg)
extern int YYPARSE_DECL();
-extern int YYLEX_DECL();
#define DIGIT 257
#define LETTER 258
#endif /* yyrule */
#define YYPREFIX "calc_"
extern int YYPARSE_DECL();
-extern int YYLEX_DECL();
extern short yylhs[];
extern short yylen[];
#line 63 "code_calc.y"
/* start of programs */
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
int
main (void)
{
}
return( c );
}
-#line 241 "code_calc.code.c"
+#line 244 "code_calc.code.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
newsize = YYMAXDEPTH;
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));
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
if (newss == 0)
return -1;
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));
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
if (newvs == 0)
return -1;
#line 60 "code_calc.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
-#line 511 "code_calc.code.c"
+#line 510 "code_calc.code.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
%% /* start of programs */
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
int
main (void)
{
#define YYERROR_CALL(msg) yyerror(msg)
extern int YYPARSE_DECL();
-extern int YYLEX_DECL();
#define YYERRCODE 256
#define YYTABLESIZE 0
#endif /* yyrule */
#define YYPREFIX "error_"
extern int YYPARSE_DECL();
-extern int YYLEX_DECL();
extern short yylhs[];
extern short yylen[];
#include <stdio.h>
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
int
main(void)
{
{
printf("%s\n", s);
}
-#line 211 "code_error.code.c"
+#line 214 "code_error.code.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
newsize = YYMAXDEPTH;
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));
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
if (newss == 0)
return -1;
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));
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
if (newvs == 0)
return -1;
#include <stdio.h>
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
int
main(void)
{
#define YYERROR_CALL(msg) yyerror(msg)
extern int YYPARSE_DECL();
-extern int YYLEX_DECL();
#define YYERRCODE 256
static const short error_lhs[] = { -1,
#include <stdio.h>
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
int
main(void)
{
{
printf("%s\n", s);
}
-#line 228 "error.tab.c"
+#line 232 "error.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
newsize = YYMAXDEPTH;
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));
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
if (newss == 0)
return -1;
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));
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
if (newvs == 0)
return -1;
#include <stdio.h>
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
int
main(void)
{
#define YYERROR_CALL(msg) yyerror(msg)
extern int YYPARSE_DECL();
-extern int YYLEX_DECL();
#define A 257
#define B 258
/* variables for the parser stack */
static YYSTACKDATA yystack;
-#line 688 "ftp.y"
+#line 689 "ftp.y"
+
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
extern jmp_buf errcatch;
(stbuf.st_mode&S_IFMT) != S_IFREG)
reply(550, "%s: not a plain file.", filename);
else
+#ifdef HAVE_LONG_LONG
+ reply(213, "%llu", (long long) stbuf.st_size);
+#else
reply(213, "%lu", stbuf.st_size);
+#endif
break;}
case TYPE_A: {
FILE *fin;
reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]);
}
}
-#line 1070 "ftp.tab.c"
+#line 1078 "ftp.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
newsize = YYMAXDEPTH;
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));
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
if (newss == 0)
return -1;
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));
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
if (newvs == 0)
return -1;
case 17:
#line 255 "ftp.y"
{
- if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
+ if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
send_file_list((char *) yystack.l_mark[-1]);
if (yystack.l_mark[-1] != 0)
free((char *) yystack.l_mark[-1]);
register struct tm *t;
t = gmtime(&stbuf.st_mtime);
reply(213,
- "19%02d%02d%02d%02d%02d%02d",
- t->tm_year, t->tm_mon+1, t->tm_mday,
+ "%04d%02d%02d%02d%02d%02d",
+ 1900 + t->tm_year,
+ t->tm_mon+1, t->tm_mday,
t->tm_hour, t->tm_min, t->tm_sec);
}
}
}
break;
case 45:
-#line 499 "ftp.y"
+#line 500 "ftp.y"
{
reply(221, "Goodbye.");
dologout(0);
}
break;
case 46:
-#line 504 "ftp.y"
+#line 505 "ftp.y"
{
yyerrok;
}
break;
case 47:
-#line 509 "ftp.y"
+#line 510 "ftp.y"
{
if (yystack.l_mark[-3] && yystack.l_mark[-1]) {
fromname = renamefrom((char *) yystack.l_mark[-1]);
}
break;
case 49:
-#line 523 "ftp.y"
+#line 524 "ftp.y"
{
*(const char **)(&(yyval)) = "";
}
break;
case 52:
-#line 534 "ftp.y"
+#line 535 "ftp.y"
{
register char *a, *p;
}
break;
case 53:
-#line 546 "ftp.y"
+#line 547 "ftp.y"
{
yyval = FORM_N;
}
break;
case 54:
-#line 550 "ftp.y"
+#line 551 "ftp.y"
{
yyval = FORM_T;
}
break;
case 55:
-#line 554 "ftp.y"
+#line 555 "ftp.y"
{
yyval = FORM_C;
}
break;
case 56:
-#line 560 "ftp.y"
+#line 561 "ftp.y"
{
cmd_type = TYPE_A;
cmd_form = FORM_N;
}
break;
case 57:
-#line 565 "ftp.y"
+#line 566 "ftp.y"
{
cmd_type = TYPE_A;
cmd_form = yystack.l_mark[0];
}
break;
case 58:
-#line 570 "ftp.y"
+#line 571 "ftp.y"
{
cmd_type = TYPE_E;
cmd_form = FORM_N;
}
break;
case 59:
-#line 575 "ftp.y"
+#line 576 "ftp.y"
{
cmd_type = TYPE_E;
cmd_form = yystack.l_mark[0];
}
break;
case 60:
-#line 580 "ftp.y"
+#line 581 "ftp.y"
{
cmd_type = TYPE_I;
}
break;
case 61:
-#line 584 "ftp.y"
+#line 585 "ftp.y"
{
cmd_type = TYPE_L;
cmd_bytesz = NBBY;
}
break;
case 62:
-#line 589 "ftp.y"
+#line 590 "ftp.y"
{
cmd_type = TYPE_L;
cmd_bytesz = yystack.l_mark[0];
}
break;
case 63:
-#line 595 "ftp.y"
+#line 596 "ftp.y"
{
cmd_type = TYPE_L;
cmd_bytesz = yystack.l_mark[0];
}
break;
case 64:
-#line 602 "ftp.y"
+#line 603 "ftp.y"
{
yyval = STRU_F;
}
break;
case 65:
-#line 606 "ftp.y"
+#line 607 "ftp.y"
{
yyval = STRU_R;
}
break;
case 66:
-#line 610 "ftp.y"
+#line 611 "ftp.y"
{
yyval = STRU_P;
}
break;
case 67:
-#line 616 "ftp.y"
+#line 617 "ftp.y"
{
yyval = MODE_S;
}
break;
case 68:
-#line 620 "ftp.y"
+#line 621 "ftp.y"
{
yyval = MODE_B;
}
break;
case 69:
-#line 624 "ftp.y"
+#line 625 "ftp.y"
{
yyval = MODE_C;
}
break;
case 70:
-#line 630 "ftp.y"
+#line 631 "ftp.y"
{
/*
* Problem: this production is used for all pathname
}
break;
case 72:
-#line 652 "ftp.y"
+#line 653 "ftp.y"
{
register int ret, dec, multby, digit;
}
break;
case 73:
-#line 677 "ftp.y"
+#line 678 "ftp.y"
{
if (logged_in)
yyval = 1;
}
}
break;
-#line 1916 "ftp.tab.c"
+#line 1921 "ftp.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
}
| NLST check_login SP STRING CRLF
= {
- if ($2 && $4 != 0)
+ if ($2 && $4 != 0)
send_file_list((char *) $4);
if ($4 != 0)
free((char *) $4);
register struct tm *t;
t = gmtime(&stbuf.st_mtime);
reply(213,
- "19%02d%02d%02d%02d%02d%02d",
- t->tm_year, t->tm_mon+1, t->tm_mday,
+ "%04d%02d%02d%02d%02d%02d",
+ 1900 + t->tm_year,
+ t->tm_mon+1, t->tm_mday,
t->tm_hour, t->tm_min, t->tm_sec);
}
}
}
}
;
-
+
username: STRING
;
byte_size: NUMBER
;
-host_port: NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA
+host_port: NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA
NUMBER COMMA NUMBER
= {
register char *a, *p;
%%
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
extern jmp_buf errcatch;
static void upper(char *);
(stbuf.st_mode&S_IFMT) != S_IFREG)
reply(550, "%s: not a plain file.", filename);
else
+#ifdef HAVE_LONG_LONG
+ reply(213, "%llu", (long long) stbuf.st_size);
+#else
reply(213, "%lu", stbuf.st_size);
+#endif
break;}
case TYPE_A: {
FILE *fin;
#define YYERROR_CALL(msg) yyerror(msg)
extern int YYPARSE_DECL();
-extern int YYLEX_DECL();
#define T_IDENTIFIER 257
#define T_TYPEDEF_NAME 258
#endif
}
#endif
-#line 1072 "grammar.tab.c"
+#line 1071 "grammar.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
newsize = YYMAXDEPTH;
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));
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
if (newss == 0)
return -1;
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));
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
if (newvs == 0)
return -1;
yyval.declarator->func_def = FUNC_ANSI;
}
break;
-#line 1956 "grammar.tab.c"
+#line 1951 "grammar.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
#define YYERROR_CALL(msg) yyerror(msg)
extern int YYPARSE_DECL();
-extern int YYLEX_DECL();
#define DIGIT 257
#define LETTER 258
#line 63 "pure_calc.y"
/* start of programs */
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
int
main (void)
{
}
return( c );
}
-#line 333 "pure_calc.tab.c"
+#line 337 "pure_calc.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
newsize = YYMAXDEPTH;
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));
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
if (newss == 0)
return -1;
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));
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
if (newvs == 0)
return -1;
%% /* start of programs */
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
int
main (void)
{
#define YYERROR_CALL(msg) yyerror(msg)
extern int YYPARSE_DECL();
-extern int YYLEX_DECL();
#define YYERRCODE 256
static const short error_lhs[] = { -1,
#include <stdio.h>
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
int
main(void)
{
{
printf("%s\n", s);
}
-#line 221 "pure_error.tab.c"
+#line 225 "pure_error.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
newsize = YYMAXDEPTH;
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));
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
if (newss == 0)
return -1;
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));
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
if (newvs == 0)
return -1;
#include <stdio.h>
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
int
main(void)
{