File mttroot/mtt/bin/trans/abg2cr_m2txt artifact 8b839d7a30 part of check-in 8788b600f5


#! /bin/sh

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

# Bourne shell script: abg2cr_m2txt

# Abg file to constitutive relationship conversion
# P.J.Gawthrop march 2000
# Copyright (C) 2000 by Peter J. Gawthrop



# Inform user
if [ -f "$1_cr.txt" ]; then
    echo "Using  $1_cr.txt"
    exit
else
    echo "Creating $1_cr.txt"
fi


rm -f mtt_error


# This is the main transformation using awk 
# And remove crs with same name as system
grep 'cr = ' $1_abg.m | awk '
BEGIN {
# Include lin cr anyway.
print "lin"
}
{
  crs=substr($3,2,length($3)-3);
    N=split(crs,cr,";");
      for (i=1;i<=N;i++){
        if (length(cr[i])>0)
        print cr[i];
      }
}'  2>mtt_error.txt | sort -u | grep -v none | grep -v '\$[0-9]'> $1_cr.txt

# Now invoke the standard error handling.
mtt_error mtt_error.txt






MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]