aboutsummaryrefslogtreecommitdiff
path: root/source/20-codegen-compiler/CodegenUtils.hpp
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2023-10-19 22:50:07 -0700
committerrtk0c <[email protected]>2025-08-16 11:31:16 -0700
commit297232d21594b138bb368a42b5b0d085ff9ed6aa (patch)
tree075d5407e1e12a9d35cbee6e4c20ad34e0765c42 /source/20-codegen-compiler/CodegenUtils.hpp
parentd5cd34ff69f7fd134d5450696f298af1a864afbc (diff)
The great renaming: switch to "module style"
Diffstat (limited to 'source/20-codegen-compiler/CodegenUtils.hpp')
-rw-r--r--source/20-codegen-compiler/CodegenUtils.hpp57
1 files changed, 0 insertions, 57 deletions
diff --git a/source/20-codegen-compiler/CodegenUtils.hpp b/source/20-codegen-compiler/CodegenUtils.hpp
deleted file mode 100644
index 2d5b684..0000000
--- a/source/20-codegen-compiler/CodegenUtils.hpp
+++ /dev/null
@@ -1,57 +0,0 @@
-#pragma once
-
-#include "CodegenConfig.hpp"
-#include "CodegenDecl.hpp"
-#include "CodegenOutput.hpp"
-
-#include <algorithm>
-#include <string>
-#include <string_view>
-
-// 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__)
-
-namespace Utils {
-
-bool WriteOutputFile(const CodegenOutput& output, const char* path);
-
-std::string JoinNames(DeclNamespace* ns, std::string_view prefix, std::string_view suffix, std::string_view delimiter);
-std::string MakeFullName(std::string_view name, DeclNamespace* ns = nullptr);
-std::string MakeMangledName(std::string_view name, DeclNamespace* ns = nullptr);
-
-std::vector<std::string_view> SplitIdentifier(std::string_view name);
-std::string MakePascalCase(std::string_view name);
-
-void ProduceGeneratedHeader(const char* headerFilename, CodegenOutput& header, const char* sourceFilename, CodegenOutput& source);
-
-} // namespace Utils