5 #include <unordered_map> 15 namespace size_multipliers
22 constexpr
size_t operator""_KB(
unsigned long long int size)
24 return static_cast<size_t>(size * 1024);
32 constexpr
size_t operator""_KB(
long double size)
34 return static_cast<size_t>(size * 1024);
42 constexpr
size_t operator""_MB(
unsigned long long int size)
44 return static_cast<size_t>(size * 1024 * 1024);
52 constexpr
size_t operator""_MB(
long double size)
54 return static_cast<size_t>(size * 1024 * 1024);
62 constexpr
size_t operator""_GB(
unsigned long long int size)
64 return static_cast<size_t>(size * 1024 * 1024 * 1024);
72 constexpr
size_t operator""_GB(
long double size)
74 return static_cast<size_t>(size * 1024 * 1024 * 1024);
78 using ::fasmcpp::size_multipliers::operator
""_KB;
97 Assembler(
size_t memory,
size_t predefinitionsMemory = 10_KB);
104 void* getMemory()
const;
106 uint32_t getMemorySize()
const;
110 char* getPredefinitionsMemory()
const;
114 uint32_t getPredefinitionsMemorySize()
const;
117 void* _assemblerMemory;
118 uint32_t _assemblerMemorySize;
119 char* _predefinitionsMemory =
nullptr;
120 uint32_t _predefinitionsMemorySize = 0;
149 int64_t run(
bool preserveRegisters =
true)
const;
151 const char* getErrors()
const;
153 const char* getMessages()
const;
155 void addError(
const char* error, AssemblyKey);
157 void addMessage(
const char* message, AssemblyKey);
159 _fasmcpp::AssemblerInput& getInput(AssemblyKey);
161 _fasmcpp::AssemblerOutput& getOutput(AssemblyKey);
169 void addPredefinition(
const char* name,
const char* value);
177 void addPredefinition(
const char* name,
const void* value);
179 void clearPredefinitions();
181 const char* getOutput();
183 size_t getOutputSize();
186 void allocateExecutableMemory(
size_t size);
187 void freeExecutableMemory();
190 _fasmcpp::AssemblerInput _code;
191 _fasmcpp::AssemblerOutput _bytecode;
193 std::string _messages;
194 std::unordered_map<std::string, std::string> _predefinitions;
195 bool _predefinitionsChanged =
false;
196 void* _executableMemory =
nullptr;
197 size_t _executableMemorySize = 0;
200 const char* rebuildPredefinitionsString();
202 std::vector<char> _predefinitionsString;
Manages resources for Flat Assembler.
Definition: fasmcpp.h:81
Contains assembly code and its bytecode and predefinitions.
Definition: fasmcpp.h:124
Contains all public symbols.
Definition: fasmcpp.h:12