11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# Copyright (c) P.J.Gawthrop 1998
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2 1998/07/25 12:39:57 peterg
## begin on same line as for and if
##
## Revision 1.1 1998/07/25 09:42:52 peterg
## Initial revision
##
###############################################################
|
>
>
>
>
|
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# Copyright (c) P.J.Gawthrop 1998
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3 1998/07/25 14:03:30 peterg
## Added () to [] conversion when the variable is i j k or an integer or
## combination
##
## Revision 1.2 1998/07/25 12:39:57 peterg
## begin on same line as for and if
##
## Revision 1.1 1998/07/25 09:42:52 peterg
## Initial revision
##
###############################################################
|
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# Find system constants
Nx=`grep "MTTNx " <$Sys\_def.r | awk '{print $3}' | sed 's/;//'`
Nu=`grep "MTTNu " <$Sys\_def.r | awk '{print $3}' | sed 's/;//'`
Ny=`grep "MTTNy " <$Sys\_def.r | awk '{print $3}' | sed 's/;//'`
#Regexps
name="[a-zA-Z0-9]*"
fun_name="$name\_$name"
space="[ \t]*"
spaces="[ \t][ \t]*"
non_space="[^ ]*"
# Heading
(case $rep in
state)
|
|
|
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# Find system constants
Nx=`grep "MTTNx " <$Sys\_def.r | awk '{print $3}' | sed 's/;//'`
Nu=`grep "MTTNu " <$Sys\_def.r | awk '{print $3}' | sed 's/;//'`
Ny=`grep "MTTNy " <$Sys\_def.r | awk '{print $3}' | sed 's/;//'`
#Regexps
name="[a-zA-Z0-9]*"
fun_name="$Sys\_$name"
space="[ \t]*"
spaces="[ \t][ \t]*"
non_space="[^ ]*"
# Heading
(case $rep in
state)
|
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
echo " InputVector =ARRAY[1..$Nu] OF REAL;"
echo " OutputVector =ARRAY[1..$Ny] OF REAL;"
echo "VAR"
echo " t,LAST,DT : REAL;"
echo " mttx,mttdx : StateVector;"
echo " mttu : InputVector;"
echo " mtty : OutputVector;"
echo " i,j,k,it,iLast,STEPFACTOR : INTEGER;"
echo " METHOD : STRING;"
;;
*) echo "PROCEDURE $Sys_rep;"
;;
esac) > $Filename
cat<<EOF >> $Filename
|
|
|
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
echo " InputVector =ARRAY[1..$Nu] OF REAL;"
echo " OutputVector =ARRAY[1..$Ny] OF REAL;"
echo "VAR"
echo " t,LAST,DT : REAL;"
echo " mttx,mttdx : StateVector;"
echo " mttu : InputVector;"
echo " mtty : OutputVector;"
echo " i,j,it,iLast,STEPFACTOR : INTEGER;"
echo " METHOD : STRING;"
;;
*) echo "PROCEDURE $Sys_rep;"
;;
esac) > $Filename
cat<<EOF >> $Filename
|
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
if ($1=="for"){
sub(/:/," TO ",$0)
sub(/=/,":=",$0)
printf("%s DO BEGIN\n", $0)
}
else {
sub(/=/,":=",$0)
sub(/\^/,"**",$0)
printf("%s\n",$0)
}
}
}
}
}
}
|
|
|
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
if ($1=="for"){
sub(/:/," TO ",$0)
sub(/=/,":=",$0)
printf("%s DO BEGIN\n", $0)
}
else {
sub(/=/,":=",$0)
gsub(/\^/,"**",$0)
printf("%s\n",$0)
}
}
}
}
}
}
|