ack/util/ego/em_ego/em_ego
1989-03-07 10:33:47 +00:00

76 lines
1.6 KiB
Plaintext
Executable file

TMP=/usr/tmp/ego
DDUMP=$TMP.dd.$$
PDUMP=$TMP.pd.$$
PHASES=''
FLAGS=''
LEVEL=xxx
EM=$1
shift
while :
do
case $# in
0) break ;;
esac
A="$1"
shift
case $A in
*.m|*.ma) ICARG="$ICARG $A"; continue;;
-P) OPT="$1"; shift; continue;;
-IL) PHASES="$PHASES il cf caopt ic cf " ; continue;;
-CS) PHASES="$PHASES cs " ; continue;;
-SR) PHASES="$PHASES sr " ; continue;;
-UD) PHASES="$PHASES ud " ; continue;;
-LV) PHASES="$PHASES lv " ; continue;;
-RA) PHASES="$PHASES ra " ; continue;;
-SP) PHASES="$PHASES sp " ; continue;;
-BO) PHASES="$PHASES bo " ; continue;;
-CJ) PHASES="$PHASES cj " ; continue;;
-O*) LEVEL=$A ; continue;;
-*) FLAGS="$FLAGS $A"; continue;;
esac
done
if test "$PHASES"
then :
else
case $LEVEL in
-O2|xxx)PHASES='cj bo sp ' ;;
-O3) PHASES='cs sr cj bo sp ud lv ra ' ;;
*) PHASES='il cf caopt ic cf cs sr cj bo sp ud lv ra ' ;;
esac
fi
TMPOPT=$TMP.o.$$
PASSES="ic cf $PHASES ca"
OUTFILES="$PDUMP $DDUMP"
FILES="$OUTFILES $TMPOPT"
c=1
if test "$ICARG"
then :
else
exit 0
fi
for i in $PASSES
do INFILES=$OUTFILES
OUTFILES="$TMP.p.$c.$$ $TMP.d.$c.$$ $TMP.l.$c.$$ $TMP.b.$c.$$"
FILES="$FILES $OUTFILES"
trap "rm -f $FILES" 0 1 2 15
case $i in
ic) $OPT/ic $INFILES - - $OUTFILES $ICARG || exit 1
;;
ca) $OPT/ca $INFILES $PDUMP $DDUMP - - || exit 1
;;
caopt) rm -f $TMPOPT
$OPT/ca $INFILES $PDUMP $DDUMP - - | $EM/lib/em_opt2 > $TMPOPT || exit 1
ICARG=$TMPOPT
OUTFILES="$PDUMP $DDUMP"
rm -f $INFILES $PDUMP $DDUMP
;;
*) $OPT/$i $INFILES $OUTFILES $FLAGS || exit 1
rm -f $INFILES
;;
esac
c=`expr $c + 1`
done
exit 0