From 292ced23684366c3ba092006fe5b8f7eed2ce8a4 Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Sun, 27 Aug 2017 03:50:31 +1000 Subject: [PATCH] Made genkernel accept some different commands so you can include executable files in your kernel. --- modules/applications/genkernel.lua | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/modules/applications/genkernel.lua b/modules/applications/genkernel.lua index e6077da..e19a9cb 100644 --- a/modules/applications/genkernel.lua +++ b/modules/applications/genkernel.lua @@ -4,14 +4,29 @@ function genkernel(modlistf,kname) nk=nk.."_BD=\""..os.date("%Y/%m/%d %H:%M %z").."\"\n" local c=f:read("*a") f:close() - n=1 - for line in c:gmatch("[^\r\n]+") do - n=n+1 - f=io.open(line,"rb") + local n=1 + local function apfile(fp) + local f=io.open(fp,"rb") if f then nk=nk..f:read("*a") f:close() end end + 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" + elseif tw[1] == "include" then + apfile(tw[2]) + else + apfile(line) + end + end return nk end