From b39acee3abd199d80b84c68ebfa7301b7e7a957e Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Fri, 12 Nov 2021 20:50:20 -0500 Subject: rb_info plugin and button,action+context name helper rb_info is just a test plugin just some info from the running rockbox install the real star here is the generator scripts to make actions_helper.c and button_helper.c Change-Id: I23f7bbdae3f2cffca2490c4df40bb13b0b5d5064 --- apps/plugins/lib/button_helper.pl | 98 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100755 apps/plugins/lib/button_helper.pl (limited to 'apps/plugins/lib/button_helper.pl') diff --git a/apps/plugins/lib/button_helper.pl b/apps/plugins/lib/button_helper.pl new file mode 100755 index 0000000000..45c3fd9073 --- /dev/null +++ b/apps/plugins/lib/button_helper.pl @@ -0,0 +1,98 @@ +#!/usr/bin/env perl +############################################################################ +# __________ __ ___. +# Open \______ \ ____ ____ | | _\_ |__ _______ ___ +# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +# \/ \/ \/ \/ \/ +# $Id$ +# +# Copyright (C) 2009 by Maurus Cuelenaere +# Copyright (C) 2021 by William Wilgus +# +# All files in this archive are subject to the GNU General Public License. +# See the file COPYING in the source tree root for full license agreement. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +############################################################################ +#expects -dM -E source input on STDIN +use strict; +use warnings; +my $svnrev = '$Revision$'; +my @buttons = (); +my $count = 1; #null sentinel +my $val; +my $def; +while(my $line = ) +{ + chomp($line); + if($line =~ /^#define (BUTTON_[^\s]+) (.+)$/) + { + $def = "{\"$1\", $2},\n"; + $val = $2; + if($val =~ /^0/) + { + $val = oct($val) + } + else + { + $val = 0xFFFFFFFF; #only used for sorting + } + push(@buttons, {'name' => $1, 'value' => $val, 'def' => $def}); + $count = $count + 1; + } +} +my @sorted = sort { @$a{'value'} <=> @$b{'value'} } @buttons; +print <name[0] != '\\0') + { + if(btn->value == 0) + { + if (button == 0) + { + buf[0] = '\\0'; + len = rb->strlcat(buf, btn->name, bufsz); + return len; + } + } + else if ((button & btn->value) == btn->value) + { + if (len > 0) + rb->strlcat(buf, " | ", bufsz); + len = rb->strlcat(buf, btn->name, bufsz); + } + btn++; + } + return len; +} +EOF +; -- cgit v1.2.3