Path fubar in overlay fixed.
This commit is contained in:
parent
9e95c1fab0
commit
f1031351ed
2 changed files with 15 additions and 31 deletions
|
@ -21,21 +21,17 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "f256.h"
|
#define SEGMENT_TEST
|
||||||
#include "f256.c"
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
|
|
||||||
#define test(...) ( *(volatile byte *)(0x000D) = 8; REAL_test(__VA_ARGS__); *(volatile byte *)(0x000D) = 5; )
|
|
||||||
|
|
||||||
|
|
||||||
void test(int arg1, int arg2) {
|
void test(int arg1, int arg2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define SEGMENT_MAIN
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
test(test);
|
test(1, 2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,6 @@ void parseCFile(char *filename, char *targetFile, FILE *trampoline, char *trampo
|
||||||
* This parser sucks.
|
* This parser sucks.
|
||||||
*
|
*
|
||||||
* - It only handles C, not C++.
|
* - It only handles C, not C++.
|
||||||
* - It should scan for function names backwards from the '(' and not by skipping possible modifiers like 'static' and 'struct'.
|
|
||||||
* - It can only handle single-line function definitions with the opening '{' on the same line as the function.
|
* - It can only handle single-line function definitions with the opening '{' on the same line as the function.
|
||||||
* - It can be borked by comments.
|
* - It can be borked by comments.
|
||||||
* - It always generates trampolines, not just when they're needed.
|
* - It always generates trampolines, not just when they're needed.
|
||||||
|
@ -152,26 +151,14 @@ void parseCFile(char *filename, char *targetFile, FILE *trampoline, char *trampo
|
||||||
if (buffer[strlen(buffer) - 1] == ')') {
|
if (buffer[strlen(buffer) - 1] == ')') {
|
||||||
// Function. Annotate it!
|
// Function. Annotate it!
|
||||||
fprintf(out, "__attribute__((noinline, section(\".block%d\")))\n", _currentBank);
|
fprintf(out, "__attribute__((noinline, section(\".block%d\")))\n", _currentBank);
|
||||||
// Scan forward to find function name.
|
|
||||||
found = false;
|
// Scan forward to find the '(' after the function name.
|
||||||
start = buffer;
|
b = buffer;
|
||||||
do {
|
|
||||||
b = start;
|
|
||||||
while (*b != ' ') b++;
|
|
||||||
// This could be 'struct' or 'static'. Put a null there and check. (Then put the space back!)
|
|
||||||
*b = 0;
|
|
||||||
if ((strcmp(start, "struct") == 0) || (strcmp(start, "static") == 0)) {
|
|
||||||
// Keep looking.
|
|
||||||
start = ++b;
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
*b = ' ';
|
|
||||||
} while (found);
|
|
||||||
// Now that we could have a 'static struct' or something, put the zero back for later.
|
|
||||||
*b = 0;
|
|
||||||
// We're past the types. Now find the '(' after the function name.
|
|
||||||
start = ++b;
|
|
||||||
while (*b != '(') b++;
|
while (*b != '(') b++;
|
||||||
|
// Now go backwards and look for a space.
|
||||||
|
start = b;
|
||||||
|
while (*start != ' ') start--;
|
||||||
|
*start++ = 0;
|
||||||
// Yank the function name out.
|
// Yank the function name out.
|
||||||
*b = 0;
|
*b = 0;
|
||||||
temp = strdup(start);
|
temp = strdup(start);
|
||||||
|
@ -314,9 +301,9 @@ int main(int argc, char *argv[]) {
|
||||||
fprintf(out, "#define TRAMPOLINE_H\n\n");
|
fprintf(out, "#define TRAMPOLINE_H\n\n");
|
||||||
|
|
||||||
// Find common inital path so we can remove it later.
|
// Find common inital path so we can remove it later.
|
||||||
sourceDir = strdup(argv[x]);
|
sourceDir = strdup(argv[3]);
|
||||||
utilFixPathSeparators(&sourceDir, true);
|
utilFixPathSeparators(&sourceDir, true);
|
||||||
sourceDirOffset = strlen(sourceDir);
|
sourceDirOffset = strlen(sourceDir) - 1;
|
||||||
if (argc > 4) {
|
if (argc > 4) {
|
||||||
for (x=4; x<argc; x++) {
|
for (x=4; x<argc; x++) {
|
||||||
thisOffset = 0;
|
thisOffset = 0;
|
||||||
|
@ -363,6 +350,7 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
free(thisDir);
|
free(thisDir);
|
||||||
parseCFile(cFile, targetFile, out, trampolineFile, nearSlot + 8);
|
parseCFile(cFile, targetFile, out, trampolineFile, nearSlot + 8);
|
||||||
|
//printf("%s --> %s\n", cFile, targetFile);
|
||||||
free(cFile);
|
free(cFile);
|
||||||
free(targetFile);
|
free(targetFile);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue