From 5a6018ad5e4c7feb55204130aa2d49881226abe2 Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Mon, 31 Jul 2017 09:26:58 +1000 Subject: [PATCH] a bit of cleaning --- genkernel.sh | 2 ++ modules/applications/luash.lua | 2 ++ modules/debug/log.lua | 8 ++++---- modules/lib/computer-ext.lua | 3 +++ modules/setup.lua | 1 + strip.lua | 4 ---- 6 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 modules/lib/computer-ext.lua diff --git a/genkernel.sh b/genkernel.sh index 8fee321..552aa10 100755 --- a/genkernel.sh +++ b/genkernel.sh @@ -1,2 +1,4 @@ #!/bin/bash +echo "_OSVERSION=\"PsychOS $(git rev-parse HEAD | head -c 8)\"" +echo "_BD=\"$(date '+%Y/%m/%d %H:%M %z')\"" cat modules/debug/log.lua modules/base/header.lua modules/drivers/tty.lua modules/lib/print.lua modules/drivers/kbd.lua modules/drivers/net.lua modules/lib/readline.lua modules/applications/luash.lua modules/setup.lua modules/base/footer.lua diff --git a/modules/applications/luash.lua b/modules/applications/luash.lua index a7447f9..9457e2f 100644 --- a/modules/applications/luash.lua +++ b/modules/applications/luash.lua @@ -1,5 +1,7 @@ function luash(si) spawn("lua shell",function() + coroutine.yield() + print(_OSVERSION..", "..string.format("%4d",computer.totalMemory()/1024).."K memory, "..string.format("%4d",computer.freeMemory()/1024).."K free") print(_VERSION) while true do write("> ") diff --git a/modules/debug/log.lua b/modules/debug/log.lua index b33113e..421613d 100644 --- a/modules/debug/log.lua +++ b/modules/debug/log.lua @@ -1,12 +1,12 @@ if component then _G.Log = "" function log(...) - if component.list("ocemu")() then for k,v in ipairs({...}) do - component.invoke(component.list("ocemu")(),"log",v) + if component.list("ocemu")() then + component.invoke(component.list("ocemu")(),"log",v) + end + Log=Log..tostring(v).."\n" end - end - Log=Log..tostring(v).."\n" end print=log else log = print diff --git a/modules/lib/computer-ext.lua b/modules/lib/computer-ext.lua new file mode 100644 index 0000000..ec82e72 --- /dev/null +++ b/modules/lib/computer-ext.lua @@ -0,0 +1,3 @@ +function _G.computer.usedMemory() + return computer.totalMemory()-computer.freeMemory() +end diff --git a/modules/setup.lua b/modules/setup.lua index 34d98d7..2657902 100644 --- a/modules/setup.lua +++ b/modules/setup.lua @@ -4,3 +4,4 @@ local ka = component.list("keyboard")() kbd(ka) end)) luash() +computer.beep() diff --git a/strip.lua b/strip.lua index 4428a89..dfb79f0 100644 --- a/strip.lua +++ b/strip.lua @@ -23,10 +23,6 @@ replacements={ {" %* ","*"}, {" \n","\n"}, {"%-%-.-\n",""}, -{"coroutine%.","C."}, -{"table%.","T."}, -{"tostring","TS"}, -{"tonumber","TN"}, } for k,v in ipairs(replacements) do while ss:find(v[1]) ~= nil do