Index: mttroot/mtt/bin/trans/m/abg2cbg.m ================================================================== --- mttroot/mtt/bin/trans/m/abg2cbg.m +++ mttroot/mtt/bin/trans/m/abg2cbg.m @@ -14,10 +14,14 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% 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. @@ -56,24 +60,27 @@ 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 strcmp(full_name, '') % Then at top level +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 strcmp(full_name, '') +if at_top_level full_name = system_name; system_type = system_name; else full_name = [full_name, '_', system_name]; end; @@ -106,22 +113,25 @@ [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,:); +% 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