Overview
Comment:Clearer error messages for incorrect ports.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 6a86eec1d32ebd588385137f7ef47dfb8a6ba20c333f4a06b65e84eb3b3d3cf8
User & Date: gawthrop@users.sourceforge.net on 1996-12-31 11:25:57
Other Links: branch diff | manifest | tags
Context
1996-12-31
11:42:36
*** empty log message *** check-in: 49d12edd47 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
11:25:57
Clearer error messages for incorrect ports. check-in: 6a86eec1d3 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1996-12-30
20:00:29
Fixed bent-bond bug.
NB unfixed problems:
1. xfig writes multi line fields if more than about 5 segments.
2. rbg2abg takes a multi-segment bond as a straignt line between the
end points - so computation of stroke and arrow directions may be
iffy.
check-in: 2b6ffa23ce user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/m/rbg2abg.m from [708333555b] to [b0a94e0639].

1
2
3
4
5
6
7



8
9
10
11
12
13
14
function [bonds,components] = rbg2abg(rbonds,rstrokes,rcomponents,rports,infofile)

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



% %% Revision 1.7  1996/11/01 18:01:57  peterg
% %% Rationalised port ordering.
% %% Fixed port bug.
% %%
% %% Revision 1.6  1996/08/25 08:27:14  peter
% %% Now checks ports correctely - I hope.
% %%







>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function [bonds,components] = rbg2abg(rbonds,rstrokes,rcomponents,rports,infofile)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.8  1996/12/04 21:52:39  peterg
% %% Now uses fopen.
% %%
% %% Revision 1.7  1996/11/01 18:01:57  peterg
% %% Rationalised port ordering.
% %% Fixed port bug.
% %%
% %% Revision 1.6  1996/08/25 08:27:14  peter
% %% Now checks ports correctely - I hope.
% %%
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
148
149
    sort_index = [1:n]'; 
    
    if n_ports>0 % then there are some numbered ports 
      % so find those associated with the bonds on this component.
      k=0; port_number=[];
      for j = 1:n
	b = signed_bond_list(j); 
	% Find the port on component end of bond (if any)
	[port_index,m] = getindex(port_near_bond(:,1),b);
	if m==1
	  k=k+1;
	  port_number(k,1) = port_near_bond(port_index,2);
	  end;
      end;

      % Must have a lable for each port or non at all
      if k==n % Then a full set of port numbers
	[sorted,sort_index]=sort(port_number);
	
	%Check that all the numbers (1..n) are there
	if sum(sorted==[1:n]')~=n % There is something wrong
	  mtt_info(port_error,fnum);
	  mtt_info(sprintf('\t it must have ports from 1:%1.0f\n', n), ...
	      fnum);
	end;
      else
	if k~=0
	  mtt_info(port_error,fnum);
	  mtt_info(sprintf('\t it must have 0 or %1.0f ports\n', n), fnum);
	  port_str = sprintf('\t the ports are: ');
	  for kk=1:k
	    port_str=sprintf('%s %1.0f', port_str, port_number(kk));
	  end;
	  mtt_info(port_str, fnum);
	end;
      end;
      







|














|






|







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
148
149
150
151
152
    sort_index = [1:n]'; 
    
    if n_ports>0 % then there are some numbered ports 
      % so find those associated with the bonds on this component.
      k=0; port_number=[];
      for j = 1:n
	b = signed_bond_list(j); 
	% Find the port label on component end of bond (if any)
	[port_index,m] = getindex(port_near_bond(:,1),b);
	if m==1
	  k=k+1;
	  port_number(k,1) = port_near_bond(port_index,2);
	  end;
      end;

      % Must have a lable for each port or non at all
      if k==n % Then a full set of port numbers
	[sorted,sort_index]=sort(port_number);
	
	%Check that all the numbers (1..n) are there
	if sum(sorted==[1:n]')~=n % There is something wrong
	  mtt_info(port_error,fnum);
	  mtt_info(sprintf('\t it must have consecutive ports labels from 1:%1.0f\n', n), ...
	      fnum);
	end;
      else
	if k~=0
	  mtt_info(port_error,fnum);
	  mtt_info(sprintf('\t it must have 0 or %1.0f ports\n', n), fnum);
	  port_str = sprintf('\t the port labels are: ');
	  for kk=1:k
	    port_str=sprintf('%s %1.0f', port_str, port_number(kk));
	  end;
	  mtt_info(port_str, fnum);
	end;
      end;
      


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