2017-07-31 13:04:44 +10:00
|
|
|
function genkernel(modlistf,kname)
|
|
|
|
local nk,f = "",io.open(modlistf,"rb")
|
|
|
|
nk=nk.."_OSVERSION=\"PsychOS "..(kname or "unknown").."\"\n"
|
|
|
|
nk=nk.."_BD=\""..os.date("%Y/%m/%d %H:%M %z").."\"\n"
|
|
|
|
local c=f:read("*a")
|
|
|
|
f:close()
|
2017-08-27 03:50:31 +10:00
|
|
|
local n=1
|
|
|
|
local function apfile(fp)
|
|
|
|
local f=io.open(fp,"rb")
|
2017-07-31 13:04:44 +10:00
|
|
|
if f then
|
|
|
|
nk=nk..f:read("*a")
|
|
|
|
f:close()
|
|
|
|
end
|
|
|
|
end
|
2017-08-27 03:50:31 +10:00
|
|
|
for line in c:gmatch("[^\r\n]+") do
|
|
|
|
local tw = {}
|
|
|
|
for w in line:gmatch("%S+") do
|
|
|
|
tw[#tw+1] = w
|
|
|
|
end
|
|
|
|
n=n+1
|
|
|
|
if tw[1] == "fwrap" then
|
|
|
|
nk=nk.."function "..tw[2].."(...)\n"
|
|
|
|
apfile(tw[3])
|
|
|
|
nk=nk.."\nend\n"
|
2017-09-13 13:15:38 +10:00
|
|
|
elseif tw[1] == "libwrap" then
|
|
|
|
nk=nk.."function "..tw[2].."(...)\n"
|
|
|
|
apfile(tw[3])
|
|
|
|
nk=nk.."\nend\n_G."..tw[2].." = "..tw[2].."()\n"
|
2017-08-27 03:50:31 +10:00
|
|
|
elseif tw[1] == "include" then
|
|
|
|
apfile(tw[2])
|
|
|
|
else
|
|
|
|
apfile(line)
|
|
|
|
end
|
|
|
|
end
|
2017-07-31 13:04:44 +10:00
|
|
|
return nk
|
|
|
|
end
|