
Vlad Skvortsov wrote:
Also, how do I demangle the names? It seems that, for example, 'base:GHC.Base.ZC' is a (:) function on strings, but where how am I supposed to figure that out?
#!/usr/bin/perl # Written by Ashley Yakeley 2003 # All rights to the public while (<>) { s/_/ /g; s/\w+/decode($&)/eg; print; } sub commas { local($i) = @_; if ($i == 0) { return ""; } elsif ($i == 1) { return " "; } else { return "," x ($i - 1); } } sub decode { local($s) = @_; my $a=""; while ($s =~/([^zZ]*)([zZ].*)/) { $a.=$1; if ($2 =~/([zZ][A-Za-z])(.*)/) { { $a.="(",last if $1 =~/ZL/; $a.=")",last if $1 =~/ZR/; $a.="[",last if $1 =~/ZM/; $a.="]",last if $1 =~/ZN/; $a.=":",last if $1 =~/ZC/; $a.="Z",last if $1 =~/ZZ/; $a.="z",last if $1 =~/zz/; $a.="&",last if $1 =~/za/; $a.="|",last if $1 =~/zb/; $a.="^",last if $1 =~/zc/; $a.='$',last if $1 =~/zd/; $a.="=",last if $1 =~/ze/; $a.=">",last if $1 =~/zg/; $a.="#",last if $1 =~/zh/; $a.=".",last if $1 =~/zi/; $a.="<",last if $1 =~/zl/; $a.="-",last if $1 =~/zm/; $a.="!",last if $1 =~/zn/; $a.="+",last if $1 =~/zp/; $a.="'",last if $1 =~/zq/; $a.="\\",last if $1 =~/zr/; $a.="/",last if $1 =~/zs/; $a.="*",last if $1 =~/zt/; $a.="_",last if $1 =~/zu/; $a.="%",last if $1 =~/zv/; $a.="???"; } $s = $2; } elsif ($2 =~/Z([0-9]+)T(.*)/) { $a.="(".commas($1).")"; $s = $2; } elsif ($2 =~/Z([0-9]+)H(.*)/) { $a.="(#".commas($1)."#)"; $s = $2; } elsif ($2 =~/Z([0-9]+)U(.*)/) { $a.=chr($1); $s = $2; } else { $a.="???".$2; $s = ""; } }; return $a.$s; };