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 @@ -11,10 +11,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.33 1998/08/10 15:51:06 peterg +## Comments may now be prefaced by # as well as % +## ## Revision 1.32 1998/07/27 20:30:03 peterg ## *** empty log message *** ## ## Revision 1.31 1998/04/16 13:18:13 peterg ## Now ignores spurious ports (in lbl but not Figure \ref{) but gives @@ -177,10 +180,14 @@ # field 14 is the type:name string terminated by \001 # To prevent text being confused with components, components consist # of alphanumeric characters and : and _ only. # The lbl file is used to sort the components. ############################################################## + +function modulo10(x) { + return x-int(x/10)*10 + } function exact_match(name1, name2) { return ((match(name1,name2)>0)&&(length(name1)==length(name2))) } @@ -234,18 +241,18 @@ for (i=15; i<=NF; i++) { str = sprintf("%s %s", str, $i) } # The depth is field 4 - depth = $4; + depth = modulo10($4); # It is terminated by \001 - so delete this termination str = substr(str,1,length(str)-4); # A component string contains only alphanumeric _ and : isa_plain_component = match(str, component_regexp)==0; -# It must also be specified at depth 0 +# It must also be specified at depth 0 (modulo 10) isa_plain_component = isa_plain_component && (depth==0); # A port is a string within [] isa_port = (match(str, port_regexp)>0) @@ -357,11 +364,11 @@ } # Unnamed component if (named_component==0) { i_name++; - name = sprintf("%1.0f", i_name); + name = sprintf("mtt%i", i_name); type = str; i_label++; label[i_label,1] = name; label[i_label,2] = default_cr; label[i_label,3] = default_args @@ -484,17 +491,16 @@ function process_fig() { # Test for the fig format first line and data line data_line = (match($1,data_symbol)>0); first_line = (data_line==0)&&(NF>min_line_length); - #Process firstline if (first_line) { object = $1; sub_type = $2; style = $3; - zero_depth = (($7==0)&&(object=polyline)) || (($4==0)&&(object=text)); + zero_depth = ((modulo10($7)==0)&&(object==polyline)) || ((modulo10($4)==0)&&(object==text)) f_arrow = ($14==1)&&(object=polyline); b_arrow = ($15==1)&&(object=polyline); arrow = f_arrow||b_arrow; arg_count = 0; }