diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugins/lua/include_lua/create_kbd_layout.lua | 143 | ||||
-rw-r--r-- | apps/plugins/lua/include_lua/menubuttons.lua | 47 | ||||
-rw-r--r-- | apps/plugins/lua/include_lua/menucoresettings.lua | 46 | ||||
-rw-r--r-- | apps/plugins/lua/include_lua/printtable.lua | 2 | ||||
-rw-r--r-- | apps/plugins/lua/include_lua/temploader.lua | 61 | ||||
-rw-r--r-- | apps/plugins/lua/rockaux.c | 2 | ||||
-rw-r--r-- | apps/plugins/lua_scripts/print_lua_func.lua | 31 |
7 files changed, 233 insertions, 99 deletions
diff --git a/apps/plugins/lua/include_lua/create_kbd_layout.lua b/apps/plugins/lua/include_lua/create_kbd_layout.lua index 3d8f343cc9..7d0792a667 100644 --- a/apps/plugins/lua/include_lua/create_kbd_layout.lua +++ b/apps/plugins/lua/include_lua/create_kbd_layout.lua | |||
@@ -1,82 +1,99 @@ | |||
1 | --[[ | ||
2 | /*************************************************************************** | ||
3 | * __________ __ ___. | ||
4 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
5 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
6 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
7 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
8 | * \/ \/ \/ \/ \/ | ||
9 | * $Id$ | ||
10 | * | ||
11 | * Copyright (C) 2021 William Wilgus | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License | ||
15 | * as published by the Free Software Foundation; either version 2 | ||
16 | * of the License, or (at your option) any later version. | ||
17 | * | ||
18 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
19 | * KIND, either express or implied. | ||
20 | * | ||
21 | ****************************************************************************/ | ||
22 | ]] | ||
1 | --create keyboard layout | 23 | --create keyboard layout |
2 | --BILGUS 4/2021 | 24 | --BILGUS 4/2021 |
3 | -- kbdlayout = require("create_kbd_layout") | 25 | -- create_kbd_layout = require("create_kbd_layout") |
4 | -- local layout = kbdlayout.create_keyboard_layout("abcd") | 26 | -- local layout = create_kbd_layout("abcd") |
5 | local _kbdlayout = {} do | ||
6 | |||
7 | local function encode_short(n) | ||
8 | return string.char(bit.band(0x00FF, n), bit.rshift(bit.band(0xFF00, n), 8)) | ||
9 | end | ||
10 | 27 | ||
11 | local function utf8decode(str) | 28 | local function encode_short(n) |
12 | local INVALID = 0xfffd | 29 | return string.char(bit.band(0x00FF, n), bit.rshift(bit.band(0xFF00, n), 8)) |
13 | local t = {} | 30 | end |
14 | local function check_char(c) | ||
15 | local tail = false | ||
16 | local code | ||
17 | c = string.byte(c) | ||
18 | if (c <= 0x7f) or (c >= 0xc2) then | ||
19 | -- Start of new character | ||
20 | if (c < 0x80) then -- U-00000000 - U-0000007F, 1 string.byte | ||
21 | code = c; | ||
22 | elseif (c < 0xe0) then -- U-00000080 - U-000007FF, 2 string.bytes | ||
23 | tail = 1; | ||
24 | code = bit.band(c, 0x1f) | ||
25 | elseif (c < 0xf0) then -- U-00000800 - U-0000FFFF, 3 string.bytes | ||
26 | tail = 2; | ||
27 | code = bit.band(c, 0x0f) | ||
28 | elseif (c < 0xf5) then -- U-00010000 - U-001FFFFF, 4 string.bytes | ||
29 | tail = 3; | ||
30 | code = bit.band(c, 0x07) | ||
31 | else | ||
32 | -- Invalid size | ||
33 | code = 0xfffd; | ||
34 | end | ||
35 | 31 | ||
36 | while tail and c ~= 0 do | 32 | local function utf8decode(str) |
37 | tail = tail - 1 | 33 | local INVALID = 0xfffd |
38 | if bit.band(c, 0xc0) == 0x80 then | 34 | local t = {} |
39 | -- Valid continuation character | 35 | local function check_char(c) |
40 | code = bit.bor(bit.lshift(code, 6),bit.band(c, 0x3f)) | 36 | local tail = false |
41 | else | 37 | local code |
42 | -- Invalid continuation char | 38 | c = string.byte(c) |
43 | code = INVALID; | 39 | if (c <= 0x7f) or (c >= 0xc2) then |
44 | break; | 40 | -- Start of new character |
45 | end | 41 | if (c < 0x80) then -- U-00000000 - U-0000007F, 1 string.byte |
46 | end | 42 | code = c; |
43 | elseif (c < 0xe0) then -- U-00000080 - U-000007FF, 2 string.bytes | ||
44 | tail = 1; | ||
45 | code = bit.band(c, 0x1f) | ||
46 | elseif (c < 0xf0) then -- U-00000800 - U-0000FFFF, 3 string.bytes | ||
47 | tail = 2; | ||
48 | code = bit.band(c, 0x0f) | ||
49 | elseif (c < 0xf5) then -- U-00010000 - U-001FFFFF, 4 string.bytes | ||
50 | tail = 3; | ||
51 | code = bit.band(c, 0x07) | ||
47 | else | 52 | else |
48 | -- Invalid UTF-8 char | 53 | -- Invalid size |
49 | code = INVALID; | 54 | code = INVALID; |
50 | end | 55 | end |
51 | -- currently we don't support chars above U-FFFF | 56 | |
52 | t[#t + 1 ] = encode_short((code < 0x10000) and code or 0xfffd) | 57 | while tail and c ~= 0 do |
58 | tail = tail - 1 | ||
59 | if bit.band(c, 0xc0) == 0x80 then | ||
60 | -- Valid continuation character | ||
61 | code = bit.bor(bit.lshift(code, 6),bit.band(c, 0x3f)) | ||
62 | else | ||
63 | -- Invalid continuation char | ||
64 | code = INVALID; | ||
65 | break; | ||
66 | end | ||
67 | end | ||
68 | else | ||
69 | -- Invalid UTF-8 char | ||
70 | code = INVALID; | ||
53 | end | 71 | end |
54 | str:gsub(".", check_char) -- run check function for every char | 72 | -- currently we don't support chars above U-FFFF |
55 | return table.concat(t) | 73 | t[#t + 1 ] = encode_short((code < 0x10000) and code or INVALID) |
56 | end | 74 | end |
75 | str:gsub(".", check_char) -- run check function for every char | ||
76 | return table.concat(t) | ||
77 | end | ||
57 | 78 | ||
58 | local function create_keyboard_layout(s_layout) | 79 | local function create_keyboard_layout(s_layout) |
59 | local insert = table.insert | 80 | local insert = table.insert |
60 | lines = {} | 81 | lines = {} |
61 | |||
62 | local t={} | ||
63 | for str in string.gmatch(s_layout, "([^\n]+)") do | ||
64 | local len = string.len(str) | ||
65 | lines[#lines + 1] = | ||
66 | table.concat({encode_short(len), utf8decode(str)}) | ||
67 | end | ||
68 | lines[#lines + 1] = encode_short(0xFEFF) | ||
69 | 82 | ||
70 | return table.concat(lines) | 83 | for str in string.gmatch(s_layout, "([^\n]+)") do |
84 | local len = string.len(str) | ||
85 | lines[#lines + 1] = | ||
86 | table.concat({encode_short(len), utf8decode(str)}) | ||
71 | end | 87 | end |
72 | _kbdlayout.create_keyboard_layout = create_keyboard_layout | 88 | lines[#lines + 1] = encode_short(0xFEFF) |
73 | _kbdlayout.utf8decode = utf8decode | 89 | |
90 | return table.concat(lines) | ||
74 | end | 91 | end |
75 | 92 | ||
76 | 93 | ||
77 | --[[ | 94 | --[[ |
78 | local name = "Test_KBD_LAYOUT_" .. tostring(1) | 95 | local name = "Test_KBD_LAYOUT_" .. tostring(1) |
79 | local test = _kbdlayout.create_keyboard_layout("ABCDEFGHIJKLM\nNOPQRSTUVWXYZ\n0123456789") | 96 | local test = create_keyboard_layout("ABCDEFGHIJKLM\nNOPQRSTUVWXYZ\n0123456789") |
80 | local file = io.open('/' .. name, "w+") -- overwrite, rb ignores the 'b' flag | 97 | local file = io.open('/' .. name, "w+") -- overwrite, rb ignores the 'b' flag |
81 | file:write(test)-- write the layout to the file now | 98 | file:write(test)-- write the layout to the file now |
82 | file:close() | 99 | file:close() |
@@ -87,4 +104,4 @@ if not file then | |||
87 | end | 104 | end |
88 | rb.kbd_input(name, test) | 105 | rb.kbd_input(name, test) |
89 | ]] | 106 | ]] |
90 | return _kbdlayout | 107 | return create_keyboard_layout |
diff --git a/apps/plugins/lua/include_lua/menubuttons.lua b/apps/plugins/lua/include_lua/menubuttons.lua index e358d94a10..7c19592bbe 100644 --- a/apps/plugins/lua/include_lua/menubuttons.lua +++ b/apps/plugins/lua/include_lua/menubuttons.lua | |||
@@ -1,6 +1,42 @@ | |||
1 | --[[ | ||
2 | /*************************************************************************** | ||
3 | * __________ __ ___. | ||
4 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
5 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
6 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
7 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
8 | * \/ \/ \/ \/ \/ | ||
9 | * $Id$ | ||
10 | * | ||
11 | * Copyright (C) 2021 William Wilgus | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License | ||
15 | * as published by the Free Software Foundation; either version 2 | ||
16 | * of the License, or (at your option) any later version. | ||
17 | * | ||
18 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
19 | * KIND, either express or implied. | ||
20 | * | ||
21 | ****************************************************************************/ | ||
22 | ]] | ||
23 | -- Bilgus 4/2021 | ||
24 | local oldrb = rb | ||
25 | local tmploader = require("temploader") | ||
1 | 26 | ||
2 | local rbac_is_loaded = (package.loaded.actions ~= nil) | 27 | local a_is_loaded = (package.loaded.actions ~= nil) |
3 | require("actions") -- Contains rb.actions & rb.contexts | 28 | local rbold = rb |
29 | |||
30 | if not a_is_loaded then | ||
31 | --replace the rb table so we can keep the defines out of the namespace | ||
32 | rb = {} | ||
33 | end | ||
34 | |||
35 | --require("actions") -- Contains rb.actions & rb.contexts | ||
36 | local actions, err = tmploader("actions") | ||
37 | if err then | ||
38 | error(err) | ||
39 | end | ||
4 | 40 | ||
5 | -- Menu Button definitions -- | 41 | -- Menu Button definitions -- |
6 | local button_t = { | 42 | local button_t = { |
@@ -19,10 +55,5 @@ local button_t = { | |||
19 | UPR = rb.actions.PLA_UP_REPEAT, | 55 | UPR = rb.actions.PLA_UP_REPEAT, |
20 | } | 56 | } |
21 | 57 | ||
22 | if not rbac_is_loaded then | 58 | rb = oldrb |
23 | rb.actions = nil | ||
24 | rb.contexts = nil | ||
25 | package.loaded.actionss = nil | ||
26 | end | ||
27 | |||
28 | return button_t | 59 | return button_t |
diff --git a/apps/plugins/lua/include_lua/menucoresettings.lua b/apps/plugins/lua/include_lua/menucoresettings.lua index 01128830f3..13f3b8ea69 100644 --- a/apps/plugins/lua/include_lua/menucoresettings.lua +++ b/apps/plugins/lua/include_lua/menucoresettings.lua | |||
@@ -1,19 +1,51 @@ | |||
1 | --[[ | ||
2 | /*************************************************************************** | ||
3 | * __________ __ ___. | ||
4 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
5 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
6 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
7 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
8 | * \/ \/ \/ \/ \/ | ||
9 | * $Id$ | ||
10 | * | ||
11 | * Copyright (C) 2021 William Wilgus | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License | ||
15 | * as published by the Free Software Foundation; either version 2 | ||
16 | * of the License, or (at your option) any later version. | ||
17 | * | ||
18 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
19 | * KIND, either express or implied. | ||
20 | * | ||
21 | ****************************************************************************/ | ||
22 | ]] | ||
1 | --menu core settings loaded from rockbox user settings | 23 | --menu core settings loaded from rockbox user settings |
2 | --Bilgus 4/2021 | 24 | --Bilgus 4/2021 |
3 | 25 | ||
4 | local function get_core_settings() | 26 | local function get_core_settings() |
27 | local tmploader = require("temploader") | ||
28 | -- rbsettings is a large module to have sitting in RAM | ||
29 | -- if user already has it in RAM then use that | ||
5 | local rbs_is_loaded = (package.loaded.rbsettings ~= nil) | 30 | local rbs_is_loaded = (package.loaded.rbsettings ~= nil) |
6 | local s_is_loaded = (package.loaded.settings ~= nil) | 31 | local s_is_loaded = (package.loaded.settings ~= nil) |
32 | local rbold = rb | ||
7 | 33 | ||
8 | require("rbsettings") | 34 | if not rbs_is_loaded then |
9 | require("settings") | 35 | --replace the rb table so we can keep the defines out of the namespace |
10 | rb.metadata = nil -- remove track metadata settings | 36 | rb = { global_settings = rb.global_settings, |
37 | global_status = rb.global_status} | ||
38 | end | ||
39 | |||
40 | tmploader("rbsettings") | ||
41 | tmploader("settings") | ||
11 | 42 | ||
12 | local rb_settings = rb.settings.dump('global_settings', "system") | 43 | local rb_settings = rb.settings.dump('global_settings', "system") |
13 | local color_table = {} | 44 | local color_table = {} |
14 | local talk_table = {} | 45 | local talk_table = {} |
15 | local list_settings_table = {} | 46 | local list_settings_table = {} |
16 | local list_settings = "cursor_style|show_icons|statusbar|scrollbar|scrollbar_width|list_separator_height|backdrop_file|" | 47 | local list_settings = "cursor_style|show_icons|statusbar|scrollbar|scrollbar_width|list_separator_height|backdrop_file|" |
48 | |||
17 | for key, value in pairs(rb_settings) do | 49 | for key, value in pairs(rb_settings) do |
18 | key = key or "" | 50 | key = key or "" |
19 | if (key:find("color")) then | 51 | if (key:find("color")) then |
@@ -27,15 +59,9 @@ local function get_core_settings() | |||
27 | 59 | ||
28 | if not s_is_loaded then | 60 | if not s_is_loaded then |
29 | rb.settings = nil | 61 | rb.settings = nil |
30 | package.loaded.settings = nil | ||
31 | end | ||
32 | |||
33 | if not rbs_is_loaded then | ||
34 | rb.system = nil | ||
35 | rb.metadata = nil | ||
36 | package.loaded.rbsettings = nil | ||
37 | end | 62 | end |
38 | 63 | ||
64 | rb = rbold | ||
39 | rb.core_color_table = color_table | 65 | rb.core_color_table = color_table |
40 | rb.core_talk_table = talk_table | 66 | rb.core_talk_table = talk_table |
41 | rb.core_list_settings_table = list_settings_table | 67 | rb.core_list_settings_table = list_settings_table |
diff --git a/apps/plugins/lua/include_lua/printtable.lua b/apps/plugins/lua/include_lua/printtable.lua index 7a883367b7..c70fc1343f 100644 --- a/apps/plugins/lua/include_lua/printtable.lua +++ b/apps/plugins/lua/include_lua/printtable.lua | |||
@@ -337,7 +337,7 @@ function print_table(t, t_count, settings) | |||
337 | table_p = init_position(15, 5) | 337 | table_p = init_position(15, 5) |
338 | line, maxline = _print.opt.area(5, 1, rb.LCD_WIDTH - 10 - sb_width, rb.LCD_HEIGHT - 2) | 338 | line, maxline = _print.opt.area(5, 1, rb.LCD_WIDTH - 10 - sb_width, rb.LCD_HEIGHT - 2) |
339 | 339 | ||
340 | if curpos > maxline then | 340 | if (curpos or 0) > maxline then |
341 | local c = maxline / 2 | 341 | local c = maxline / 2 |
342 | start = (start or 1) + curpos - maxline | 342 | start = (start or 1) + curpos - maxline |
343 | curpos = maxline | 343 | curpos = maxline |
diff --git a/apps/plugins/lua/include_lua/temploader.lua b/apps/plugins/lua/include_lua/temploader.lua index 69eae468a8..7fd58aee99 100644 --- a/apps/plugins/lua/include_lua/temploader.lua +++ b/apps/plugins/lua/include_lua/temploader.lua | |||
@@ -1,30 +1,63 @@ | |||
1 | --[[ | 1 | --[[ |
2 | temp loader allows some lua requires to be loaded and later garbage collected | 2 | /*************************************************************************** |
3 | unfortunately the module needs to be formatted in such a way to pass back a | 3 | * __________ __ ___. |
4 | call table in order to keep the functions within from being garbage collected | 4 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
5 | too early | 5 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
6 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
7 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
8 | * \/ \/ \/ \/ \/ | ||
9 | * $Id$ | ||
10 | * | ||
11 | * Copyright (C) 2021 William Wilgus | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License | ||
15 | * as published by the Free Software Foundation; either version 2 | ||
16 | * of the License, or (at your option) any later version. | ||
17 | * | ||
18 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
19 | * KIND, either express or implied. | ||
20 | * | ||
21 | ****************************************************************************/ | ||
22 | -- | ||
23 | temp_loader allows some (pure) lua requires to be loaded and later garbage collected | ||
24 | unfortunately the 'required' module needs to be formatted in such a way to | ||
25 | pass back a reference to a function or call table in order to keep the functions | ||
26 | within from being garbage collected too early | ||
6 | 27 | ||
7 | BE AWARE this bypasses the module loader which would allow code reuse | 28 | modules that add things to _G table are unaffected by using this function |
8 | so if you aren't careful this memory saving tool could spell disaster | 29 | except if later you use require or temp_loader those tables will again |
9 | for free RAM if you load the same code multiple times | 30 | be reloaded with fresh data since nothing was recorded about the module being loaded |
10 | --]] | 31 | |
32 | modulename - same as require() | ||
33 | newinstance == true -- get a new copy (from disk) of the module | ||
34 | ... other args for the module | ||
11 | 35 | ||
36 | BE AWARE this bypasses the module loader | ||
37 | which would allow code reuse so if you aren't careful this memory saving tool | ||
38 | could spell disaster for free RAM if you load the same code multiple times | ||
39 | --]] | ||
12 | 40 | ||
13 | local function tempload(modulename) | 41 | local function tempload(modulename, newinstance, ...) |
14 | --http://lua-users.org/wiki/LuaModulesLoader | 42 | --http://lua-users.org/wiki/LuaModulesLoader |
15 | local errmsg = "" | 43 | local errmsg = "" |
44 | -- Is there current a loaded module by this name? | ||
45 | if package.loaded[modulename] ~= nil and not newinstance then | ||
46 | return require(modulename) | ||
47 | end | ||
16 | -- Find source | 48 | -- Find source |
17 | local modulepath = string.gsub(modulename, "%.", "/") | 49 | local modulepath = string.gsub(modulename, "%.", "/") |
18 | for path in string.gmatch(package.path, "([^;]+)") do | 50 | for path in string.gmatch(package.path, "([^;]+)") do |
19 | local filename = string.gsub(path, "%?", modulepath) | 51 | local filename = string.gsub(path, "%?", modulepath) |
20 | local file = io.open(filename, "r") | 52 | --attempt to open and compile module |
53 | local file, err = loadfile(filename) | ||
21 | if file then | 54 | if file then |
22 | -- Compile and return the module | 55 | -- execute the compiled chunk |
23 | return assert(loadstring(assert(file:read("*a")), filename))() | 56 | return file(... or modulename) |
24 | end | 57 | end |
25 | errmsg = errmsg.."\n\tno file '"..filename.."' (temp loader)" | 58 | errmsg = table.concat({errmsg, "\n\tno file '", filename, "' (temp loader)"}) |
26 | end | 59 | end |
27 | return errmsg | 60 | return nil, errmsg |
28 | end | 61 | end |
29 | 62 | ||
30 | return tempload | 63 | return tempload |
diff --git a/apps/plugins/lua/rockaux.c b/apps/plugins/lua/rockaux.c index 73fe458889..058ad313fa 100644 --- a/apps/plugins/lua/rockaux.c +++ b/apps/plugins/lua/rockaux.c | |||
@@ -52,6 +52,8 @@ char *strerror(int errnum) | |||
52 | */ | 52 | */ |
53 | int splash_scroller(int timeout, const char* str) | 53 | int splash_scroller(int timeout, const char* str) |
54 | { | 54 | { |
55 | if (!str) | ||
56 | str = "[nil]"; | ||
55 | int w, ch_w, ch_h; | 57 | int w, ch_w, ch_h; |
56 | rb->lcd_getstringsize("W", &ch_w, &ch_h); | 58 | rb->lcd_getstringsize("W", &ch_w, &ch_h); |
57 | 59 | ||
diff --git a/apps/plugins/lua_scripts/print_lua_func.lua b/apps/plugins/lua_scripts/print_lua_func.lua index 8cfbcf0e8e..8519914d5f 100644 --- a/apps/plugins/lua_scripts/print_lua_func.lua +++ b/apps/plugins/lua_scripts/print_lua_func.lua | |||
@@ -279,8 +279,9 @@ end | |||
279 | for i=1, #tWriteBuf do tWriteBuf[i] = _NIL end -- reuse table | 279 | for i=1, #tWriteBuf do tWriteBuf[i] = _NIL end -- reuse table |
280 | end | 280 | end |
281 | end | 281 | end |
282 | 282 | if ... then | |
283 | tcBase= nil tkSortCbase= nil | 283 | tcBase= nil tkSortCbase= nil |
284 | end | ||
284 | tWriteBuf[#tWriteBuf + 1] = "\r\n" | 285 | tWriteBuf[#tWriteBuf + 1] = "\r\n" |
285 | tWriteBuf[#tWriteBuf + 1] = dtTag("?") | 286 | tWriteBuf[#tWriteBuf + 1] = dtTag("?") |
286 | tWriteBuf[#tWriteBuf + 1] = "\r\n\r\n" | 287 | tWriteBuf[#tWriteBuf + 1] = "\r\n\r\n" |
@@ -309,5 +310,29 @@ end | |||
309 | filehandle:write(table.concat(tWriteBuf)) | 310 | filehandle:write(table.concat(tWriteBuf)) |
310 | for i=1, #tWriteBuf do tWriteBuf[i] = _NIL end -- empty table | 311 | for i=1, #tWriteBuf do tWriteBuf[i] = _NIL end -- empty table |
311 | filehandle:close() | 312 | filehandle:close() |
312 | rb.splash(rb.HZ * 5, n .. " Items dumped to : " .. sDumpFile) | 313 | --rb.splash((rb.HZ or 100) * 5, n .. " Items dumped to : " .. sDumpFile) |
313 | --rb.splash(500, collectgarbage("count")) | 314 | --rb.splash(500, collectgarbage("count")) |
315 | if not ... then | ||
316 | local lu = collectgarbage("collect") | ||
317 | local used, allocd, free = rb.mem_stats() | ||
318 | local lu = collectgarbage("count") | ||
319 | local fmt = function(t, v) return string.format("%s: %d Kb\n", t, v /1024) end | ||
320 | local s_t = {} | ||
321 | s_t[1] = n | ||
322 | s_t[2] = " Items dumped to:\n" | ||
323 | s_t[3] = sDumpFile | ||
324 | s_t[4] = "\n\nLoaded Modules:\n" | ||
325 | n = 0 | ||
326 | for k, v in pairsByPairs(tcBase, tkSortCbase ) do | ||
327 | n = n + 1 | ||
328 | if n ~= 1 then | ||
329 | s_t[#s_t + 1] = ", " | ||
330 | end | ||
331 | s_t[#s_t + 1] = tostring(k) | ||
332 | if n >= 3 then -- split loaded modules to multiple lines | ||
333 | n = 0 | ||
334 | s_t[#s_t + 1] = "\n" | ||
335 | end | ||
336 | end | ||
337 | rb.splash_scroller(5 * (rb.HZ or 100), table.concat(s_t)) | ||
338 | end | ||