1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#! /bin/sh
######################################
##### Model Transformation Tools #####
######################################
# Bourne shell script: sympar_txt2r
# Label file to symbolic parameters conversion
# P.J.Gawthrop August 1996
# Copyright (c) P.J.Gawthrop, 1996.
# Inform user
echo "Creating $1_sympar.r"
rm -f mtt_error
#Write some file headers
echo "%% Symbolic parameter file ($1_sympar.r)" > $1_sympar.r
echo "%% Generated by MTT at `date`" >> $1_sympar.r
# This is the main transformation using gawk
tr ';' ',' < $1_lbl.txt | \
gawk -f $MTTPATH/trans/awk/sympar.awk | sort >> $1_sympar.r 2>mtt_error.txt
# Now invoke the standard error handling.
mtt_error mtt_error.txt
|
>
>
>
>
>
>
>
|
|
>
>
>
>
>
>
|
>
>
|
|
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#! /bin/sh
######################################
##### Model Transformation Tools #####
######################################
# Bourne shell script: sympar_txt2r
# Label file to symbolic parameters conversion
# P.J.Gawthrop August 1996
# Copyright (c) P.J.Gawthrop, 1996.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################
# Inform user
echo "Creating $1_sympar.r"
rm -f mtt_error
#Write some file headers
echo "%% Symbolic parameter file ($1_sympar.r)" > $1_sympar.r
echo "%% Generated by MTT at `date`" >> $1_sympar.r
echo >> $1_sympar.r
#Count the lines in the file
lines=`grep -c '.' $1_sympar.txt`
echo "MATRIX MTTVAR($lines,1);" >> $1_sympar.r
echo "MTTNVAR = $lines;" >> $1_sympar.r
echo >> $1_sympar.r
#Write out the variables in reduce format.
awk '{i++; print "MTTVAR(" i ",1) := " $1 ";"}' $1_sympar.txt >> $1_sympar.r
echo 'END;' >> $1_sympar.r
# Now invoke the standard error handling.
# mtt_error mtt_error.txt
|