aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cc1/io.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/cc1/io.h')
-rw-r--r--src/cc1/io.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/cc1/io.h b/src/cc1/io.h
new file mode 100644
index 0000000..be48b51
--- /dev/null
+++ b/src/cc1/io.h
@@ -0,0 +1,26 @@
+#ifndef DUCC_IO_H
+#define DUCC_IO_H
+
+#include "../lib/json.h"
+
+typedef struct {
+ const char* filename;
+ int line;
+} SourceLocation;
+
+void sourcelocation_build_json(JsonBuilder* builder, SourceLocation* loc);
+
+typedef struct {
+ const char* buf;
+ int pos;
+ SourceLocation loc;
+} InFile;
+
+InFile* infile_open(const char* filename);
+bool infile_eof(InFile* f);
+char infile_peek_char(InFile* f);
+char infile_peek_char2(InFile* f);
+char infile_next_char(InFile* f);
+bool infile_consume_if(InFile* f, char expected);
+
+#endif