lua remove and consolidate some rb plugin functions

removes some usless / duplicated functions
removes atoi - lua tonumber() does this for you
removes strlen - lua string.len does this for you
removes system_memory_guard - if a device that actually implements
              system_memory_guard needs it we can add it back conditionally

consolidates talk_number and talk_spell (on backend)
consolidates talk_shutup and talk_force_shutup talk_shutup(bForce)

Change-Id: Id132642f087975a7c132e99a668a41c977942b81
This commit is contained in:
William Wilgus 2019-09-26 23:23:16 -05:00
parent 5afdcdd460
commit de06a06351
2 changed files with 73 additions and 6 deletions

View file

@ -21,7 +21,7 @@
# The purpose of this script is to automatically generate Lua wrappers for
# (easily) portable C functions used in the Rockbox plugin API.
# It doesn't contain support for enums, structs or pointers (apart from char*).
# It doesn't contain support for structs or pointers (apart from char*).
#
# The output will be written to <build_dir>/apps/plugins/lua/rocklib_aux.c
@ -50,7 +50,8 @@ my @ported_functions;
# These functions are excluded from automatically wrapping. This is useful if
# you want to manually port them to Lua. The format is a standard Perl regular
# expression.
my @forbidden_functions = ('^open$',
my @forbidden_functions = ('^atoi$',
'^open$',
'^open_utf8$',
'^close$',
'dcache',
@ -69,6 +70,7 @@ my @forbidden_functions = ('^open$',
'^strip_extension$',
'^create_numbered_filename$',
'^s?+rand$',
'^strlen$',
'^strl?+cpy$',
'^strl?+cat$',
'strn?+casecmp$',
@ -103,11 +105,17 @@ my @forbidden_functions = ('^open$',
'^pcm_(set_frequency|calculate_peaks)$',
'^sound_(set|current|default|min|max|unit|pitch|val2phys)$',
'^mixer_(set|get)_frequency$',
'^rock_plugin_get_current_filename$',
'^plugin_get_current_filename$',
'^plugin_release_audio_buffer$',
'^reload_directory$',
'^set_current_file$',
'^set_dirfilter$',
'^sleep$',
'^system_memory_guard$',
'^talk_number$',
'^talk_force_shutup$',
'^talk_spell$',
'^talk_shutup$',
'^(trigger|cancel)_cpu_boost$',
'^thread_',
'^round_value_to_list32$');
@ -185,6 +193,7 @@ EOF
;
my %in_types = ('void' => \&in_void,
'enum' => \&in_int,
'int' => \&in_int,
'unsigned' => \&in_int,
'unsignedint' => \&in_int,
@ -237,6 +246,12 @@ sub in_void
return "\t(void)L;\n";
}
sub in_null
{
my ($name, $type, $pos) = @_;
return sprintf("\t%s %s = NULL;\n", $type, $name, $type, $pos)
}
sub in_int
{
my ($name, $type, $pos) = @_;