update preproc so it can still cope with building PsychOS (hopefully)
This commit is contained in:
parent
d8dbaccd2a
commit
b62beff891
@ -59,6 +59,47 @@ end
|
|||||||
|
|
||||||
preproc.directives.include = preproc.preproc
|
preproc.directives.include = preproc.preproc
|
||||||
|
|
||||||
|
function preproc.directives.includelib(file, name) -- string string -- string -- Returns a preprocessed inlined library
|
||||||
|
return string.format("package.loaded.%s = (function()\n%s\nend)()", name, preproc.preproc(file))
|
||||||
|
end
|
||||||
|
|
||||||
|
function preproc.directives.includepkgfile(package, file)
|
||||||
|
if (_OSVERSION or ""):sub(1,7) == "PsychOS" then
|
||||||
|
return preproc.preproc(string.format("/pkg/%s", file))
|
||||||
|
else
|
||||||
|
for path in (os.getenv("PSYCHOSPACKAGES") or "../PsychOSPackages"):gmatch("[^:]+") do
|
||||||
|
local f = io.open(string.format("%s/%s/%s", path, package, file), "r")
|
||||||
|
if f then
|
||||||
|
f:close()
|
||||||
|
return preproc.preproc(string.format("%s/%s/%s", path, package, file))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
error(string.format("unable to locate file %s from package %s", file, package))
|
||||||
|
end
|
||||||
|
|
||||||
|
function preproc.directives.includepkglib(package, file, name) -- string string -- string -- Returns a preprocessed inlined library
|
||||||
|
return string.format("package.loaded.%s = (function()\n%s\nend)()", name, preproc.directives.includepkgfile(package, file))
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[
|
||||||
|
function preproc.directives.includepkglib(package, file, name)
|
||||||
|
if (_OSVERSION or ""):sub(1,7) == "PsychOS" then
|
||||||
|
return preproc.directives.includelib(string.format("/pkg/%s", file), name)
|
||||||
|
else
|
||||||
|
for path in (os.getenv("PSYCHOSPACKAGES") or "../PsychOSPackages"):gmatch("[^:]+") do
|
||||||
|
print(string.format("%s/%s/%s", path, package, file))
|
||||||
|
local f = io.open(string.format("%s/%s/%s", path, package, file), "r")
|
||||||
|
if f then
|
||||||
|
f:close()
|
||||||
|
return preproc.directives.includelib(string.format("%s/%s/%s", path, package, file), name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
error(string.format("unable to locate library %s from package %s", name, package))
|
||||||
|
end
|
||||||
|
]]
|
||||||
|
|
||||||
return setmetatable(preproc,{__call=function(_,...)
|
return setmetatable(preproc,{__call=function(_,...)
|
||||||
local tA = {...}
|
local tA = {...}
|
||||||
local out = table.remove(tA,#tA)
|
local out = table.remove(tA,#tA)
|
||||||
|
Loading…
Reference in New Issue
Block a user