+/* $NetBSD: parse.c,v 1.7 1999/02/10 01:36:50 hubertf Exp $ */
+
/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 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[] = "@(#)parse.c 5.3 (Berkeley) 6/1/90";
-#endif /* not lint */
+#if 0
+static char sccsid[] = "@(#)parse.c 8.2 (Berkeley) 4/28/95";
+#else
+__RCSID("$NetBSD: parse.c,v 1.7 1999/02/10 01:36:50 hubertf Exp $");
+#endif
+#endif /* not lint */
-#include "externs.h"
+#include "extern.h"
+void
wordinit()
{
- register struct wlist *w;
+ struct wlist *w;
for (w = wlist; w->string; w++)
install(w);
}
+int
hash(s)
- register char *s;
+ const char *s;
{
- register hashval = 0;
+ int hashval = 0;
while (*s) {
hashval += *s++;
struct wlist *
lookup(s)
- char *s;
+ const char *s;
{
- register struct wlist *wp;
+ struct wlist *wp;
for (wp = hashtab[hash(s)]; wp != NULL; wp = wp->next)
if (*s == *wp->string && strcmp(s, wp->string) == 0)
return NULL;
}
+void
install(wp)
- register struct wlist *wp;
+ struct wlist *wp;
{
- int hashval;
+ int hashval;
if (lookup(wp->string) == NULL) {
hashval = hash(wp->string);
printf("Multiply defined %s.\n", wp->string);
}
+void
parse()
{
- register struct wlist *wp;
- register n;
+ struct wlist *wp;
+ int n;
- wordnumber = 0; /* for cypher */
+ wordnumber = 0; /* for cypher */
for (n = 0; n <= wordcount; n++) {
if ((wp = lookup(words[n])) == NULL) {
wordvalue[n] = -1;
wordtype[n] = -1;
} else {
- wordvalue[n] = wp -> value;
- wordtype[n] = wp -> article;
+ wordvalue[n] = wp->value;
+ wordtype[n] = wp->article;
}
}
}