diff options
author | rtk0c <[email protected]> | 2022-06-03 23:30:01 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-06-03 23:30:01 -0700 |
commit | 791b3f354b378769bffe623b05f1305c91b77101 (patch) | |
tree | 5409b311e6232eb4a6d3f8259b780d76b8ee1c59 /source/CodegenCompiler/CodegenUtils.hpp | |
parent | 60ccc62f4934e44ad5b905fdbcf458302b8d8a09 (diff) |
Changeset: 64 [WIP] Rename directoriesmaster-switch-to-build2
Diffstat (limited to 'source/CodegenCompiler/CodegenUtils.hpp')
-rw-r--r-- | source/CodegenCompiler/CodegenUtils.hpp | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/source/CodegenCompiler/CodegenUtils.hpp b/source/CodegenCompiler/CodegenUtils.hpp deleted file mode 100644 index 62d5400..0000000 --- a/source/CodegenCompiler/CodegenUtils.hpp +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once - -#include "CodegenConfig.hpp" -#include "CodegenDecl.hpp" -#include "CodegenOutput.hpp" - -#include <algorithm> -#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 MakeFullName(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); -void ProduceClassTypeInfo(CodegenOutput& source, std::string_view className, const DeclNamespace* ns = nullptr); - -} // namespace Utils |