Abolish a silly layer of macros.

This commit is contained in:
Eric S. Raymond 2017-06-09 11:36:49 -04:00
parent b1fafc4d4d
commit db8dc40b84
4 changed files with 11 additions and 17 deletions

View file

@ -81,7 +81,7 @@ static int attack(FILE *input, long verb, long obj)
* fixed), move rug there (not fixed), and move him there, * fixed), move rug there (not fixed), and move him there,
* too. Then do a null motion to get new description. */ * too. Then do a null motion to get new description. */
RSPEAK(49); RSPEAK(49);
GETIN(input,WD1,WD1X,WD2,WD2X); GETIN(input,&WD1,&WD1X,&WD2,&WD2X);
if (WD1 != MAKEWD(25) && WD1 != MAKEWD(250519)) if (WD1 != MAKEWD(25) && WD1 != MAKEWD(250519))
return(2607); return(2607);
PSPEAK(DRAGON,3); PSPEAK(DRAGON,3);

View file

@ -89,17 +89,11 @@ extern void SPEAK(vocab_t);
extern void PSPEAK(vocab_t,int); extern void PSPEAK(vocab_t,int);
extern void RSPEAK(vocab_t); extern void RSPEAK(vocab_t);
extern void SETPRM(long,long,long); extern void SETPRM(long,long,long);
extern bool GETIN(FILE *,token_t*,token_t*,token_t*,token_t*);
extern bool fGETIN(FILE *,token_t*,token_t*,token_t*,token_t*);
#define GETIN(input,WORD1,WORD1X,WORD2,WORD2X) fGETIN(input,&WORD1,&WORD1X,&WORD2,&WORD2X)
extern long YES(FILE *,vocab_t,vocab_t,vocab_t); extern long YES(FILE *,vocab_t,vocab_t,vocab_t);
extern long GETTXT(bool,bool,bool); extern long GETTXT(bool,bool,bool);
extern token_t MAKEWD(long); extern token_t MAKEWD(long);
extern void PUTTXT(token_t,long*,long);
extern void fPUTTXT(token_t,long*,long);
#define PUTTXT(WORD,STATE,CASE) fPUTTXT(WORD,&STATE,CASE)
extern void SHFTXT(long,long); extern void SHFTXT(long,long);
extern void TYPE0(void); extern void TYPE0(void);

2
main.c
View file

@ -574,7 +574,7 @@ L2603: if(game.closed) {
game.knfloc=0; game.knfloc=0;
/* This is where we get a new command from the user */ /* This is where we get a new command from the user */
if (!GETIN(cmdin, WD1,WD1X,WD2,WD2X)) if (!GETIN(cmdin, &WD1,&WD1X,&WD2,&WD2X))
return false; return false;
/* Every input, check "game.foobar" flag. If zero, nothing's /* Every input, check "game.foobar" flag. If zero, nothing's

14
misc.c
View file

@ -32,7 +32,7 @@ void SPEAK(vocab_t msg)
LNPOSN=1; LNPOSN=1;
state=0; state=0;
for (i = msg; i <= nxt; i++) { for (i = msg; i <= nxt; i++) {
PUTTXT(LINES[i],state,2); PUTTXT(LINES[i],&state,2);
} }
LNPOSN=0; LNPOSN=0;
++LNPOSN; ++LNPOSN;
@ -69,7 +69,7 @@ void SPEAK(vocab_t msg)
while (PARMS[nparms] > 0) { while (PARMS[nparms] > 0) {
if (PARMS[nparms+1] < 0) if (PARMS[nparms+1] < 0)
casemake=0; casemake=0;
PUTTXT(PARMS[nparms],state,casemake); PUTTXT(PARMS[nparms],&state,casemake);
nparms=nparms+1; nparms=nparms+1;
} }
++nparms; ++nparms;
@ -96,8 +96,8 @@ void SPEAK(vocab_t msg)
if (prmtyp == 33) if (prmtyp == 33)
casemake=0; casemake=0;
i = LNPOSN; i = LNPOSN;
PUTTXT(PARMS[nparms],state,casemake); PUTTXT(PARMS[nparms],&state,casemake);
PUTTXT(PARMS[nparms+1],state,casemake); PUTTXT(PARMS[nparms+1],&state,casemake);
if (prmtyp == 13 && INLINE[i] >= 37 && INLINE[i] <= 62) if (prmtyp == 13 && INLINE[i] >= 37 && INLINE[i] <= 62)
INLINE[i] -= 26; INLINE[i] -= 26;
nparms += 2; nparms += 2;
@ -176,7 +176,7 @@ void SETPRM(long first, long p1, long p2)
} }
} }
bool fGETIN(FILE *input, bool GETIN(FILE *input,
long *pword1, long *pword1x, long *pword1, long *pword1x,
long *pword2, long *pword2x) long *pword2, long *pword2x)
/* Get a command from the adventurer. Snarf out the first word, pad it with /* Get a command from the adventurer. Snarf out the first word, pad it with
@ -221,7 +221,7 @@ long YES(FILE *input, vocab_t x, vocab_t y, vocab_t z)
for (;;) { for (;;) {
RSPEAK(x); RSPEAK(x);
GETIN(input, reply,junk1,junk2,junk3); GETIN(input, &reply, &junk1, &junk2, &junk3);
if (reply == MAKEWD(250519) || reply == MAKEWD(25)) { if (reply == MAKEWD(250519) || reply == MAKEWD(25)) {
RSPEAK(y); RSPEAK(y);
return true; return true;
@ -306,7 +306,7 @@ token_t MAKEWD(long letters)
return word; return word;
} }
void fPUTTXT(token_t word, long *state, long casemake) void PUTTXT(token_t word, long *state, long casemake)
/* Unpack the 30-bit value in word to obtain up to TOKLEN (currently /* Unpack the 30-bit value in word to obtain up to TOKLEN (currently
* 5) integer-encoded chars, and store them in inline starting at * 5) integer-encoded chars, and store them in inline starting at
* LNPOSN. If LNLENG>=LNPOSN, shift existing characters to the right * LNPOSN. If LNLENG>=LNPOSN, shift existing characters to the right