From 8f3e3e301233935f630d837ac61c4c02f735e43b Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 5 Jan 2024 10:24:13 +0100 Subject: [PATCH] Added the ability to strip from files to the joiner script. --- sfw/core/aabb.h | 2 ++ tools/merger/join.py | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/sfw/core/aabb.h b/sfw/core/aabb.h index 525983a..15def54 100644 --- a/sfw/core/aabb.h +++ b/sfw/core/aabb.h @@ -6,9 +6,11 @@ /* From https://github.com/Relintai/pandemonium_engine (MIT) */ /*************************************************************************/ +//--STRIP #include "core/math_defs.h" #include "core/plane.h" #include "core/vector3.h" +//--STRIP /** * AABB / AABB (Axis Aligned Bounding Box) diff --git a/tools/merger/join.py b/tools/merger/join.py index fe04352..e67836a 100644 --- a/tools/merger/join.py +++ b/tools/merger/join.py @@ -42,10 +42,27 @@ def print_includes(f): print(l) print_includes_dict[l] = 1 +def strip_file(f): + if "//--STRIP" in f: + s = f.split("//--STRIP") + + if len(s) % 2 != 1: + print("File likely has non-terminated //--STRIP comments!") + return f + + f = "" + + for i in range(len(s)): + if i % 2 == 0: + f += s[i] + + return f def process_file(f): #print_includes(f) + f = strip_file(f) + #return f.replace('#include ', '//#include ') return f