mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2025-04-21 12:27:27 +03:00
rescue files from svn.openmoko.org
This commit is contained in:
64
old-boom/gen2chr
Executable file
64
old-boom/gen2chr
Executable file
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
require "parser.pl";
|
||||
require "match.pl";
|
||||
|
||||
|
||||
sub translate
|
||||
{
|
||||
local ($r) = @_;
|
||||
|
||||
undef %field;
|
||||
$field{"REF"} = $r;
|
||||
&match_set_error($r);
|
||||
if (!&apply_rules()) {
|
||||
print "$id{$r}\n" if $negate;
|
||||
return;
|
||||
}
|
||||
return if $negate;
|
||||
print $id{$r};
|
||||
for (sort keys %field) {
|
||||
next if $_ =~ /^_/;
|
||||
next if $_ eq "REF";
|
||||
print " $_=$field{$_}";
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
|
||||
|
||||
sub usage
|
||||
{
|
||||
print STDERR "usage: $0 [-d|-n] key file ...\n";
|
||||
print STDERR " $0 -q query file ...\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
while ($ARGV[0] =~ /^-/) {
|
||||
if ($ARGV[0] eq "-d") {
|
||||
$debug = 1;
|
||||
} elsif ($ARGV[0] eq "-n") {
|
||||
$negate = 1;
|
||||
} elsif ($ARGV[0] eq "-q") {
|
||||
$query = 1;
|
||||
} else {
|
||||
&usage;
|
||||
}
|
||||
shift @ARGV;
|
||||
}
|
||||
|
||||
$key = shift @ARGV;
|
||||
&usage unless defined $key;
|
||||
|
||||
&parse;
|
||||
|
||||
if ($query) {
|
||||
$debug = 1;
|
||||
&translate($key);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
print "#CHR\n";
|
||||
for (keys %id) {
|
||||
next unless $id{$_} eq "$key $_";
|
||||
&translate($_);
|
||||
}
|
||||
Reference in New Issue
Block a user