summaryrefslogtreecommitdiffstats
path: root/atc/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'atc/input.c')
-rw-r--r--atc/input.c97
1 files changed, 62 insertions, 35 deletions
diff --git a/atc/input.c b/atc/input.c
index a2b49f5a..62947cd4 100644
--- a/atc/input.c
+++ b/atc/input.c
@@ -1,4 +1,4 @@
-/* $NetBSD: input.c,v 1.23 2009/05/26 00:00:56 dholland Exp $ */
+/* $NetBSD: input.c,v 1.24 2009/08/12 04:48:03 dholland Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -46,13 +46,40 @@
#if 0
static char sccsid[] = "@(#)input.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: input.c,v 1.23 2009/05/26 00:00:56 dholland Exp $");
+__RCSID("$NetBSD: input.c,v 1.24 2009/08/12 04:48:03 dholland Exp $");
#endif
#endif /* not lint */
#include "include.h"
#include "pathnames.h"
+static void rezero(void);
+static void noise(void);
+static int gettoken(void);
+static const char *setplane(int);
+static const char *turn(int);
+static const char *circle(int);
+static const char *left(int);
+static const char *right(int);
+static const char *Left(int);
+static const char *Right(int);
+static const char *delayb(int);
+static const char *beacon(int);
+static const char *ex_it(int);
+static const char *airport(int);
+static const char *climb(int);
+static const char *descend(int);
+static const char *setalt(int);
+static const char *setrelalt(int);
+static const char *benum(int);
+static const char *to_dir(int);
+static const char *rel_dir(int);
+static const char *mark(int);
+static const char *unmark(int);
+static const char *ignore(int);
+
+
+
#define MAXRULES 6
#define MAXDEPTH 15
@@ -93,7 +120,7 @@ typedef struct {
#define NUMSTATES NUMELS(st)
-
+static
RULE state0[] = { { ALPHATOKEN, 1, "%c:", setplane},
{ RETTOKEN, -1, "", NULL },
{ HELPTOKEN, 12, " [a-z]<ret>", NULL }},
@@ -160,7 +187,7 @@ RULE state0[] = { { ALPHATOKEN, 1, "%c:", setplane},
#define DEF_STATE(s) { NUMELS(s), (s) }
-STATE st[] = {
+static STATE st[] = {
DEF_STATE(state0), DEF_STATE(state1), DEF_STATE(state2),
DEF_STATE(state3), DEF_STATE(state4), DEF_STATE(state5),
DEF_STATE(state6), DEF_STATE(state7), DEF_STATE(state8),
@@ -168,13 +195,13 @@ STATE st[] = {
DEF_STATE(state12)
};
-PLANE p;
-STACK stack[MAXDEPTH];
-int level;
-int tval;
-int dest_type, dest_no, dir;
+static PLANE p;
+static STACK stack[MAXDEPTH];
+static int level;
+static int tval;
+static int dest_type, dest_no, dir;
-int
+static int
pop(void)
{
if (level == 0)
@@ -189,7 +216,7 @@ pop(void)
return (0);
}
-void
+static void
rezero(void)
{
iomove(0);
@@ -202,7 +229,7 @@ rezero(void)
(void)strcpy(T_STR, "");
}
-void
+static void
push(int ruleno, int ch)
{
int newstate, newpos;
@@ -286,14 +313,14 @@ getcommand(void)
return (0);
}
-void
+static void
noise(void)
{
(void)putchar('\07');
(void)fflush(stdout);
}
-int
+static int
gettoken(void)
{
while ((tval = getAChar()) == REDRAWTOKEN || tval == SHELLTOKEN)
@@ -357,7 +384,7 @@ gettoken(void)
return (tval);
}
-const char *
+static const char *
setplane(int c)
{
PLANE *pp;
@@ -371,7 +398,7 @@ setplane(int c)
}
/* ARGSUSED */
-const char *
+static const char *
turn(int c __unused)
{
if (p.altitude == 0)
@@ -380,7 +407,7 @@ turn(int c __unused)
}
/* ARGSUSED */
-const char *
+static const char *
circle(int c __unused)
{
if (p.altitude == 0)
@@ -390,7 +417,7 @@ circle(int c __unused)
}
/* ARGSUSED */
-const char *
+static const char *
left(int c __unused)
{
dir = D_LEFT;
@@ -401,7 +428,7 @@ left(int c __unused)
}
/* ARGSUSED */
-const char *
+static const char *
right(int c __unused)
{
dir = D_RIGHT;
@@ -412,7 +439,7 @@ right(int c __unused)
}
/* ARGSUSED */
-const char *
+static const char *
Left(int c __unused)
{
p.new_dir = p.dir - 2;
@@ -422,7 +449,7 @@ Left(int c __unused)
}
/* ARGSUSED */
-const char *
+static const char *
Right(int c __unused)
{
p.new_dir = p.dir + 2;
@@ -431,7 +458,7 @@ Right(int c __unused)
return (NULL);
}
-const char *
+static const char *
delayb(int c)
{
int xdiff, ydiff;
@@ -476,7 +503,7 @@ delayb(int c)
}
/* ARGSUSED */
-const char *
+static const char *
beacon(int c __unused)
{
dest_type = T_BEACON;
@@ -484,7 +511,7 @@ beacon(int c __unused)
}
/* ARGSUSED */
-const char *
+static const char *
ex_it(int c __unused)
{
dest_type = T_EXIT;
@@ -492,7 +519,7 @@ ex_it(int c __unused)
}
/* ARGSUSED */
-const char *
+static const char *
airport(int c __unused)
{
dest_type = T_AIRPORT;
@@ -500,7 +527,7 @@ airport(int c __unused)
}
/* ARGSUSED */
-const char *
+static const char *
climb(int c __unused)
{
dir = D_UP;
@@ -508,14 +535,14 @@ climb(int c __unused)
}
/* ARGSUSED */
-const char *
+static const char *
descend(int c __unused)
{
dir = D_DOWN;
return (NULL);
}
-const char *
+static const char *
setalt(int c)
{
int newalt = c - '0';
@@ -528,7 +555,7 @@ setalt(int c)
return (NULL);
}
-const char *
+static const char *
setrelalt(int c)
{
int newalt;
@@ -559,7 +586,7 @@ setrelalt(int c)
return (NULL);
}
-const char *
+static const char *
benum(int c)
{
dest_no = c -= '0';
@@ -589,14 +616,14 @@ benum(int c)
return (NULL);
}
-const char *
+static const char *
to_dir(int c)
{
p.new_dir = dir_no(c);
return (NULL);
}
-const char *
+static const char *
rel_dir(int c)
{
int angle;
@@ -620,7 +647,7 @@ rel_dir(int c)
}
/* ARGSUSED */
-const char *
+static const char *
mark(int c __unused)
{
if (p.altitude == 0)
@@ -632,7 +659,7 @@ mark(int c __unused)
}
/* ARGSUSED */
-const char *
+static const char *
unmark(int c __unused)
{
if (p.altitude == 0)
@@ -644,7 +671,7 @@ unmark(int c __unused)
}
/* ARGSUSED */
-const char *
+static const char *
ignore(int c __unused)
{
if (p.altitude == 0)