Index: mttroot/mtt/bin/trans/awk/rbg_fig2m.awk ================================================================== --- mttroot/mtt/bin/trans/awk/rbg_fig2m.awk +++ mttroot/mtt/bin/trans/awk/rbg_fig2m.awk @@ -10,10 +10,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.4 1996/08/05 10:14:46 peter +## Made ports appear, in order, at top of component lists +## ## Revision 1.3 1996/08/04 20:32:28 peter ## Stopped complaint about missing lbl entry for port components ## ## Revision 1.2 1996/08/04 20:05:25 peter ## Included port components - eg SS:[1] @@ -342,35 +345,38 @@ } } END { #Print out the matlab functions - print sprintf("function [rbonds, rstrokes,rcomponents,rports] = %s_rbg", sys_name) > b_file; - print sprintf("%%[rbonds,rstrokes,rcomponents,rports] = %s_rbg", sys_name) > b_file; - print sprintf("%%Generated by MTT") > b_file; + printf("function [rbonds, rstrokes,rcomponents,rports] = %s_rbg\n", sys_name) > b_file; + printf("%% [rbonds,rstrokes,rcomponents,rports] = %s_rbg\n", sys_name) > b_file; + printf("%% Generated by MTT\n\n") > b_file; - print sprintf("function [comp_type, name, cr, arg] = %s_cmp(i)",\ + printf("function [comp_type, name, cr, arg, n_ports] = %s_cmp(i)\n",\ sys_name) > c_file; - print sprintf("%%[comp_type, name, cr, arg] = %s_cmp", sys_name) > c_file; - print sprintf("%%Generated by MTT") > c_file; + printf("%% [comp_type, name, cr, arg, n_ports] = %s_cmp\n", sys_name) > c_file; + printf("%% Generated by MTT\n\n") > c_file; - print sprintf("rbonds = [") >> b_file; + printf("rbonds = [\n") >> b_file; for (i = 1; i <= i_bond; i++) print bonds[i] >> b_file; for (i = 1; i <= i_arrow; i++) print arrows[i], "-1 -1" >> b_file; - print sprintf("];") >> b_file; + printf("];\n") >> b_file; - print sprintf("rstrokes = [") >> b_file; + printf("rstrokes = [\n") >> b_file; for (i = 1; i <= i_stroke; i++) print strokes[i] >> b_file; - print sprintf("];") >> b_file; + printf("];\n") >> b_file; - print sprintf("rcomponents = [") >> b_file; + printf("rcomponents = [") >> b_file; j = 0; -# Do the port componennts, in order, first +# Number of ports + printf("n_ports = %1.0f;\n\n", i_port_component) >> c_file; + +# Do the port components, in order, first for (i = 1; i <= i_port_component; i++) { port_type = "SS"; name = sprintf("[%1.0f]", i); cr = i; arg = ""; @@ -407,15 +413,15 @@ printf("\tcr = %s%s%s;\n", q, cr, q) >> c_file; printf("\targ = %s%s%s;\n", q, arg, q) >> c_file; print "end" >> c_file } } - print sprintf("];") >> b_file; + printf("];\n") >> b_file; - print sprintf("rports = [") >> b_file; + printf("rports = [\n") >> b_file; for (i = 1; i <= i_port; i++) print ports[i] >> b_file; - print sprintf("];") >> b_file; + printf("];\n") >> b_file; }