21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
+
+
+
+
|
;;
-parameters)
parameters='-parameters';
;;
-matrix)
matrix='yes';
;;
-optimise)
optimise='LOAD SCOPE; ON GENTRANOPT;';
iname='INAME mtt_o;';
;;
*)
echo $1 is an unknown option
exit;;
esac
shift
done
|
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
+
+
+
+
-
+
|
;;
*) echo Representation $2 not recognised;
exit;;
esac
# Inform user
if [ -n "$optimise" ]; then
blurbopt=' using code optimisation'
fi
echo Creating $1_$rep.$lang $blurb
echo Creating $1_$rep.$lang $blurb $blurbopt
#echo Creating $1_smxx.$lang
#echo Creating $1_smxtx.$lang
# Remove the old log file
rm -f cse2smx_r.log
rm -f $1_smx.$lang
rm -f $1_smxx.$lang
|
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
|
105
106
107
108
109
110
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
|
-
-
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
clear mttx; % Dont need this now - use mkid instead
OFF Echo;
% Load the general translator package
LOAD GENTRAN;
LOAD SCOPE;
GENTRANLANG!* := 'Pascal;
ON GENTRANSEG; % Segmentation
ON GENTRANOPT; % Code optimise using scope
OFF GENDECS; % No declarations
MAXEXPPRINTLEN!* := 80;
TEMPVARNUM!* := 1;
TEMPVARNAME!* := 'mtt_s;
%% '
% Optimise
$optimise
% Matrix output function
%in"$MTTPATH/trans/lang_matrix.r";
ON GETDECS; % Create decrarations automatically
DEFTYPE!* := 'REAL; % and default to real
%%% The following is a bug fix from ZIB to fix
%%% segmentation violation problem
symbolic procedure maxtype type;
% ------------------------------------------------------------------- ;
% A type may be a pair (l u) wher l is the minimum type for a variable;
% and u is the maximum type. This procedure returns the maximum type.;
% ------------------------------------------------------------------- ;
if atom type
then type
else if pairp cdr type then cadr type else car type;
% This fix handles the case that the type is a list with ONE entry.
% Should never happen ?? W.N.
%%%%%% End of bug fix
%Set up output according to the language.
OFF NAT;
GENTRANOUT "$1_$rep.body";
% Set up output according to the language.
IF (lang = r) THEN
|
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
-
+
-
+
-
+
|
xj := mkid(mttx,j);
a_ij := df(MTTEdx(i,1), xj, 1);
aa_ij := MTTE(i,j) - mttt*a_ij;
IF (aa_ij NEQ 0) THEN
IF ($nmatrix EQ 1) THEN
BEGIN
%% Write a with full indexing
INAME(mtt_o); % Set temp name
$iname
GENTRAN mtta(i,j) ::=: aa_ij;
END;
IF (($nmatrix EQ 0) AND ($nrep EQ 1)) THEN
BEGIN
%% Write a with vector indexing
INAME(mtt_o); % Set temp name
$iname
GENTRAN mtta(ij) ::=: aa_ij;
END;
mttAAx_i := mttAAx_i + aa_ij*xj;
END;
IF (mttAAx_i NEQ 0) THEN
IF (($nrep EQ 0) OR ($nrep EQ 2)) THEN
BEGIN
INAME(mtt_o); % Set temp name
$iname
GENTRAN mttax(i) ::=: mttAAx_i;
END;
END;
%Shut the output according to the language.
GENTRANSHUT "$1_$rep.body";
EOF
|