- Comments
- D
- Search
- Home

Last update Sun Jul 1 11:16:37 2007

# std.demangle

Demangle D mangled names.

const(char)[] demangle(const(char)[] name);
  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 std.stdio;
      import std.ctype;
      import std.demangle;

      int main()
      {   char[] buffer;
          bool inword;
          int c;

          while ((c = fgetc(stdin)) != EOF)
          {
      	if (inword)
      	{
      	    if (c == '_' || isalnum(c))
      		buffer ~= cast(char) c;
      	    else
      	    {
      		inword = false;
      		writef(demangle(buffer), cast(char) c);
      	    }
      	}
      	else
      	{   if (c == '_' || isalpha(c))
      	    {	inword = true;
      		buffer.length = 0;
      		buffer ~= cast(char) c;
      	    }
      	    else
      		writef(cast(char) c);
      	}
          }
          if (inword)
      	writef(demangle(buffer));
          return 0;
      }

Copyright © 1999-2007 by Digital Mars, All Rights Reserved | Page generated by Ddoc.