summaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>1999-01-30 21:35:36 +0000
committerSimon Tatham <anakin@pobox.com>1999-01-30 21:35:36 +0000
commitf91811f57de0561cc7c8efb5897a6b62f5c0e0b2 (patch)
tree0f942e70bd4936e5806874193d17ba90693cd313 /input.c
downloadhalibut-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.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/input.c b/input.c
new file mode 100644
index 0000000..dc745f1
--- /dev/null
+++ b/input.c
@@ -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 */
+}