aboutsummaryrefslogtreecommitdiff
path: root/buildtools/codegen/CodegenOutput.inl
diff options
context:
space:
mode:
Diffstat (limited to 'buildtools/codegen/CodegenOutput.inl')
-rw-r--r--buildtools/codegen/CodegenOutput.inl18
1 files changed, 16 insertions, 2 deletions
diff --git a/buildtools/codegen/CodegenOutput.inl b/buildtools/codegen/CodegenOutput.inl
index 6d59301..752682c 100644
--- a/buildtools/codegen/CodegenOutput.inl
+++ b/buildtools/codegen/CodegenOutput.inl
@@ -15,6 +15,14 @@ struct CodegenOutputThing {
class CodegenOutput {
private:
std::vector<CodegenOutputThing> mOutThings;
+ std::vector<DeclStruct> mOutStructs;
+ std::vector<DeclEnum> mOutEnums;
+ std::vector<DeclFunction> mOutFunctions;
+
+public:
+ std::string optionOutPrefix;
+ // Whether to add prefixes mOutPrefix to all global names or not
+ bool optionAutoAddPrefix : 1 = false;
public:
void AddOutputThing(CodegenOutputThing thing) {
@@ -22,10 +30,16 @@ public:
}
void MergeContents(CodegenOutput other) {
- std::move(other.mOutThings.begin(), other.mOutThings.end(), this->mOutThings.begin());
+ std::move(other.mOutThings.begin(), other.mOutThings.end(), std::back_inserter(this->mOutThings));
}
void Write(FILE* file) {
- // TODO
+#define WRITE_LITERAL(str) fwrite(str, sizeof(char), sizeof(str) - 1, file)
+ for (auto& thing : mOutThings) {
+ WRITE_LITERAL("// Output thing\n");
+ fwrite(thing.text.c_str(), sizeof(char), thing.text.size(), file);
+ WRITE_LITERAL("\n");
+ }
+#undef WRITE_LITERAL
}
};