From 788cfd8bcc932e545db73da282c48a9bad8ca271 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 31 Jul 2025 02:43:02 +0900 Subject: feat: implement __FILE__ macro --- main.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 0aedc6d..3d06c02 100644 --- a/main.c +++ b/main.c @@ -2,6 +2,7 @@ // clang-format off #include "std.h" #include "common.c" +#include "io.c" #include "preprocess.c" #include "tokenize.c" #include "ast.c" @@ -13,13 +14,7 @@ int main(int argc, char** argv) { if (argc == 1) { fatal_error("usage: ducc "); } - FILE* in; - if (strcmp(argv[1], "-") == 0) { - in = stdin; - } else { - in = fopen(argv[1], "rb"); - } - char* source = read_all(in); + InFile* source = read_all(argv[1]); PpToken* pp_tokens = preprocess(source); Token* tokens = tokenize(pp_tokens); Program* prog = parse(tokens); -- cgit v1.2.3-70-g09d2