OpenSceneGraph/PlatformSpecifics/Windows/collect_mangled_names.js

103 lines
1.7 KiB
JavaScript
Raw Normal View History

2006-04-04 22:10:48 +08:00
/* collect_mangled_names - Copyright (C) 2006 Joran Jessurun
2006-04-04 22:10:48 +08:00
*
2006-04-04 22:10:48 +08:00
* This library is open source and may be redistributed and/or modified under
2006-04-04 22:10:48 +08:00
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
2006-04-04 22:10:48 +08:00
* (at your option) any later version. The full license is in LICENSE file
2006-04-04 22:10:48 +08:00
* included with this distribution, and on the openscenegraph.org website.
2006-04-04 22:10:48 +08:00
*
2006-04-04 22:10:48 +08:00
* This library is distributed in the hope that it will be useful,
2006-04-04 22:10:48 +08:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
2006-04-04 22:10:48 +08:00
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2006-04-04 22:10:48 +08:00
* OpenSceneGraph Public License for more details.
2006-04-04 22:10:48 +08:00
*
2006-04-04 22:10:48 +08:00
* Made by Joran Jessurun (A.J.Jessurun@tue.nl)
2006-04-04 22:10:48 +08:00
*/
2006-04-04 22:10:48 +08:00
var dumpbin="dumpbin";
2006-04-04 22:10:48 +08:00
var fso=WScript.createObject("Scripting.FileSystemObject");
2006-04-04 22:10:48 +08:00
var ForReading=1;
2006-04-04 22:10:48 +08:00
var ForWriting=2;
2006-04-04 22:10:48 +08:00
var shell=WScript.createObject("WScript.Shell");
2006-04-04 22:10:48 +08:00
function process(file) {
2006-04-04 22:10:48 +08:00
WScript.echo("Processing: "+file);
2006-04-04 22:10:48 +08:00
var txt="";
2006-04-04 22:10:48 +08:00
var exec=shell.exec(dumpbin+' /linkermember:1 "'+file+'"');
2006-04-04 22:10:48 +08:00
while(!exec.stdOut.atEndOfStream)
2006-04-04 22:10:48 +08:00
{
2006-04-04 22:10:48 +08:00
var line=exec.stdOut.readLine();
2006-04-04 22:10:48 +08:00
if(/3V\?\$RegisterReaderWriterProxy/.test(line)
2006-04-04 22:10:48 +08:00
|| /3VRegisterDotOsgWrapperProxy/.test(line))
2006-04-04 22:10:48 +08:00
{
2006-04-04 22:10:48 +08:00
txt+=line.substr(10)+"\n";
2006-04-04 22:10:48 +08:00
}
2006-04-04 22:10:48 +08:00
}
2006-04-04 22:10:48 +08:00
while(exec.status!=1) WScript.sleep(100);
2006-04-04 22:10:48 +08:00
2006-04-04 22:10:48 +08:00
if(txt!="") {
2006-04-04 22:10:48 +08:00
file=file.replace(/\.lib$/m,".sym");
2006-04-04 22:10:48 +08:00
var f=fso.openTextFile(file,ForWriting,true);
2006-04-04 22:10:48 +08:00
f.write(txt);
2006-04-04 22:10:48 +08:00
f.close();
2006-04-04 22:10:48 +08:00
WScript.echo("Created: "+file);
2006-04-04 22:10:48 +08:00
}
2006-04-04 22:10:48 +08:00
}
2006-04-04 22:10:48 +08:00
WScript.echo("Collecting mangled names");
var files=new Enumerator(fso.getFolder("..\\lib\\win32").Files);
2006-04-04 22:10:48 +08:00
for(;!files.atEnd();files.moveNext()) {
2006-04-04 22:10:48 +08:00
if(/_s\.lib$/.test(files.item())) {
2006-04-04 22:10:48 +08:00
process(""+files.item());
2006-04-04 22:10:48 +08:00
}
2006-04-04 22:10:48 +08:00
}