Index: mttroot/mtt/bin/trans/m/cbg2ese.m ================================================================== --- mttroot/mtt/bin/trans/m/cbg2ese.m +++ mttroot/mtt/bin/trans/m/cbg2ese.m @@ -21,10 +21,13 @@ # ############################################################### # ## Version control history # ############################################################### # ## $Id$ # ## $Log$ +# ## Revision 1.27 1998/08/25 07:16:49 peterg +# ## Modified to data struture representation +# ## # ## Revision 1.26 1998/08/24 14:53:55 peterg # ## Uses new _cbg structure. # ## # ## Revision 1.25 1998/07/28 19:05:12 peterg # ## Sttill has vector SS port bug? @@ -152,13 +155,13 @@ fprintf(ese_file, "%s%s Generated by MTT\n\n", pc, pc); # Evaluate the system function to get the bonds eval(["CBG = ", cbg_name, ";"]); #eval(["[bonds,status,system_type,components] = ", cbg_name, ";"]); - abg_name = [system_type, "_abg"]; - cmp_name = [system_type, "_cmp"]; - alias_name = [system_type, "_alias"]; +# abg_name = [system_type, "_abg"]; +# cmp_name = [system_type, "_cmp"]; +# alias_name = [system_type, "_alias"]; # No longer needed - cbg now has components: # eval(["[junk,components]=", abg_name, ";"]); # Find number of bonds @@ -188,33 +191,35 @@ mtt_info(sprintf("No cr given so no cr aliasing done for system %s(%s)",\ system_name,system_type), infofilenum); endif; - field=["ports";"subsystems"]; # Do for both ports and subsystems - + fields=["ports";"subsystems"]; # Do for both ports and subsystems - # ports first for i=1:2 - if struct_contains(CBG,field(i,:)); - eval(["CBG_field = CBG.",field(i,:), ";"]); + field=deblank(fields(i,:)); + if struct_contains(CBG,field); + eval(["CBG_field = CBG.",field, ";"]); for [subsystem,comp_name] = CBG_field +i,comp_name #comp = nozeros(components(i,:)); comp = subsystem.connections; bond_list = abs(comp); direction = sign(comp)'*[1 1]; # Convert from arrow orientated to component orientated causality comp_bonds = CBG.bonds(bond_list,:).*direction; - disp(["---- ", field(i,:), "Component ---"]); + disp(["---- ", field, " ---"]); # Get the component details #eval([ "[comp_type,comp_name,cr,args,repetitions] = ", cmp_name, "(i)"]); # Alias the args list -- if not at top level message = sprintf("\tfor component %s (%s) within %s",\ comp_name,subsystem.type,full_name); - if struct_contains(subsystem,"alias") - subsystem.arg = alias_args(subsystem.arg,subsystem.alias,";",message,infofilenum) - subsystem.cr = alias_args(subsystem.cr,subsystem.alias,";",message,infofilenum) + if struct_contains(CBG,"alias") + subsystem.arg = alias_args(subsystem.arg,CBG.alias,";",message,infofilenum) + subsystem.cr = alias_args(subsystem.cr,CBG.alias,";",message,infofilenum) endif; # Substitute positional ($1 etc) arguments subsystem.cr = subs_arg(subsystem.cr,system_cr, ... @@ -361,14 +366,14 @@ endif; end; end; endfor # [subsystem,comp_name] = CBG_field - endif # struct_contains(CBG,field(i,:)) + endif # struct_contains(CBG,field) endfor # i=1:2 # Close the files fclose(ese_file); endfunction