diff options
Diffstat (limited to 'buildtools/codegen/CodegenOutput.inl')
-rw-r--r-- | buildtools/codegen/CodegenOutput.inl | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/buildtools/codegen/CodegenOutput.inl b/buildtools/codegen/CodegenOutput.inl index 752682c..d1f2e50 100644 --- a/buildtools/codegen/CodegenOutput.inl +++ b/buildtools/codegen/CodegenOutput.inl @@ -1,7 +1,9 @@ #pragma once #include "CodegenDecl.hpp" +#include "CodegenMacros.hpp" +#include <algorithm> #include <cstdio> #include <cstdlib> #include <string> @@ -31,15 +33,30 @@ public: 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) { -#define WRITE_LITERAL(str) fwrite(str, sizeof(char), sizeof(str) - 1, file) for (auto& thing : mOutThings) { - WRITE_LITERAL("// Output thing\n"); + WRITE_LIT(file, "// Output thing\n"); fwrite(thing.text.c_str(), sizeof(char), thing.text.size(), file); - WRITE_LITERAL("\n"); + WRITE_LIT(file, "\n"); + } + + for (auto& declStruct : mOutStructs) { + WRITE_FMT(file, "struct %s {\n", declStruct.name.c_str()); + // TODO + WRITE_LIT(file, "}\n"); + } + + for (auto& declEnum : mOutEnums) { + // TODO + } + + for (auto& declFunc : mOutFunctions) { + // TODO } -#undef WRITE_LITERAL } }; |