[gta02-core] Script to extrace global label names from schematics

Rask Ingemann Lambertsen ccc94453 at vip.cybercity.dk
Sun Aug 30 21:07:27 CEST 2009


   FWIW, this is what I use to find mismatches in global labels:

#!/usr/bin/perl -w

# eeschema-glabel-report - Report global labels in eeschem schematics (*.sch).

# Copyright (C) 2009  Rask Ingemann Lambertsen <ccc94453 at vip.cybercity.dk>

#    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 3 of the License, or
#    (at your option) any later version.

#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.

#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

use strict;
$, = "\t";
$\ = "\n";

my ($label, $direction);
my %labels;

while (<>) {
	if (($direction) = /^Text\s+GLabel\s+\d+\s+\d+\s+\d+\s+\d+\s+(\w+)/) {
		$label = <>;
		chomp $label;

		push @{$labels{$label}}, [ $direction, $ARGV ];
	}
}

sub sort_direction
{
	($a->[0] eq $b->[0])
		and return 0;
	($a->[0] eq 'Output' || $b->[0] eq 'Input')
		and return -1;
	($a->[0] eq 'Input' || $b->[0] eq 'Output')
		and return 1;
	return ($a->[0] cmp $b->[0]);
}

foreach $label (sort (keys %labels)) {
	foreach my $i (sort sort_direction @{$labels{$label}}) {
		print $label, $i->[0], $i->[1];
	}
}



-- 
Rask Ingemann Lambertsen
Danish law requires addresses in e-mail to be logged and stored for a year



More information about the gta02-core mailing list