/usr/include/d/std/demangle.d is in libphobos2-ldc-dev 1:0.17.1-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | // Written in the D programming language.
/**
* Demangle D mangled names.
*
* Macros:
* WIKI = Phobos/StdDemangle
*
* Copyright: Copyright Digital Mars 2000 - 2009.
* License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
* Authors: $(WEB digitalmars.com, Walter Bright),
* Thomas K$(UUML)hne, Frits van Bommel
* Source: $(PHOBOSSRC std/_demangle.d)
*/
/*
* Copyright Digital Mars 2000 - 2009.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
module std.demangle;
/+
private class MangleException : Exception
{
this()
{
super("MangleException");
}
}
+/
/*****************************
* Demangle D mangled names.
*
* If it is not a D mangled name, it returns its argument name.
* Example:
* This program reads standard in and writes it to standard out,
* pretty-printing any found D mangled names.
-------------------
import core.stdc.stdio : stdin;
import std.stdio;
import std.ascii;
import std.demangle;
void test(int x, float y) { }
int main()
{
string buffer;
bool inword;
int c;
writefln("Try typing in: %s", test.mangleof);
while ((c = fgetc(stdin)) != EOF)
{
if (inword)
{
if (c == '_' || isAlphaNum(c))
buffer ~= cast(char) c;
else
{
inword = false;
write(demangle(buffer), cast(char) c);
}
}
else
{ if (c == '_' || isAlpha(c))
{
inword = true;
buffer.length = 0;
buffer ~= cast(char) c;
}
else
write(cast(char) c);
}
}
if (inword)
write(demangle(buffer));
return 0;
}
-------------------
*/
string demangle(string name)
{
import core.demangle : demangle;
import std.exception : assumeUnique;
auto ret = demangle(name);
return assumeUnique(ret);
}
|