misc/decompile
author Christian Urban <christian.urban@kcl.ac.uk>
Sun, 15 Jan 2023 10:58:13 +0000
changeset 462 34feeb53c0ba
parent 329 8a34b2ebc8cc
permissions -rwxr-xr-x
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
323
1f8005b4cdf6 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
#!/bin/bash
1f8005b4cdf6 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
set -euo pipefail
1f8005b4cdf6 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
1f8005b4cdf6 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
trap "exit" INT
1f8005b4cdf6 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
324
2969ee4a6cee updated
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
     6
files=${1:-assignment2019scala-*}
323
1f8005b4cdf6 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
1f8005b4cdf6 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
function scala_compile {
1f8005b4cdf6 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala "$1" 2>> /dev/null 1>> /dev/null) 
1f8005b4cdf6 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
}
1f8005b4cdf6 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
329
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    12
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    13
#for sd in $files; do
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    14
#  cd $sd/Part7
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    15
#  echo $sd
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    16
#  if (scala_compile docdiff.scala)
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    17
#  then    
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    18
#    scalac -g:notailcalls -d docdiff-decompiled.jar docdiff.scala
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    19
#    java -jar ~/pep-material/procyon-decompiler-0.5.36.jar -ln -jar docdiff-decompiled.jar -o .
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    20
#    rm CW7a.java
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    21
#    mv CW7a$.java $sd-CW7a.java
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    22
#  else
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    23
#    echo -e "  --> SCALA DID NOT RUN docdiff.scala" 
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    24
#  fi  
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    25
#  cd ..
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    26
#  cd ..
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    27
#done
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    28
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    29
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    30
323
1f8005b4cdf6 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
for sd in $files; do
329
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    32
  cd $sd/Part9
323
1f8005b4cdf6 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
  echo $sd
329
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    34
  if (scala_compile postfix2.scala)
323
1f8005b4cdf6 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
  then    
329
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    36
    scalac -g:notailcalls -d docdiff-decompiled.jar postfix2.scala
323
1f8005b4cdf6 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
    java -jar ~/pep-material/procyon-decompiler-0.5.36.jar -ln -jar docdiff-decompiled.jar -o .
329
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    38
    rm CW9b.java
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
    39
    mv CW9b$.java $sd-CW9b.java
323
1f8005b4cdf6 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
  else
1f8005b4cdf6 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
    echo -e "  --> SCALA DID NOT RUN docdiff.scala" 
1f8005b4cdf6 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
  fi  
1f8005b4cdf6 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
  cd ..
1f8005b4cdf6 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
  cd ..
1f8005b4cdf6 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
done