diff options
| author | Simon Tatham <anakin@pobox.com> | 1999-01-30 21:35:36 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 1999-01-30 21:35:36 +0000 |
| commit | f91811f57de0561cc7c8efb5897a6b62f5c0e0b2 (patch) | |
| tree | 0f942e70bd4936e5806874193d17ba90693cd313 /input.c | |
| download | halibut-f91811f57de0561cc7c8efb5897a6b62f5c0e0b2.zip halibut-f91811f57de0561cc7c8efb5897a6b62f5c0e0b2.tar.gz halibut-f91811f57de0561cc7c8efb5897a6b62f5c0e0b2.tar.bz2 halibut-f91811f57de0561cc7c8efb5897a6b62f5c0e0b2.tar.xz | |
Initial checkin of skeleton application. About to start reading files
[originally from svn r22]
Diffstat (limited to 'input.c')
| -rw-r--r-- | input.c | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -0,0 +1,33 @@ +/* + * input.c: read the source form + */ + +#include <stdio.h> +#include <assert.h> +#include "buttress.h" + +static void unget(input *in, char c) { + assert(in->npushback < INPUT_PUSHBACK_MAX); + in->pushback[in->npushback++] = c; +} + +/* + * Can return EOF + */ +static int get(input *in) { + if (in->npushback) + return (unsigned char)in->pushback[--in->npushback]; + else if (in->currfp) { + int c = getc(in->currfp); + if (c == EOF) { + fclose(in->currfp); + in->currfp = NULL; + in->currindex++; + } + return c; + } +} + +paragraph *read_input(input *in) { + /* FIXME: do some reading */ +} |