![]() |
Phasor 2.2.0
Stack VM based Programming Language
|
Generates C++ header files with embedded Phasor bytecode. More...
#include <CppCodeGenerator.hpp>
Public Member Functions | |
| bool | generate (const Bytecode &bytecode, const std::filesystem::path &outputPath, const std::string &moduleName="") |
| Generate C++ header file from bytecode. | |
| Bytecode | generateBytecodeFromEmbedded (const std::string &input) |
| Generate Bytecode object from embedded bytecode string. | |
Private Member Functions | |
| void | generateFileHeader () |
| void | generateModuleName () |
| void | generateIncludes () |
| void | generateEmbeddedBytecode () |
| void | generateTempFileWriter () |
| void | generateMainFunction () |
| std::vector< unsigned char > | parseEmbeddedBytecode (const std::string &input) |
| std::string | escapeString (const std::string &str) |
| std::string | getValueTypeString (ValueType type) |
| std::string | sanitizeModuleName (const std::string &name) |
Private Attributes | |
| std::ostringstream | output |
| Output stream for generated code. | |
| const Bytecode * | bytecode = nullptr |
| std::string | moduleName |
| std::vector< uint8_t > | serializedBytecode |
| Serialized bytecode in .phsb format. | |
Generates C++ header files with embedded Phasor bytecode.
This class takes compiled Phasor bytecode and generates a C++ header file that embeds the bytecode as inline data. The header is designed to be included in CppRuntime_main.cpp to provide the module name, bytecode array, and bytecode size.
Definition at line 19 of file CppCodeGenerator.hpp.
|
private |
Definition at line 123 of file CppCodeGenerator.cpp.
| bool Phasor::CppCodeGenerator::generate | ( | const Bytecode & | bytecode, |
| const std::filesystem::path & | outputPath, | ||
| const std::string & | moduleName = "" ) |
Generate C++ header file from bytecode.
| bytecode | The compiled bytecode to embed |
| outputPath | Path to the output header file |
| moduleName | Optional module name (defaults to filename without extension) |
Definition at line 11 of file CppCodeGenerator.cpp.
| Bytecode Phasor::CppCodeGenerator::generateBytecodeFromEmbedded | ( | const std::string & | input | ) |
Generate Bytecode object from embedded bytecode string.
| input | The string containing the embedded bytecode array |
Definition at line 56 of file CppCodeGenerator.cpp.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Definition at line 157 of file CppCodeGenerator.cpp.
|
private |
|
private |
|
private |
Definition at line 43 of file CppCodeGenerator.hpp.
|
private |
Definition at line 44 of file CppCodeGenerator.hpp.
|
private |
Output stream for generated code.
Definition at line 42 of file CppCodeGenerator.hpp.
|
private |
Serialized bytecode in .phsb format.
Definition at line 45 of file CppCodeGenerator.hpp.