aboutsummaryrefslogtreecommitdiff
path: root/source/20-codegen-compiler/CodegenMacros.hpp
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2022-06-02 21:34:16 -0700
committerrtk0c <[email protected]>2022-06-02 21:34:16 -0700
commitbd07ae3f4e1bcdedc3e373460671ca9713a03de5 (patch)
tree15c897891474a97983f247196923f8e4f2184083 /source/20-codegen-compiler/CodegenMacros.hpp
parent8a0f2cd0b398ee0b7740e44a0e5fb2f75d090ccb (diff)
Changeset: 60 Add struct/class scanning to codegen
Diffstat (limited to 'source/20-codegen-compiler/CodegenMacros.hpp')
-rw-r--r--source/20-codegen-compiler/CodegenMacros.hpp36
1 files changed, 0 insertions, 36 deletions
diff --git a/source/20-codegen-compiler/CodegenMacros.hpp b/source/20-codegen-compiler/CodegenMacros.hpp
deleted file mode 100644
index e56aed0..0000000
--- a/source/20-codegen-compiler/CodegenMacros.hpp
+++ /dev/null
@@ -1,36 +0,0 @@
-#pragma once
-
-#include <algorithm>
-
-// I give up, hopefully nothing overflows this buffer
-// TODO handle buffer sizing properly
-
-#define INPLACE_FMT(varName, format, ...) \
- char varName[2048]; \
- snprintf(varName, sizeof(varName), format, __VA_ARGS__);
-
-#define APPEND_LIT(out, str) \
- out += str
-
-#define APPEND_FMT(out, format, ...) \
- { \
- char buffer[65536]; \
- snprintf(buffer, sizeof(buffer), format, __VA_ARGS__); \
- out += buffer; \
- }
-
-#define WRITE_LIT(file, str) \
- fwrite(str, sizeof(char), sizeof(str) - 1, file)
-
-// NOTE: snprintf() returns the size written (given an infinite buffer) not including \0
-#define WRITE_FMT(file, format, ...) \
- { \
- char buffer[65536]; \
- int size = snprintf(buffer, sizeof(buffer), format, __VA_ARGS__); \
- fwrite(buffer, sizeof(char), std::min<int>(size, sizeof(buffer)), file); \
- }
-
-#define APPEND_LIT_LN(out, str) APPEND_LIT(out, (str "\n"))
-#define APPEND_FMT_LN(out, format, ...) APPEND_FMT(out, (format "\n"), __VA_ARGS__)
-#define WRITE_LIT_LN(out, str) WRITE_LIT(out, (str "\n"))
-#define WRITE_FMT_LN(out, format, ...) WRITE_FMT(out, (format "\n"), __VA_ARGS__)