Implement infrastructure around new lexer

The lexer itself is very much incomplete, but this is intended to be a
safe point to revert to should further implementation go south.
This commit is contained in:
ISSOtm
2020-07-23 12:12:58 +02:00
parent 3a44cc7722
commit 6dc4ce6599
15 changed files with 497 additions and 1586 deletions

View File

@@ -656,9 +656,15 @@ void out_BinaryFile(char const *s, int32_t startPos)
startPos = 0;
}
FILE *f = fstk_FindFile(s, NULL);
char *fullPath = NULL;
size_t size = 0;
FILE *f = NULL;
if (fstk_FindFile(s, &fullPath, &size))
f = fopen(fullPath, "rb");
if (!f) {
free(fullPath);
if (oGeneratedMissingIncludes) {
oFailedOnMissingInclude = true;
return;
@@ -699,6 +705,7 @@ void out_BinaryFile(char const *s, int32_t startPos)
error("Error reading INCBIN file '%s': %s\n", s, strerror(errno));
fclose(f);
free(fullPath);
}
void out_BinaryFileSlice(char const *s, int32_t start_pos, int32_t length)
@@ -715,9 +722,15 @@ void out_BinaryFileSlice(char const *s, int32_t start_pos, int32_t length)
if (length == 0) /* Don't even bother with 0-byte slices */
return;
FILE *f = fstk_FindFile(s, NULL);
char *fullPath = NULL;
size_t size = 0;
FILE *f = NULL;
if (fstk_FindFile(s, &fullPath, &size))
f = fopen(fullPath, "rb");
if (!f) {
free(fullPath);
if (oGeneratedMissingIncludes) {
oFailedOnMissingInclude = true;
return;
@@ -767,6 +780,7 @@ void out_BinaryFileSlice(char const *s, int32_t start_pos, int32_t length)
}
fclose(f);
free(fullPath);
}
/*