Differences From Artifact [9bbb28550a]:

To Artifact [57a4091ca6]:


9
10
11
12
13
14
15




16
17
18
19
20
21
22
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26






+
+
+
+







# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.17  2002/04/28 18:41:27  geraint
## Fixed [ 549658 ] awk should be gawk.
## Replaced calls to awk with call to gawk.
##
## Revision 1.16  2000/10/17 13:45:18  peterg
## split up state and input - different defaults
##
## Revision 1.15  2000/10/17 09:53:05  peterg
## More on logic rep
##
## Revision 1.14  2000/10/17 08:36:56  peterg
71
72
73
74
75
76
77















78
79
80
81
82
83
84
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103






+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







update=$3 # Update or not
date=`date`

if [ -z "$2" ]; then
  echo Usage mtt_update system representation [update]    
  exit
fi

## Extract initial value from steady-state information
initial_value() {
    i=$1
    ssfile=${sys}_ss.r
    if [ "${rep}" = "state" ]; then
       if [ -f "${ssfile}" ]; then
	value=`grep "MTTx($i" ${ssfile}| sed 's/ //g' | gawk -F '=' '{print substr($2,1,length($2)-2)}'`
       else
	value=${default}   
       fi 
    else
	value=${default}
    fi
}

rm -f mtt_empty
touch mtt_empty

case $rep in
    numpar)
	    lang=txt
126
127
128
129
130
131
132

133


134

135
136
137
138
139
140
141
145
146
147
148
149
150
151
152
153
154
155

156
157
158
159
160
161
162
163






+

+
+
-
+







if [ -f "$textfile" ]; then
  # Inform User
  echo Checking $textfile
else
  echo Creating $textfile
  mtt_header $sys $rep $lang > $textfile 
  info=`cut -f1 $infofile | sort`
  i=0;
  for new in $info; do
    let i=$i+1;
    initial_value $i;
    echo $new $default  |\
    echo $new $value  |\
    gawk '{printf("%s\t= %s; # Default\n",$1,$2)}' >> $textfile
  done
  exit    
fi

# Remove tmp files
rm -f mtt_in_text mtt_in_info

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