From 1141193fc8bd67d30b9417b3fe6e74b969454991 Mon Sep 17 00:00:00 2001 From: Astronand Date: Thu, 15 Jan 2026 16:12:28 -0500 Subject: [PATCH] added events pirimitive --- Src/Hyperion-core-v1.0.0/sbin/init.lua | 52 ------------------- .../lib/modules/Hyperion/13_keventd.kmod | 9 ++-- 2 files changed, 5 insertions(+), 56 deletions(-) diff --git a/Src/Hyperion-core-v1.0.0/sbin/init.lua b/Src/Hyperion-core-v1.0.0/sbin/init.lua index 76a19d4..8e54b67 100644 --- a/Src/Hyperion-core-v1.0.0/sbin/init.lua +++ b/Src/Hyperion-core-v1.0.0/sbin/init.lua @@ -24,59 +24,7 @@ for i,v in ipairs(files) do end end -local function serialize(table, seen) - seen = seen or {} - if seen[tostring(table)] then - return "\"\"" - end - seen[tostring(table)] = true - local output = "{" - for i,v in pairs(table) do - local coma=true - if type(i) == "string" then - output=output.."[\""..i.."\"]=" - elseif type(i) == "number" then - output=output.."["..tostring(i).."]=" - end - if type(v) == "table" then - if v == table then - output=string.sub(output,1,#output-(#i+1)) - coma=false - else - output=output..serialize(v, seen) - end - elseif type(v) == "string" then - output=output.."[=["..v.."]=]" - elseif type(v) == "number" then - output=output..tostring(v) - elseif type(v) == "boolean" then - if v == true then - output=output.."true" - else - output=output.."false" - end - elseif type(v) == "function" then - output=output..tostring(v) - elseif type(v) == "userdata" then - output=output..tostring(v) - elseif type(v) == "thread" then - output=output..tostring(v) - else - error("serialization of type \""..type(v).."\" is not supported") - end - if coma then - output=output.."," - end - end - if #table>0 or string.sub(output,#output,#output) == "," then - output=string.sub(output,1,#output-1) - end - output=output.."}" - return output -end - while true do - --kernel.log(serialize(kernel.tasks)) kernel.saveLog() sleep(1000) end \ No newline at end of file diff --git a/Src/Hyperion-kernel-v1.0.0/lib/modules/Hyperion/13_keventd.kmod b/Src/Hyperion-kernel-v1.0.0/lib/modules/Hyperion/13_keventd.kmod index 2d833b8..e909c36 100644 --- a/Src/Hyperion-kernel-v1.0.0/lib/modules/Hyperion/13_keventd.kmod +++ b/Src/Hyperion-kernel-v1.0.0/lib/modules/Hyperion/13_keventd.kmod @@ -1,13 +1,14 @@ --:Minify:-- local kernel = ... +local events = kernel.newFifo() kernel.processes.keventd = function() while true do local event = {kernel.computer:getMachineEvent()} if event[1] then - if event[1] == "key" or event[1] == "keyPressed" or event[1] == "keyReleased" then - kernel.devfs.keyboard.push(event) - end + events.push(event) end end -end \ No newline at end of file +end + +kernel.syscalls["IO_getEventAny"]=events.pop