Mostly confine assumptions about what token_t is to misc.c

The token_t things like WD* are presently longs and will someday be
char[6].  By introducing some trivial functions - wordeq(),
wordempty(), and wordclear() - we mostly hide the difference.

All runtime knowledge about packing now lives only in misc.c and the
list of magic WORD_* defines in advent.h.  Outside this, literals are
now accessed through #define names that could expand to either longs
or strings.

Still to be done: WD* values are sometiimes compated to zero in
ways implying they can be negative. Must figure out wat thus means.
This commit is contained in:
Eric S. Raymond 2017-06-19 17:21:45 -04:00
parent 87961483a2
commit a678b68b39
5 changed files with 28 additions and 6 deletions

View file

@ -1054,7 +1054,8 @@ int action(FILE *input, enum speechpart part, token_t verb, token_t obj)
switch (part) {
case intransitive:
if (WD2 > 0 && verb != SAY) return (2800);
if (WD2 > 0 && verb != SAY)
return GO_WORD2;
if (verb == SAY)obj = WD2;
if (obj == 0 || obj == INTRANSITIVE) {
/* Analyse an intransitive verb (ie, no object given yet). */