a bunch of random bugfixes

This commit is contained in:
Izaya 2017-08-01 23:59:29 +10:00
parent 6879c22e13
commit 593f6c40c0
4 changed files with 10 additions and 6 deletions

View File

@ -1,2 +1,3 @@
#!/bin/bash #!/bin/bash
./genkernel.lua build.cfg "$(git rev-parse --short HEAD)" > kernel.lua ./genkernel.lua build.cfg "$(git rev-parse --short HEAD)" > kernel.lua
lua strip.lua kernel.lua skernel.lua

View File

@ -4,10 +4,12 @@ function skex2(fp)
if not fp then return end if not fp then return end
if not rp then ft = {} end if not rp then ft = {} end
local f=io.open(fp,"rb") local f=io.open(fp,"rb")
C=f:read("*a") if f then
f:close() C=f:read("*a")
for l in C:gmatch("[^\n]+") do f:close()
ft[#ft+1] = l for l in C:gmatch("[^\n]+") do
ft[#ft+1] = l
end
end end
end end
function ct.writefile(nfp) function ct.writefile(nfp)
@ -30,7 +32,7 @@ function skex2(fp)
end end
end end
function ct.sp(np) function ct.sp(np)
if np then p=tonumber(np)%#ft end if np then p=(tonumber(np)%#ft)+1 end
end end
function ct.pointer(np) function ct.pointer(np)
ct.sp(np) ct.sp(np)

View File

@ -9,7 +9,7 @@ do -- so local works
-- ["ep"]= event queue pointer -- ["ep"]= event queue pointer
-- } -- }
local tT,nP,rg,eq,p = {},1,_G,{},1 -- taskTable,nextPid,real _G,event queue local tT,nP,rg,eq,p = {},1,_G,{},1 -- taskTable,nextPid,real _G,event queue
_G.cT,sbt,C,T = 0,{},coroutine,table -- currentTask,sandboxTable _G.cT,sbt,C,T,io = 0,{},coroutine,table,io -- currentTask,sandboxTable
function _G.spawn(n,f,e) function _G.spawn(n,f,e)
tT[nP] = {} tT[nP] = {}
sbt[nP] = {} sbt[nP] = {}

View File

@ -8,3 +8,4 @@ function print(...)
write(tostring(v).."\n") write(tostring(v).."\n")
end end
end end
io.write = write