#pragma once #include #include typedef struct FasmLinkedLine { char const *begin; char const *end; FasmToken instruction; uint8_t *operands; size_t operands_size; } FasmLinkedLine; typedef struct FasmVariable { char const *begin; char const *end; uint64_t value; } FasmVariable; typedef struct FasmLinkedLines { FasmLinkedLine *lines; size_t lines_size; FasmVariable *variables; size_t variables_size; uint8_t *data; size_t data_size; } FasmLinkedLines; extern void fasmVariablePrint(FasmVariable variable); extern void fasmLinkedLinePrint(FasmLinkedLine line); extern void fasmLinkedLinesPrint(FasmLinkedLines lines); extern void fasmLinkedLineDeleteInner(FasmLinkedLine line); extern void fasmLinkedLinesDeleteInner(FasmLinkedLines lines); extern FasmLinkedLines fasmLinker(const FasmLines *lines, SourceCode *sourceCode); extern void fasmLinesSetVariables(FasmLinkedLines *linkedLines, const FasmLines *lines, SourceCode *sourceCode); extern void fasmLinesSetLines(FasmLinkedLines *linkedLines, const FasmLines *lines, SourceCode *sourceCode); extern void fasmLinesSetData(FasmLinkedLines *linkedLines, const FasmLines *lines, SourceCode *sourceCode); extern FasmLinkedLine fasmLinesParseLine(FasmLinkedLines *linkedLines, FasmLine line, SourceCode *sourceCode); extern bool fasmLinkerOperandSizeCorrect(FasmToken token, int size); extern size_t getSizeOfLine(const FasmLine line); extern size_t getSizeOfLineOperands(const FasmLine line); extern size_t getSizeOfLineOperandElementSize(const FasmLine line); extern void fasmLinesPushVariable(FasmLinkedLines *linkedLines, FasmVariable variable); extern void fasmLinesPushLine(FasmLinkedLines *linkedLines, FasmLinkedLine line); extern void fasmLinesPushData(FasmLinkedLines *linkedLines, uint8_t *data, size_t size); extern FasmVariable fasmLinesGetVariable(const FasmLinkedLines *linkedLines, char const *nameBegin, char const *nameEnd); extern bool isOperandString(FasmOperand operand); extern uint64_t getOperandValue(FasmLinkedLines *linkedLines, FasmOperand operand, SourceCode *sourceCode); extern uint64_t strToInt(const char *begin, const char *end, SourceCode *sourceCode); extern uint64_t hexStrToInt(const char *begin, const char *end, SourceCode *sourceCode); extern uint64_t binStrToInt(const char *begin, const char *end, SourceCode *sourceCode);