# make abstract machine executor with state
# @(#)mamexec (gsf@research.att.com) 07/17/94
# mamexec [ -dfins ] [ target ... ] < mam-file
# NOTE: variables defined in this script may conflict with
-*[abceghjklmopqrtuvwxyz_A-Z0-9]*) # [!...] not portable
echo "Usage: $_command_ [ -dfins ] [ target ... ] < mam-file" >&2; exit 2
*d*) _debug_="eval echo $_command_: debug: >&2" ;;
*) _select_="$_select_|$1" ;;
(set -e; false || true) && _set_=e || echo $_command_: command errors ignored because of shell botch >&2
?*) _set_="set -$_set_;" ;;
if test -f $_state_list_ -a -f $_state_time_
then mamstate $_state_list_ < $_state_list_ | sort > $_tmp_
for _i_ in `comm -12 $_state_time_ $_tmp_ | sed 's/ .*//'`
*) _same_="$_same_|$_i_" ;;
case `(echo ok | (read -r a; echo $a) 2>
/dev/null)` in
*) # read strips \ -- thanks a lot
# tmp file avoids char at a time read
sed 's/\\/\\\\/g' > $_tmp_
while IFS=' '; $_read_ _op_ _arg_ _val_
"setv") eval _data_='$'$_arg_
*) echo "$_arg_=$_val_" ;;
echo 'main(){return 0;}' >
main.c "make") eval _name_$_index_=$_name_
eval _prev_$_index_=$_prev_
eval _cmds_$_index_='"$_cmds_"'
eval _attr_$_index_=$_attr_
*" metarule "*) _attr_=m$_attr_ ;;
eval " case \"$_name_\" in
\"*\") _select_=$_name_ ;;
"") eval " case \"$_name_\" in
$_diff_)_attr_=u$_attr_ ;;
*) _diff_="$_diff_|$_name_" ;;
eval _name_$_index_=$_name_
eval _prev_$_index_=$_prev_
eval _cmds_$_index_=$_cmds_
eval _attr_$_index_=$_attr_
eval _list_='"'"$_list_"'
"") eval " case \"$_arg_\" in
$_diff_)_attr_=u$_attr_ ;;
_) echo $_op_: missing make op >&2; continue ;;
"meta"|"suff") _attr_=m$_attr_ ;;
?*) _arg_="$_arg_ $_val_" ;;
"done") eval _arg_=$_arg_
*) $_exec_ "$_begin_$_set_$_cmds_$_end_" ||
*if*then*fi*|"||") _code_=0 ;;
*) echo "*** exit code $_code_ making $_name_" >&2
eval _name_='$'_name_$_index_
eval _prev_='$'_prev_$_index_
eval _cmds_='$'_cmds_$_index_
eval _attr_=$_prop_'$'_attr_$_index_
*) echo $_val_: $_op_ $_name_ expected >&2
"") echo "$_command_: don't know how to make $_select_" >&2; $_error_ ;;
"eval") echo "$_list_" > $_state_list_
mamstate $_state_list_ < $_state_list_ | sort > $_state_time_