2009-07-13 10:59:35 +00:00
|
|
|
#!/usr/bin/perl -w
|
|
|
|
|
2009-07-13 11:15:34 +00:00
|
|
|
# Dieses Skript prüft übergebene Compose-Dateien auf
|
|
|
|
# Präfix-Eigenschaft und auf Code-Dopplungen
|
|
|
|
#
|
2009-07-13 10:59:35 +00:00
|
|
|
# Beispiel-Aufruf:
|
|
|
|
#
|
|
|
|
# ./check-compose.pl *.neo
|
|
|
|
|
|
|
|
use strict;
|
2009-07-14 13:35:59 +00:00
|
|
|
use Getopt::Std;
|
|
|
|
our ($opt_q);
|
|
|
|
|
|
|
|
getopts('q'); # almost quiet operation
|
2009-07-13 10:59:35 +00:00
|
|
|
|
|
|
|
my %prefix;
|
|
|
|
my %code;
|
|
|
|
|
|
|
|
while (my $line = <>) {
|
|
|
|
chomp $line;
|
|
|
|
next unless ($line =~ /^([^#]+):/);
|
|
|
|
|
|
|
|
my @codes = split (/\s+/, $1);
|
|
|
|
|
|
|
|
for my $i (0..$#codes-1) {
|
|
|
|
$prefix{"@codes[0..$i]"} = $line;
|
|
|
|
|
|
|
|
if ($code{"@codes[0..$i]"}) {
|
2009-07-14 13:35:59 +00:00
|
|
|
if ($opt_q) { exit 1; }
|
2009-07-13 10:59:35 +00:00
|
|
|
print <<EOF;
|
|
|
|
|
|
|
|
* @codes[0..$i] Präfix bereits terminal verwendet
|
|
|
|
$line
|
|
|
|
$code{"@codes[0..$i]"}
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-13 11:15:34 +00:00
|
|
|
if ($code{"@codes"}) {
|
2009-07-14 13:35:59 +00:00
|
|
|
if ($opt_q) { exit 1; }
|
|
|
|
print <<EOF;
|
2009-07-13 11:15:34 +00:00
|
|
|
|
|
|
|
* @codes Sequenz mehrfach verwendet
|
|
|
|
$line
|
|
|
|
$code{"@codes"}
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
2009-07-13 10:59:35 +00:00
|
|
|
$code{"@codes"} = $line;
|
2009-07-13 11:15:34 +00:00
|
|
|
|
2009-07-13 10:59:35 +00:00
|
|
|
if ($prefix{"@codes"}) {
|
2009-07-14 13:35:59 +00:00
|
|
|
if ($opt_q) { exit 1; }
|
|
|
|
print <<EOF;
|
2009-07-13 10:59:35 +00:00
|
|
|
|
|
|
|
* @codes Sequenz bereits als Präfix verwendet
|
|
|
|
$line
|
|
|
|
$prefix{"@codes"}
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
}
|
2009-07-14 13:35:59 +00:00
|
|
|
|