mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Move RPN buffer encoding logic into rpn.cpp
This commit is contained in:
@@ -12,10 +12,12 @@
|
||||
|
||||
struct Expression;
|
||||
struct FileStackNode;
|
||||
struct Symbol;
|
||||
|
||||
enum StateFeature { STATE_EQU, STATE_VAR, STATE_EQUS, STATE_CHAR, STATE_MACRO, NB_STATE_FEATURES };
|
||||
|
||||
void out_RegisterNode(std::shared_ptr<FileStackNode> node);
|
||||
void out_RegisterSymbol(Symbol &sym);
|
||||
void out_CreatePatch(uint32_t type, Expression const &expr, uint32_t ofs, uint32_t pcShift);
|
||||
void out_CreateAssert(
|
||||
AssertionType type, Expression const &expr, std::string const &message, uint32_t ofs
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
struct Symbol;
|
||||
|
||||
struct RPNValue {
|
||||
RPNCommand command;
|
||||
std::variant<std::monostate, uint8_t, uint32_t, std::string> data;
|
||||
RPNCommand command; // The RPN_* command ID
|
||||
std::variant<std::monostate, uint8_t, uint32_t, std::string> data; // Data after the ID, if any
|
||||
|
||||
void appendEncoded(std::vector<uint8_t> &buffer) const;
|
||||
};
|
||||
|
||||
struct Expression {
|
||||
@@ -48,6 +50,8 @@ struct Expression {
|
||||
void addCheckBitIndex(uint8_t mask);
|
||||
|
||||
void checkNBit(uint8_t n) const;
|
||||
|
||||
void encode(std::vector<uint8_t> &buffer) const;
|
||||
};
|
||||
|
||||
bool checkNBit(int32_t v, uint8_t n, char const *name);
|
||||
|
||||
Reference in New Issue
Block a user