lib/Tools/unsymbolize
author wenzelm
Sun, 20 Jan 2013 13:59:13 +0100
changeset 50990 11996ea98bbe
parent 35022 c844b93dd147
child 52617 42e02ddd1568
permissions -rwxr-xr-x
tuned;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10555
2323ec838401 /usr/bin/env bash;
wenzelm
parents: 10511
diff changeset
     1
#!/usr/bin/env bash
10026
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
     2
#
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
     3
# Author: Markus Wenzel, TU Muenchen
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
     4
#
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
     5
# DESCRIPTION: remove unreadable symbol names from sources
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
     6
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
     7
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
     8
## diagnostics
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
     9
10511
wenzelm
parents: 10026
diff changeset
    10
PRG="$(basename "$0")"
10026
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    11
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    12
function usage()
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    13
{
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    14
  echo
28650
a7ba12e0d3b7 tuned usage line;
wenzelm
parents: 26576
diff changeset
    15
  echo "Usage: isabelle $PRG [FILES|DIRS...]"
10026
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    16
  echo
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    17
  echo "  Recursively find .thy/.ML files, removing unreadable symbol names."
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    18
  echo "  Note: this is an ad-hoc script; there is no systematic way to replace"
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    19
  echo "  symbols independently of the inner syntax of a theory!"
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    20
  echo
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    21
  echo "  Renames old versions of FILES by appending \"~~\"."
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    22
  echo
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    23
  exit 1
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    24
}
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    25
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    26
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    27
## process command line
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    28
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    29
[ "$#" -eq 0 -o "$1" = "-?" ] && usage
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    30
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    31
SPECS="$@"; shift "$#"
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    32
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    33
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    34
## main
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    35
dfa85ba2295a remove unreadable symbol names from sources;
wenzelm
parents:
diff changeset
    36
find $SPECS \( -name \*.ML -o -name \*.thy \) -print | \
35022
c844b93dd147 modernized perl scripts: prefer standalone executables;
wenzelm
parents: 29143
diff changeset
    37
  xargs "$ISABELLE_HOME/lib/scripts/unsymbolize"