X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=tools%2Ftranslate.c;h=1fa3d95fdb686bb2129bfdba0479becf0d9e2727;hb=9ea60b8d585086fa64f7a8cd298ec1cd698ad56d;hp=cc6795a98a549302457b1fcd24e68743069738c7;hpb=6bda240a5ac56a698fbe25bcf59e3afdf164ff69;p=ia32rtools.git diff --git a/tools/translate.c b/tools/translate.c index cc6795a..1fa3d95 100644 --- a/tools/translate.c +++ b/tools/translate.c @@ -13,6 +13,7 @@ #include "my_assert.h" #include "my_str.h" +#include "common.h" #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) #define IS(w, y) !strcmp(w, y) @@ -6350,30 +6351,6 @@ static void output_hdr(FILE *fout) fwrite(line, 1, strlen(line), fout); } -// read a line, truncating it if it doesn't fit -static char *my_fgets(char *s, size_t size, FILE *stream) -{ - char *ret, *ret2; - char buf[64]; - int p; - - p = size - 2; - if (p >= 0) - s[p] = 0; - - ret = fgets(s, size, stream); - if (ret != NULL && p >= 0 && s[p] != 0 && s[p] != '\n') { - p = sizeof(buf) - 2; - do { - buf[p] = 0; - ret2 = fgets(buf, sizeof(buf), stream); - } - while (ret2 != NULL && buf[p] != 0 && buf[p] != '\n'); - } - - return ret; -} - // '=' needs special treatment // also ' quote static char *next_word_s(char *w, size_t wsize, char *s) @@ -6473,6 +6450,11 @@ static void scan_variables(FILE *fasm) if (wordc < 2) continue; + if (IS_START(words[0], "__IMPORT_DESCRIPTOR_")) { + // when this starts, we don't need anything from this section + break; + } + if ((hg_var_cnt & 0xff) == 0) { hg_vars = realloc(hg_vars, sizeof(hg_vars[0]) * (hg_var_cnt + 0x100));