+/* $NetBSD: computer.c,v 1.8 2000/07/03 03:57:44 matt Exp $ */
+
/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
-/*static char sccsid[] = "from: @(#)computer.c 4.8 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: computer.c,v 1.2 1993/08/01 18:50:46 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)computer.c 8.1 (Berkeley) 5/31/93";
+#else
+__RCSID("$NetBSD: computer.c,v 1.8 2000/07/03 03:57:44 matt Exp $");
+#endif
#endif /* not lint */
-# include "trek.h"
-# include "getpar.h"
-# include <stdio.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "trek.h"
+#include "getpar.h"
+
/*
** On-Board Computer
**
struct cvntab Cputab[] =
{
- "ch", "art", (int (*)())1, 0,
- "t", "rajectory", (int (*)())2, 0,
- "c", "ourse", (int (*)())3, 0,
- "m", "ove", (int (*)())3, 1,
- "s", "core", (int (*)())4, 0,
- "p", "heff", (int (*)())5, 0,
- "w", "arpcost", (int (*)())6, 0,
- "i", "mpcost", (int (*)())7, 0,
- "d", "istresslist", (int (*)())8, 0,
- 0
+ { "ch", "art", (cmdfun)1, 0 },
+ { "t", "rajectory", (cmdfun)2, 0 },
+ { "c", "ourse", (cmdfun)3, 0 },
+ { "m", "ove", (cmdfun)3, 1 },
+ { "s", "core", (cmdfun)4, 0 },
+ { "p", "heff", (cmdfun)5, 0 },
+ { "w", "arpcost", (cmdfun)6, 0 },
+ { "i", "mpcost", (cmdfun)7, 0 },
+ { "d", "istresslist", (cmdfun)8, 0 },
+ { NULL, NULL, NULL, 0 }
};
-computer()
+static int kalc __P((int, int, int, int, double *));
+static void prkalc __P((int, double));
+
+/*ARGSUSED*/
+void
+computer(v)
+ int v __attribute__((__unused__));
{
- int ix, iy;
- register int i, j;
- int numout;
- int tqx, tqy;
- struct cvntab *r;
- int cost;
- int course;
- double dist, time;
- double warpfact;
- struct quad *q;
- register struct event *e;
+ int ix, iy;
+ int i, j;
+ int tqx, tqy;
+ const struct cvntab *r;
+ int cost;
+ int course;
+ double dist, time;
+ double warpfact;
+ struct quad *q;
+ struct event *e;
if (check_out(COMPUTER))
return;
while (1)
{
r = getcodpar("\nRequest", Cputab);
- switch ((int)r->value)
+ switch ((long)r->value)
{
case 1: /* star chart */
** sqx,sqy/ssx,ssy to tqx,tqy/tsx,tsy.
*/
+static int
kalc(tqx, tqy, tsx, tsy, dist)
int tqx;
int tqy;
double dx, dy;
double quadsize;
double angle;
- register int course;
+ int course;
/* normalize to quadrant distances */
quadsize = NSECTS;
return (course);
}
-
+static void
prkalc(course, dist)
int course;
double dist;