diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-01 14:46:37 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-01 14:46:37 +0900 |
commit | d3613397480d95ca222512ea4be3814fc6726b5f (patch) | |
tree | 0f8a3120271b36494d33b200d264b2657d987010 /test | |
parent | 30c125a1e41107d7f8a5cabcbdebb427364152bd (diff) | |
download | byacc-d3613397480d95ca222512ea4be3814fc6726b5f.tar.gz byacc-d3613397480d95ca222512ea4be3814fc6726b5f.tar.bz2 byacc-d3613397480d95ca222512ea4be3814fc6726b5f.zip |
Imported Upstream version 20101229upstream/20101229
Diffstat (limited to 'test')
-rw-r--r-- | test/calc.tab.c | 16 | ||||
-rw-r--r-- | test/calc.y | 5 | ||||
-rw-r--r-- | test/calc1.tab.c | 75 | ||||
-rw-r--r-- | test/calc1.y | 6 | ||||
-rw-r--r-- | test/calc2.tab.c | 18 | ||||
-rw-r--r-- | test/calc2.y | 5 | ||||
-rw-r--r-- | test/calc3.tab.c | 18 | ||||
-rw-r--r-- | test/calc3.y | 5 | ||||
-rw-r--r-- | test/code_calc.code.c | 19 | ||||
-rw-r--r-- | test/code_calc.y | 5 | ||||
-rw-r--r-- | test/code_error.code.c | 17 | ||||
-rw-r--r-- | test/code_error.y | 5 | ||||
-rw-r--r-- | test/error.tab.c | 16 | ||||
-rw-r--r-- | test/error.y | 5 | ||||
-rw-r--r-- | test/ftp.tab.c | 81 | ||||
-rw-r--r-- | test/ftp.y | 20 | ||||
-rw-r--r-- | test/grammar.tab.c | 13 | ||||
-rw-r--r-- | test/pure_calc.tab.c | 16 | ||||
-rw-r--r-- | test/pure_calc.y | 5 | ||||
-rw-r--r-- | test/pure_error.tab.c | 16 | ||||
-rw-r--r-- | test/pure_error.y | 5 |
21 files changed, 213 insertions, 158 deletions
diff --git a/test/calc.tab.c b/test/calc.tab.c index bd98caa..9554d8f 100644 --- a/test/calc.tab.c +++ b/test/calc.tab.c @@ -134,7 +134,6 @@ typedef int YYSTYPE; #define YYERROR_CALL(msg) yyerror(msg) extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); #define DIGIT 257 #define LETTER 258 @@ -297,6 +296,11 @@ static YYSTACKDATA yystack; #line 63 "calc.y" /* start of programs */ +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main (void) { @@ -336,7 +340,7 @@ yylex(void) } return( c ); } -#line 340 "calc.tab.c" +#line 344 "calc.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -361,18 +365,14 @@ static int yygrowstack(YYSTACKDATA *data) 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; diff --git a/test/calc.y b/test/calc.y index da02c19..654062b 100644 --- a/test/calc.y +++ b/test/calc.y @@ -62,6 +62,11 @@ number: DIGIT %% /* start of programs */ +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main (void) { diff --git a/test/calc1.tab.c b/test/calc1.tab.c index 0597b94..e55e64a 100644 --- a/test/calc1.tab.c +++ b/test/calc1.tab.c @@ -112,12 +112,13 @@ INTERVAL; 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 @@ -131,7 +132,7 @@ typedef union 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 */ @@ -158,7 +159,6 @@ typedef union #define YYERROR_CALL(msg) yyerror(msg) extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); #define DREG 257 #define VREG 258 @@ -342,9 +342,14 @@ YYSTYPE yylval; /* 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 */ @@ -473,7 +478,7 @@ vdiv(double a, double b, INTERVAL v) { 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 */ @@ -498,18 +503,14 @@ static int yygrowstack(YYSTACKDATA *data) 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; @@ -684,85 +685,85 @@ yyreduce: 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; @@ -774,79 +775,79 @@ case 17: } 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; diff --git a/test/calc1.y b/test/calc1.y index d99dd2d..00a560f 100644 --- a/test/calc1.y +++ b/test/calc1.y @@ -15,6 +15,7 @@ INTERVAL; INTERVAL vmul(double, double, INTERVAL); INTERVAL vdiv(double, double, INTERVAL); + int dcheck(INTERVAL); double dreg[26]; @@ -171,6 +172,11 @@ vexp : dexp %% /* 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 */ diff --git a/test/calc2.tab.c b/test/calc2.tab.c index 4cf9c03..15d51e8 100644 --- a/test/calc2.tab.c +++ b/test/calc2.tab.c @@ -127,11 +127,10 @@ typedef int YYSTYPE; #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 @@ -294,6 +293,11 @@ static YYSTACKDATA yystack; #line 65 "calc2.y" /* start of programs */ +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main (void) { @@ -336,7 +340,7 @@ yylex(int *base) } return( c ); } -#line 340 "calc2.tab.c" +#line 344 "calc2.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -361,18 +365,14 @@ static int yygrowstack(YYSTACKDATA *data) 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; diff --git a/test/calc2.y b/test/calc2.y index ca6b74a..4b2d42f 100644 --- a/test/calc2.y +++ b/test/calc2.y @@ -64,6 +64,11 @@ number: DIGIT %% /* start of programs */ +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main (void) { diff --git a/test/calc3.tab.c b/test/calc3.tab.c index 1ef1908..c37df50 100644 --- a/test/calc3.tab.c +++ b/test/calc3.tab.c @@ -127,11 +127,10 @@ typedef int YYSTYPE; #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 @@ -287,6 +286,11 @@ typedef struct { #line 67 "calc3.y" /* start of programs */ +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main (void) { @@ -329,7 +333,7 @@ YYLEX_DECL() } return( c ); } -#line 333 "calc3.tab.c" +#line 337 "calc3.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -354,18 +358,14 @@ static int yygrowstack(YYSTACKDATA *data) 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; diff --git a/test/calc3.y b/test/calc3.y index ce55a9c..9b31546 100644 --- a/test/calc3.y +++ b/test/calc3.y @@ -66,6 +66,11 @@ number: DIGIT %% /* start of programs */ +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main (void) { diff --git a/test/code_calc.code.c b/test/code_calc.code.c index 6833def..9a663ef 100644 --- a/test/code_calc.code.c +++ b/test/code_calc.code.c @@ -53,7 +53,6 @@ typedef int YYSTYPE; #define YYERROR_CALL(msg) yyerror(msg) extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); #define DIGIT 257 #define LETTER 258 @@ -147,7 +146,6 @@ extern int YYLEX_DECL(); #endif /* yyrule */ #define YYPREFIX "calc_" extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); extern short yylhs[]; extern short yylen[]; @@ -199,6 +197,11 @@ static YYSTACKDATA yystack; #line 63 "code_calc.y" /* start of programs */ +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main (void) { @@ -237,7 +240,7 @@ yylex(void) { } return( c ); } -#line 241 "code_calc.code.c" +#line 244 "code_calc.code.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -262,18 +265,14 @@ static int yygrowstack(YYSTACKDATA *data) 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; @@ -507,7 +506,7 @@ case 18: #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; diff --git a/test/code_calc.y b/test/code_calc.y index 9644e07..a9b0b3e 100644 --- a/test/code_calc.y +++ b/test/code_calc.y @@ -62,6 +62,11 @@ number: DIGIT %% /* start of programs */ +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main (void) { diff --git a/test/code_error.code.c b/test/code_error.code.c index 35050b5..dd3d96b 100644 --- a/test/code_error.code.c +++ b/test/code_error.code.c @@ -45,7 +45,6 @@ typedef int YYSTYPE; #define YYERROR_CALL(msg) yyerror(msg) extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); #define YYERRCODE 256 #define YYTABLESIZE 0 @@ -136,7 +135,6 @@ extern int YYLEX_DECL(); #endif /* yyrule */ #define YYPREFIX "error_" extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); extern short yylhs[]; extern short yylen[]; @@ -189,6 +187,11 @@ static YYSTACKDATA yystack; #include <stdio.h> +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main(void) { @@ -207,7 +210,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 211 "code_error.code.c" +#line 214 "code_error.code.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -232,18 +235,14 @@ static int yygrowstack(YYSTACKDATA *data) 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; diff --git a/test/code_error.y b/test/code_error.y index e25ff83..3614433 100644 --- a/test/code_error.y +++ b/test/code_error.y @@ -4,6 +4,11 @@ S: error #include <stdio.h> +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main(void) { diff --git a/test/error.tab.c b/test/error.tab.c index 66487ac..bcf64dc 100644 --- a/test/error.tab.c +++ b/test/error.tab.c @@ -126,7 +126,6 @@ typedef int YYSTYPE; #define YYERROR_CALL(msg) yyerror(msg) extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); #define YYERRCODE 256 static const short error_lhs[] = { -1, @@ -206,6 +205,11 @@ static YYSTACKDATA yystack; #include <stdio.h> +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main(void) { @@ -224,7 +228,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 228 "error.tab.c" +#line 232 "error.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -249,18 +253,14 @@ static int yygrowstack(YYSTACKDATA *data) 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; diff --git a/test/error.y b/test/error.y index e25ff83..3614433 100644 --- a/test/error.y +++ b/test/error.y @@ -4,6 +4,11 @@ S: error #include <stdio.h> +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main(void) { diff --git a/test/ftp.tab.c b/test/ftp.tab.c index 55f7de0..23b15d9 100644 --- a/test/ftp.tab.c +++ b/test/ftp.tab.c @@ -208,7 +208,6 @@ typedef int YYSTYPE; #define YYERROR_CALL(msg) yyerror(msg) extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); #define A 257 #define B 258 @@ -543,7 +542,12 @@ YYSTYPE yylval; /* 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; @@ -1034,7 +1038,11 @@ sizecmd(char *filename) (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; @@ -1066,7 +1074,7 @@ sizecmd(char *filename) 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 */ @@ -1091,18 +1099,14 @@ static int yygrowstack(YYSTACKDATA *data) 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; @@ -1427,7 +1431,7 @@ break; 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]); @@ -1697,8 +1701,9 @@ case 44: 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); } } @@ -1707,20 +1712,20 @@ case 44: } 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]); @@ -1731,13 +1736,13 @@ case 47: } 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; @@ -1749,116 +1754,116 @@ case 52: } 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 @@ -1877,7 +1882,7 @@ case 70: } break; case 72: -#line 652 "ftp.y" +#line 653 "ftp.y" { register int ret, dec, multby, digit; @@ -1902,7 +1907,7 @@ case 72: } break; case 73: -#line 677 "ftp.y" +#line 678 "ftp.y" { if (logged_in) yyval = 1; @@ -1912,7 +1917,7 @@ case 73: } } break; -#line 1916 "ftp.tab.c" +#line 1921 "ftp.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -253,7 +253,7 @@ cmd: USER SP username CRLF } | 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); @@ -487,8 +487,9 @@ cmd: USER SP username CRLF 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); } } @@ -515,7 +516,7 @@ rcmd: RNFR check_login SP pathname CRLF } } ; - + username: STRING ; @@ -529,7 +530,7 @@ password: /* empty */ 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; @@ -686,6 +687,11 @@ check_login: /* empty */ %% +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + extern jmp_buf errcatch; static void upper(char *); @@ -1175,7 +1181,11 @@ sizecmd(char *filename) (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; diff --git a/test/grammar.tab.c b/test/grammar.tab.c index b8b16f6..5231895 100644 --- a/test/grammar.tab.c +++ b/test/grammar.tab.c @@ -401,7 +401,6 @@ haveAnsiParam (void) #define YYERROR_CALL(msg) yyerror(msg) extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); #define T_IDENTIFIER 257 #define T_TYPEDEF_NAME 258 @@ -1068,7 +1067,7 @@ free_parser(void) #endif } #endif -#line 1072 "grammar.tab.c" +#line 1071 "grammar.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -1093,18 +1092,14 @@ static int yygrowstack(YYSTACKDATA *data) 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; @@ -1952,7 +1947,7 @@ case 114: 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; diff --git a/test/pure_calc.tab.c b/test/pure_calc.tab.c index 5d10ba8..4608901 100644 --- a/test/pure_calc.tab.c +++ b/test/pure_calc.tab.c @@ -134,7 +134,6 @@ typedef int YYSTYPE; #define YYERROR_CALL(msg) yyerror(msg) extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); #define DIGIT 257 #define LETTER 258 @@ -290,6 +289,11 @@ typedef struct { #line 63 "pure_calc.y" /* start of programs */ +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main (void) { @@ -329,7 +333,7 @@ yylex(YYSTYPE *value) } return( c ); } -#line 333 "pure_calc.tab.c" +#line 337 "pure_calc.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -354,18 +358,14 @@ static int yygrowstack(YYSTACKDATA *data) 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; diff --git a/test/pure_calc.y b/test/pure_calc.y index 462f04c..16af107 100644 --- a/test/pure_calc.y +++ b/test/pure_calc.y @@ -62,6 +62,11 @@ number: DIGIT %% /* start of programs */ +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main (void) { diff --git a/test/pure_error.tab.c b/test/pure_error.tab.c index 4bce3c8..4c252bc 100644 --- a/test/pure_error.tab.c +++ b/test/pure_error.tab.c @@ -126,7 +126,6 @@ typedef int YYSTYPE; #define YYERROR_CALL(msg) yyerror(msg) extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); #define YYERRCODE 256 static const short error_lhs[] = { -1, @@ -199,6 +198,11 @@ typedef struct { #include <stdio.h> +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main(void) { @@ -217,7 +221,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 221 "pure_error.tab.c" +#line 225 "pure_error.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -242,18 +246,14 @@ static int yygrowstack(YYSTACKDATA *data) 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; diff --git a/test/pure_error.y b/test/pure_error.y index 8c308d2..dd9c79e 100644 --- a/test/pure_error.y +++ b/test/pure_error.y @@ -4,6 +4,11 @@ S: error #include <stdio.h> +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main(void) { |