From 4e53b7051dcdfc5b6ef631583a1955166f2b5bc7 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 21 Jan 2024 01:29:54 +0100 Subject: [PATCH] The doc generator will only write the remaining classes list now if a new --remaining parameter is passed. --- tools/doc/main.cpp | 30 ++++++++++++++++++++---------- tools/doc/run.sh | 2 +- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/tools/doc/main.cpp b/tools/doc/main.cpp index dfb30ab..87f7c12 100644 --- a/tools/doc/main.cpp +++ b/tools/doc/main.cpp @@ -240,7 +240,7 @@ List process_classes_and_structs(const List &list) { return ret; } -void process_file(const String &path) { +void process_file(const String &path, bool write_remaining) { String file_data = FileAccess::get_file_as_string(path); LOG_MSG("Processing file: " + path); @@ -548,15 +548,17 @@ void process_file(const String &path) { FileAccess::write_file("out/index.md.html", index_str); - //Generate a list from the unused classes. - String index_remaining_template = FileAccess::get_file_as_string("index_remaining_template.md.html"); - String d = index_remaining_template; + if (write_remaining) { + //Generate a list from the unused classes. + String index_remaining_template = FileAccess::get_file_as_string("index_remaining_template.md.html"); + String d = index_remaining_template; - d = d.replace("$ENUMS$", generate_section_class_list(enums, "ENUM_", used_keywords)); - d = d.replace("$STRUCTS$", generate_section_class_list(structs, "STRUCT_", used_keywords)); - d = d.replace("$CLASSES$", generate_section_class_list(classes, "CLASS_", used_keywords)); + d = d.replace("$ENUMS$", generate_section_class_list(enums, "ENUM_", used_keywords)); + d = d.replace("$STRUCTS$", generate_section_class_list(structs, "STRUCT_", used_keywords)); + d = d.replace("$CLASSES$", generate_section_class_list(classes, "CLASS_", used_keywords)); - FileAccess::write_file("out/index_remaining.gen.md.html", d); + FileAccess::write_file("out/index_remaining.gen.md.html", d); + } } int main(int argc, char **argv) { @@ -571,14 +573,22 @@ int main(int argc, char **argv) { dir.copy("slate.css", "out/slate.css"); } + bool write_remaining = false; List args; for (int i = 1; i < argc; ++i) { - args.push_back(String::utf8(argv[i])); + String arg = String::utf8(argv[i]); + + if (arg == "--remaining") { + write_remaining = true; + continue; + } + + args.push_back(arg); } for (List::Element *E = args.front(); E; E = E->next()) { - process_file(E->get()); + process_file(E->get(), write_remaining); } SFWCore::cleanup(); diff --git a/tools/doc/run.sh b/tools/doc/run.sh index a890be1..e4aa8a6 100755 --- a/tools/doc/run.sh +++ b/tools/doc/run.sh @@ -1,2 +1,2 @@ -./game ../merger/out/full/sfw.h +./game ../merger/out/full/sfw.h --remaining