| 58610 |      1 | #!/usr/bin/env bash
 | 
|  |      2 | #
 | 
|  |      3 | # Author: Makarius
 | 
|  |      4 | #
 | 
|  |      5 | # DESCRIPTION: update theory syntax to use cartouches
 | 
|  |      6 | 
 | 
|  |      7 | 
 | 
|  |      8 | ## diagnostics
 | 
|  |      9 | 
 | 
|  |     10 | PRG="$(basename "$0")"
 | 
|  |     11 | 
 | 
|  |     12 | function usage()
 | 
|  |     13 | {
 | 
|  |     14 |   echo
 | 
|  |     15 |   echo "Usage: isabelle $PRG [FILES|DIRS...]"
 | 
|  |     16 |   echo
 | 
|  |     17 |   echo "  Recursively find .thy files and update theory syntax to use cartouches"
 | 
|  |     18 |   echo "  instead of old-style {* verbatim *} or \`alt_string\` tokens."
 | 
|  |     19 |   echo
 | 
|  |     20 |   echo "  Old versions of files are preserved by appending \"~~\"."
 | 
|  |     21 |   echo
 | 
|  |     22 |   exit 1
 | 
|  |     23 | }
 | 
|  |     24 | 
 | 
|  |     25 | 
 | 
|  |     26 | ## process command line
 | 
|  |     27 | 
 | 
|  |     28 | [ "$#" -eq 0 -o "$1" = "-?" ] && usage
 | 
|  |     29 | 
 | 
|  |     30 | SPECS="$@"; shift "$#"
 | 
|  |     31 | 
 | 
|  |     32 | 
 | 
|  |     33 | ## main
 | 
|  |     34 | 
 | 
|  |     35 | find $SPECS -name \*.thy -print0 | \
 | 
|  |     36 |   xargs -0 "$ISABELLE_TOOL" java isabelle.Update_Cartouches
 |