# # $Id: unsymbolize.pl,v 1.6 2004/06/21 08:25:58 kleing Exp $ # Author: Markus Wenzel, TU Muenchen # # unsymbolize.pl - remove unreadable symbol names from sources # sub unsymbolize { my ($file) = @_; open (FILE, $file) || die $!; undef $/; $text = ; $/ = "\n"; # slurp whole file close FILE || die $!; $_ = $text; # Pure s/\\?\\/!!/g; s/\\?\\/::/g; s/\\?\\/==>/g; s/\\?\\\\?\\/==>/g; s/\\?\\/=>/g; s/\\?\\/==/g; s/\\?\\/.../g; s/\\?\\ ?/[| /g; s/\\?\\ ?/ |]/g; s/\\?\\ ?/(| /g; s/\\?\\ ?/ |)/g; # HOL s/\\?\\/<->/g; s/\\?\\/-->/g; s/\\?\\\\?\\/-->/g; s/\\?\\/->/g; s/\\?\\/~/g; s/\\?\\ ?/SOME /g; # outer syntax s/\\?\\/==/g; s/\\?\\/=>/g; s/\\?\\/<=/g; $result = $_; if ($text ne $result) { print STDERR "fixing $file\n"; if (! -f "$file~~") { rename $file, "$file~~" || die $!; } open (FILE, "> $file") || die $!; print FILE $result; close FILE || die $!; } } ## main foreach $file (@ARGV) { eval { &unsymbolize($file); }; if ($@) { print STDERR "*** unsymbolize $file: ", $@, "\n"; } }