D Programming Language 1.0

Last update Mon Dec 31 10:53:28 2012

# std.demangle

Demangle D mangled names.
Source:
std/demangle.d

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 © 1999-2012 by Digital Mars, All Rights Reserved | Page generated by Ddoc.