aboutsummaryrefslogtreecommitdiff
path: root/src/compiler/codegen.h
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2023-07-16 02:03:33 +0200
committerToni Uhlig <matzeton@googlemail.com>2023-07-16 02:03:33 +0200
commit5a40295c4cf0af5ea8da9ced04a4ce7d3621a080 (patch)
treecb21506e7b04d10b45d6066a0ee1655563d5d52b /src/compiler/codegen.h
Squashed 'flatcc/' content from commit 473da2a
git-subtree-dir: flatcc git-subtree-split: 473da2afa5ca435363f8c5e6569167aee6bc31c5
Diffstat (limited to 'src/compiler/codegen.h')
-rw-r--r--src/compiler/codegen.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/compiler/codegen.h b/src/compiler/codegen.h
new file mode 100644
index 0000000..2798767
--- /dev/null
+++ b/src/compiler/codegen.h
@@ -0,0 +1,46 @@
+#ifndef CODEGEN_H
+#define CODEGEN_H
+
+#include "symbols.h"
+#include "parser.h"
+
+typedef struct fb_output fb_output_t;
+
+struct fb_output {
+ /*
+ * Common namespace across files. May differ from namespace
+ * for consistent use of type names.
+ */
+ char nsc[FLATCC_NAMESPACE_MAX + 2];
+ char nscup[FLATCC_NAMESPACE_MAX + 2];
+
+ FILE *fp;
+ fb_schema_t *S;
+ fb_options_t *opts;
+ fb_scope_t *current_scope;
+ int indent;
+ int spacing;
+ int tmp_indent;
+};
+
+int __flatcc_fb_init_output_c(fb_output_t *out, fb_options_t *opts);
+#define fb_init_output_c __flatcc_fb_init_output_c
+void __flatcc_fb_end_output_c(fb_output_t *out);
+#define fb_end_output_c __flatcc_fb_end_output_c
+
+int __flatcc_fb_codegen_common_c(fb_output_t *out);
+#define fb_codegen_common_c __flatcc_fb_codegen_common_c
+
+int __flatcc_fb_codegen_c(fb_output_t *out, fb_schema_t *S);
+#define fb_codegen_c __flatcc_fb_codegen_c
+
+void *__flatcc_fb_codegen_bfbs_to_buffer(fb_options_t *opts, fb_schema_t *S, void *buffer, size_t *size);
+#define fb_codegen_bfbs_to_buffer __flatcc_fb_codegen_bfbs_to_buffer
+
+void *__flatcc_fb_codegen_bfbs_alloc_buffer(fb_options_t *opts, fb_schema_t *S, size_t *size);
+#define fb_codegen_bfbs_alloc_buffer __flatcc_fb_codegen_bfbs_alloc_buffer
+
+int __flatcc_fb_codegen_bfbs_to_file(fb_options_t *opts, fb_schema_t *S);
+#define fb_codegen_bfbs_to_file __flatcc_fb_codegen_bfbs_to_file
+
+#endif /* CODEGEN_H */