mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-04 23:29:42 +02:00
553514cc67
print the name of the subsheet file
37 lines
870 B
Perl
Executable File
37 lines
870 B
Perl
Executable File
#!/usr/bin/perl
|
|
#
|
|
# subschname2file - Translate a subsheet's name to sheet file's name
|
|
#
|
|
# Written 2010 by Werner Almesberger
|
|
# Copyright 2010 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.
|
|
#
|
|
|
|
sub usage
|
|
{
|
|
print STDERR "usage: $0 toplevel.sch subsheet-name\n";
|
|
exit(1);
|
|
}
|
|
|
|
|
|
($top, $name) = @ARGV;
|
|
&usage if $#ARGV != 1;
|
|
|
|
open(FILE, $top) || die "$top: $!";
|
|
while (<FILE>) {
|
|
$sheet = 1 if /^\$Sheet/;
|
|
$sheet = 0 if /^\$EndSheet/;
|
|
next unless $sheet;
|
|
$f0 = $1 if /^F0 "(.*)" /;
|
|
next unless /^F1 "(.*)" /;
|
|
next unless $f0 eq $name;
|
|
print "$1\n";
|
|
exit(0);
|
|
}
|
|
print STDERR "\"$name\" not found in $top\n";
|
|
exit(1);
|