diff options
Diffstat (limited to 'boot')
| -rw-r--r-- | boot/catboot.c | 6 | ||||
| -rw-r--r-- | boot/catboot.h | 20 | ||||
| -rw-r--r-- | boot/common.c | 4 | ||||
| -rw-r--r-- | boot/lex.c | 4 | ||||
| -rw-r--r-- | boot/parse.c | 4 | ||||
| -rw-r--r-- | boot/tree.c | 4 | ||||
| -rw-r--r-- | boot/visit.c | 4 |
7 files changed, 41 insertions, 5 deletions
diff --git a/boot/catboot.c b/boot/catboot.c index f716e4f..fac6273 100644 --- a/boot/catboot.c +++ b/boot/catboot.c @@ -24,11 +24,7 @@ #include <sys/mman.h> #include <sys/stat.h> -#include "common.c" -#include "lex.c" -#include "tree.c" -#include "parse.c" -#include "visit.c" +#include "catboot.h" const ascii* read_file(const ascii* path) diff --git a/boot/catboot.h b/boot/catboot.h new file mode 100644 index 0000000..4c40676 --- /dev/null +++ b/boot/catboot.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2025, Mel G. <mel@rnrd.eu> + * + * SPDX-License-Identifier: MPL-2.0 + */ + +#pragma once + +// include all partial translation units, for correct language server behaviour +// despite the fact that single translation units are not yet supported. + +// when included in the root of the translation unit, this will compile the whole project, +// however if included in a partial subunit, the `#pragma once` in the subunit will prevent +// multiple inclusions of the itself, only adding other files, thus allowing for an LSP like `clang` +// to find the definitions of all other functions and types in the project. +#include "common.c" +#include "lex.c" +#include "tree.c" +#include "parse.c" +#include "visit.c" diff --git a/boot/common.c b/boot/common.c index 22ee50a..cf9aa46 100644 --- a/boot/common.c +++ b/boot/common.c @@ -8,6 +8,10 @@ * SPDX-License-Identifier: MPL-2.0 */ +#pragma once + +#include "catboot.h" + #include <stdarg.h> #include <stddef.h> #include <stdint.h> diff --git a/boot/lex.c b/boot/lex.c index 5b91187..f450798 100644 --- a/boot/lex.c +++ b/boot/lex.c @@ -7,6 +7,10 @@ * SPDX-License-Identifier: MPL-2.0 */ +#pragma once + +#include "catboot.h" + #define MAX_CHAR_BUFFER_SIZE 256 // byte position within a file. diff --git a/boot/parse.c b/boot/parse.c index 6aa61f7..d410476 100644 --- a/boot/parse.c +++ b/boot/parse.c @@ -7,6 +7,10 @@ * SPDX-License-Identifier: MPL-2.0 */ +#pragma once + +#include "catboot.h" + #define PARSER_LOOKAHEAD 2 #define CHECK(parse) \ diff --git a/boot/tree.c b/boot/tree.c index cb5fd2a..1eb19a8 100644 --- a/boot/tree.c +++ b/boot/tree.c @@ -6,6 +6,10 @@ * SPDX-License-Identifier: MPL-2.0 */ +#pragma once + +#include "catboot.h" + enum Unary_Operation { UNARY_NONE, diff --git a/boot/visit.c b/boot/visit.c index 24f033a..c297fb4 100644 --- a/boot/visit.c +++ b/boot/visit.c @@ -9,6 +9,10 @@ * SPDX-License-Identifier: MPL-2.0 */ +#pragma once + +#include "catboot.h" + struct Visit { struct Visit_Table* table; |
