ALPHA 3.0.0 - Added Inter-Process Communication and fixed the bug where the shell would continue taking in input when a command was still running.

This commit is contained in:
WahPlus
2025-08-21 21:03:17 +03:00
parent 5276d2437b
commit ef0ffa1886
10 changed files with 208 additions and 73 deletions
+54 -38
View File
@@ -1,25 +1,6 @@
local gpu = component.proxy(component.list("gpu")())
local resX, resY = gpu.getResolution()
-- Architecture check
local foundArchitecture = false
for _, arch in pairs(computer.getArchitectures()) do
if arch == "Lua 5.3" then
foundArchitecture = true
break
end
end
if foundArchitecture then
computer.setArchitecture("Lua 5.3")
else
gpu.set(1, 1, "Required architecture (Lua 5.3) is not supported.")
gpu.set(1, 2, "Halting.")
while true do
computer.pullSignal()
end
end
local function loadfile(file)
checkArg(1, file, "string")
local handle = component.invoke(computer.getBootAddress(), "open", file, "r")
@@ -37,6 +18,26 @@ local function handleError(errorMessage)
end
function loadBoot()
local foundArchitecture = false
for _, arch in pairs(computer.getArchitectures()) do
if arch == "Lua 5.3" then
foundArchitecture = true
break
end
end
if foundArchitecture then
local _, errorMesage = computer.setArchitecture("Lua 5.3")
if errorMessage then
error(errorMessage)
end
else
gpu.set(1, 1, "Required architecture (Lua 5.3) is not supported.")
gpu.set(1, 2, "Halting.")
while true do
computer.pullSignal()
end
end
loadfile("/halyde/kernel/boot.lua")(loadfile)
end
@@ -45,28 +46,43 @@ gpu.fill(1, 1, resX, resY, " ")
-- Copying low-level functions in case of post-preload failure
local pullSignal = computer.pullSignal
local shutdown = computer.shutdown
local beep = computer.beep
local result, reason = xpcall(loadBoot, handleError)
if not result then
gpu.setBackground(0x000000)
gpu.fill(1, 1, resX, resY, " ")
gpu.setBackground(0x800000)
gpu.setForeground(0xFFFFFF)
gpu.set(2,2,"A critical error has occurred.")
local i = 4
reason = tostring(reason):gsub("\t", " ")
for line in string.gmatch(reason or "unknown error", "([^\n]*)\n?") do
gpu.set(2,i,line)
i = i + 1
local bgColor
if gpu.getDepth() == 1 then
bgColor = 0x000000
else
bgColor = 0x000080
end
gpu.set(2,i+1, "Press any key to restart.")
local evname
repeat
evname = pullSignal()
until evname == "key_down"
shutdown(true)
while true do
coroutine.yield()
gpu.setBackground(bgColor)
gpu.fill(1, 1, resX, resY, " ")
local function render()
gpu.setForeground(0xFFFFFF)
local i = 2
reason = "A fatal error has occurred.\nHalyde cannot continue.\n \n" .. tostring(reason or "unknown error"):gsub("\t", " ")
for line in string.gmatch(reason, "([^\n]*)\n?") do
gpu.set(2, i, line)
i = i + 1
end
gpu.set(1, resY - 1, string.rep("", resX))
gpu.setForeground(bgColor)
gpu.setBackground(0xFFFFFF)
gpu.set(2, resY, "🠅 🠄 🠇 🠆")
gpu.setForeground(0xFFFFFF)
gpu.setBackground(bgColor)
gpu.set(4, resY, " / ")
gpu.set(9, resY, " / ")
gpu.set(14, resY, " / ")
gpu.set(20, resY, "Scroll" .. string.rep(" ", resX - 21))
end
render()
beep(440, 0.2)
beep(465, 0.2)
beep(440, 0.2)
beep(370, 0.5)
while true do -- TODO: Make this scrollable
pullSignal()
end
end