X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/5ff78ede5ea1a80c654d3f0684cd5f36d5253ae1..05a507aaa8096771a9b90f2cc460f701d05002af:/atc/grammar.y diff --git a/atc/grammar.y b/atc/grammar.y index a409b490..770683a0 100644 --- a/atc/grammar.y +++ b/atc/grammar.y @@ -1,4 +1,4 @@ -/* $NetBSD: grammar.y,v 1.3 1995/03/21 15:03:59 cgd Exp $ */ +/* $NetBSD: grammar.y,v 1.7 1999/07/26 21:14:21 hubertf Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -63,11 +63,12 @@ %{ #include "include.h" +#include #ifndef lint #if 0 static char sccsid[] = "@(#)grammar.y 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: grammar.y,v 1.3 1995/03/21 15:03:59 cgd Exp $"; +__RCSID("$NetBSD: grammar.y,v 1.7 1999/07/26 21:14:21 hubertf Exp $"); #endif #endif /* not lint */ @@ -136,7 +137,7 @@ hdef: wdef: WidthOp '=' ConstOp ';' { - if (sp->height != 0) + if (sp->width != 0) return (yyerror("Redefinition of 'width'.")); else if ($3 < 3) return (yyerror("'width' is too small.")); @@ -252,7 +253,6 @@ Apoint: sp->airport[sp->num_airports].y = $3; sp->airport[sp->num_airports].dir = dir; check_point($2, $3); - check_adir($2, $3, dir); sp->num_airports++; } ; @@ -288,14 +288,18 @@ Lline: ; %% +void check_edge(x, y) + int x, y; { if (!(x == 0) && !(x == sp->width - 1) && !(y == 0) && !(y == sp->height - 1)) yyerror("edge value not on edge."); } +void check_point(x, y) + int x, y; { if (x < 1 || x >= sp->width - 1) yyerror("X value out of range."); @@ -303,7 +307,9 @@ check_point(x, y) yyerror("Y value out of range."); } +void check_linepoint(x, y) + int x, y; { if (x < 0 || x >= sp->width) yyerror("X value out of range."); @@ -311,7 +317,9 @@ check_linepoint(x, y) yyerror("Y value out of range."); } +void check_line(x1, y1, x2, y2) + int x1, y1, x2, y2; { int d1, d2; @@ -325,7 +333,9 @@ check_line(x1, y1, x2, y2) yyerror("Bad line endpoints."); } +int yyerror(s) + const char *s; { fprintf(stderr, "\"%s\": line %d: %s\n", file, line, s); errors++; @@ -333,7 +343,9 @@ yyerror(s) return (errors); } +void check_edir(x, y, dir) + int x, y, dir; { int bad = 0; @@ -364,10 +376,7 @@ check_edir(x, y, dir) yyerror("Bad direction for entrance at exit."); } -check_adir(x, y, dir) -{ -} - +int checkdefs() { int err = 0;