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.36 2000/10/13 10:54:47 peterg + ## ## Now writes out a unique name for each state etc + ## ## ## ## Revision 1.35 2000/10/12 19:27:47 peterg ## ## Now writes the aliased args ## ## ## ## Revision 1.34 2000/09/01 08:42:44 peterg ## ## Cahged somes ends to end for etc for clarity @@ -173,11 +176,11 @@ return end; ## Setup files ese_name = [full_name_repetition, "_ese.r"]; - ese_file = fopen(ese_name, "w"); + ese_file = fopen(ese_name, "w"); # open file (first time) fprintf(ese_file, "\n%s%s Equation file for system %s (file %s)\n", ... pc, pc, full_name_repetition, ese_name); fprintf(ese_file, "%s%s Generated by MTT\n\n", pc, pc); @@ -315,15 +318,20 @@ ## Invoke the appropriate equation-generating procedure name_r = full_name_repetition; eqn_name = [subsystem.type, "_eqn"] if exist(eqn_name)~=2 ## Try a compound component + fclose(ese_file); # Close but reopen later + disp("---PUSH---"); bond_list, comp_name, subsystem.type structure = cbg2ese(comp_name, subsystem.type, subsystem.cr, subsystem.arg, ... full_name, full_name_repetition, ... k, structure, structure_file, infofilenum); + disp("---POP---"); + ese_file = fopen(ese_name, "a"); # open file (again) + ## Link up the bonds fprintf(ese_file, ... "\n\t%s Equations linking up subsystem %s (%s)\n\n", ... pc, comp_name, subsystem.type); name_comp_name = sprintf("%s_%s_%d", ... @@ -359,11 +367,10 @@ varname(name_r, ... bond_list(port_number),-1), name_comp_name, y_index); end; end; - disp("---POP---"); else # its a simple component fprintf(ese_file, "\n\t%s Equations for component %s (%s), repetition %d\n\n", ... pc, comp_name, subsystem.type,k); @@ -408,12 +415,12 @@ endif endfor endfor # [subsystem,comp_name] = CBG_field endif # struct_contains(CBG,field) endfor # i=1:2 - ## Close the files - fclose(ese_file); + + fclose(ese_file); # Close endfunction