From e66286ebe30afc9acc4531fc2bea29b7fb924f93 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Mon, 30 May 2022 17:03:20 -0700 Subject: Changeset: 56 Buildsystem cleanup: change to layered structure for different targets --- buildtools/codegen/CodegenOutput.inl | 76 ------------------------------------ 1 file changed, 76 deletions(-) delete mode 100644 buildtools/codegen/CodegenOutput.inl (limited to 'buildtools/codegen/CodegenOutput.inl') diff --git a/buildtools/codegen/CodegenOutput.inl b/buildtools/codegen/CodegenOutput.inl deleted file mode 100644 index ff7b912..0000000 --- a/buildtools/codegen/CodegenOutput.inl +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include "CodegenDecl.hpp" -#include "CodegenMacros.hpp" - -#include - -#include -#include -#include -#include -#include -#include - -// A generic "thing" (could be anything, comments, string-concated functionsm, etc.) to spit into the output file -struct CodegenOutputThing { - std::string text; -}; - -class CodegenOutput { -private: - robin_hood::unordered_set mRequestIncludes; - std::vector mOutThings; - std::vector mOutStructs; - std::vector mOutEnums; - std::vector mOutFunctions; - -public: - std::string optionOutPrefix; - // Whether to add prefixes mOutPrefix to all global names or not - bool optionAutoAddPrefix : 1 = false; - -public: - void AddRequestInclude(std::string_view include) { - if (!mRequestIncludes.contains(include)) { - mRequestIncludes.insert(std::string(include)); - } - } - - void AddOutputThing(CodegenOutputThing thing) { - mOutThings.push_back(std::move(thing)); - } - - void MergeContents(CodegenOutput other) { - std::move(other.mOutThings.begin(), other.mOutThings.end(), std::back_inserter(this->mOutThings)); - std::move(other.mOutStructs.begin(), other.mOutStructs.end(), std::back_inserter(this->mOutStructs)); - std::move(other.mOutEnums.begin(), other.mOutEnums.end(), std::back_inserter(this->mOutEnums)); - std::move(other.mOutFunctions.begin(), other.mOutFunctions.end(), std::back_inserter(this->mOutFunctions)); - } - - void Write(FILE* file) const { - for (auto& include : mRequestIncludes) { - // TODO how to resolve to the correct include paths? - WRITE_FMT_LN(file, "#include <%s>", include.c_str()); - } - - for (auto& thing : mOutThings) { - fwrite(thing.text.c_str(), sizeof(char), thing.text.size(), file); - WRITE_LIT(file, "\n"); - } - - for (auto& declStruct : mOutStructs) { - WRITE_FMT_LN(file, "struct %s {", declStruct.name.c_str()); - // TODO - WRITE_LIT_LN(file, "};"); - } - - for (auto& declEnum : mOutEnums) { - // TODO - } - - for (auto& declFunc : mOutFunctions) { - // TODO - } - } -}; -- cgit v1.2.3-70-g09d2