PRE-ALPHA 3.0.0 - Rewrote the kernel to use a more modular design, changed some terms, added process sandboxing for security.
COMING IN THE FULL RELEASE: - A user system - A functional IPC (Inter-Process Communication) system THINGS CAN AND WILL CHANGE FROM NOW UNTIL THE FINAL RELEASE.
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
_G.evmgr = {}
|
||||
_G.evmgr.eventQueue = {}
|
||||
local maxEventQueueLength = 10 -- increase if events start getting dropped
|
||||
|
||||
local computer = require("computer")
|
||||
|
||||
_G._PUBLIC.keyboard.ctrlDown = false
|
||||
_G._PUBLIC.keyboard.altDown = false
|
||||
_G._PUBLIC.keyboard.shiftDown = false
|
||||
|
||||
--local ocelot = component.proxy(component.list("ocelot")())
|
||||
|
||||
while true do
|
||||
local args
|
||||
repeat
|
||||
args = {computer.uptime(), computer.pullSignal(0)}
|
||||
if args and args[2] then
|
||||
table.insert(evmgr.eventQueue, args)
|
||||
if _PUBLIC.keyboard then
|
||||
if args[2] == "key_down" then
|
||||
local keycode = args[5]
|
||||
local key = _PUBLIC.keyboard.keys[keycode]
|
||||
if key == "lcontrol" then
|
||||
_PUBLIC.keyboard.ctrlDown = true
|
||||
elseif key == "lmenu" then
|
||||
_PUBLIC.keyboard.altDown = true
|
||||
elseif key == "lshift" then
|
||||
_PUBLIC.keyboard.shiftDown = true
|
||||
elseif key == "c" and _PUBLIC.keyboard.ctrlDown and _PUBLIC.keyboard.altDown then
|
||||
if print then
|
||||
print("\n\27[91mCoroutine "..tostring(#tsched.tasks).." killed.")
|
||||
end
|
||||
tsched.tasks[#tsched.tasks] = nil
|
||||
end
|
||||
elseif args[2] == "key_up" then
|
||||
local keycode = args[5]
|
||||
local key = _PUBLIC.keyboard.keys[keycode]
|
||||
if key == "lcontrol" then
|
||||
_PUBLIC.keyboard.ctrlDown = false
|
||||
elseif key == "lmenu" then
|
||||
_PUBLIC.keyboard.altDown = false
|
||||
elseif key == "lshift" then
|
||||
_PUBLIC.keyboard.shiftDown = true
|
||||
end
|
||||
end
|
||||
end
|
||||
while #evmgr.eventQueue > maxEventQueueLength do
|
||||
--ocelot.log("Queue length breach, removing first signal")
|
||||
table.remove(evmgr.eventQueue, 1)
|
||||
end
|
||||
end
|
||||
until not args or not args[1]
|
||||
--ocelot.log("done")
|
||||
coroutine.yield()
|
||||
end
|
||||
Reference in New Issue
Block a user