-/* $NetBSD: vocab.c,v 1.10 2000/01/09 17:17:19 jsm Exp $ */
+/* $NetBSD: vocab.c,v 1.15 2009/08/25 06:56:52 dholland Exp $ */
/*-
* Copyright (c) 1991, 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.
*
#if 0
static char sccsid[] = "@(#)vocab.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: vocab.c,v 1.10 2000/01/09 17:17:19 jsm Exp $");
+__RCSID("$NetBSD: vocab.c,v 1.15 2009/08/25 06:56:52 dholland Exp $");
#endif
#endif /* not lint */
#include "extern.h"
void
-dstroy(object)
- int object;
+destroy(int object)
{
move(object, 0);
}
void
-juggle(object)
- int object;
+juggle(int object)
{
int i, j;
move(object + 100, j);
}
-
void
-move(object, where)
- int object, where;
+move(int object, int where)
{
int from;
}
int
-put(object, where, pval)
- int object, where, pval;
+put(int object, int where, int pval)
{
move(object, where);
return (-1 - pval);
}
void
-carry(object, where)
- int object, where;
+carry(int object, int where)
{
int temp;
if (place[object] == -1)
return;
place[object] = -1;
- holdng++;
+ holding++;
}
if (atloc[where] == object) {
atloc[where] = links[object];
void
-drop(object, where)
- int object, where;
+drop(int object, int where)
{
if (object > 100)
fixed[object - 100] = where;
else {
if (place[object] == -1)
- holdng--;
+ holding--;
place[object] = where;
}
if (where <= 0)
atloc[where] = object;
}
+/* look up or store a word */
+/* -2 for store, -1 for user word, >=0 for canned lookup */
+/* used for storing only */
int
-vocab(word, type, value) /* look up or store a word */
- const char *word;
- int type; /* -2 for store, -1 for user word, >=0 for
- * canned lookup */
- int value; /* used for storing only */
+vocab(const char *word, int type, int value)
{
int adr;
const char *s;
int hash, i;
struct hashtab *h;
- for (hash = 0, s = word, i = 0; i < 5 && *s; i++) /* some kind of hash */
+ for (hash = 0, s = word, i = 0; i < 5 && *s; i++) /* some kind of hash*/
hash += *s++; /* add all chars in the word */
hash = (hash * 3719) & 077777; /* pulled that one out of a hat */
hash %= HTSIZE; /* put it into range of table */
}
exitloop2: /* hashed entry does not match */
- if (adr + 1 == hash || (adr == HTSIZE && hash == 0))
+ if (adr + 1 == hash || hash == 0)
errx(1,"Hash table overflow");
}
}
-void
-prht()
-{ /* print hash table */
+/* print hash table (for debugging) */
+static __unused void
+prht(void)
+{
int i, j, l;
char *c;
struct hashtab *h;