diff options
author | William Wilgus <me.theuser@yahoo.com> | 2019-09-27 20:08:58 -0500 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2019-09-28 03:15:15 +0200 |
commit | 01cccaf2d27dcd92a7a6d4b7f5658e780a6da68c (patch) | |
tree | 85e766c94edfb2a055a78c7a2d6750a0d1b46be1 /apps/plugins/lua/rocklib.c | |
parent | 4fb783582fa6d961160fea940ad417d099ec0732 (diff) | |
download | rockbox-01cccaf2d27dcd92a7a6d4b7f5658e780a6da68c.tar.gz rockbox-01cccaf2d27dcd92a7a6d4b7f5658e780a6da68c.zip |
lua move strip_extension and create_numbered_filename out of main binary
rb.strip_extension and rb.create_numbered_filename
have been moved to include_lua/files.lua
to use simply add require('files') to your script
Change-Id: I95af7b312c8614cb10da4b71b22714b3e282e08a
Diffstat (limited to 'apps/plugins/lua/rocklib.c')
-rw-r--r-- | apps/plugins/lua/rocklib.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c index e617f3e4bf..6b24984130 100644 --- a/apps/plugins/lua/rocklib.c +++ b/apps/plugins/lua/rocklib.c | |||
@@ -637,6 +637,7 @@ RB_WRAP(buttonlight_brightness_set) | |||
637 | 637 | ||
638 | /* DEVICE STRING / FILENAME MANIPULATION */ | 638 | /* DEVICE STRING / FILENAME MANIPULATION */ |
639 | 639 | ||
640 | #if 0 /*See files.lua */ | ||
640 | RB_WRAP(strip_extension) | 641 | RB_WRAP(strip_extension) |
641 | { | 642 | { |
642 | const char* filename = luaL_checkstring(L, -1); | 643 | const char* filename = luaL_checkstring(L, -1); |
@@ -672,6 +673,7 @@ RB_WRAP(create_numbered_filename) | |||
672 | 673 | ||
673 | return 1; | 674 | return 1; |
674 | } | 675 | } |
676 | #endif | ||
675 | 677 | ||
676 | RB_WRAP(utf8encode) | 678 | RB_WRAP(utf8encode) |
677 | { | 679 | { |
@@ -697,6 +699,7 @@ RB_WRAP(strncasecmp) | |||
697 | return 1; | 699 | return 1; |
698 | } | 700 | } |
699 | 701 | ||
702 | /* ROCKBOX SETTINGS / INFO */ | ||
700 | static int mem_read_write(lua_State *L, uintptr_t address, size_t maxsize, bool isstr_p) | 703 | static int mem_read_write(lua_State *L, uintptr_t address, size_t maxsize, bool isstr_p) |
701 | { | 704 | { |
702 | if(isstr_p) /*pointer to string (**char)*/ | 705 | if(isstr_p) /*pointer to string (**char)*/ |
@@ -844,6 +847,12 @@ RB_WRAP(audio_current_track) | |||
844 | return mem_read_write(L, address, maxsize, isstr_p); | 847 | return mem_read_write(L, address, maxsize, isstr_p); |
845 | } | 848 | } |
846 | 849 | ||
850 | RB_WRAP(settings_save) | ||
851 | { | ||
852 | rb->settings_save(); | ||
853 | return 0; | ||
854 | } | ||
855 | |||
847 | #if 0 | 856 | #if 0 |
848 | RB_WRAP(read_mem) | 857 | RB_WRAP(read_mem) |
849 | { | 858 | { |
@@ -906,6 +915,12 @@ RB_WRAP(restart_lua) | |||
906 | return -1; | 915 | return -1; |
907 | } | 916 | } |
908 | 917 | ||
918 | RB_WRAP(show_logo) | ||
919 | { | ||
920 | rb->show_logo(); | ||
921 | return 0; | ||
922 | } | ||
923 | |||
909 | #define RB_FUNC(func) {#func, rock_##func} | 924 | #define RB_FUNC(func) {#func, rock_##func} |
910 | #define RB_ALIAS(name, func) {name, rock_##func} | 925 | #define RB_ALIAS(name, func) {name, rock_##func} |
911 | static const luaL_Reg rocklib[] = | 926 | static const luaL_Reg rocklib[] = |
@@ -967,8 +982,10 @@ static const luaL_Reg rocklib[] = | |||
967 | #endif | 982 | #endif |
968 | 983 | ||
969 | /* DEVICE STRING / FILENAME MANIPULATION */ | 984 | /* DEVICE STRING / FILENAME MANIPULATION */ |
985 | #if 0 /*See files.lua */ | ||
970 | RB_FUNC(strip_extension), | 986 | RB_FUNC(strip_extension), |
971 | RB_FUNC(create_numbered_filename), | 987 | RB_FUNC(create_numbered_filename), |
988 | #endif | ||
972 | RB_FUNC(utf8encode), | 989 | RB_FUNC(utf8encode), |
973 | RB_FUNC(strncasecmp), | 990 | RB_FUNC(strncasecmp), |
974 | 991 | ||
@@ -977,6 +994,7 @@ static const luaL_Reg rocklib[] = | |||
977 | RB_FUNC(global_settings), | 994 | RB_FUNC(global_settings), |
978 | RB_FUNC(audio_next_track), | 995 | RB_FUNC(audio_next_track), |
979 | RB_FUNC(audio_current_track), | 996 | RB_FUNC(audio_current_track), |
997 | RB_FUNC(settings_save), | ||
980 | 998 | ||
981 | /* SPEAKING */ | 999 | /* SPEAKING */ |
982 | {"talk_number", rock_talk}, | 1000 | {"talk_number", rock_talk}, |
@@ -985,6 +1003,7 @@ static const luaL_Reg rocklib[] = | |||
985 | 1003 | ||
986 | /* MISC */ | 1004 | /* MISC */ |
987 | RB_FUNC(restart_lua), | 1005 | RB_FUNC(restart_lua), |
1006 | RB_FUNC(show_logo), | ||
988 | 1007 | ||
989 | {NULL, NULL} | 1008 | {NULL, NULL} |
990 | }; | 1009 | }; |