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.8 1996/08/05 20:12:43 peter +## Now writes a _fig.fig file. +## ## Revision 1.7 1996/08/05 18:44:56 peter ## Now writes out a _cbg file without ----- symbol. ## ## Revision 1.6 1996/08/05 12:17:37 peter ## n_ports now appear in the _abg file instead. @@ -122,12 +125,12 @@ str = substr(str,1,length(str)-4); # A component string contain only alphanumeric _ and : isa_plain_component = match(str, component_regexp)==0; -# A port is an integer within [] - isa_port = exact_match(str, port_regexp)>0; +# A port is an integer within [] and no alpha characters + isa_port = (match(str, port_regexp)>0)&&(match(str, nonport_regexp)==0); # A port component is SS followed by : followed by a port string isa_port_component = 0; if (match(str, delimiter)) { split(str,a,delimiter); @@ -139,10 +142,17 @@ isa_component = isa_plain_component||isa_port_component; # Coordinates in fields 12 & 13 x_coord = $12; y_coord = $13; + +# Do the ports + if (isa_port) { + i_port++; + port_index = substr(str,2,length(str)-2); + ports[i_port] = sprintf("%s %s %s", x_coord, y_coord, port_index); + } # Do the port components if (isa_port_component) { i_port_component++; # Port number is the bit between the [] @@ -219,15 +229,10 @@ x[name] = x_coord; y[name] = y_coord; info[name] = fig_info(); } - if (isa_port) { - i_port++; - port_index = substr(str,2,length(str)-2); - ports[i_port] = sprintf("%s %s %s", x_coord, y_coord, port_index); - } } function process_bond() { arg_count++; @@ -324,10 +329,11 @@ delimiter = ":"; q = "\047"; terminator = "\\001"; component_regexp = "[^0-9a-zA-Z_:]"; port_regexp = "\[[0-9]*\]"; + nonport_regexp = "a-zA-Z"; isa_fig_file = 0; min_line_length = 10; object = 0; polyline = 2; @@ -430,16 +436,19 @@ print "end" >> c_file } } printf("];\n") >> b_file; +# Print the ports list printf("rports = [\n") >> b_file; for (i = 1; i <= i_port; i++) print ports[i] >> b_file; printf("];\n\n") >> b_file; + +# Print the number of ports printf("n_ports = %1.0f;\n", i_port_component) >> b_file; }