#!/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 $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/; if (m/^(L[0-9A-F]{4})(?::|\s+:=)(.*)/) { my $def = $1; $_ = $2; $defs{$def} = ($defs{$def} // 0) + 1; $unscoped{$def} = 1 if $depth < 2; } foreach my $term (split /(?