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
46
47
48
49
50
51
52
53
54
55
|
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
46
47
48
49
50
51
52
53
54
55
|
-
+
-
+
-
+
|
Nu=`mtt_getsize $Sys u` # Inputs
echo "Creating $outfile for standard input"
## Pascal code
make_p()
{
cat <<EOF > $outfile
PROCEDURE $1_input(VAR mttu : InputVector;
PROCEDURE $Sys_input(VAR mttu : InputVector;
mttx : StateVector;
mtty : OutputVector;
mttt : REAL;
par : ParameterVector);
{Created by MTT on $date for standard input to simulation}
VAR t : REAL; Start:BOOLEAN;
BEGIN{$1_input}
BEGIN{$Sys_input}
{Zap comments}
IF (input^ = chr("#")) THEN
BEGIN
readln;
WHILE (input^ = chr("#")) DO readln;
END;
read(t); { Read, and discard, first column (time) }
FOR mtti:=1 TO $Nu DO {Read the inputs}
read(mttu[mtti]);
readln; {Next line}
END{$1_input};
END{$Sys_input};
EOF
}
make_m() {
mtt_header $Sys input m stdin > $outfile
cat >> $outfile <<EOF
## The "standard input"
|
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
-
+
|
}
#endif // STANDALONE
EOF
}
case $lang in
p)
make_p
make_p
;;
m)
make_m
;;
cc)
make_cc
;;
*)
echo language $lang not supported - sorry
esac
|