aboutsummaryrefslogtreecommitdiffhomepage
path: root/preprocess.c
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-08-02 02:21:48 +0900
committernsfisis <nsfisis@gmail.com>2025-08-15 10:06:21 +0900
commit242c8a93d9a754df07c750f63259e3e23d5fc5d4 (patch)
tree2524e714c3ff9fae131c9913a4d8f3b3d311c77e /preprocess.c
parent3d64c9165ba8ae6a06ece0817ae246b21f6f661a (diff)
downloadducc-242c8a93d9a754df07c750f63259e3e23d5fc5d4.tar.gz
ducc-242c8a93d9a754df07c750f63259e3e23d5fc5d4.tar.zst
ducc-242c8a93d9a754df07c750f63259e3e23d5fc5d4.zip
feat: do not use hard-coded ducc include path
Diffstat (limited to 'preprocess.c')
-rw-r--r--preprocess.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/preprocess.c b/preprocess.c
index 8607fdf..6547028 100644
--- a/preprocess.c
+++ b/preprocess.c
@@ -796,9 +796,16 @@ void pp_dump(PpToken* t, int include_whitespace) {
}
}
+char* get_ducc_include_path() {
+ const char* self_dir = get_self_dir();
+ char* buf = calloc(strlen(self_dir) + strlen("/include") + 1, sizeof(char));
+ sprintf(buf, "%s/include", self_dir);
+ return buf;
+}
+
PpToken* do_preprocess(InFile* src, int depth, PpMacros* pp_macros) {
Preprocessor* pp = preprocessor_new(src, depth, pp_macros);
- add_include_path(pp, "/home/ken/src/ducc/include");
+ add_include_path(pp, get_ducc_include_path());
add_include_path(pp, "/usr/include");
pp_tokenize_all(pp);
process_pp_directives(pp);