Differences From Artifact [1b9d8e34d7]:

To Artifact [ae72d83aa8]:


24
25
26
27
28
29
30



31
32
33
34
35
36
37
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40







+
+
+








			
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.17  1998/07/04 07:15:44  peterg
% %% Back under RCS
% %%
% %% Revision 1.16  1998/04/11 19:07:16  peterg
% %% Now do named ports as ordinary ports iff at top level.
% %% --- not yet complete, need to pass necesssary info though to this
% %%     function
% %%
% %% Revision 1.15  1997/12/16 19:16:07  peterg
% %% Added unknown input to the effort part.
90
91
92
93
94
95
96
97
98
99
100














101
102
103
104
105
106
107
93
94
95
96
97
98
99




100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120







-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+







% internal indicates an internal variable
% anything else is the name of a constant.
% Blank is taken to be external
% If its a numbered port:
%     cr contains 'MTT_port'
%     arg contains port number

STDerr = 2; % Standard output

effort_attribute = cr;
flow_attribute = args;
if (strcmp(cr,"SS"))		# Then its the standard file
  a = split(args,",");
  [N,M]=size(a);
  if (N~=2)			# Must have 2 arguments
    mtt_info(sprintf("SS should have 2 args not %i", N));
  else
    effort_attribute = a(1,:);
    flow_attribute   = a(2,:);
  end;
else				# Old style file
  effort_attribute = cr;
  flow_attribute = args;
  mtt_info(sprintf("SS component: Hmm... looks like an old-style label file"));
end;

% Default attributes
if strcmp(effort_attribute,'')
  effort_attribute = 'external';
end;

if strcmp(flow_attribute,'')
185
186
187
188
189
190
191
192

193
194
195
196
197
198
199
198
199
200
201
202
203
204

205
206
207
208
209
210
211
212







-
+







	varname(name, bond_number,1), effort_attribute);
  else % Sensor
    if strcmp(effort_attribute, 'zero') %Zero output
      zero_outputs = zero_outputs + 1;
      fprintf(filenum, 'MTTyz%d := %s;\n', ...
	  zero_outputs, varname(name, bond_number,1));
    else
      mtt_info([effort_attribute, ' not appropriate for an output '],STDerr);
      mtt_info([effort_attribute, ' not appropriate for an output ']);
    end;
  end;
end;
  
% Flow
if strcmp(flow_attribute, 'external')
  if bonds(1,2)==1 % Source
216
217
218
219
220
221
222
223

224
225
226
227
228
229
230
231
232
229
230
231
232
233
234
235

236

237
238
239
240
241
242
243
244







-
+
-








	varname(name, bond_number,-1), flow_attribute);
  else % Sensor
    if strcmp(flow_attribute, 'zero') %Zero output
      zero_outputs = zero_outputs + 1;
      fprintf(filenum, 'MTTyz%d := %s;\n', ...
	  zero_outputs, varname(name, bond_number,-1));
    else
      mtt_info([flow_attribute, ' not appropriate for an output '], ...
      mtt_info([flow_attribute, ' not appropriate for an output ']);
	  STDerr);
    end;
  end;
end;

structure(3) = inputs;
structure(4) = outputs;
structure(5) = zero_outputs;
structure(6) = unknown_inputs;

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