Refactor tokenization to save raw tokens and use static buffer space...
...rather than dynamic storage. As a side effect, this seems to have fixed a very ninor bug in the processing of the bare word 'nothing'. But I don't know where the bug was. Not happy.
This commit is contained in:
parent
eba8015059
commit
f03bde268e
4 changed files with 14 additions and 23 deletions
3
advent.h
3
advent.h
|
@ -183,6 +183,7 @@ struct command_t {
|
|||
vocab_t obj;
|
||||
token_t wd1, wd1x;
|
||||
token_t wd2, wd2x;
|
||||
char raw1[BUFSIZ], raw2[BUFSIZ];
|
||||
};
|
||||
|
||||
extern struct game_t game;
|
||||
|
@ -192,7 +193,7 @@ extern char* xstrdup(const char* s);
|
|||
extern void* xmalloc(size_t size);
|
||||
extern void packed_to_token(long, char token[]);
|
||||
extern long token_to_packed(const char token[TOKLEN+1]);
|
||||
extern void tokenize(char*, long tokens[4]);
|
||||
extern void tokenize(char*, struct command_t *);
|
||||
extern void vspeak(const char*, bool, va_list);
|
||||
extern bool wordeq(token_t, token_t);
|
||||
extern bool wordempty(token_t);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue