Overview
Comment:Commented out redundent code -- obsolete due to new default mechanism
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 69243f733ca0cf5b4be185d781657d9f985c227422d2b6b2ddde998a26f9883f
User & Date: gawthrop@users.sourceforge.net on 1998-07-02 17:16:06
Other Links: branch diff | manifest | tags
Context
1998-07-02
19:16:03
Prettyfied output check-in: 1dd032ef39 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
17:16:06
Commented out redundent code -- obsolete due to new default mechanism check-in: 69243f733c user: gawthrop@users.sourceforge.net tags: origin/master, trunk
15:12:05
Added hard error reporting
Added error when two unlabled bonds point in.
check-in: fc8f983688 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/m/rbg2abg.m from [117b8cf421] to [917f410e33].

1
2
3
4
5
6
7




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

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




% %% Revision 1.31  1998/07/02 14:30:50  peterg
% %% Corrected various bugs - including resettting n_ports to correct value
% %%
% %% Revision 1.30  1998/07/02 13:40:50  peterg
% %% Added extra ports names (due to defaults) to relevant lists:
% %% 	port_name
% %% 	port_bond







>
>
>
>







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

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.32  1998/07/02 15:12:05  peterg
% %% Added hard error reporting
% %% Added error when two unlabled bonds point in.
% %%
% %% Revision 1.31  1998/07/02 14:30:50  peterg
% %% Corrected various bugs - including resettting n_ports to correct value
% %%
% %% Revision 1.30  1998/07/02 13:40:50  peterg
% %% Added extra ports names (due to defaults) to relevant lists:
% %% 	port_name
% %% 	port_bond
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
	unsorted_port_list(k,:) = port_name(port_index,:);
      end;
    end;
  else 
    k=0;
  end;
    
  %Either all ports or no ports should be labelled - write error
  %message if this is not so
  if (k~=0)&(k~=n_comp_bonds)
    mtt_info(['Component ', comp_name, ' (', comp_type, ') has wrong number of labels'], fnum); 
    mtt_info(sprintf("\tit has %1.0f labels but should have 0 or \
    %1.0f",k,n_comp_bonds), fnum);
    portnames=""; 
    for kk=1:k 
      portnames=sprintf("%s %s",portnames, unsorted_port_list(kk,:));
    end;
    mtt_error(portnames,fnum);
  end;
  
  %Compute the number of labeled ports
  [n_unsorted_ports,m_unsorted_ports] = size(unsorted_port_list);
  if m_unsorted_ports==0
    n_unsorted_ports = 0;
  end;
  n_unsorted_ports,n_comp_bonds
  % One port defaults:
  if (n_comp_bonds==1)&(n_unsorted_ports==0)
    %if (direction(1)<0) & ~strcmp(comp_type,'SS') % Wrong way for default
    % mtt_error(['One-port ', comp_name, ' (', comp_type, ') has the sign pointing the wrong way '], fnum);
    %end;
    unsorted_port_list = port_list;
  end;
  
  %Two port defaults
  if (n_comp_bonds==2)&(n_unsorted_ports==0)
    if direction(1)==direction(2) % Wrong way for default
      % mtt_error(['Two-port ', comp_name, ' (', comp_type, ') does not have through-pointing arrows'], fnum);
    end;
    if direction(1)==1 %in
      % mtt_info([comp_name, ' in'],fnum);
      unsorted_port_list = ['[in]';'[out]'];
    else %reverse the order
      % mtt_info([comp_name, ' out'],fnum);
      unsorted_port_list = ['[out]';'[in]'];
    end;
  end;
  
  % Recompute the number of unsorted ports
  [n_unsorted_ports,m_unsorted_ports] = size(unsorted_port_list);
  if m_unsorted_ports==0
    n_unsorted_ports = 0;
  end;
  
  % Junctions or no lables(order of ports unimportant)
  if strcmp(comp_type,'zero')|strcmp(comp_type,'one')
    for j = 1:n_comp_bonds
      components(i,j) = signed_bond_list(j);
    end
  else %Order of ports is important







|
|
|
|
|
|
|
|
|
|
|
|






|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|







480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
	unsorted_port_list(k,:) = port_name(port_index,:);
      end;
    end;
  else 
    k=0;
  end;
    
#  %Either all ports or no ports should be labelled - write error
#  %message if this is not so
#  if (k~=0)&(k~=n_comp_bonds)
#    mtt_info(['Component ', comp_name, ' (', comp_type, ') has wrong number of labels'], fnum); 
#    mtt_info(sprintf("\tit has %1.0f labels but should have 0 or \
#    %1.0f",k,n_comp_bonds), fnum);
#    portnames=""; 
#    for kk=1:k 
#      portnames=sprintf("%s %s",portnames, unsorted_port_list(kk,:));
#    end;
#    mtt_error(portnames,fnum);
#  end;
  
  %Compute the number of labeled ports
  [n_unsorted_ports,m_unsorted_ports] = size(unsorted_port_list);
  if m_unsorted_ports==0
    n_unsorted_ports = 0;
  end;
#  n_unsorted_ports,n_comp_bonds
#  % One port defaults:
#  if (n_comp_bonds==1)&(n_unsorted_ports==0)
#    %if (direction(1)<0) & ~strcmp(comp_type,'SS') % Wrong way for default
#    % mtt_error(['One-port ', comp_name, ' (', comp_type, ') has the sign pointing the wrong way '], fnum);
#    %end;
#    unsorted_port_list = port_list;
#  end;
  
#  %Two port defaults
#  if (n_comp_bonds==2)&(n_unsorted_ports==0)
#    if direction(1)==direction(2) % Wrong way for default
#      % mtt_error(['Two-port ', comp_name, ' (', comp_type, ') does not have through-pointing arrows'], fnum);
#    end;
#    if direction(1)==1 %in
#      % mtt_info([comp_name, ' in'],fnum);
#      unsorted_port_list = ['[in]';'[out]'];
#    else %reverse the order
#      % mtt_info([comp_name, ' out'],fnum);
#      unsorted_port_list = ['[out]';'[in]'];
#    end;
#  end;
  
#  % Recompute the number of unsorted ports
#  [n_unsorted_ports,m_unsorted_ports] = size(unsorted_port_list);
#  if m_unsorted_ports==0
#    n_unsorted_ports = 0;
#  end;
  
  % Junctions or no lables(order of ports unimportant)
  if strcmp(comp_type,'zero')|strcmp(comp_type,'one')
    for j = 1:n_comp_bonds
      components(i,j) = signed_bond_list(j);
    end
  else %Order of ports is important
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
	mtt_error(['Component ', comp_name, ' (', comp_type, ') has an unrecognised port: ', name_k], fnum); 
      else
	components(i,k) = signed_bond_list(j);     
      end;
    end;
  end;
end;



fclose(fnum);











<
<






562
563
564
565
566
567
568


569
570
571
572
573
574
	mtt_error(['Component ', comp_name, ' (', comp_type, ') has an unrecognised port: ', name_k], fnum); 
      else
	components(i,k) = signed_bond_list(j);     
      end;
    end;
  end;
end;



fclose(fnum);





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