diff options
Diffstat (limited to 'apps/plugins/lua/rocklib_aux.pl')
-rwxr-xr-x | apps/plugins/lua/rocklib_aux.pl | 21 |
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. |
53 | my @forbidden_functions = ('^open$', | 53 | my @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 | ||
187 | my %in_types = ('void' => \&in_void, | 195 | my %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 | ||
249 | sub in_null | ||
250 | { | ||
251 | my ($name, $type, $pos) = @_; | ||
252 | return sprintf("\t%s %s = NULL;\n", $type, $name, $type, $pos) | ||
253 | } | ||
254 | |||
240 | sub in_int | 255 | sub in_int |
241 | { | 256 | { |
242 | my ($name, $type, $pos) = @_; | 257 | my ($name, $type, $pos) = @_; |