mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-22 10:06:16 +02:00
rptflt/rptflt.pl: filter for KiCad DRC reports
This commit is contained in:
parent
8c5d7d7bcd
commit
c07e33bec6
104
rptflt/rptflt.pl
Executable file
104
rptflt/rptflt.pl
Executable file
@ -0,0 +1,104 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# rptflt.pl - Filter known issues from KiCad DRC reports
|
||||
#
|
||||
# Written 2014 by Werner Almesberger
|
||||
# Copyright 2014 Werner Almesberger
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# - generate a DRC report file with pcbnew, e.g., foo.rpt
|
||||
# - review report file for any real issues
|
||||
# - rename foo.rpt to foo.exceptions
|
||||
# - to check for new errors, generate new report file, then run
|
||||
# rptflt.pl foo.exceptions foo.rpt
|
||||
#
|
||||
|
||||
|
||||
sub compact
|
||||
{
|
||||
local ($m);
|
||||
|
||||
die if $#e != 2;
|
||||
die unless $e[0] =~ /^ErrType\(\d+\):\s+(.*)\s*$/;
|
||||
$m = $1;
|
||||
die unless $e[1] =~ /^\s+@[^:]++:\s+(.*)\s*$/;
|
||||
$m .= "; $1";
|
||||
die unless $e[2] =~ /^\s+@[^:]+:\s+(.*)\s*$/;
|
||||
$m .= "; $1";
|
||||
return $m;
|
||||
}
|
||||
|
||||
|
||||
sub add
|
||||
{
|
||||
local ($m);
|
||||
|
||||
$m = &compact;
|
||||
$exc{$m} = 1;
|
||||
undef @e;
|
||||
}
|
||||
|
||||
|
||||
sub filter
|
||||
{
|
||||
local ($m);
|
||||
|
||||
$m = &compact;
|
||||
if (defined $exc{$m}) {
|
||||
$seen{$m} = 1;
|
||||
} else {
|
||||
print join("", @e);
|
||||
}
|
||||
undef @e;
|
||||
}
|
||||
|
||||
|
||||
sub process
|
||||
{
|
||||
open(FILE, $_[0]) || die "$_[0]: $!";
|
||||
undef @e;
|
||||
while (<FILE>) {
|
||||
if (/^ErrType/) {
|
||||
&flush if @e;
|
||||
@e = ($_);
|
||||
next;
|
||||
}
|
||||
if (/^\s+@/) {
|
||||
die unless @e;
|
||||
push(@e, $_);
|
||||
next;
|
||||
}
|
||||
&flush if @e;
|
||||
print unless $silent;
|
||||
}
|
||||
&flush if @e;
|
||||
close FILE;
|
||||
}
|
||||
|
||||
|
||||
if ($#ARGV != 1) {
|
||||
print stderr "usage: $0 name.exceptions name.rpt\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
*flush = *add;
|
||||
$silent = 1;
|
||||
&process($ARGV[0]);
|
||||
*flush = *filter;
|
||||
$silent = 0;
|
||||
&process($ARGV[1]);
|
||||
|
||||
for $m (keys %exc) {
|
||||
#print STDERR "check $i\n";
|
||||
next if $seen{$m};
|
||||
print STDERR "Warning: exception \"$m\" not seen\n";
|
||||
}
|
Loading…
Reference in New Issue
Block a user