fix sh/dx properly both for freq range and adding a . to the end of
authorminima <minima>
Tue, 5 Dec 2000 14:30:37 +0000 (14:30 +0000)
committerminima <minima>
Tue, 5 Dec 2000 14:30:37 +0000 (14:30 +0000)
a freq so it doesn't match any times.

cmd/show/dx.pl
perl/Spot.pm

index 380328ee9486eeb76ab51b6246cac31e3846bdff..c63e063f68f6352dd170ea1bfed15a00059bac11 100644 (file)
@@ -101,7 +101,7 @@ if (@freq) {
        for ($i = 0; $i < @freq; $i += 2) {
                $expr .= "(\$f0 >= $freq[$i] && \$f0 <= $freq[$i+1]) ||";
                my $r = Spot::ftor($freq[$i], $freq[$i+1]);
-               $hint .= "m{$r} ||" if $r;
+               $hint .= "m{$r\\.} ||" if $r;
        }
        chop $expr;     chop $expr;
        chop $hint;     chop $hint;
index cb91c18aead934482da1878bb292e7b1ad6672e6..57cf2599a103e0c71d310da69487144387898ddb 100644 (file)
@@ -230,6 +230,7 @@ sub ftor
        my ($a, $b) = @_;
        return undef unless $a < $b;
        $b--;
+       my $d = $b - $a;
        my @a = split //, $a;
        my @b = split //, $b;
        my $out;
@@ -239,7 +240,9 @@ sub ftor
        while (@b) {
                my $aa = shift @a;
                my $bb = shift @b;
-               if ($aa eq $bb) {
+               if (@b < (length $d) - 1) {
+                       $out .= '\\d';
+               } elsif ($aa eq $bb) {
                        $out .= $aa;
                } elsif ($aa < $bb) {
                        $out .= "[$aa-$bb]";