made lua debugger stop crying and added more docs
This commit is contained in:
@@ -38,6 +38,7 @@ end
|
||||
|
||||
function kernel.PANIC(msg)
|
||||
if kernel.status~="Panic" then
|
||||
kernel.exitMain = true
|
||||
kernel.log("PANIC: "..msg, "PANIC")
|
||||
pcall(kernel["saveLog"])
|
||||
kernel.status="Panic"
|
||||
@@ -50,7 +51,7 @@ function kernel.PANIC(msg)
|
||||
screen:print("KERNEL PANIC!\n"..msg.."\nSystem halted.")
|
||||
screen:print("Press any key to continue...")
|
||||
end
|
||||
while true do
|
||||
while true do
|
||||
local event={computer:getMachineEvent()}
|
||||
if event[1]=="keyPressed" then
|
||||
break
|
||||
@@ -117,6 +118,7 @@ if not initCfgFunc then
|
||||
kernel.PANIC("Failed to load /boot/boot.cfg: "..tostring(err))
|
||||
end
|
||||
|
||||
---@diagnostic disable-next-line: param-type-mismatch
|
||||
local initCfgStatus, config = pcall(initCfgFunc)
|
||||
if not initCfgStatus then
|
||||
kernel.PANIC("Error in /boot/boot.cfg: "..tostring(config))
|
||||
@@ -218,6 +220,14 @@ kernel.kernelTask = {
|
||||
}
|
||||
kernel.currentTask = kernel.kernelTask
|
||||
|
||||
function kernel.shutdown()
|
||||
kernel.computer:shutdown()
|
||||
end
|
||||
|
||||
function kernel.reboot()
|
||||
kernel.computer:reboot()
|
||||
end
|
||||
|
||||
kernel.syscalls["OS_time"]=function() return kernel.computer:time() end
|
||||
kernel.syscalls["OS_log"]=kernel.log
|
||||
|
||||
|
||||
@@ -204,6 +204,7 @@ function type(object, trueType)
|
||||
else
|
||||
if oldtype(oldgetmetatable(object))=="table" then
|
||||
local metatable = oldgetmetatable(object)
|
||||
---@diagnostic disable-next-line: need-check-nil
|
||||
if metatable.__type then return metatable.__type end
|
||||
else
|
||||
return "table"
|
||||
|
||||
@@ -275,4 +275,4 @@ kernel.syscalls["VFS_whereis"] = vfs.whereis
|
||||
kernel.syscalls["VFS_dup"] = vfs.dup
|
||||
kernel.syscalls["VFS_dup2"] = vfs.dup2
|
||||
|
||||
kernel.log("VFS module loaded")
|
||||
kernel.log("VFS module loaded")
|
||||
@@ -6,6 +6,13 @@ kernel.processes.keventd = function()
|
||||
while true do
|
||||
local event = {kernel.computer:getMachineEvent()}
|
||||
if event[1] then
|
||||
if event[1]=="keyTyped" then
|
||||
if event[3]=="\x1b^s" then
|
||||
kernel.shutdown()
|
||||
elseif event[3]=="\x1b^r" then
|
||||
kernel.reboot()
|
||||
end
|
||||
end
|
||||
events.push(event)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -29,7 +29,7 @@ function sys.spawn(func, name, envars, args, tgid)
|
||||
tasks[tostring(id)].exit=err
|
||||
end
|
||||
end),
|
||||
name=name or "task"..tostring(id),
|
||||
name=name or ("task"..tostring(id)),
|
||||
envars=envars or {},
|
||||
args=args or {},
|
||||
status="R",
|
||||
|
||||
Reference in New Issue
Block a user