-/* $NetBSD: grammar.y,v 1.3 1995/03/21 15:03:59 cgd Exp $ */
+/* $NetBSD: grammar.y,v 1.8 2003/08/07 09:36:54 agc Exp $ */
/*-
* Copyright (c) 1990, 1993
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
%{
#include "include.h"
+#include <sys/cdefs.h>
#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.8 2003/08/07 09:36:54 agc Exp $");
#endif
#endif /* not lint */
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."));
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++;
}
;
;
%%
+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.");
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.");
yyerror("Y value out of range.");
}
+void
check_line(x1, y1, x2, y2)
+ int x1, y1, x2, y2;
{
int d1, d2;
yyerror("Bad line endpoints.");
}
+int
yyerror(s)
+ const char *s;
{
fprintf(stderr, "\"%s\": line %d: %s\n", file, line, s);
errors++;
return (errors);
}
+void
check_edir(x, y, dir)
+ int x, y, dir;
{
int bad = 0;
yyerror("Bad direction for entrance at exit.");
}
-check_adir(x, y, dir)
-{
-}
-
+int
checkdefs()
{
int err = 0;