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,16 @@ ## ############################################################### ## ## Version control history ## ############################################################### ## ## $Id$ ## ## $Log$ + ## ## Revision 1.37 2000/11/12 16:45:57 peterg + ## ## Close ese file before recursive call of cbg2ese -- reopen when + ## ## finished. + ## ## THis prevents a new file being opened for each subsystem which fails + ## ## when > 1K files opened + ## ## ## ## 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 @@ -137,12 +143,12 @@ ## ## Revision 1.1 1996/08/08 15:53:23 peter ## ## Initial revision ## ## ## ############################################################# - disp("cbg2ese"); - system_name, system_type, full_name, repetition + ## disp("cbg2ese"); + ## system_name, system_type, full_name, repetition pc = "%"; ## Set up the names corresponding to the structure matrix. structure_name = [ @@ -176,11 +182,11 @@ return end; ## Setup files ese_name = [full_name_repetition, "_ese.r"]; - ese_file = fopen(ese_name, "w"); # open file (first time) + 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); @@ -245,25 +251,25 @@ 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, " ---"]); + ## disp(["---- ", field, " ---"]); if AliasingArguments # Alias the args list if appropriate message = sprintf("\tfor component %s (%s) within %s",\ comp_name,subsystem.type,full_name); if struct_contains(CBG,"alias") - subsystem.arg = alias_args(subsystem.arg,CBG.alias,";",message,infofilenum,full_name) + subsystem.arg = alias_args(subsystem.arg,CBG.alias,";",message,infofilenum,full_name); endif; endif; if AliasingCRs # Alias the CR list if appropriate message = sprintf("\tfor component %s (%s) within %s",\ comp_name,subsystem.type,full_name); if struct_contains(CBG,"alias") - subsystem.cr = alias_args(subsystem.cr,CBG.alias,";",message,infofilenum,full_name) + subsystem.cr = alias_args(subsystem.cr,CBG.alias,";",message,infofilenum,full_name); endif; endif; ## Substitute positional ($1 etc) arguments subsystem.cr = subs_arg(subsystem.cr,system_cr, ... @@ -315,11 +321,11 @@ endif; ## Invoke the appropriate equation-generating procedure name_r = full_name_repetition; - eqn_name = [subsystem.type, "_eqn"] + 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 @@ -326,11 +332,11 @@ 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) + 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);