D Programming Language 2.0

- Comments
- D
- Search
- Home

Last update Thu Mar 18 17:08:36 2010

# std.demangle

Demangle D mangled names.

License:
Boost License 1.0.

Authors:
Walter Bright, Thomas Kuehne, Frits van Bommel

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

string demangle(string 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 Digital Mars 2000 - 2009. | Page generated by Ddoc.