Overview
Comment:-optimise switch added
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 70640800dbdbf6c251431ca927e5a314662f414aea75a519c590db792f4881fb
User & Date: gawthrop@users.sourceforge.net on 2000-08-30 11:43:50
Other Links: branch diff | manifest | tags
Context
2000-08-31
14:31:28
Initial revision check-in: b71c7b3c28 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2000-08-30
11:43:50
-optimise switch added check-in: 70640800db user: gawthrop@users.sourceforge.net tags: origin/master, trunk
11:43:04
Put in the -opt switch for code optimisation check-in: ea55c44147 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/cse2smx_lang from [42d61abe8b] to [3c0731a9fc].

21
22
23
24
25
26
27




28
29
30
31
32
33
34
	;;
    -parameters)
	parameters='-parameters';
	;;
    -matrix)
	matrix='yes';
	;;




    *)
	echo $1 is an unknown option
        exit;;
  esac
  shift
done








>
>
>
>







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
	;;
    *) echo Representation $2 not recognised;
       exit;;
esac


# Inform user




echo Creating $1_$rep.$lang $blurb
#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







>
>
>
>
|







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 $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

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;




% Matrix output function


%in"$MTTPATH/trans/lang_matrix.r";















%Set up output according to the language.
 OFF NAT;
 GENTRANOUT "$1_$rep.body";

% Set up output according to the language.
    IF (lang = r) THEN 







<


|




>
>
>

|
>
>
|
>
>
>
>
>
>
>
>
>
>

>
>
>







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;

GENTRANLANG!* := 'Pascal;
ON GENTRANSEG; % Segmentation

OFF GENDECS;  % No declarations
MAXEXPPRINTLEN!* := 80;
TEMPVARNUM!* := 1;
TEMPVARNAME!* := 'mtt_s;
%% '
% Optimise
$optimise


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
      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
          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
          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
          GENTRAN mttax(i) ::=: mttAAx_i;
        END;
  END;

%Shut the  output according to the language.
 GENTRANSHUT "$1_$rep.body";
EOF







|





|







|







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
          GENTRAN mtta(i,j) ::=: aa_ij;
        END;
        IF (($nmatrix EQ 0) AND ($nrep EQ 1)) THEN
        BEGIN
          %% Write a  with vector indexing
          $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
          GENTRAN mttax(i) ::=: mttAAx_i;
        END;
  END;

%Shut the  output according to the language.
 GENTRANSHUT "$1_$rep.body";
EOF

Modified mttroot/mtt/bin/trans/mtt_r2m from [c4b66df764] to [1eb6f99853].

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.19  2000/08/28 20:17:59  peterg
## Put in Winfried Neun's bug fix
## -- prevents segmentation violation using optimised gentran when matrix
## comtains a number
##
## Revision 1.18  2000/08/24 17:11:40  peterg
## Now optimises as well as segmenting - uses the SCOPE package







>
>
>
>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Copyright (c) P.J.Gawthrop 1991, 1994, 1995, 1996, 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.20  2000/08/30 10:43:17  peterg
## Simplified version using GENTRAN matrix :=: matrix
## lang_matrix is no longer used at all
##
## Revision 1.19  2000/08/28 20:17:59  peterg
## Put in Winfried Neun's bug fix
## -- prevents segmentation violation using optimised gentran when matrix
## comtains a number
##
## Revision 1.18  2000/08/24 17:11:40  peterg
## Now optimises as well as segmenting - uses the SCOPE package
85
86
87
88
89
90
91





92
93
94
95
96
97
98
    -noglobals)
	noglobals='-noglobals';
	;;
    -parameters)
	parameters='-parameters';
        par='mttpar'
	;;





    *)
	echo $1 is an unknown option
        exit;;
  esac
  shift
done








>
>
>
>
>







89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
    -noglobals)
	noglobals='-noglobals';
	;;
    -parameters)
	parameters='-parameters';
        par='mttpar'
	;;
    -optimise)
	optimise='LOAD SCOPE; ON GENTRANOPT;';
        iname='INAME mtt_o;';
	;;

    *)
	echo $1 is an unknown option
        exit;;
  esac
  shift
done

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

#Set up gentran
cat <<EOF >mtt_setreduce.r
% Set up the code generator

% Load the general translator package
LOAD GENTRAN;
LOAD SCOPE;
GENTRANLANG!* := '$codegenerator;
ON GENTRANSEG; % Segmentation

ON GENTRANOPT; % Code optimise using scope

ON GETDECS;    % Create decrarations automatically
DEFTYPE!* := 'REAL; % and default to real
OFF GENDECS;  % No declarations
MAXEXPPRINTLEN!* := 80;
TEMPVARNUM!* := 1;
TEMPVARNAME!* := 'mtt_s;
INAME(mtt_o);


% Matrix output function
%in"$MTTPATH/trans/lang_matrix.r";

%Read the reduce definitions file
in "$1_def.r";

%Read the reduce  $REP   file







<
|
|
>
|


|



|
|
>
>







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

#Set up gentran
cat <<EOF >mtt_setreduce.r
% Set up the code generator

% Load the general translator package
LOAD GENTRAN;

GENTRANLANG!* := '$codegenerator; %'
ON GENTRANSEG; % Segmentation 
% Optimise
$optimise 

ON GETDECS;    % Create decrarations automatically
DEFTYPE!* := 'REAL; % and default to real '
OFF GENDECS;  % No declarations
MAXEXPPRINTLEN!* := 80;
TEMPVARNUM!* := 1;
TEMPVARNAME!* := 'mtt_s; % '

$iname

% Matrix output function
%in"$MTTPATH/trans/lang_matrix.r";

%Read the reduce definitions file
in "$1_def.r";

%Read the reduce  $REP   file
156
157
158
159
160
161
162



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
%%%%%% End of bug fix


END;
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 $noglobals $parameters $1 $rep $ext 'mttx,mttu,mttt,mttpar' mttdx > $1_$2.pas
  lang_header $noglobals $parameters $1 $2o $ext 'mttx,mttu,mttt,mttpar' mtty  > $1_$2o.pas








>
>
>
|










|







167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
%%%%%% End of bug fix


END;
EOF

#Inform user
if [ -n "$optimise" ]; then
    blurb=' using code optimisation'
fi
echo Creating $outfile.m $blurb



# 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 $blurb

  #rm -f $1_odea.$ext.1;

  #Header
  lang_header $noglobals $parameters $1 $rep $ext 'mttx,mttu,mttt,mttpar' mttdx > $1_$2.pas
  lang_header $noglobals $parameters $1 $2o $ext 'mttx,mttu,mttt,mttpar' mtty  > $1_$2o.pas


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]