summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/rocklib_aux.pl
diff options
context:
space:
mode:
authorWilliam Wilgus <me.theuser@yahoo.com>2019-09-26 23:23:16 -0500
committerWilliam Wilgus <me.theuser@yahoo.com>2019-09-26 23:45:38 -0500
commitde06a06351dfb8df1963033ec7e4fc69c796288a (patch)
treea5516d6a3f51be7bc30ad6768ace5325852b7dbc /apps/plugins/lua/rocklib_aux.pl
parent5afdcdd46043481675a48891a071dbb1fea1ab4c (diff)
downloadrockbox-de06a06351dfb8df1963033ec7e4fc69c796288a.tar.gz
rockbox-de06a06351dfb8df1963033ec7e4fc69c796288a.zip
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
Diffstat (limited to 'apps/plugins/lua/rocklib_aux.pl')
-rwxr-xr-xapps/plugins/lua/rocklib_aux.pl21
1 files changed, 18 insertions, 3 deletions
diff --git a/apps/plugins/lua/rocklib_aux.pl b/apps/plugins/lua/rocklib_aux.pl
index 7202d8dff9..a618c3d360 100755
--- a/apps/plugins/lua/rocklib_aux.pl
+++ b/apps/plugins/lua/rocklib_aux.pl
@@ -21,7 +21,7 @@
21 21
22# The purpose of this script is to automatically generate Lua wrappers for 22# The purpose of this script is to automatically generate Lua wrappers for
23# (easily) portable C functions used in the Rockbox plugin API. 23# (easily) portable C functions used in the Rockbox plugin API.
24# It doesn't contain support for enums, structs or pointers (apart from char*). 24# It doesn't contain support for structs or pointers (apart from char*).
25# 25#
26# The output will be written to <build_dir>/apps/plugins/lua/rocklib_aux.c 26# The output will be written to <build_dir>/apps/plugins/lua/rocklib_aux.c
27 27
@@ -50,7 +50,8 @@ my @ported_functions;
50# These functions are excluded from automatically wrapping. This is useful if 50# These functions are excluded from automatically wrapping. This is useful if
51# you want to manually port them to Lua. The format is a standard Perl regular 51# you want to manually port them to Lua. The format is a standard Perl regular
52# expression. 52# expression.
53my @forbidden_functions = ('^open$', 53my @forbidden_functions = ('^atoi$',
54 '^open$',
54 '^open_utf8$', 55 '^open_utf8$',
55 '^close$', 56 '^close$',
56 'dcache', 57 'dcache',
@@ -69,6 +70,7 @@ my @forbidden_functions = ('^open$',
69 '^strip_extension$', 70 '^strip_extension$',
70 '^create_numbered_filename$', 71 '^create_numbered_filename$',
71 '^s?+rand$', 72 '^s?+rand$',
73 '^strlen$',
72 '^strl?+cpy$', 74 '^strl?+cpy$',
73 '^strl?+cat$', 75 '^strl?+cat$',
74 'strn?+casecmp$', 76 'strn?+casecmp$',
@@ -103,11 +105,17 @@ my @forbidden_functions = ('^open$',
103 '^pcm_(set_frequency|calculate_peaks)$', 105 '^pcm_(set_frequency|calculate_peaks)$',
104 '^sound_(set|current|default|min|max|unit|pitch|val2phys)$', 106 '^sound_(set|current|default|min|max|unit|pitch|val2phys)$',
105 '^mixer_(set|get)_frequency$', 107 '^mixer_(set|get)_frequency$',
106 '^rock_plugin_get_current_filename$', 108 '^plugin_get_current_filename$',
107 '^plugin_release_audio_buffer$', 109 '^plugin_release_audio_buffer$',
108 '^reload_directory$', 110 '^reload_directory$',
109 '^set_current_file$', 111 '^set_current_file$',
110 '^set_dirfilter$', 112 '^set_dirfilter$',
113 '^sleep$',
114 '^system_memory_guard$',
115 '^talk_number$',
116 '^talk_force_shutup$',
117 '^talk_spell$',
118 '^talk_shutup$',
111 '^(trigger|cancel)_cpu_boost$', 119 '^(trigger|cancel)_cpu_boost$',
112 '^thread_', 120 '^thread_',
113 '^round_value_to_list32$'); 121 '^round_value_to_list32$');
@@ -185,6 +193,7 @@ EOF
185; 193;
186 194
187my %in_types = ('void' => \&in_void, 195my %in_types = ('void' => \&in_void,
196 'enum' => \&in_int,
188 'int' => \&in_int, 197 'int' => \&in_int,
189 'unsigned' => \&in_int, 198 'unsigned' => \&in_int,
190 'unsignedint' => \&in_int, 199 'unsignedint' => \&in_int,
@@ -237,6 +246,12 @@ sub in_void
237 return "\t(void)L;\n"; 246 return "\t(void)L;\n";
238} 247}
239 248
249sub in_null
250{
251 my ($name, $type, $pos) = @_;
252 return sprintf("\t%s %s = NULL;\n", $type, $name, $type, $pos)
253}
254
240sub in_int 255sub in_int
241{ 256{
242 my ($name, $type, $pos) = @_; 257 my ($name, $type, $pos) = @_;