mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Initialize maxRecursionDepth with other options
This commit is contained in:
@@ -75,6 +75,6 @@ void fstk_RunFor(
|
||||
bool fstk_Break();
|
||||
|
||||
void fstk_NewRecursionDepth(size_t newDepth);
|
||||
void fstk_Init(std::string const &mainPath, size_t maxDepth);
|
||||
void fstk_Init(std::string const &mainPath);
|
||||
|
||||
#endif // RGBDS_ASM_FSTACK_HPP
|
||||
|
||||
@@ -15,7 +15,7 @@ enum MissingInclude {
|
||||
|
||||
struct Options {
|
||||
uint8_t fixPrecision = 16; // -Q
|
||||
size_t maxRecursionDepth; // -r
|
||||
size_t maxRecursionDepth = 64; // -r
|
||||
char binDigits[2] = {'0', '1'}; // -b
|
||||
char gfxDigits[4] = {'0', '1', '2', '3'}; // -g
|
||||
bool verbose = false; // -v
|
||||
|
||||
@@ -410,11 +410,9 @@ void fstk_NewRecursionDepth(size_t newDepth) {
|
||||
options.maxRecursionDepth = newDepth;
|
||||
}
|
||||
|
||||
void fstk_Init(std::string const &mainPath, size_t maxDepth) {
|
||||
void fstk_Init(std::string const &mainPath) {
|
||||
newFileContext(mainPath, true);
|
||||
|
||||
options.maxRecursionDepth = maxDepth;
|
||||
|
||||
for (std::string const &name : preIncludeNames) {
|
||||
if (std::optional<std::string> fullPath = fstk_FindFile(name); fullPath) {
|
||||
newFileContext(*fullPath, false);
|
||||
|
||||
@@ -165,26 +165,23 @@ static std::vector<StateFeature> parseStateFeatures(char *str) {
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
time_t now = time(nullptr);
|
||||
// Support SOURCE_DATE_EPOCH for reproducible builds
|
||||
// https://reproducible-builds.org/docs/source-date-epoch/
|
||||
time_t now = time(nullptr);
|
||||
if (char const *sourceDateEpoch = getenv("SOURCE_DATE_EPOCH"); sourceDateEpoch) {
|
||||
now = static_cast<time_t>(strtoul(sourceDateEpoch, nullptr, 0));
|
||||
}
|
||||
|
||||
// Perform some init for below
|
||||
sym_Init(now);
|
||||
|
||||
// Set defaults
|
||||
sym_SetExportAll(false);
|
||||
uint32_t maxDepth = 64;
|
||||
char const *dependFileName = nullptr;
|
||||
std::unordered_map<std::string, std::vector<StateFeature>> stateFileSpecs;
|
||||
// Maximum of 100 errors only applies if rgbasm is printing errors to a terminal.
|
||||
// Maximum of 100 errors only applies if rgbasm is printing errors to a terminal
|
||||
if (isatty(STDERR_FILENO)) {
|
||||
options.maxErrors = 100;
|
||||
}
|
||||
|
||||
// Local options
|
||||
char const *dependFileName = nullptr; // -M
|
||||
std::unordered_map<std::string, std::vector<StateFeature>> stateFileSpecs; // -s
|
||||
|
||||
for (int ch; (ch = musl_getopt_long_only(argc, argv, optstring, longopts, nullptr)) != -1;) {
|
||||
switch (ch) {
|
||||
char *endptr;
|
||||
@@ -295,7 +292,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
case 'r':
|
||||
maxDepth = strtoul(musl_optarg, &endptr, 0);
|
||||
options.maxRecursionDepth = strtoul(musl_optarg, &endptr, 0);
|
||||
|
||||
if (musl_optarg[0] == '\0' || *endptr != '\0') {
|
||||
fatal("Invalid argument for option 'r'");
|
||||
@@ -415,7 +412,7 @@ int main(int argc, char *argv[]) {
|
||||
charmap_New(DEFAULT_CHARMAP_NAME, nullptr);
|
||||
|
||||
// Init lexer and file stack, providing file info
|
||||
fstk_Init(mainFileName, maxDepth);
|
||||
fstk_Init(mainFileName);
|
||||
|
||||
// Perform parse (`yy::parser` is auto-generated from `parser.y`)
|
||||
if (yy::parser parser; parser.parse() != 0) {
|
||||
|
||||
@@ -36,7 +36,7 @@ static char savedTIME[256];
|
||||
static char savedDATE[256];
|
||||
static char savedTIMESTAMP_ISO8601_LOCAL[256];
|
||||
static char savedTIMESTAMP_ISO8601_UTC[256];
|
||||
static bool exportAll; // -E
|
||||
static bool exportAll = false; // -E
|
||||
|
||||
bool sym_IsPC(Symbol const *sym) {
|
||||
return sym == PCSymbol;
|
||||
|
||||
Reference in New Issue
Block a user