From fbfbd2145aa6ec9f234fae72a26f995bedb1fa39 Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Fri, 26 Feb 2016 11:50:43 +0100 Subject: Run clang-format on gendef.cc --- MSVC_Net2013/gendef/gendef.cc | 80 ++++++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 35 deletions(-) diff --git a/MSVC_Net2013/gendef/gendef.cc b/MSVC_Net2013/gendef/gendef.cc index cf665604..d18ac9fb 100644 --- a/MSVC_Net2013/gendef/gendef.cc +++ b/MSVC_Net2013/gendef/gendef.cc @@ -22,68 +22,78 @@ /* Modified by Cedric Gustin on 2006/01/13 : * Redirect the output of dumpbin to dumpbin.out instead of reading the - * output stream of popen, as it fails with Visual Studio 2005 in + * output stream of popen, as it fails with Visual Studio 2005 in * pre-link build events. */ -#include #include +#include #include using namespace std; -int main(int argc,char** argv) +int +main(int argc, char** argv) { - if (argc < 4) { - cerr << "Usage: " << argv[0] << " ...." << endl; - return 2; + if (argc < 4) + { + cerr << "Usage: " << argv[0] << " ...." << endl; + return 2; } // CG : Explicitly redirect stdout to dumpbin.out. string dumpbin = "dumpbin /SYMBOLS /OUT:dumpbin.out"; int i = 3; - for(;i fct - def_file << " " << (s+1) << endl; - else - if(strchr(s,'?')!=0 && strncmp(s,"??_G",4)!=0 && strncmp(s,"??_E",4)!=0) { - def_file << " " << s << endl; - } - } - } + i = 0; + while (!feof(dump)) + { + char buf[65000]; + + if (fgets(buf, 64999, dump) != NULL) + { + if (!strstr(buf, " UNDEF ") && strstr(buf, " External ")) + { + char* s = strchr(buf, '|') + 1; + while (*s == ' ' || *s == '\t') + s++; + char* e = s; + while (*e != ' ' && *e != '\t' && *e != '\0' && *e != '\n') + e++; + *e = '\0'; + + if (strchr(s, '?') == 0 && s[0] == '_' && + strchr(s, '@') == 0) // this is a C export type: _fct -> fct + def_file << " " << (s + 1) << endl; + else if (strchr(s, '?') != 0 && strncmp(s, "??_G", 4) != 0 && strncmp(s, "??_E", 4) != 0) + { + def_file << " " << s << endl; + } + } + } } // CG : Close dumpbin.out and delete it. -- cgit v1.2.1