From 3654ce578e6fff53950874adf7e0e4ae0a6eb956 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 3 May 2026 17:29:12 +0900 Subject: refactor: organize directory structure --- src/cc1/io.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/cc1/io.h (limited to 'src/cc1/io.h') 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 -- cgit v1.3.1