11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
+
+
+
|
# Copyright (c) P.J.Gawthrop 1998
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.23 1998/11/18 14:38:01 peterg
## Now convert ALL globals to VAR .. the last one isn't repeated now
##
## Revision 1.22 1998/11/17 17:39:45 peterg
## Put _smx include at end of list (?????)
##
## Revision 1.21 1998/11/17 17:26:11 peterg
## Put sign.p first
##
## Revision 1.20 1998/10/01 16:01:09 peterg
|
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
-
+
|
mttfun_name=$name
tab=' '
space="[ $tab]*"
spaces="[ $tab][ $tab]*"
non_space="[^ ]*"
# Body
grep -v '^[ ]*function' < $Sys_rep.m | sed "s/^$space%/#/" | sed "s/\(;$space\)%/\1#/" |\
grep -v '^[ ]*function' < $Sys_rep.m | sed "s/^$space%/#/" | sed "s/\([;)]$space\)%/\1#/" |\
awk -F# '{printf("%s",$1)
if (NF>1) printf("{* %s *}", $2)
printf("\n")
}' |\
sed "s/$space\[\($non_space\)\]$spaces=$spaces\($fun_name\)(\([a-zA-Z0-9,]*\))/\2(\1,\3)/" |\
sed "s/$space\[\($non_space\)\]$spaces=$spaces\($mttfun_name\)(\([a-zA-Z0-9,]*\))/\2(\1,\3)/" |\
sed "s/$space\[\($non_space\)\]$spaces=$spaces\(zeros\)(\([a-zA-Z0-9,]*\))/\2(\1,\3)/" |\
|
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
|
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
|
-
-
+
+
-
+
|
inc ="$I"
}
{
if ($1=="global")
doing_globals = 1
else{
if (doing_globals==1){
if (match($1,";")==0){
global[++i]=$1;
global[++i]=$1;
if (match($0,";")==0){
}
else{
doing_globals = 0
doing_header = 1
}
}
else
{
if (doing_header==1){
if (rep=="ode2odes"){
printf("VAR \n");
for (k=1;k<=i;k++) printf(" %s,\n",global[k])
for (k=1;k<i;k++) printf(" %s,\n",global[k])
printf("%s : REAL;\n", global[i])
printvar("x",Nx);
printvar("u",Nu);
printvar("y",Ny);
printvar("_t",Nt);
printf("\n{%s sign.p}\n",inc)
|