FS#13961 - Add audio status, file_attr constants to lua

use require "audio_status" to use the new AUDIO_STATUS_ defines
use require "file_attrs" to use the new FILE_ATTR_ defines

Change-Id: If0b3b612e92e9e5b361a9487ccca2d40f79a953e
This commit is contained in:
William Wilgus 2026-07-30 01:07:56 -04:00
parent db87622e7d
commit 1007216fc4
3 changed files with 29 additions and 7 deletions

View file

@ -27,7 +27,7 @@ all: $(subst $(LUA_INCLUDEDIR)/,$(LUA_BUILDDIR)/,$(LUA_INCLUDELIST))
$(LUA_BUILDDIR)/lua.rock: $(LUA_OBJ) $(TLSFLIB) $(LUA_BUILDDIR)/actions.lua $(LUA_BUILDDIR)/buttons.lua $(LUA_BUILDDIR)/settings.lua \
$(LUA_BUILDDIR)/rocklib_aux.o $(LUA_BUILDDIR)/rb_defines.lua $(LUA_BUILDDIR)/sound_defines.lua \
$(LUA_INCLUDELIST)
$(LUA_BUILDDIR)/audio_status.lua $(LUA_BUILDDIR)/file_attrs.lua $(LUA_INCLUDELIST)
$(LUA_BUILDDIR)/actions.lua: $(LUA_OBJ) $(LUA_SRCDIR)/action_helper.pl
$(call PRINTS,GEN $(@F))$(CC) $(PLUGINFLAGS) $(INCLUDES) -E -P $(APPSDIR)/plugins/lib/pluginlib_actions.h | $(LUA_SRCDIR)/action_helper.pl > $(LUA_BUILDDIR)/actions.lua
@ -52,6 +52,16 @@ $(LUA_BUILDDIR)/sound_defines.lua: $(LUA_OBJ) $(LUA_SRCDIR)/rbdefines_helper.pl
$(HOSTCC) -fno-builtin $(HOST_INCLUDES) -x c -o $(LUA_BUILDDIR)/sounddefines_helper -
$(call PRINTS,GEN $(@F))$(LUA_BUILDDIR)/sounddefines_helper > $(LUA_BUILDDIR)/sound_defines.lua
$(LUA_BUILDDIR)/audio_status.lua: $(LUA_OBJ) $(LUA_SRCDIR)/rbdefines_helper.pl
$(SILENT)$(CC) $(INCLUDES) -dD -E -P $(TARGET) $(CFLAGS) -include plugin.h - < /dev/null | $(LUA_SRCDIR)/rbdefines_helper.pl "audio_status" | \
$(HOSTCC) -fno-builtin $(HOST_INCLUDES) -x c -o $(LUA_BUILDDIR)/audiodefines_helper -
$(call PRINTS,GEN $(@F))$(LUA_BUILDDIR)/audiodefines_helper > $(LUA_BUILDDIR)/audio_status.lua
$(LUA_BUILDDIR)/file_attrs.lua: $(LUA_OBJ) $(LUA_SRCDIR)/rbdefines_helper.pl
$(SILENT)$(CC) $(INCLUDES) -dD -E -P $(TARGET) $(CFLAGS) -include plugin.h - < /dev/null | $(LUA_SRCDIR)/rbdefines_helper.pl "file_attrs" | \
$(HOSTCC) -fno-builtin $(HOST_INCLUDES) -x c -o $(LUA_BUILDDIR)/fileattrs_helper -
$(call PRINTS,GEN $(@F))$(LUA_BUILDDIR)/fileattrs_helper > $(LUA_BUILDDIR)/file_attrs.lua
$(LUA_BUILDDIR)/rocklib_aux.c: $(APPSDIR)/plugin.h $(LUA_OBJ) $(LUA_SRCDIR)/rocklib_aux.pl
$(call PRINTS,GEN $(@F))$(CC) $(PLUGINFLAGS) $(INCLUDES) -E -P -include plugin.h - < /dev/null | $(LUA_SRCDIR)/rocklib_aux.pl $(LUA_SRCDIR) > $(LUA_BUILDDIR)/rocklib_aux.c

View file

@ -57,13 +57,24 @@ if ($def_type eq "rb_defines") {
'^CORE_KEYMAP_FILE$',
'CONTEXT_(STOPSEARCHING|REMOTE|CUSTOM|CUSTOM2|PLUGIN|REMAPPED)$',
'^VIEWERS_DATA_DIR$');
}
elsif ($def_type eq "audio_status") {
$lua_table = "rb";
@rockbox_defines = (
'^AUDIO_STATUS_(PLAY|PAUSE|RECORD|PRERECORD|ERROR|WARNING)$');
}
elsif ($def_type eq "sound_defines") {
$lua_table = "rb.sound_settings";
@rockbox_defines = (
'^(?!.*LAST_SETTING)SOUND_');
}
elsif ($def_type eq "file_attrs") {
$lua_table = "rb";
@rockbox_defines = (
'^FILE_ATTR_');
}
my @captured_defines;
my @names_seen;
my @all_defines;
@ -100,7 +111,7 @@ while(my $line = <STDIN>)
$name = $1;
next if $name =~ /^(ATTRIBUTE_|print|__).*/; #don't add reserved
$value = $2;
#print STDERR "#define ".$name." (".$value.")\n";
if(grep($name =~ $_, @rockbox_defines))
{
push(@names_seen, $name);