added more hpv funcs and made primshell
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
-- bit32.lua
|
||||
-- Full pure-Lua implementation of Lua 5.2 bit32 library
|
||||
-- NO Lua 5.3 operators used
|
||||
--:Minify:--
|
||||
|
||||
local bit32 = {}
|
||||
|
||||
@@ -136,16 +134,4 @@ function bit32.replace(x, v, field, width)
|
||||
return bit32.bor(x, bit32.lshift(v, field))
|
||||
end
|
||||
|
||||
-- ===== Test =====
|
||||
|
||||
function bit32.test(x, ...)
|
||||
local args = {...}
|
||||
for i = 1, #args do
|
||||
if bit32.band(x, args[i]) ~= 0 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
return bit32
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
--:Minify:--
|
||||
local fs={}
|
||||
|
||||
-- "VFS_open" : open
|
||||
@@ -136,4 +137,8 @@ function fs.setcwd(path)
|
||||
return syscall.VFS_setcwd(path)
|
||||
end
|
||||
|
||||
function fs.isDir(path)
|
||||
return syscall.VFS_isDirectory(path)
|
||||
end
|
||||
|
||||
return fs
|
||||
@@ -1,57 +1,6 @@
|
||||
local sys = {}
|
||||
local fs = require("sys.fs")
|
||||
|
||||
function sys.spawn(func, name, envars, args)
|
||||
return coroutine.yield(0x10, func, name, envars, args)
|
||||
end
|
||||
|
||||
function sys.spawnFromFile(path, name, envars, args)
|
||||
local data = fs.readAllText(path)
|
||||
if not data then
|
||||
error("File not found: "..path,2)
|
||||
end
|
||||
local func, err = load(data, "@"..path)
|
||||
if not func then
|
||||
error("Error loading file "..path..": "..tostring(err),2)
|
||||
end
|
||||
return coroutine.yield(0x10, func, name, envars, args)
|
||||
end
|
||||
|
||||
function sys.spawnAndWait(func, name, envars, args)
|
||||
local task = coroutine.yield(0x10, func, name, envars, args)
|
||||
local oldsignal = sys.getSignalHandler(17)
|
||||
local exit = false
|
||||
sys.setSignalHandler(17, function()
|
||||
local tasks = sys.getChildrenTasks(task)
|
||||
if not tasks[task] then
|
||||
exit = true
|
||||
end
|
||||
end)
|
||||
while not exit do
|
||||
coroutine.yield()
|
||||
end
|
||||
sys.setSignalHandler(17, oldsignal)
|
||||
return task
|
||||
end
|
||||
|
||||
function sys.spawnFromFileAndWait(path, name, envars, args)
|
||||
local data = fs.readAllText(path)
|
||||
if not data then
|
||||
error("File not found: "..path,2)
|
||||
end
|
||||
local func, err = load(data, "@"..path)
|
||||
if not func then
|
||||
error("Error loading file "..path..": "..tostring(err),2)
|
||||
end
|
||||
return sys.spawnAndWait(func, name, envars, args)
|
||||
end
|
||||
|
||||
function sys.exit(code)
|
||||
return coroutine.yield(0x11, code)
|
||||
end
|
||||
|
||||
function sys.getTaskInfo(task)
|
||||
return coroutine.yield(0x12, task)
|
||||
end
|
||||
|
||||
return sys
|
||||
Reference in New Issue
Block a user