mirror of
https://github.com/gbdev/rgbds.git
synced 2026-06-09 18:22:35 +00:00
Encapsulate charmap_Init, like sym_Init
This commit is contained in:
@@ -10,8 +10,7 @@
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#define DEFAULT_CHARMAP_NAME "main"
|
||||
|
||||
void charmap_Init();
|
||||
bool charmap_ForEach(
|
||||
void (*mapFunc)(std::string const &),
|
||||
void (*charFunc)(std::string const &, std::vector<int32_t>)
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#include "asm/warning.hpp"
|
||||
|
||||
#define DEFAULT_CHARMAP_NAME "main"
|
||||
|
||||
static bool compareNode(std::pair<char, size_t> edge, char c) {
|
||||
return edge.first < c;
|
||||
}
|
||||
@@ -91,6 +93,10 @@ static InsertionOrderedMap<Charmap> charmaps;
|
||||
static Charmap *currentCharmap;
|
||||
static std::stack<Charmap *> charmapStack;
|
||||
|
||||
void charmap_Init() {
|
||||
charmap_New(DEFAULT_CHARMAP_NAME, nullptr);
|
||||
}
|
||||
|
||||
bool charmap_ForEach(
|
||||
void (*mapFunc)(std::string const &),
|
||||
void (*charFunc)(std::string const &, std::vector<int32_t>)
|
||||
|
||||
+1
-1
@@ -558,7 +558,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
options.printDep(*localOptions.inputFileName);
|
||||
|
||||
charmap_New(DEFAULT_CHARMAP_NAME, nullptr);
|
||||
charmap_Init();
|
||||
|
||||
// Init lexer and file stack, and parse (`yy::parser` is auto-generated from `parser.y`)
|
||||
if (yy::parser parser; fstk_Init(*localOptions.inputFileName) && parser.parse() != 0) {
|
||||
|
||||
Reference in New Issue
Block a user