Differences From Artifact [44d0261bf2]:

To Artifact [2795ee140c]:


12
13
14
15
16
17
18




19
20
21
22
23
24
25
% [bonds,status] = abg2cbg(system_name, system_type, full_name, port_bonds, infofile)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$




% %% Revision 1.9  1996/08/30  12:55:40  peter
% %% More heirachical stuff added.
% %%
% %% Revision 1.8  1996/08/26  10:04:25  peterg
% %% Fixed error due to a line wrap.
% %%
% %%Revision 1.7  1996/08/16  12:58:58  peter







>
>
>
>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
% [bonds,status] = abg2cbg(system_name, system_type, full_name, port_bonds, infofile)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.10  1996/12/04 21:48:55  peterg
% %% Compares full-name with empty string (instead of testing for zero
% %% length.
% %%
% %% Revision 1.9  1996/08/30  12:55:40  peter
% %% More heirachical stuff added.
% %%
% %% Revision 1.8  1996/08/26  10:04:25  peterg
% %% Fixed error due to a line wrap.
% %%
% %%Revision 1.7  1996/08/16  12:58:58  peter
54
55
56
57
58
59
60



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
if nargin<4
  port_bonds = [];
end;

if nargin<5
  infofile = 'stdout';
end;




% Create a file to contain shell commands which map subsystem types 
% onto components
if strcmp(full_name, '') % Then at top level
  fprintf(typefile, '# Commands to map types onto subsystems\n');
  fprintf(typefile, '# File %s_type.sh\n', system_name);
  fprintf(typefile, '# Generated by MTT on %s\n\n', date);
end;

full_name
length(full_name)

% Create the (full) system name
if strcmp(full_name, '')
  full_name = system_name;
  system_type = system_name;
else
  full_name = [full_name, '_', system_name];
end;

% Add to file to contain shell commands which map subsystem types 







>
>
>



|









|







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
if nargin<4
  port_bonds = [];
end;

if nargin<5
  infofile = 'stdout';
end;

% Are we at the top level of the heirarchy?
at_top_level = strcmp(full_name, '');

% Create a file to contain shell commands which map subsystem types 
% onto components
if at_top_level % Then at top level
  fprintf(typefile, '# Commands to map types onto subsystems\n');
  fprintf(typefile, '# File %s_type.sh\n', system_name);
  fprintf(typefile, '# Generated by MTT on %s\n\n', date);
end;

full_name
length(full_name)

% Create the (full) system name
if at_top_level
  full_name = system_name;
  system_type = system_name;
else
  full_name = [full_name, '_', system_name];
end;

% Add to file to contain shell commands which map subsystem types 
104
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
 
% Find number of components
[n_components,columns] = size(components);
if n_components==0 % there is nothing to be done
  return
end;



% Find number of port bonds
[n_port_bonds,columns] = size(port_bonds);

% Check compatibility - if ok copy port bonds to the internal bonds list.
if n_port_bonds~=n_ports
  mtt_info(sprintf('%1.0f port bonds incompatible with %1.0f ports', ...
      n_port_bonds, n_ports), infofile);
else % Copy the port bonds
  for i = 1:n_ports      % The port SSs come first
    j = abs(components(i,1)); % Get the bonds attached to the ports
    direction = -sign(components(i,1)); 
    bonds(j,:) = direction*port_bonds(i,:);

  end;
end;


% Set initial status
status = -ones(n_components,1);
total = 2*n_bonds;







>
>
|
|

|
|
|
|
|
|
|
|
|
>







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
 
% Find number of components
[n_components,columns] = size(components);
if n_components==0 % there is nothing to be done
  return
end;

% If not at top level, then sort out the port bonds.
if !at_top_level 
  % Find number of port bonds
  [n_port_bonds,columns] = size(port_bonds);

  % Check compatibility - if ok copy port bonds to the internal bonds list.
  if n_port_bonds~=n_ports
    mtt_info(sprintf('%1.0f port bonds incompatible with %1.0f ports', ...
	n_port_bonds, n_ports), infofile);
  else % Copy the port bonds
    for i = 1:n_ports      % The port SSs come first
      j = abs(components(i,1)); % Get the bonds attached to the ports
      direction = -sign(components(i,1)); 
      bonds(j,:) = direction*port_bonds(i,:);
    end;
  end;
end;


% Set initial status
status = -ones(n_components,1);
total = 2*n_bonds;

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