module d_filt; import std.stdio; import std.ctype; import core.demangle; bool fullDecoration = true; void do_filt(ref File file) { foreach(ln; file.byLine()) { for (int i = 0; i < ln.length; ) { char ch = ln[i]; // compressed symbols are NOT utf8! if(isalnum(ch) || ch == '_') { string s = decodeDmdString(ln, i); if(s.length > 3 && s[0] == '_' && s[1] == 'D' && isdigit(s[2])) { auto d = core.demangle.demangle(s); //, null, fullDecoration); // needs patched demangle stdout.write(d); } else if(s.length > 4 && s[0] == '_' && s[1] == '_' && s[2] == 'D' && isdigit(s[3])) { // __moddtor/__modctor have duplicate '__' auto d = core.demangle.demangle(s[1..$]); //, null, fullDecoration); // needs patched demangle if(d == s[1..$]) stdout.write(s); else stdout.write(d); } else stdout.write(s); } else { stdout.write(ch); i++; } } } } int main(string[] argv) { if(argv.length < 2) do_filt(stdin); else for(int i = 1; i < argv.length; i++) { File file = File(argv[i], "rb"); do_filt(file); } return 0; }