mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-22 09:36:16 +02:00
schhist/subschname2file: search a subsheet name in the top-level sheet and
print the name of the subsheet file
This commit is contained in:
parent
f0eb8ce77b
commit
553514cc67
36
schhist/subschname2file
Executable file
36
schhist/subschname2file
Executable file
@ -0,0 +1,36 @@
|
||||
#!/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);
|
Loading…
Reference in New Issue
Block a user