diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-11-01 12:10:24 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-11-01 12:10:24 +0100 |
commit | 5fd6625a09421c86f7bf27efaff9a64cc5cf3d0f (patch) | |
tree | 32c7f9643a7edc077bbce72414afc7ab52e61ac7 /tex/context/base/mkiv/util-lua.lua | |
parent | 7fc4b935d045c84e89459e726ff54ae331e4c574 (diff) | |
download | context-5fd6625a09421c86f7bf27efaff9a64cc5cf3d0f.tar.gz |
2017-11-01 12:01:00
Diffstat (limited to 'tex/context/base/mkiv/util-lua.lua')
-rw-r--r-- | tex/context/base/mkiv/util-lua.lua | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tex/context/base/mkiv/util-lua.lua b/tex/context/base/mkiv/util-lua.lua index 27daa516f..1c25bcc03 100644 --- a/tex/context/base/mkiv/util-lua.lua +++ b/tex/context/base/mkiv/util-lua.lua @@ -72,12 +72,21 @@ end -- quite subtle ... doing this wrong incidentally can give more bytes -function luautilities.loadedluacode(fullname,forcestrip,name) +function luautilities.loadedluacode(fullname,forcestrip,name,macros) -- quite subtle ... doing this wrong incidentally can give more bytes name = name or fullname local code, message - if environment.loadpreprocessedfile then - code, message = environment.loadpreprocessedfile(fullname) + if macros then + macros = lua.macros + end + if macros and macros.enabled then + -- local c = io.loaddata(fullname) -- not yet available + local f = io.open(fullname,"rb") local c = f:read("*a") f:close() + local n = c and macros.resolvestring(c) + if n and #n ~= #c then + report_lua("preprocessed file %a: %i => %i bytes",fullname,#c,#n) + end + code, message = load(n or c) else code, message = loadfile(fullname) end |