diff options
Diffstat (limited to '')
-rw-r--r-- | src/input.h | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/src/input.h b/src/input.h index 90ff6c3..ad8b463 100644 --- a/src/input.h +++ b/src/input.h @@ -41,14 +41,41 @@ enum { INPUT_NOFILE_OK = 2, }; +struct alias; + +struct strpush { + struct strpush *prev; /* preceding string on stack */ + char *prevstring; + int prevnleft; + struct alias *ap; /* if push was associated with an alias */ + char *string; /* remember the string since it may change */ +}; + +/* + * The parsefile structure pointed to by the global variable parsefile + * contains information about the current file being read. + */ + +struct parsefile { + struct parsefile *prev; /* preceding file on stack */ + int linno; /* current line */ + int fd; /* file descriptor (or -1 if string) */ + int nleft; /* number of chars left in this line */ + int lleft; /* number of chars left in this buffer */ + char *nextc; /* next char in buffer */ + char *buf; /* input buffer */ + struct strpush *strpush; /* for pushing strings at this level */ + struct strpush basestrpush; /* so pushing one is fast */ +}; + +extern struct parsefile *parsefile; + /* * The input line number. Input.c just defines this variable, and saves * and restores it when files are pushed and popped. The user of this * package must set its value. */ -extern int plinno; -extern int parsenleft; /* number of characters left in input buffer */ -extern char *parsenextc; /* next character in input buffer */ +#define plinno (parsefile->linno) int pgetc(void); int pgetc2(void); |