#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: makesubs
# Makes the default substitution file

# Copyright (C) 2000 by Peter J. Gawthrop


###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
##
###############################################################

#Inform user
echo Creating $1_subs.r

cat > $1_subs.r <<EOF
% Default SUBS file
% File $1_subs.r
% Generated by MTT on `date`.

EOF

cat $MTTPATH/trans/m/rcs_header.txt	>> $1_subs.r

cat >> $1_subs.r <<EOF
% Put algebraic substitution commands here

END;
EOF


exit

## NB the following messes up the expansion switch ????
cat >> $1_subs.r <<EOF
% Ordering switch
ORDER
EOF

# Symbolic params first
awk '{
  print $1 ","
}' < $1_sympar.txt >> $1_subs.r

# Then states
Nx=`mtt_getsize $1 x` # States

awk 'END{
  for (k=1;k<Nx;k++){
    printf("mttx%i,\n", k);
  }
    printf("mttx%i;\n", Nx);
  
}' Nx=$Nx < $1_sympar.txt >> $1_subs.r

cat >> $1_subs.r <<EOF
END;
EOF









