From: notaz Date: Wed, 22 Jan 2014 19:09:11 +0000 (+0200) Subject: move some files, fix winelib build X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa1aa2c24c3b224443702c556a5e1c50f6dc9d05;p=ia32rtools.git move some files, fix winelib build --- diff --git a/stdc.list b/stdc.list new file mode 100644 index 0000000..840b592 --- /dev/null +++ b/stdc.list @@ -0,0 +1,71 @@ +_exit +__exit +_strcpy +_strcat +_strncpy +_strlen +_free +_malloc +_memcpy +_calloc +_realloc +_memset +_strcspn +_strcmp +_memcmp +_strncmp +_strpbrk +_atol +_getenv +_isalpha +_isdigit +_isspace +_isprint +_tolower +#_strncnt +#_findenv +#__strdup +#__mbschr +_strchr +_strrchr +_strtoxl +_strtol +_strtoul +_srand +_rand +_time +_siglookup +_signal +_strtok +__wcsicmp +__ismbcspace +__mbsrchr +_shortsort +_qsort +__mbspbrk +__mbsstr +_localtime +_asctime +_strstr +_gmtime +_wctomb +__vsnprintf +__mbslen +_fopen +_fclose +_setvbuf +_fread +_fwrite +_fseek +_fgetc +__filbuf +__mbsicmp +__beginthreadex +__onexit +_atexit +__stricmp +__strnicmp +# not from mingw +_memcpy_0 +# math +# __ftol2 - todo diff --git a/tools/cvt_data.c b/tools/cvt_data.c index bddd6ef..2f32181 100644 --- a/tools/cvt_data.c +++ b/tools/cvt_data.c @@ -311,6 +311,16 @@ check_sym: return pp; } +static void output_decorated_pp(FILE *fout, + const struct parsed_proto *pp) +{ + if (pp->name[0] != '_') + fprintf(fout, pp->is_fastcall ? "@" : "_"); + fprintf(fout, "%s", pp->name); + if (pp->is_stdcall && pp->argc > 0) + fprintf(fout, "@%d", pp->argc * 4); +} + static int cmpstringp(const void *p1, const void *p2) { return strcmp(*(char * const *)p1, *(char * const *)p2); @@ -320,6 +330,7 @@ int main(int argc, char *argv[]) { FILE *fout, *fasm, *fhdr, *frlist; const struct parsed_proto *pp; + int no_decorations = 0; char words[20][256]; char word[256]; char line[256]; @@ -345,11 +356,19 @@ int main(int argc, char *argv[]) char *p2; if (argc < 4) { - printf("usage:\n%s <.s> <.asm> [rlist]*\n", + // -nd: no symbol decorations + printf("usage:\n%s [-nd] <.s> <.asm> [rlist]*\n", argv[0]); return 1; } + for (arg = 1; arg < argc; arg++) { + if (IS(argv[arg], "-nd")) + no_decorations = 1; + else + break; + } + arg_out = arg++; asmfn = argv[arg++]; @@ -482,7 +501,7 @@ int main(int argc, char *argv[]) g_func_sym_pp = NULL; len = strlen(sym); - fprintf(fout, "_%s:", sym); + fprintf(fout, "%s%s:", no_decorations ? "" : "_", sym); len += 2; if (len < 8) @@ -607,11 +626,16 @@ int main(int argc, char *argv[]) } else { pp = check_var(fhdr, sym, p); - if (p[0] != '_') - fprintf(fout, (pp && pp->is_fastcall) ? "@" : "_"); - fprintf(fout, "%s", p); - if (pp && pp->is_stdcall && pp->argc > 0) - fprintf(fout, "@%d", pp->argc * 4); + if (pp == NULL) { + fprintf(fout, "%s%s", + (no_decorations || p[0] == '_') ? "" : "_", p); + } + else { + if (no_decorations) + fprintf(fout, "%s", pp->name); + else + output_decorated_pp(fout, pp); + } } } else { @@ -638,7 +662,8 @@ fin: // dump public syms for (i = 0; i < pub_sym_cnt; i++) - fprintf(fout, ".global _%s\n", pub_syms[i]); + fprintf(fout, ".global %s%s\n", + no_decorations ? "" : "_", pub_syms[i]); fclose(fout); fclose(fasm); diff --git a/tools/mkdef_ord.c b/tools/mkdef_ord.c index 4f6b50b..fd999c2 100644 --- a/tools/mkdef_ord.c +++ b/tools/mkdef_ord.c @@ -19,13 +19,22 @@ int main(int argc, char *argv[]) char line[256]; char fmt[256]; char word[256]; + int noname = 0; + const char *p2; char *p; - int arg = 1; + int arg; int ret, ord; int l; - if (argc != 3) { - printf("usage:\n%s <.h> <.def>\n", argv[0]); + for (arg = 1; arg < argc; arg++) { + if (IS(argv[arg], "-n")) + noname = 1; + else + break; + } + + if (argc != arg + 2) { + printf("usage:\n%s [-n] <.h> <.def>\n", argv[0]); return 1; } @@ -38,9 +47,12 @@ int main(int argc, char *argv[]) p = strrchr(hdrfn, '.'); my_assert_not(p, NULL); - l = p - hdrfn; - my_assert(l < 256, 1); - memcpy(basename, hdrfn, l); + p2 = strrchr(hdrfn, '/'); + if (p2++ == NULL) + p2 = hdrfn; + l = p - p2; + my_assert((unsigned int)l < 256, 1); + memcpy(basename, p2, l); basename[l] = 0; snprintf(fmt, sizeof(fmt), "%s_%%d", basename); @@ -79,7 +91,10 @@ int main(int argc, char *argv[]) fprintf(fout, "@%-2d", pp->argc_stack * 4); else fprintf(fout, " "); - fprintf(fout, " @%d\n", ord); + fprintf(fout, " @%d", ord); + if (noname) + fprintf(fout, " NONAME"); + fprintf(fout, "\n"); } fclose(fhdr);