mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Refactor code that handles when included files are missing
- Single unified routine for erroring out or handling missing dependencies - Single three-state enum instead of two Booleans for missing dependencies (this causes `-MC` to imply `-MG` instead of needing `-MG -MC`) - Functions than can miss included files return a Boolean for whether the parser should `YYACCEPT` and exit
This commit is contained in:
@@ -58,9 +58,10 @@ MacroArgs *fstk_GetCurrentMacroArgs();
|
||||
void fstk_AddIncludePath(std::string const &path);
|
||||
void fstk_SetPreIncludeFile(std::string const &path);
|
||||
std::optional<std::string> fstk_FindFile(std::string const &path);
|
||||
bool fstk_FileError(std::string const &path, char const *functionName);
|
||||
|
||||
bool yywrap();
|
||||
void fstk_RunInclude(std::string const &path, bool updateStateNow);
|
||||
bool fstk_RunInclude(std::string const &path);
|
||||
void fstk_RunMacro(std::string const ¯oName, std::shared_ptr<MacroArgs> macroArgs);
|
||||
void fstk_RunRept(uint32_t count, int32_t reptLineNo, ContentSpan const &span);
|
||||
void fstk_RunFor(
|
||||
|
||||
@@ -15,11 +15,16 @@ extern bool verbose;
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
enum MissingInclude {
|
||||
INC_ERROR, // A missing included file is an error that halts assembly
|
||||
GEN_EXIT, // A missing included file is assumed to be generated; exit normally
|
||||
GEN_CONTINUE, // A missing included file is assumed to be generated; continue assembling
|
||||
};
|
||||
|
||||
extern FILE *dependFile;
|
||||
extern std::string targetFileName;
|
||||
extern bool continueAfterMissingIncludes;
|
||||
extern bool generatedMissingIncludes;
|
||||
extern bool failedOnMissingInclude;
|
||||
extern MissingInclude missingIncludeState;
|
||||
extern bool generatePhonyDeps;
|
||||
extern bool failedOnMissingInclude;
|
||||
|
||||
#endif // RGBDS_ASM_MAIN_HPP
|
||||
|
||||
@@ -96,8 +96,8 @@ void sect_RelBytes(uint32_t n, std::vector<Expression> const &exprs);
|
||||
void sect_RelWord(Expression const &expr, uint32_t pcShift);
|
||||
void sect_RelLong(Expression const &expr, uint32_t pcShift);
|
||||
void sect_PCRelByte(Expression const &expr, uint32_t pcShift);
|
||||
void sect_BinaryFile(std::string const &name, uint32_t startPos);
|
||||
void sect_BinaryFileSlice(std::string const &name, uint32_t startPos, uint32_t length);
|
||||
bool sect_BinaryFile(std::string const &name, uint32_t startPos);
|
||||
bool sect_BinaryFileSlice(std::string const &name, uint32_t startPos, uint32_t length);
|
||||
|
||||
void sect_EndSection();
|
||||
void sect_PushSection();
|
||||
|
||||
Reference in New Issue
Block a user