diff --git a/desktop/ovl7.s b/desktop/ovl7.s index 54fbd7d..2a03a30 100644 --- a/desktop/ovl7.s +++ b/desktop/ovl7.s @@ -161,7 +161,7 @@ L7207: .byte $29 entry 0, $66D8 L7232: .byte $29 -L7233: entry 0, $72CD + entry 0, $72CD entry 0, $736C entry 0, $65F0 entry 0, $6693 diff --git a/res/stats.pl b/res/stats.pl index 006e871..64fa46e 100755 --- a/res/stats.pl +++ b/res/stats.pl @@ -1,31 +1,57 @@ #!/usr/bin/env perl +# stats.pl < source.s -- dump stats +# stats.pl unscoped < source.s -- list Lxxxx symbols not within 2 scopes +# stats.pl single < source.s -- list Lxxxx symbols with no references + use strict; use warnings; -my %terms; +my $command = shift(@ARGV) // ""; + +my %defs; +my %refs; my %unscoped; my $depth = 0; while () { ++$depth if m/\.proc/ || m/\.scope/; --$depth if m/\.endproc/ || m/\.endscope/; - foreach my $term (split /\b/, $_) { + + if (m/^(L[0-9A-F]{4}):(.*)/) { + my $def = $1; + $_ = $2; + $defs{$def} = ($defs{$def} // 0) + 1; + $unscoped{$def} = 1 if $depth < 2; + } + + foreach my $term (split /(?) { - ++$depth if m/\.proc/ || m/\.scope/; - --$depth if m/\.endproc/ || m/\.endscope/; - foreach my $term (split /\b/, $_) { - if ($term =~ /^L[0-9A-F]{4}$/) { - $terms{$term} = 0 unless defined $terms{$term}; - $terms{$term} += 1; - $unscoped{$term} = 1 if $depth < 2; - } - } -} - -foreach my $term (sort keys %unscoped) { - print "$term\n"; -}