OLD | NEW |
1 #!/usr/local/bin/perl | 1 #!/usr/local/bin/perl |
2 | 2 |
3 open (NUMIN,"$ARGV[1]") || die "Can't open number file $ARGV[1]"; | 3 open (NUMIN,"$ARGV[1]") || die "Can't open number file $ARGV[1]"; |
4 $max_nid=0; | 4 $max_nid=0; |
5 $o=0; | 5 $o=0; |
6 while(<NUMIN>) | 6 while(<NUMIN>) |
7 { | 7 { |
8 chop; | 8 chop; |
9 $o++; | 9 $o++; |
10 s/#.*$//; | 10 s/#.*$//; |
11 next if /^\s*$/; | 11 next if /^\s*$/; |
12 $_ = 'X'.$_; | 12 $_ = 'X'.$_; |
13 ($Cname,$mynum) = split; | 13 ($Cname,$mynum) = split; |
14 $Cname =~ s/^X//; | 14 $Cname =~ s/^X//; |
15 if (defined($nidn{$mynum})) | 15 if (defined($nidn{$mynum})) |
16 { die "$ARGV[1]:$o:There's already an object with NID ",$mynum,"
on line ",$order{$mynum},"\n"; } | 16 { die "$ARGV[1]:$o:There's already an object with NID ",$mynum,"
on line ",$order{$mynum},"\n"; } |
| 17 if (defined($nid{$Cname})) |
| 18 { die "$ARGV[1]:$o:There's already an object with name ",$Cname,
" on line ",$order{$nid{$Cname}},"\n"; } |
17 $nid{$Cname} = $mynum; | 19 $nid{$Cname} = $mynum; |
18 $nidn{$mynum} = $Cname; | 20 $nidn{$mynum} = $Cname; |
19 $order{$mynum} = $o; | 21 $order{$mynum} = $o; |
20 $max_nid = $mynum if $mynum > $max_nid; | 22 $max_nid = $mynum if $mynum > $max_nid; |
21 } | 23 } |
22 close NUMIN; | 24 close NUMIN; |
23 | 25 |
24 open (IN,"$ARGV[0]") || die "Can't open input file $ARGV[0]"; | 26 open (IN,"$ARGV[0]") || die "Can't open input file $ARGV[0]"; |
25 $Cname=""; | 27 $Cname=""; |
26 $o=0; | 28 $o=0; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 $ordern{$o} = $Cname; | 97 $ordern{$o} = $Cname; |
96 $order{$Cname} = $o; | 98 $order{$Cname} = $o; |
97 $sn{$Cname} = $mysn; | 99 $sn{$Cname} = $mysn; |
98 $ln{$Cname} = $myln; | 100 $ln{$Cname} = $myln; |
99 $obj{$Cname} = $myoid; | 101 $obj{$Cname} = $myoid; |
100 if (!defined($nid{$Cname})) | 102 if (!defined($nid{$Cname})) |
101 { | 103 { |
102 $max_nid++; | 104 $max_nid++; |
103 $nid{$Cname} = $max_nid; | 105 $nid{$Cname} = $max_nid; |
104 $nidn{$max_nid} = $Cname; | 106 $nidn{$max_nid} = $Cname; |
| 107 print STDERR "Added OID $Cname\n"; |
105 } | 108 } |
106 $Cname=""; | 109 $Cname=""; |
107 } | 110 } |
108 close IN; | 111 close IN; |
109 | 112 |
110 open (NUMOUT,">$ARGV[1]") || die "Can't open output file $ARGV[1]"; | 113 open (NUMOUT,">$ARGV[1]") || die "Can't open output file $ARGV[1]"; |
111 foreach (sort { $a <=> $b } keys %nidn) | 114 foreach (sort { $a <=> $b } keys %nidn) |
112 { | 115 { |
113 print NUMOUT $nidn{$_},"\t\t",$_,"\n"; | 116 print NUMOUT $nidn{$_},"\t\t",$_,"\n"; |
114 } | 117 } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 if ($oids ne "L") | 223 if ($oids ne "L") |
221 { | 224 { |
222 $oids = $pref_oid . $pref_sep . $oids; | 225 $oids = $pref_oid . $pref_sep . $oids; |
223 } | 226 } |
224 else | 227 else |
225 { | 228 { |
226 $oids = $pref_oid; | 229 $oids = $pref_oid; |
227 } | 230 } |
228 return($oids); | 231 return($oids); |
229 } | 232 } |
OLD | NEW |