From 5c1676dfe6d2f3c837a5e074117b45613fd29a72 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:30:19 +0200 Subject: Adding upstream version 2.10.34. Signed-off-by: Daniel Baumann --- tools/mnemonic-clashes | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100755 tools/mnemonic-clashes (limited to 'tools/mnemonic-clashes') diff --git a/tools/mnemonic-clashes b/tools/mnemonic-clashes new file mode 100755 index 0000000..28a1efc --- /dev/null +++ b/tools/mnemonic-clashes @@ -0,0 +1,96 @@ +#!/bin/sh + +srcdir="`dirname \"$0\"`/.." + +find_actions () { + for f in "$srcdir"/app/actions/*-actions.c; do + < $f \ + tr '\n' ' ' | \ + grep -Po '{ *".*?".*?(NC_\("/*?" *, *)?".*?".*?}' | \ + perl -pe 's/{ *(".*?").*?(?:NC_\(".*?" *, *)?(".*?").*?}/\1: \2,/g' + done +} + +python3 - $@ < 1 and menu.tag != argv[1]: + continue + + mnemonics = {} + + found_clashes_in_menu = False + + for element in menu: + action = element.get ("action") + + if action in actions: + label = actions[action] + + if "_" in label: + mnemonic = label[label.find ("_") + 1].upper () + + if mnemonic not in mnemonics: + mnemonics[mnemonic] = [] + + mnemonics[mnemonic] += [action] + + mnemonic_list = list (mnemonics.keys ()) + mnemonic_list.sort () + + for mnemonic in mnemonic_list: + action_list = mnemonics[mnemonic] + + if len (action_list) > 1: + if found_clashes: + print () + + if not found_clashes_in_menu: + + if menu.tag == "menu": + print ("In %s (%s):" % (menu.get ("action"), + menu_path (menu))) + elif menu.tag == "popup": + print ("In %s:" % menu.get ("action")) + else: + print ("In top-level menu bar:") + + found_clashes = True + found_clashes_in_menu = True + + print (" Mnemonic clash for '%s':" % mnemonic) + + for action in action_list: + print (" %s: %s" % (action, actions[action])) + +exit (found_clashes) +END -- cgit v1.2.3