12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# Copyright (c) P.J.Gawthrop 1991, 1994, 1995, 1996, 1998
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.14 1999/12/08 02:06:00 peterg
## Now incudes csm rep.
##
## Revision 1.13 1999/11/23 00:59:14 peterg
## Now does ssm.m
##
## Revision 1.12 1999/11/15 22:57:20 peterg
|
>
>
>
|
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# Copyright (c) P.J.Gawthrop 1991, 1994, 1995, 1996, 1998
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.15 2000/02/10 14:58:57 peterg
## *** empty log message ***
##
## Revision 1.14 1999/12/08 02:06:00 peterg
## Now incudes csm rep.
##
## Revision 1.13 1999/11/23 00:59:14 peterg
## Now does ssm.m
##
## Revision 1.12 1999/11/15 22:57:20 peterg
|
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
##
## Revision 1.1 1998/07/27 16:30:26 peterg
## Initial revision
##
###############################################################
# Set up the language specific stuff
rep=$2
ext='m';
codegenerator='PASCAL'
Lc='#';
Rc='#';
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
##
## Revision 1.1 1998/07/27 16:30:26 peterg
## Initial revision
##
###############################################################
# Args
while [ -n "`echo $1 | grep '^-'`" ]; do
case $1 in
-noglobal)
noglobal='-noglobal';
;;
-parameters)
parameters='-parameters';
;;
*)
echo $1 is an unknown option
exit;;
esac
shift
done
# Set up the language specific stuff
rep=$2
ext='m';
codegenerator='PASCAL'
Lc='#';
Rc='#';
|
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
%Read the reduce definitions file
in "$1_def.r";
%Read the reduce $REP file
in "$1_$rep.r";
EOF
#Inform user
echo Creating $outfile.m
# Remove the old log file
rm -f mtt_r2m.log
if [ "$rep" = "ode" ]||[ "$rep" = "cse" ]; then
#echo Creating $1_odea.$ext
outfileo=$outfile"o"
echo Creating $outfileo.m
#rm -f $1_odea.$ext.1;
#Header
lang_header $1 $rep $ext 'mttx,mttu,t' mttdx > $1_$2.p
lang_header $1 $2o $ext 'mttx,mttu,t' mtty > $1_$2o.p
rm -f mtt_ode mtt_odeo
# Use reduce to accomplish the transformation
$SYMBOLIC > mtt_r2m.log <<EOF
%Set up the code generator
in"mtt_setreduce.r";
|
>
>
>
>
|
|
|
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
%Read the reduce definitions file
in "$1_def.r";
%Read the reduce $REP file
in "$1_$rep.r";
%Read the substitution file
in "$1_subs.r";
EOF
#Inform user
echo Creating $outfile.m
# Remove the old log file
rm -f mtt_r2m.log
if [ "$rep" = "ode" ]||[ "$rep" = "cse" ]; then
#echo Creating $1_odea.$ext
outfileo=$outfile"o"
echo Creating $outfileo.m
#rm -f $1_odea.$ext.1;
#Header
lang_header $noglobal $parameters $1 $rep $ext 'mttx,mttu,mttt,mttpar' mttdx > $1_$2.p
lang_header $noglobal $parameters $1 $2o $ext 'mttx,mttu,mttt,mttpar' mtty > $1_$2o.p
rm -f mtt_ode mtt_odeo
# Use reduce to accomplish the transformation
$SYMBOLIC > mtt_r2m.log <<EOF
%Set up the code generator
in"mtt_setreduce.r";
|
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
fi
if [ "$rep" = "sm" ]||[ "$rep" = "ssm" ]||[ "$rep" = "dm" ]||\
[ "$rep" = "csm" ]||[ "$rep" = "obs" ]; then
if [ "$rep" = "sm" ]||[ "$rep" = "ssm" ]; then
#Header
lang_header $1 $rep $ext '' [mtta,mttb,mttc,mttd] > $outfile.p
Symbols='a b c d'
fi
if [ "$rep" = "dm" ]||[ "$rep" = "csm" ]; then
#Header
lang_header $1 $rep $ext '' [mtta,mttb,mttc,mttd,mtte] > $outfile.p
Symbols='a b c d e'
fi
if [ "$rep" = "obs" ]; then
# Is the system affine (look in the _obs.r file
affine=`grep 'affine :=' $1_obs.r | awk '{print $3}' | sed 's/;//'`
echo 'affine = ' $affine
#Header
if [ "$affine" = "1" ]; then
lang_header $1 obs m mttx [mttobs_o,mttobs_h] > $outfile.p
else
lang_header $1 obs m mttx,mttu mttyy > $outfile.p
fi
Symbols='obs_o obs_h'
fi
for Symbol in $Symbols; do
rm -f $outfile.1
|
|
|
|
|
|
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
|
fi
if [ "$rep" = "sm" ]||[ "$rep" = "ssm" ]||[ "$rep" = "dm" ]||\
[ "$rep" = "csm" ]||[ "$rep" = "obs" ]; then
if [ "$rep" = "sm" ]||[ "$rep" = "ssm" ]; then
#Header
lang_header $noglobal $parameters $1 $rep $ext '' [mtta,mttb,mttc,mttd] > $outfile.p
Symbols='a b c d'
fi
if [ "$rep" = "dm" ]||[ "$rep" = "csm" ]; then
#Header
lang_header $noglobal $parameters $1 $rep $ext '' [mtta,mttb,mttc,mttd,mtte] > $outfile.p
Symbols='a b c d e'
fi
if [ "$rep" = "obs" ]; then
# Is the system affine (look in the _obs.r file
affine=`grep 'affine :=' $1_obs.r | awk '{print $3}' | sed 's/;//'`
echo 'affine = ' $affine
#Header
if [ "$affine" = "1" ]; then
lang_header $noglobal $parameters $1 obs m mttx [mttobs_o,mttobs_h] > $outfile.p
else
lang_header $noglobal $parameters $1 obs m mttx,mttu mttyy > $outfile.p
fi
Symbols='obs_o obs_h'
fi
for Symbol in $Symbols; do
rm -f $outfile.1
|