3 look-up vocabulary word in lex-ordered table. words may have
4 two entries with different codes. if minimum acceptable type
5 = 0, then return minimum of different codes. last word CANNOT
6 have two entries(due to binary sort).
7 word is the word to look up.
8 type is the minimum acceptable value,
17 static _CONST
struct wac wc
[] = {
18 "\"spelunker\"", 1016,
81 "cake", 1107, /* value must be
100 "chasm", 1021, /* troll bridge */
144 "door", 1041, /* giant door */
209 "geyser", 1037, /* same as volcano */
321 "oil", 1083, /* in bottle */
517 "wall", 1088, /* in blue grotto */
519 "water", 1081, /* in bottle */
530 "wine", 1085, /* in bottle */
544 #define MAXWC (sizeof(wc) / sizeof(struct wac))
546 _PROTOTYPE(int binary
, (char *));
548 int vocab(word
, type
)
554 if ((v1
= binary(word
)) >= 0) {
555 if (v1
> 0 && strcmp(word
, wc
[v1
- 1].aword
) == 0)
557 else if (v1
< (MAXWC
- 1) && strcmp(word
, wc
[v1
+ 1].aword
) == 0)
561 if (wc
[v1
].acode
> wc
[v2
].acode
) {
566 if (type
<= CLASS(wc
[v1
].acode
))
567 return (wc
[v1
].acode
);
568 else if (type
<= CLASS(wc
[v2
].acode
))
569 return (wc
[v2
].acode
);
579 int lo
, mid
, hi
, check
;
585 check
= strcmp(w
, wc
[mid
].aword
);