source: git/lib/checkshortcut.pl @ 46cb98f

RELEASE/1.0RELEASE/1.1RELEASE/1.2debug-cidebug-ci-sanitisersstereowalls-data
Last change on this file since 46cb98f was 46cb98f, checked in by Olly Betts <olly@…>, 22 years ago

aven: Resolved a number of menu shortcut clashes.

cavern: improved error reporting from *data; better handling of some
incorrect usages of *sd and *units.

git-svn-id: file:///home/survex-svn/survex/trunk@1693 4b37db11-9a0c-4f06-9ece-9ab7cdaee568

  • Property mode set to 100755
File size: 793 bytes
Line 
1#!/usr/bin/perl -w
2use strict;
3my %menu = ();
4open I, "<../src/mainfrm.cc" or die $!;
5while (<I>) {
6    /(\w+)->Append\(.*\(\/\*.*?\*\/(\d+)/ && push @{$menu{$1}}, $2;
7}
8close I;
9
10for my $lang (@ARGV) {
11    print "Lang $lang:\n";
12    open L, "<$lang.msg" or die $!;
13    my $buf;
14    read L, $buf, 20;
15    read L, $buf, 999999;
16    close L;
17    my @msg = split /\0/, $buf;
18    for my $menu (sort keys %menu) {
19        my %sc = ();
20        my $bad = 0;
21        for (@{$menu{$menu}}) {
22            my ($acc) = ($msg[$_] =~ /\@(.)/);
23            $acc = lc $acc;
24            if (exists $sc{$acc}) {
25                print "Menu $menu : '$msg[$sc{$acc}]' and '$msg[$_]' clash\n";
26                $bad = 1;
27            } else {
28                $sc{$acc} = $_;
29            }
30        }
31        if ($bad) {
32            print "Unused letters: ", grep {!exists $sc{$_}} ('a' .. 'z'), "\n";
33        }
34    }
35    print "\n";
36}
37
Note: See TracBrowser for help on using the repository browser.