diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-03 17:29:12 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-03 18:42:58 +0900 |
| commit | 3654ce578e6fff53950874adf7e0e4ae0a6eb956 (patch) | |
| tree | 5b6c04273de38dba70b7c25e55da144f5f7c37da /src/cc1/io.h | |
| parent | 1b406b13b03055d2b2d08e8279a4a80c41ca7c20 (diff) | |
| download | ducc-main.tar.gz ducc-main.tar.zst ducc-main.zip | |
Diffstat (limited to 'src/cc1/io.h')
| -rw-r--r-- | src/cc1/io.h | 26 |
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 |
