summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-03-22 19:57:53 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2018-03-22 19:57:53 +0100
commit5c46359f4fa543e24e5d4a0a327d41bf8a9ff7c8 (patch)
tree79fc6a0e161820ebb16a8830572868dcd0e1aae2
parentf47b4939787074397c9ea37c1d892a1f7ccc7290 (diff)
downloadcontext-5c46359f4fa543e24e5d4a0a327d41bf8a9ff7c8.tar.gz
2018-03-22 19:49:00
-rw-r--r--doc/context/documents/general/qrcs/setup-cs.pdfbin844254 -> 844508 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-de.pdfbin844110 -> 844367 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-en.pdfbin848123 -> 848385 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-fr.pdfbin839796 -> 840051 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-it.pdfbin845669 -> 845926 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-mapping-cs.pdfbin358991 -> 359250 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-mapping-de.pdfbin438372 -> 438632 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-mapping-en.pdfbin356100 -> 356363 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-mapping-fr.pdfbin359081 -> 359337 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-mapping-it.pdfbin357923 -> 358183 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-mapping-nl.pdfbin357376 -> 357638 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-mapping-ro.pdfbin624172 -> 624435 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-nl.pdfbin836763 -> 837028 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-ro.pdfbin839748 -> 840010 bytes
-rw-r--r--doc/context/sources/general/manuals/languages/languages-sorting.tex59
-rw-r--r--scripts/context/lua/mtxlibs.lua26
-rw-r--r--scripts/context/lua/mtxrun.lua99
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua99
-rw-r--r--scripts/context/stubs/unix/mtxrun99
-rw-r--r--scripts/context/stubs/win64/mtxrun.lua99
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/font-ots.lua2
-rw-r--r--tex/context/base/mkiv/l-macro.lua72
-rw-r--r--tex/context/base/mkiv/l-package.lua6
-rw-r--r--tex/context/base/mkiv/lpdf-epd.lua2
-rw-r--r--tex/context/base/mkiv/lpdf-ini.lua30
-rw-r--r--tex/context/base/mkiv/lpdf-mis.lua32
-rw-r--r--tex/context/base/mkiv/lpdf-pda.xml9
-rw-r--r--tex/context/base/mkiv/lpdf-pdx.xml9
-rw-r--r--tex/context/base/mkiv/lpdf-pua.xml9
-rw-r--r--tex/context/base/mkiv/lpdf-xmp.lua123
-rw-r--r--tex/context/base/mkiv/sort-ini.lua58
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25801 -> 26081 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin254074 -> 254477 bytes
-rw-r--r--tex/context/base/mkiv/trac-log.lua11
-rw-r--r--tex/context/base/mkiv/util-lua.lua14
-rw-r--r--tex/context/base/mkiv/util-sql-imp-ffi.lua4
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin848123 -> 848385 bytes
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin60776 -> 61034 bytes
-rw-r--r--tex/context/modules/mkiv/s-fonts-shapes.lua115
-rw-r--r--tex/context/modules/mkiv/s-fonts-shapes.mkiv6
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua4
45 files changed, 737 insertions, 258 deletions
diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf
index 1604f5f71..0e74fd519 100644
--- a/doc/context/documents/general/qrcs/setup-cs.pdf
+++ b/doc/context/documents/general/qrcs/setup-cs.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf
index c5b2c365b..00538b2d1 100644
--- a/doc/context/documents/general/qrcs/setup-de.pdf
+++ b/doc/context/documents/general/qrcs/setup-de.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf
index bdcfefbb0..97254d3ef 100644
--- a/doc/context/documents/general/qrcs/setup-en.pdf
+++ b/doc/context/documents/general/qrcs/setup-en.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf
index 72fdd762a..05805c08a 100644
--- a/doc/context/documents/general/qrcs/setup-fr.pdf
+++ b/doc/context/documents/general/qrcs/setup-fr.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf
index 36ac146e6..15bd44630 100644
--- a/doc/context/documents/general/qrcs/setup-it.pdf
+++ b/doc/context/documents/general/qrcs/setup-it.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf
index 997587ef6..6e8047b60 100644
--- a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf
+++ b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-mapping-de.pdf b/doc/context/documents/general/qrcs/setup-mapping-de.pdf
index 2b83ff0c9..0dfb0be15 100644
--- a/doc/context/documents/general/qrcs/setup-mapping-de.pdf
+++ b/doc/context/documents/general/qrcs/setup-mapping-de.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-mapping-en.pdf b/doc/context/documents/general/qrcs/setup-mapping-en.pdf
index 34c49e4db..8973f3e07 100644
--- a/doc/context/documents/general/qrcs/setup-mapping-en.pdf
+++ b/doc/context/documents/general/qrcs/setup-mapping-en.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf
index bf2bbaa50..8e2ad2f37 100644
--- a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf
+++ b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-mapping-it.pdf b/doc/context/documents/general/qrcs/setup-mapping-it.pdf
index c6d7ef61c..cb64f0085 100644
--- a/doc/context/documents/general/qrcs/setup-mapping-it.pdf
+++ b/doc/context/documents/general/qrcs/setup-mapping-it.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf
index 8a2210430..f9e85449d 100644
--- a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf
+++ b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf
index da590962a..a4d542b45 100644
--- a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf
+++ b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf
index eaf020ea1..22596bd8e 100644
--- a/doc/context/documents/general/qrcs/setup-nl.pdf
+++ b/doc/context/documents/general/qrcs/setup-nl.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf
index 27a283406..5abb7c9bc 100644
--- a/doc/context/documents/general/qrcs/setup-ro.pdf
+++ b/doc/context/documents/general/qrcs/setup-ro.pdf
Binary files differ
diff --git a/doc/context/sources/general/manuals/languages/languages-sorting.tex b/doc/context/sources/general/manuals/languages/languages-sorting.tex
index ce24f385c..b090cd3c5 100644
--- a/doc/context/sources/general/manuals/languages/languages-sorting.tex
+++ b/doc/context/sources/general/manuals/languages/languages-sorting.tex
@@ -230,6 +230,65 @@ This three entry index\jindex{ぱあ}\jindex{ぱー}\jindex{ぱぁ} should be so
% ぱー $\prec$ ぱぁ $\prec$ ぱあ
+\startsection[title=Special usage]
+
+The following example demonstrates how you can trick the sorter into doing other
+things: \footnote {The \type {replacementlist} helper is the result of a request
+by John Grasty on the mailing list.}
+
+\startbuffer
+\startluacode
+ local list = {
+ -- old testament
+ "Genesis", "Exodus", "Leviticus", "Numbers", "Deuteronomy", "Joshua",
+ "Judges", "Ruth", "1 Samuel", "2 Samuel", "1 Kings", "2 Kings",
+ "1 Chronicles", "2 Chronicles", "Ezra", "Nehemiah", "Esther", "Job",
+ "Psalms", "Proverbs", "Ecclesiastes", "Canticles", "Isaiah", "Jeremiah",
+ "Lamentations", "Ezekiel", "Daniel", "Hosea", "Joel", "Amos", "Obadiah",
+ "Jonah", "Micah", "Nahum", "Habakkuk", "Zephaniah", "Haggai",
+ "Zechariah", "Malachi",
+ -- new testament
+ "Matthew", "Mark", "Luke", "John", "Acts", "Romans", "1 Corinthians",
+ "2 Corinthians", "Galatians", "Ephesians", "Philippians", "Colossians",
+ "1 Thessalonians", "2 Thessalonians", "1 Timothy", "2 Timothy", "Titus",
+ "Philemon", "Hebrews", "James", "1 Peter", "2 Peter", "1 John", "2 John",
+ "3 John", "Jude", "Revelation",
+ }
+
+ sorters.definitions["bible"] = {
+ replacements = sorters.replacementlist(list),
+ }
+\stopluacode
+
+\defineregister
+ [booksort]
+ [language=bible,
+ n=1,
+ indicator=no]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+We use this as follows:
+
+\startbuffer
+One \booksort{Genesis+5.2}
+Two \booksort{Exodus+2}
+Three \booksort{Genesis+45}
+Four \booksort{Philemon+2}
+Five \booksort{John+45}
+Six \booksort{1 John 1+45}
+Seven \booksort{2 John 2+45}
+
+\placeregister
+ [booksort]
+ [language=bible]
+\stopbuffer
+
+\stoptext
+
+\stopsection
+
\stopchapter
\stopcomponent
diff --git a/scripts/context/lua/mtxlibs.lua b/scripts/context/lua/mtxlibs.lua
index bb0e03b17..f6839eb9d 100644
--- a/scripts/context/lua/mtxlibs.lua
+++ b/scripts/context/lua/mtxlibs.lua
@@ -68,7 +68,7 @@ local owntree = ownpath
local ownlibs = {
"l-lua.lua",
- "l-macros.lua",
+ "l-macro.lua",
"l-sandbox.lua",
"l-package.lua",
"l-lpeg.lua",
@@ -196,15 +196,13 @@ end
local arguments = environment.arguments
local files = environment.files
-if file.basename(environment.ownname) ~= "mtxlibs.lua" then
- return
-end
+local ownname = file.basename(environment.ownname)
local helpinfo = [[
usage: mtxlibs [options]
---merge
---merge targetfile extralibs
+--selfmerge
+--selfmerge targetfile extralibs
--selfclean
and in a lua file:
@@ -218,7 +216,19 @@ local application = logs.application {
helpinfo = helpinfo,
}
-local report = application.report
+local report = application.report
+
+if ownname == "mtxrun" or ownname == "mtxrun.lua" then
+ -- we're using mtxrun
+ ownname = "mtxlibs.lua"
+elseif ownname == "mtxlibs" or ownname == "mtxlibs.lua" then
+ -- we're using lua
+ ownname = "mtxlibs.lua"
+else
+ report("usage : lua mtxlibs.lua ...")
+ report(" : mtxrun --script mtxlibs.lua ...")
+ return
+end
if arguments.selfmerge then
@@ -247,7 +257,7 @@ elseif arguments.selfclean then
merger.selfclean(ownname)
report("done")
-elseif arguments.help or files[1] == "help" then
+else -- if arguments.help or files[1] == "help" then
application.help()
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index cec16c7e5..1a470244a 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -195,7 +195,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-macro"] = package.loaded["l-macro"] or true
--- original size: 6393, stripped down to: 3659
+-- original size: 8260, stripped down to: 5213
if not modules then modules={} end modules ['l-macros']={
version=1.001,
@@ -207,7 +207,8 @@ if not modules then modules={} end modules ['l-macros']={
local S,P,R,V,C,Cs,Cc,Ct,Carg=lpeg.S,lpeg.P,lpeg.R,lpeg.V,lpeg.C,lpeg.Cs,lpeg.Cc,lpeg.Ct,lpeg.Carg
local lpegmatch=lpeg.match
local concat=table.concat
-local next=next
+local format,sub=string.format,string.sub
+local next,load,type=next,load,type
local newline=S("\n\r")^1
local continue=P("\\")*newline
local spaces=S(" \t")+continue
@@ -228,6 +229,14 @@ local patterns={}
local definitions={}
local resolve
local subparser
+local report_lua=function(...)
+ if logs and logs.reporter then
+ report_lua=logs.reporter("system","lua")
+ report_lua(...)
+ else
+ print(format(...))
+ end
+end
resolve=C(C(name)*arguments^-1)/function(raw,s,a)
local d=definitions[s]
if d then
@@ -334,6 +343,61 @@ end
function macros.resolving()
return next(patterns)
end
+local function loaded(name,trace,detail)
+ local f=io.open(name,"rb")
+ if not f then
+ return false,format("file '%s' not found",name)
+ end
+ local c=f:read("*a")
+ if not c then
+ return false,format("file '%s' is invalid",name)
+ end
+ f:close()
+ local n=lpegmatch(parser,c)
+ if trace then
+ if #n~=#c then
+ report_lua("macros expanded in '%s' (%i => %i bytes)",name,#c,#n)
+ if detail then
+ report_lua()
+ report_lua(n)
+ report_lua()
+ end
+ elseif detail then
+ report_lua("no macros expanded in '%s'",name)
+ end
+ end
+ if #name>30 then
+ n="--[["..sub(name,-30).."]] "..n
+ else
+ n="--[["..name.."]] "..n
+ end
+ return load(n)
+end
+macros.loaded=loaded
+function required(name,trace)
+ local filename=file.addsuffix(name,"lua")
+ local fullname=resolvers and resolvers.find_file(filename) or filename
+ if not fullname or fullname=="" then
+ return false
+ end
+ local codeblob=package.loaded[fullname]
+ if codeblob then
+ return codeblob
+ end
+ local code,message=loaded(fullname,macros,trace,trace)
+ if type(code)=="function" then
+ code=code()
+ else
+ report_lua("error when loading '%s'",fullname)
+ return false,message
+ end
+ if code==nil then
+ code=false
+ end
+ package.loaded[fullname]=code
+ return code
+end
+macros.required=required
end -- of closure
@@ -609,7 +673,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-package"] = package.loaded["l-package"] or true
--- original size: 11564, stripped down to: 8625
+-- original size: 11562, stripped down to: 8625
if not modules then modules={} end modules ['l-package']={
version=1.001,
@@ -620,10 +684,10 @@ if not modules then modules={} end modules ['l-package']={
}
local type=type
local gsub,format,find=string.gsub,string.format,string.find
+local insert,remove=table.insert,table.remove
local P,S,Cs,lpegmatch=lpeg.P,lpeg.S,lpeg.Cs,lpeg.match
local package=package
local searchers=package.searchers or package.loaders
-local insert,remove=table.insert,table.remove
local filejoin=file and file.join or function(path,name) return path.."/"..name end
local isreadable=file and file.is_readable or function(name) local f=io.open(name) if f then f:close() return true end end
local addsuffix=file and file.addsuffix or function(name,suffix) return name.."."..suffix end
@@ -9200,7 +9264,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 32737, stripped down to: 22946
+-- original size: 32923, stripped down to: 23011
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -9210,13 +9274,15 @@ if not modules then modules={} end modules ['trac-log']={
license="see context related readme files"
}
local next,type,select,print=next,type,select,print
-local write_nl,write=texio and texio.write_nl or print,texio and texio.write or io.write
local format,gmatch,find=string.format,string.gmatch,string.find
local concat,insert,remove=table.concat,table.insert,table.remove
local topattern=string.topattern
local utfchar=utf.char
local datetime=os.date
local openfile=io.open
+local runningtex=tex and (tex.jobname or tex.formatname)
+local write_nl=runningtex and texio and texio.write_nl or print
+local write=runningtex and texio and texio.write or io.write
local setmetatableindex=table.setmetatableindex
local formatters=string.formatters
local settings_to_hash=utilities.parsers.settings_to_hash
@@ -9243,7 +9309,7 @@ local function ignore() end
setmetatableindex(logs,function(t,k) t[k]=ignore;return ignore end)
local report,subreport,status,settarget,setformats,settranslations
local direct,subdirect,writer,pushtarget,poptarget,setlogfile,settimedlog,setprocessor,setformatters,newline
-if tex and (tex.jobname or tex.formatname) then
+if runningtex then
if texio.setescape then
texio.setescape(0)
end
@@ -10427,7 +10493,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-lua"] = package.loaded["util-lua"] or true
--- original size: 6921, stripped down to: 4998
+-- original size: 6621, stripped down to: 4764
if not modules then modules={} end modules ['util-lua']={
version=1.001,
@@ -10463,7 +10529,7 @@ luautilities.suffixes={
tua="tua",
tuc="tuc",
}
-local function register(name)
+local function register(name)
if tracestripping then
report_lua("stripped bytecode from %a",name or "unknown")
end
@@ -10491,17 +10557,12 @@ local function stupidcompile(luafile,lucfile,strip)
end
function luautilities.loadedluacode(fullname,forcestrip,name,macros)
name=name or fullname
- local code,message
if macros then
macros=lua.macros
end
- if macros and macros.enabled then
- local f=io.open(fullname,"rb") local c=f:read("*a") f:close()
- local n=c and macros.resolvestring("--[["..fullname.."]] "..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)
+ local code,message
+ if macros then
+ code,message=macros.loaded(fullname,true,false)
else
code,message=loadfile(fullname)
end
@@ -21234,8 +21295,8 @@ end -- of closure
-- used libraries : l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 874888
--- stripped bytes : 317568
+-- original bytes : 876639
+-- stripped bytes : 317934
-- end library merge
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index cec16c7e5..1a470244a 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -195,7 +195,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-macro"] = package.loaded["l-macro"] or true
--- original size: 6393, stripped down to: 3659
+-- original size: 8260, stripped down to: 5213
if not modules then modules={} end modules ['l-macros']={
version=1.001,
@@ -207,7 +207,8 @@ if not modules then modules={} end modules ['l-macros']={
local S,P,R,V,C,Cs,Cc,Ct,Carg=lpeg.S,lpeg.P,lpeg.R,lpeg.V,lpeg.C,lpeg.Cs,lpeg.Cc,lpeg.Ct,lpeg.Carg
local lpegmatch=lpeg.match
local concat=table.concat
-local next=next
+local format,sub=string.format,string.sub
+local next,load,type=next,load,type
local newline=S("\n\r")^1
local continue=P("\\")*newline
local spaces=S(" \t")+continue
@@ -228,6 +229,14 @@ local patterns={}
local definitions={}
local resolve
local subparser
+local report_lua=function(...)
+ if logs and logs.reporter then
+ report_lua=logs.reporter("system","lua")
+ report_lua(...)
+ else
+ print(format(...))
+ end
+end
resolve=C(C(name)*arguments^-1)/function(raw,s,a)
local d=definitions[s]
if d then
@@ -334,6 +343,61 @@ end
function macros.resolving()
return next(patterns)
end
+local function loaded(name,trace,detail)
+ local f=io.open(name,"rb")
+ if not f then
+ return false,format("file '%s' not found",name)
+ end
+ local c=f:read("*a")
+ if not c then
+ return false,format("file '%s' is invalid",name)
+ end
+ f:close()
+ local n=lpegmatch(parser,c)
+ if trace then
+ if #n~=#c then
+ report_lua("macros expanded in '%s' (%i => %i bytes)",name,#c,#n)
+ if detail then
+ report_lua()
+ report_lua(n)
+ report_lua()
+ end
+ elseif detail then
+ report_lua("no macros expanded in '%s'",name)
+ end
+ end
+ if #name>30 then
+ n="--[["..sub(name,-30).."]] "..n
+ else
+ n="--[["..name.."]] "..n
+ end
+ return load(n)
+end
+macros.loaded=loaded
+function required(name,trace)
+ local filename=file.addsuffix(name,"lua")
+ local fullname=resolvers and resolvers.find_file(filename) or filename
+ if not fullname or fullname=="" then
+ return false
+ end
+ local codeblob=package.loaded[fullname]
+ if codeblob then
+ return codeblob
+ end
+ local code,message=loaded(fullname,macros,trace,trace)
+ if type(code)=="function" then
+ code=code()
+ else
+ report_lua("error when loading '%s'",fullname)
+ return false,message
+ end
+ if code==nil then
+ code=false
+ end
+ package.loaded[fullname]=code
+ return code
+end
+macros.required=required
end -- of closure
@@ -609,7 +673,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-package"] = package.loaded["l-package"] or true
--- original size: 11564, stripped down to: 8625
+-- original size: 11562, stripped down to: 8625
if not modules then modules={} end modules ['l-package']={
version=1.001,
@@ -620,10 +684,10 @@ if not modules then modules={} end modules ['l-package']={
}
local type=type
local gsub,format,find=string.gsub,string.format,string.find
+local insert,remove=table.insert,table.remove
local P,S,Cs,lpegmatch=lpeg.P,lpeg.S,lpeg.Cs,lpeg.match
local package=package
local searchers=package.searchers or package.loaders
-local insert,remove=table.insert,table.remove
local filejoin=file and file.join or function(path,name) return path.."/"..name end
local isreadable=file and file.is_readable or function(name) local f=io.open(name) if f then f:close() return true end end
local addsuffix=file and file.addsuffix or function(name,suffix) return name.."."..suffix end
@@ -9200,7 +9264,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 32737, stripped down to: 22946
+-- original size: 32923, stripped down to: 23011
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -9210,13 +9274,15 @@ if not modules then modules={} end modules ['trac-log']={
license="see context related readme files"
}
local next,type,select,print=next,type,select,print
-local write_nl,write=texio and texio.write_nl or print,texio and texio.write or io.write
local format,gmatch,find=string.format,string.gmatch,string.find
local concat,insert,remove=table.concat,table.insert,table.remove
local topattern=string.topattern
local utfchar=utf.char
local datetime=os.date
local openfile=io.open
+local runningtex=tex and (tex.jobname or tex.formatname)
+local write_nl=runningtex and texio and texio.write_nl or print
+local write=runningtex and texio and texio.write or io.write
local setmetatableindex=table.setmetatableindex
local formatters=string.formatters
local settings_to_hash=utilities.parsers.settings_to_hash
@@ -9243,7 +9309,7 @@ local function ignore() end
setmetatableindex(logs,function(t,k) t[k]=ignore;return ignore end)
local report,subreport,status,settarget,setformats,settranslations
local direct,subdirect,writer,pushtarget,poptarget,setlogfile,settimedlog,setprocessor,setformatters,newline
-if tex and (tex.jobname or tex.formatname) then
+if runningtex then
if texio.setescape then
texio.setescape(0)
end
@@ -10427,7 +10493,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-lua"] = package.loaded["util-lua"] or true
--- original size: 6921, stripped down to: 4998
+-- original size: 6621, stripped down to: 4764
if not modules then modules={} end modules ['util-lua']={
version=1.001,
@@ -10463,7 +10529,7 @@ luautilities.suffixes={
tua="tua",
tuc="tuc",
}
-local function register(name)
+local function register(name)
if tracestripping then
report_lua("stripped bytecode from %a",name or "unknown")
end
@@ -10491,17 +10557,12 @@ local function stupidcompile(luafile,lucfile,strip)
end
function luautilities.loadedluacode(fullname,forcestrip,name,macros)
name=name or fullname
- local code,message
if macros then
macros=lua.macros
end
- if macros and macros.enabled then
- local f=io.open(fullname,"rb") local c=f:read("*a") f:close()
- local n=c and macros.resolvestring("--[["..fullname.."]] "..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)
+ local code,message
+ if macros then
+ code,message=macros.loaded(fullname,true,false)
else
code,message=loadfile(fullname)
end
@@ -21234,8 +21295,8 @@ end -- of closure
-- used libraries : l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 874888
--- stripped bytes : 317568
+-- original bytes : 876639
+-- stripped bytes : 317934
-- end library merge
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index cec16c7e5..1a470244a 100644
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -195,7 +195,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-macro"] = package.loaded["l-macro"] or true
--- original size: 6393, stripped down to: 3659
+-- original size: 8260, stripped down to: 5213
if not modules then modules={} end modules ['l-macros']={
version=1.001,
@@ -207,7 +207,8 @@ if not modules then modules={} end modules ['l-macros']={
local S,P,R,V,C,Cs,Cc,Ct,Carg=lpeg.S,lpeg.P,lpeg.R,lpeg.V,lpeg.C,lpeg.Cs,lpeg.Cc,lpeg.Ct,lpeg.Carg
local lpegmatch=lpeg.match
local concat=table.concat
-local next=next
+local format,sub=string.format,string.sub
+local next,load,type=next,load,type
local newline=S("\n\r")^1
local continue=P("\\")*newline
local spaces=S(" \t")+continue
@@ -228,6 +229,14 @@ local patterns={}
local definitions={}
local resolve
local subparser
+local report_lua=function(...)
+ if logs and logs.reporter then
+ report_lua=logs.reporter("system","lua")
+ report_lua(...)
+ else
+ print(format(...))
+ end
+end
resolve=C(C(name)*arguments^-1)/function(raw,s,a)
local d=definitions[s]
if d then
@@ -334,6 +343,61 @@ end
function macros.resolving()
return next(patterns)
end
+local function loaded(name,trace,detail)
+ local f=io.open(name,"rb")
+ if not f then
+ return false,format("file '%s' not found",name)
+ end
+ local c=f:read("*a")
+ if not c then
+ return false,format("file '%s' is invalid",name)
+ end
+ f:close()
+ local n=lpegmatch(parser,c)
+ if trace then
+ if #n~=#c then
+ report_lua("macros expanded in '%s' (%i => %i bytes)",name,#c,#n)
+ if detail then
+ report_lua()
+ report_lua(n)
+ report_lua()
+ end
+ elseif detail then
+ report_lua("no macros expanded in '%s'",name)
+ end
+ end
+ if #name>30 then
+ n="--[["..sub(name,-30).."]] "..n
+ else
+ n="--[["..name.."]] "..n
+ end
+ return load(n)
+end
+macros.loaded=loaded
+function required(name,trace)
+ local filename=file.addsuffix(name,"lua")
+ local fullname=resolvers and resolvers.find_file(filename) or filename
+ if not fullname or fullname=="" then
+ return false
+ end
+ local codeblob=package.loaded[fullname]
+ if codeblob then
+ return codeblob
+ end
+ local code,message=loaded(fullname,macros,trace,trace)
+ if type(code)=="function" then
+ code=code()
+ else
+ report_lua("error when loading '%s'",fullname)
+ return false,message
+ end
+ if code==nil then
+ code=false
+ end
+ package.loaded[fullname]=code
+ return code
+end
+macros.required=required
end -- of closure
@@ -609,7 +673,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-package"] = package.loaded["l-package"] or true
--- original size: 11564, stripped down to: 8625
+-- original size: 11562, stripped down to: 8625
if not modules then modules={} end modules ['l-package']={
version=1.001,
@@ -620,10 +684,10 @@ if not modules then modules={} end modules ['l-package']={
}
local type=type
local gsub,format,find=string.gsub,string.format,string.find
+local insert,remove=table.insert,table.remove
local P,S,Cs,lpegmatch=lpeg.P,lpeg.S,lpeg.Cs,lpeg.match
local package=package
local searchers=package.searchers or package.loaders
-local insert,remove=table.insert,table.remove
local filejoin=file and file.join or function(path,name) return path.."/"..name end
local isreadable=file and file.is_readable or function(name) local f=io.open(name) if f then f:close() return true end end
local addsuffix=file and file.addsuffix or function(name,suffix) return name.."."..suffix end
@@ -9200,7 +9264,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 32737, stripped down to: 22946
+-- original size: 32923, stripped down to: 23011
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -9210,13 +9274,15 @@ if not modules then modules={} end modules ['trac-log']={
license="see context related readme files"
}
local next,type,select,print=next,type,select,print
-local write_nl,write=texio and texio.write_nl or print,texio and texio.write or io.write
local format,gmatch,find=string.format,string.gmatch,string.find
local concat,insert,remove=table.concat,table.insert,table.remove
local topattern=string.topattern
local utfchar=utf.char
local datetime=os.date
local openfile=io.open
+local runningtex=tex and (tex.jobname or tex.formatname)
+local write_nl=runningtex and texio and texio.write_nl or print
+local write=runningtex and texio and texio.write or io.write
local setmetatableindex=table.setmetatableindex
local formatters=string.formatters
local settings_to_hash=utilities.parsers.settings_to_hash
@@ -9243,7 +9309,7 @@ local function ignore() end
setmetatableindex(logs,function(t,k) t[k]=ignore;return ignore end)
local report,subreport,status,settarget,setformats,settranslations
local direct,subdirect,writer,pushtarget,poptarget,setlogfile,settimedlog,setprocessor,setformatters,newline
-if tex and (tex.jobname or tex.formatname) then
+if runningtex then
if texio.setescape then
texio.setescape(0)
end
@@ -10427,7 +10493,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-lua"] = package.loaded["util-lua"] or true
--- original size: 6921, stripped down to: 4998
+-- original size: 6621, stripped down to: 4764
if not modules then modules={} end modules ['util-lua']={
version=1.001,
@@ -10463,7 +10529,7 @@ luautilities.suffixes={
tua="tua",
tuc="tuc",
}
-local function register(name)
+local function register(name)
if tracestripping then
report_lua("stripped bytecode from %a",name or "unknown")
end
@@ -10491,17 +10557,12 @@ local function stupidcompile(luafile,lucfile,strip)
end
function luautilities.loadedluacode(fullname,forcestrip,name,macros)
name=name or fullname
- local code,message
if macros then
macros=lua.macros
end
- if macros and macros.enabled then
- local f=io.open(fullname,"rb") local c=f:read("*a") f:close()
- local n=c and macros.resolvestring("--[["..fullname.."]] "..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)
+ local code,message
+ if macros then
+ code,message=macros.loaded(fullname,true,false)
else
code,message=loadfile(fullname)
end
@@ -21234,8 +21295,8 @@ end -- of closure
-- used libraries : l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 874888
--- stripped bytes : 317568
+-- original bytes : 876639
+-- stripped bytes : 317934
-- end library merge
diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua
index cec16c7e5..1a470244a 100644
--- a/scripts/context/stubs/win64/mtxrun.lua
+++ b/scripts/context/stubs/win64/mtxrun.lua
@@ -195,7 +195,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-macro"] = package.loaded["l-macro"] or true
--- original size: 6393, stripped down to: 3659
+-- original size: 8260, stripped down to: 5213
if not modules then modules={} end modules ['l-macros']={
version=1.001,
@@ -207,7 +207,8 @@ if not modules then modules={} end modules ['l-macros']={
local S,P,R,V,C,Cs,Cc,Ct,Carg=lpeg.S,lpeg.P,lpeg.R,lpeg.V,lpeg.C,lpeg.Cs,lpeg.Cc,lpeg.Ct,lpeg.Carg
local lpegmatch=lpeg.match
local concat=table.concat
-local next=next
+local format,sub=string.format,string.sub
+local next,load,type=next,load,type
local newline=S("\n\r")^1
local continue=P("\\")*newline
local spaces=S(" \t")+continue
@@ -228,6 +229,14 @@ local patterns={}
local definitions={}
local resolve
local subparser
+local report_lua=function(...)
+ if logs and logs.reporter then
+ report_lua=logs.reporter("system","lua")
+ report_lua(...)
+ else
+ print(format(...))
+ end
+end
resolve=C(C(name)*arguments^-1)/function(raw,s,a)
local d=definitions[s]
if d then
@@ -334,6 +343,61 @@ end
function macros.resolving()
return next(patterns)
end
+local function loaded(name,trace,detail)
+ local f=io.open(name,"rb")
+ if not f then
+ return false,format("file '%s' not found",name)
+ end
+ local c=f:read("*a")
+ if not c then
+ return false,format("file '%s' is invalid",name)
+ end
+ f:close()
+ local n=lpegmatch(parser,c)
+ if trace then
+ if #n~=#c then
+ report_lua("macros expanded in '%s' (%i => %i bytes)",name,#c,#n)
+ if detail then
+ report_lua()
+ report_lua(n)
+ report_lua()
+ end
+ elseif detail then
+ report_lua("no macros expanded in '%s'",name)
+ end
+ end
+ if #name>30 then
+ n="--[["..sub(name,-30).."]] "..n
+ else
+ n="--[["..name.."]] "..n
+ end
+ return load(n)
+end
+macros.loaded=loaded
+function required(name,trace)
+ local filename=file.addsuffix(name,"lua")
+ local fullname=resolvers and resolvers.find_file(filename) or filename
+ if not fullname or fullname=="" then
+ return false
+ end
+ local codeblob=package.loaded[fullname]
+ if codeblob then
+ return codeblob
+ end
+ local code,message=loaded(fullname,macros,trace,trace)
+ if type(code)=="function" then
+ code=code()
+ else
+ report_lua("error when loading '%s'",fullname)
+ return false,message
+ end
+ if code==nil then
+ code=false
+ end
+ package.loaded[fullname]=code
+ return code
+end
+macros.required=required
end -- of closure
@@ -609,7 +673,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-package"] = package.loaded["l-package"] or true
--- original size: 11564, stripped down to: 8625
+-- original size: 11562, stripped down to: 8625
if not modules then modules={} end modules ['l-package']={
version=1.001,
@@ -620,10 +684,10 @@ if not modules then modules={} end modules ['l-package']={
}
local type=type
local gsub,format,find=string.gsub,string.format,string.find
+local insert,remove=table.insert,table.remove
local P,S,Cs,lpegmatch=lpeg.P,lpeg.S,lpeg.Cs,lpeg.match
local package=package
local searchers=package.searchers or package.loaders
-local insert,remove=table.insert,table.remove
local filejoin=file and file.join or function(path,name) return path.."/"..name end
local isreadable=file and file.is_readable or function(name) local f=io.open(name) if f then f:close() return true end end
local addsuffix=file and file.addsuffix or function(name,suffix) return name.."."..suffix end
@@ -9200,7 +9264,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 32737, stripped down to: 22946
+-- original size: 32923, stripped down to: 23011
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -9210,13 +9274,15 @@ if not modules then modules={} end modules ['trac-log']={
license="see context related readme files"
}
local next,type,select,print=next,type,select,print
-local write_nl,write=texio and texio.write_nl or print,texio and texio.write or io.write
local format,gmatch,find=string.format,string.gmatch,string.find
local concat,insert,remove=table.concat,table.insert,table.remove
local topattern=string.topattern
local utfchar=utf.char
local datetime=os.date
local openfile=io.open
+local runningtex=tex and (tex.jobname or tex.formatname)
+local write_nl=runningtex and texio and texio.write_nl or print
+local write=runningtex and texio and texio.write or io.write
local setmetatableindex=table.setmetatableindex
local formatters=string.formatters
local settings_to_hash=utilities.parsers.settings_to_hash
@@ -9243,7 +9309,7 @@ local function ignore() end
setmetatableindex(logs,function(t,k) t[k]=ignore;return ignore end)
local report,subreport,status,settarget,setformats,settranslations
local direct,subdirect,writer,pushtarget,poptarget,setlogfile,settimedlog,setprocessor,setformatters,newline
-if tex and (tex.jobname or tex.formatname) then
+if runningtex then
if texio.setescape then
texio.setescape(0)
end
@@ -10427,7 +10493,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-lua"] = package.loaded["util-lua"] or true
--- original size: 6921, stripped down to: 4998
+-- original size: 6621, stripped down to: 4764
if not modules then modules={} end modules ['util-lua']={
version=1.001,
@@ -10463,7 +10529,7 @@ luautilities.suffixes={
tua="tua",
tuc="tuc",
}
-local function register(name)
+local function register(name)
if tracestripping then
report_lua("stripped bytecode from %a",name or "unknown")
end
@@ -10491,17 +10557,12 @@ local function stupidcompile(luafile,lucfile,strip)
end
function luautilities.loadedluacode(fullname,forcestrip,name,macros)
name=name or fullname
- local code,message
if macros then
macros=lua.macros
end
- if macros and macros.enabled then
- local f=io.open(fullname,"rb") local c=f:read("*a") f:close()
- local n=c and macros.resolvestring("--[["..fullname.."]] "..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)
+ local code,message
+ if macros then
+ code,message=macros.loaded(fullname,true,false)
else
code,message=loadfile(fullname)
end
@@ -21234,8 +21295,8 @@ end -- of closure
-- used libraries : l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 874888
--- stripped bytes : 317568
+-- original bytes : 876639
+-- stripped bytes : 317934
-- end library merge
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 58823af2c..6603bb01f 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2018.03.21 09:16}
+\newcontextversion{2018.03.22 19:41}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii
index 1a4769614..acfda88dc 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2018.03.21 09:16}
+\edef\contextversion{2018.03.22 19:41}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index cb7607eac..10ae9d1df 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2018.03.21 09:16}
+\newcontextversion{2018.03.22 19:41}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index f786d1d0c..cef988ce7 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -42,7 +42,7 @@
%D has to match \type {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2018.03.21 09:16}
+\edef\contextversion{2018.03.22 19:41}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua
index 3e338f614..25083dfce 100644
--- a/tex/context/base/mkiv/font-ots.lua
+++ b/tex/context/base/mkiv/font-ots.lua
@@ -936,7 +936,7 @@ function handlers.gpos_pair(head,start,dataset,sequence,kerns,rlmode,skiphash,st
elseif b then -- #b > 0
local x, y, w, h = setposition(2,snext,factor,rlmode,b,injection)
if trace_kerns then
- local startchar = getchar(snext)
+ local startchar = getchar(start)
logprocess("%s: shifting second of pair %s and %s by xy (%p,%p) and wh (%p,%p) as %s",pref(dataset,sequence),gref(startchar),gref(nextchar),x,y,w,h,injection or "injections")
end
start = snext -- cf spec
diff --git a/tex/context/base/mkiv/l-macro.lua b/tex/context/base/mkiv/l-macro.lua
index d2b8c7ae4..30c7cbec6 100644
--- a/tex/context/base/mkiv/l-macro.lua
+++ b/tex/context/base/mkiv/l-macro.lua
@@ -14,7 +14,8 @@ if not modules then modules = { } end modules ['l-macros'] = {
local S, P, R, V, C, Cs, Cc, Ct, Carg = lpeg.S, lpeg.P, lpeg.R, lpeg.V, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.Ct, lpeg.Carg
local lpegmatch = lpeg.match
local concat = table.concat
-local next = next
+local format, sub = string.format, string.sub
+local next, load, type = next, load, type
local newline = S("\n\r")^1
local continue = P("\\") * newline
@@ -41,6 +42,15 @@ local definitions = { }
local resolve
local subparser
+local report_lua = function(...)
+ if logs and logs.reporter then
+ report_lua = logs.reporter("system","lua")
+ report_lua(...)
+ else
+ print(format(...))
+ end
+end
+
-- todo: zero case
resolve = C(C(name) * arguments^-1) / function(raw,s,a)
@@ -160,6 +170,66 @@ function macros.resolving()
return next(patterns)
end
+local function loaded(name,trace,detail)
+ -- local c = io.loaddata(fullname) -- not yet available
+ local f = io.open(name,"rb")
+ if not f then
+ return false, format("file '%s' not found",name)
+ end
+ local c = f:read("*a")
+ if not c then
+ return false, format("file '%s' is invalid",name)
+ end
+ f:close()
+ local n = lpegmatch(parser,c)
+ if trace then
+ if #n ~= #c then
+ report_lua("macros expanded in '%s' (%i => %i bytes)",name,#c,#n)
+ if detail then
+ report_lua()
+ report_lua(n)
+ report_lua()
+ end
+ elseif detail then
+ report_lua("no macros expanded in '%s'",name)
+ end
+ end
+ if #name > 30 then
+ n = "--[[" .. sub(name,-30) .. "]] " .. n
+ else
+ n = "--[[" .. name .. "]] " .. n
+ end
+ return load(n)
+end
+
+macros.loaded = loaded
+
+function required(name,trace)
+ local filename = file.addsuffix(name,"lua")
+ local fullname = resolvers and resolvers.find_file(filename) or filename
+ if not fullname or fullname == "" then
+ return false
+ end
+ local codeblob = package.loaded[fullname]
+ if codeblob then
+ return codeblob
+ end
+ local code, message = loaded(fullname,macros,trace,trace)
+ if type(code) == "function" then
+ code = code()
+ else
+ report_lua("error when loading '%s'",fullname)
+ return false, message
+ end
+ if code == nil then
+ code = false
+ end
+ package.loaded[fullname] = code
+ return code
+end
+
+macros.required = required
+
-- local str = [[
-- #define check(p,q) (p ~= 0) and (p > q)
--
diff --git a/tex/context/base/mkiv/l-package.lua b/tex/context/base/mkiv/l-package.lua
index d43c5c5c6..4faee76bf 100644
--- a/tex/context/base/mkiv/l-package.lua
+++ b/tex/context/base/mkiv/l-package.lua
@@ -18,12 +18,12 @@ if not modules then modules = { } end modules ['l-package'] = {
local type = type
local gsub, format, find = string.gsub, string.format, string.find
+local insert, remove = table.insert, table.remove
local P, S, Cs, lpegmatch = lpeg.P, lpeg.S, lpeg.Cs, lpeg.match
-local package = package
-local searchers = package.searchers or package.loaders
-local insert, remove = table.insert, table.remove
+local package = package
+local searchers = package.searchers or package.loaders
-------.loaders = nil -- old stuff that we don't want
-------.seeall = nil -- old stuff that we don't want
diff --git a/tex/context/base/mkiv/lpdf-epd.lua b/tex/context/base/mkiv/lpdf-epd.lua
index 2fcd28473..cf02b5a22 100644
--- a/tex/context/base/mkiv/lpdf-epd.lua
+++ b/tex/context/base/mkiv/lpdf-epd.lua
@@ -374,6 +374,8 @@ local function get_array(object,document)
end
end
+-- todo: collect chunks
+
local function streamaccess(s,_,what)
if not what or what == "all" or what == "*all" then
local t, n = { }, 0
diff --git a/tex/context/base/mkiv/lpdf-ini.lua b/tex/context/base/mkiv/lpdf-ini.lua
index f8cff2032..8af1fb409 100644
--- a/tex/context/base/mkiv/lpdf-ini.lua
+++ b/tex/context/base/mkiv/lpdf-ini.lua
@@ -1082,10 +1082,28 @@ end
do
+ -- It's a bit of a historical mess here.
+
+ local metadata = nil
local timestamp = backends.timestamp()
- function lpdf.timestamp()
- return timestamp
+ function lpdf.getmetadata()
+ if not metadata then
+ local contextversion = environment.version
+ local luatexversion = format("%1.2f",LUATEXVERSION)
+ local luatexfunctionality = tostring(LUATEXFUNCTIONALITY)
+ metadata = {
+ producer = format("LuaTeX-%s",luatexversion),
+ creator = format("LuaTeX %s %s + ConTeXt MkIV %s",luatexversion,luatexfunctionality,contextversion),
+ luatexversion = luatexversion,
+ contextversion = contextversion,
+ luatexfunctionality = luatexfunctionality,
+ luaversion = tostring(LUAVERSION),
+ platform = os.platform,
+ time = timestamp,
+ }
+ end
+ return metadata
end
function lpdf.settime(n)
@@ -1096,6 +1114,9 @@ do
timestamp = backends.timestamp()
end
end
+ if metadata then
+ metadata.time = timestamp
+ end
return timestamp
end
@@ -1107,10 +1128,11 @@ do
end
function lpdf.id(nodate)
+ local banner = environment.jobname or tex.jobname or "unknown"
if nodate then
- return tex.jobname
+ return banner
else
- return format("%s.%s",tex.jobname,timestamp)
+ return format("%s.%s",banner,timestamp)
end
end
diff --git a/tex/context/base/mkiv/lpdf-mis.lua b/tex/context/base/mkiv/lpdf-mis.lua
index 07dc3dcf1..6d1b09ca0 100644
--- a/tex/context/base/mkiv/lpdf-mis.lua
+++ b/tex/context/base/mkiv/lpdf-mis.lua
@@ -52,6 +52,8 @@ local addtoinfo = lpdf.addtoinfo
local addtopageattributes = lpdf.addtopageattributes
local addtonames = lpdf.addtonames
+local pdfgetmetadata = lpdf.getmetadata
+
local variables = interfaces.variables
local v_stop = variables.stop
@@ -189,6 +191,12 @@ local done = false -- using "setupidentity = function() end" fails as the meani
local function setupidentity()
if not done then
+ local metadata = pdfgetmetadata()
+ local creator = metadata.creator
+ local version = metadata.contextversion
+ local time = metadata.time
+ local jobname = environment.jobname or tex.jobname or "unknown"
+ --
local title = identity.title
if not title or title == "" then
title = tex.jobname
@@ -202,21 +210,16 @@ local function setupidentity()
if author ~= "" then
addtoinfo("Author", pdfunicode(author), author) -- '/Author' in /Info, 'Creator' in XMP
end
- -- local creator = identity.creator or ""
- local creator = "LuaTeX + ConTeXt MkIV" -- has to be the same in CreatorTool
- if creator ~= "" then
- addtoinfo("Creator", pdfunicode(creator), creator) -- '/Creator' in /Info, 'CreatorTool' in XMP
- end
- local currenttimestamp = lpdf.timestamp()
- addtoinfo("CreationDate", pdfstring(formattedtimestamp(currenttimestamp)))
+ addtoinfo("Creator", pdfunicode(creator), creator)
+ addtoinfo("CreationDate", pdfstring(formattedtimestamp(time)))
local date = identity.date or ""
- local pdfdate = formattedtimestamp(date)
+ local pdfdate = date and formattedtimestamp(date)
if pdfdate then
addtoinfo("ModDate", pdfstring(pdfdate), date)
else
-- users should enter the date in 2010-01-19T23:27:50+01:00 format
-- and if not provided that way we use the creation time instead
- addtoinfo("ModDate", pdfstring(formattedtimestamp(currenttimestamp)), currenttimestamp)
+ addtoinfo("ModDate", pdfstring(formattedtimestamp(time)),time)
end
local keywords = identity.keywords or ""
if keywords ~= "" then
@@ -226,11 +229,12 @@ local function setupidentity()
local id = lpdf.id()
addtoinfo("ID", pdfstring(id), id) -- needed for pdf/x
--
- addtoinfo("ConTeXt.Version", environment.version)
- addtoinfo("ConTeXt.Time", os.date("%Y-%m-%d %H:%M"))
- addtoinfo("ConTeXt.Jobname", environment.jobname or tex.jobname)
- addtoinfo("ConTeXt.Url", "www.pragma-ade.com")
- addtoinfo("ConTeXt.Support", "contextgarden.net")
+ addtoinfo("ConTeXt.Version",version)
+ addtoinfo("ConTeXt.Time",os.date("%Y-%m-%d %H:%M"))
+ addtoinfo("ConTeXt.Jobname",jobname)
+ addtoinfo("ConTeXt.Url","www.pragma-ade.com")
+ addtoinfo("ConTeXt.Support","contextgarden.net")
+ addtoinfo("TeX.Support","tug.org")
--
done = true
else
diff --git a/tex/context/base/mkiv/lpdf-pda.xml b/tex/context/base/mkiv/lpdf-pda.xml
index 78ad47f21..efdfc4d7d 100644
--- a/tex/context/base/mkiv/lpdf-pda.xml
+++ b/tex/context/base/mkiv/lpdf-pda.xml
@@ -24,12 +24,17 @@
</dc:title>
</rdf:Description>
<rdf:Description rdf:about="" xmlns:pdfx="http://ns.adobe.com/pdfx/1.3/">
+ <pdfx:ID/>
<pdfx:ConTeXt.Jobname/>
<pdfx:ConTeXt.Time/>
<pdfx:ConTeXt.Url/>
+ <pdfx:ConTeXt.Support/>
<pdfx:ConTeXt.Version/>
- <pdfx:ID/>
- <pdfx:PTEX.Fullbanner/>
+ <pdfx:TeX.Support/>
+ <pdfx:LuaTeX.Version/>
+ <pdfx:LuaTeX.Functionality/>
+ <pdfx:LuaTeX.LuaVersion/>
+ <pdfx:LuaTeX.Platform/>
</rdf:Description>
<rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/">
<xmp:CreateDate/>
diff --git a/tex/context/base/mkiv/lpdf-pdx.xml b/tex/context/base/mkiv/lpdf-pdx.xml
index d55e1fdf3..889862c76 100644
--- a/tex/context/base/mkiv/lpdf-pdx.xml
+++ b/tex/context/base/mkiv/lpdf-pdx.xml
@@ -23,12 +23,17 @@
</dc:title>
</rdf:Description>
<rdf:Description rdf:about="" xmlns:pdfx="http://ns.adobe.com/pdfx/1.3/">
+ <pdfx:ID/>
<pdfx:ConTeXt.Jobname/>
<pdfx:ConTeXt.Time/>
<pdfx:ConTeXt.Url/>
+ <pdfx:ConTeXt.Support/>
<pdfx:ConTeXt.Version/>
- <pdfx:ID/>
- <pdfx:PTEX.Fullbanner/>
+ <pdfx:TeX.Support/>
+ <pdfx:LuaTeX.Version/>
+ <pdfx:LuaTeX.Functionality/>
+ <pdfx:LuaTeX.LuaVersion/>
+ <pdfx:LuaTeX.Platform/>
</rdf:Description>
<rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/">
<xmp:CreateDate/>
diff --git a/tex/context/base/mkiv/lpdf-pua.xml b/tex/context/base/mkiv/lpdf-pua.xml
index c50e1f05b..f985b54d3 100644
--- a/tex/context/base/mkiv/lpdf-pua.xml
+++ b/tex/context/base/mkiv/lpdf-pua.xml
@@ -23,12 +23,17 @@
</dc:title>
</rdf:Description>
<rdf:Description rdf:about="" xmlns:pdfx="http://ns.adobe.com/pdfx/1.3/">
+ <pdfx:ID/>
<pdfx:ConTeXt.Jobname/>
<pdfx:ConTeXt.Time/>
<pdfx:ConTeXt.Url/>
+ <pdfx:ConTeXt.Support/>
<pdfx:ConTeXt.Version/>
- <pdfx:ID/>
- <pdfx:PTEX.Fullbanner/>
+ <pdfx:TeX.Support/>
+ <pdfx:LuaTeX.Version/>
+ <pdfx:LuaTeX.Functionality/>
+ <pdfx:LuaTeX.LuaVersion/>
+ <pdfx:LuaTeX.Platform/>
</rdf:Description>
<rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/">
<xmp:CreateDate/>
diff --git a/tex/context/base/mkiv/lpdf-xmp.lua b/tex/context/base/mkiv/lpdf-xmp.lua
index 2eb573acb..eb15a3582 100644
--- a/tex/context/base/mkiv/lpdf-xmp.lua
+++ b/tex/context/base/mkiv/lpdf-xmp.lua
@@ -27,6 +27,8 @@ local pdfconstant = lpdf.constant
local pdfreference = lpdf.reference
local pdfflushstreamobject = lpdf.flushstreamobject
+local pdfgetmetadata = lpdf.getmetadata
+
-- The XMP packet wrapper is kind of fixed, see page 10 of XMPSpecificationsPart1.pdf from
-- XMP-Toolkit-SDK-CC201607.zip. So we hardcode the id.
@@ -39,47 +41,52 @@ local xpacket = format ( [[
local mapping = {
-- user defined keys (pdfx:)
- ["ConTeXt.Jobname"] = { "context", "rdf:Description/pdfx:ConTeXt.Jobname" },
- ["ConTeXt.Time"] = { "date", "rdf:Description/pdfx:ConTeXt.Time" },
- ["ConTeXt.Url"] = { "context", "rdf:Description/pdfx:ConTeXt.Url" },
- ["ConTeXt.Version"] = { "context", "rdf:Description/pdfx:ConTeXt.Version" },
- ["ID"] = { "id", "rdf:Description/pdfx:ID" }, -- has date
- ["PTEX.Fullbanner"] = { "metadata","rdf:Description/pdfx:PTEX.Fullbanner" },
+ ["ConTeXt.Jobname"] = { "context", "rdf:Description/pdfx:ConTeXt.Jobname" },
+ ["ConTeXt.Time"] = { "date", "rdf:Description/pdfx:ConTeXt.Time" },
+ ["ConTeXt.Url"] = { "context", "rdf:Description/pdfx:ConTeXt.Url" },
+ ["ConTeXt.Support"] = { "context", "rdf:Description/pdfx:ConTeXt.Support" },
+ ["ConTeXt.Version"] = { "context", "rdf:Description/pdfx:ConTeXt.Version" },
+ ["TeX.Support"] = { "metadata", "rdf:Description/pdfx:TeX.Support" },
+ ["LuaTeX.Version"] = { "metadata","rdf:Description/pdfx:LuaTeX.Version" },
+ ["LuaTeX.Functionality"] = { "metadata","rdf:Description/pdfx:LuaTeX.Functionality" },
+ ["LuaTeX.LuaVersion"] = { "metadata","rdf:Description/pdfx:LuaTeX.LuaVersion" },
+ ["LuaTeX.Platform"] = { "metadata","rdf:Description/pdfx:LuaTeX.Platform" },
+ ["ID"] = { "id", "rdf:Description/pdfx:ID" }, -- has date
-- Adobe PDF schema
- ["Keywords"] = { "metadata","rdf:Description/pdf:Keywords" },
- ["Producer"] = { "metadata","rdf:Description/pdf:Producer" },
- -- ["Trapped"] = { "pdf", "rdf:Description/pdf:Trapped" }, -- '/False' in /Info, but 'False' in XMP
+ ["Keywords"] = { "metadata","rdf:Description/pdf:Keywords" },
+ ["Producer"] = { "metadata","rdf:Description/pdf:Producer" },
+ -- ["Trapped"] = { "pdf", "rdf:Description/pdf:Trapped" }, -- '/False' in /Info, but 'False' in XMP
-- Dublin Core schema
- ["Author"] = { "metadata","rdf:Description/dc:creator/rdf:Seq/rdf:li" },
- ["Format"] = { "metadata","rdf:Description/dc:format" }, -- optional, but nice to have
- ["Subject"] = { "metadata","rdf:Description/dc:description/rdf:Alt/rdf:li" },
- ["Title"] = { "metadata","rdf:Description/dc:title/rdf:Alt/rdf:li" },
+ ["Author"] = { "metadata","rdf:Description/dc:creator/rdf:Seq/rdf:li" },
+ ["Format"] = { "metadata","rdf:Description/dc:format" }, -- optional, but nice to have
+ ["Subject"] = { "metadata","rdf:Description/dc:description/rdf:Alt/rdf:li" },
+ ["Title"] = { "metadata","rdf:Description/dc:title/rdf:Alt/rdf:li" },
-- XMP Basic schema
- ["CreateDate"] = { "date", "rdf:Description/xmp:CreateDate" },
- ["CreationDate"] = { "date", "rdf:Description/xmp:CreationDate" }, -- dummy
- ["Creator"] = { "metadata","rdf:Description/xmp:CreatorTool" },
- ["MetadataDate"] = { "date", "rdf:Description/xmp:MetadataDate" },
- ["ModDate"] = { "date", "rdf:Description/xmp:ModDate" }, -- dummy
- ["ModifyDate"] = { "date", "rdf:Description/xmp:ModifyDate" },
+ ["CreateDate"] = { "date", "rdf:Description/xmp:CreateDate" },
+ ["CreationDate"] = { "date", "rdf:Description/xmp:CreationDate" }, -- dummy
+ ["Creator"] = { "metadata","rdf:Description/xmp:CreatorTool" },
+ ["MetadataDate"] = { "date", "rdf:Description/xmp:MetadataDate" },
+ ["ModDate"] = { "date", "rdf:Description/xmp:ModDate" }, -- dummy
+ ["ModifyDate"] = { "date", "rdf:Description/xmp:ModifyDate" },
-- XMP Media Management schema
- ["DocumentID"] = { "id", "rdf:Description/xmpMM:DocumentID" }, -- uuid
- ["InstanceID"] = { "id", "rdf:Description/xmpMM:InstanceID" }, -- uuid
- ["RenditionClass"] = { "pdf", "rdf:Description/xmpMM:RenditionClass" }, -- PDF/X-4
- ["VersionID"] = { "pdf", "rdf:Description/xmpMM:VersionID" }, -- PDF/X-4
+ ["DocumentID"] = { "id", "rdf:Description/xmpMM:DocumentID" }, -- uuid
+ ["InstanceID"] = { "id", "rdf:Description/xmpMM:InstanceID" }, -- uuid
+ ["RenditionClass"] = { "pdf", "rdf:Description/xmpMM:RenditionClass" }, -- PDF/X-4
+ ["VersionID"] = { "pdf", "rdf:Description/xmpMM:VersionID" }, -- PDF/X-4
-- additional entries
-- PDF/X
- ["GTS_PDFXVersion"] = { "pdf", "rdf:Description/pdfxid:GTS_PDFXVersion" },
+ ["GTS_PDFXVersion"] = { "pdf", "rdf:Description/pdfxid:GTS_PDFXVersion" },
-- optional entries
-- all what is visible in the 'document properties --> additional metadata' window
-- XMP Rights Management schema (optional)
- ["Marked"] = { "pdf", "rdf:Description/xmpRights:Marked" },
- -- ["Owner"] = { "metadata", "rdf:Description/xmpRights:Owner/rdf:Bag/rdf:li" }, -- maybe useful (not visible)
- -- ["UsageTerms"] = { "metadata", "rdf:Description/xmpRights:UsageTerms" }, -- maybe useful (not visible)
- ["WebStatement"] = { "metadata", "rdf:Description/xmpRights:WebStatement" },
+ ["Marked"] = { "pdf", "rdf:Description/xmpRights:Marked" },
+ -- ["Owner"] = { "metadata", "rdf:Description/xmpRights:Owner/rdf:Bag/rdf:li" }, -- maybe useful (not visible)
+ -- ["UsageTerms"] = { "metadata", "rdf:Description/xmpRights:UsageTerms" }, -- maybe useful (not visible)
+ ["WebStatement"] = { "metadata", "rdf:Description/xmpRights:WebStatement" },
-- Photoshop PDF schema (optional)
- ["AuthorsPosition"] = { "metadata", "rdf:Description/photoshop:AuthorsPosition" },
- ["Copyright"] = { "metadata", "rdf:Description/photoshop:Copyright" },
- ["CaptionWriter"] = { "metadata", "rdf:Description/photoshop:CaptionWriter" },
+ ["AuthorsPosition"] = { "metadata", "rdf:Description/photoshop:AuthorsPosition" },
+ ["Copyright"] = { "metadata", "rdf:Description/photoshop:Copyright" },
+ ["CaptionWriter"] = { "metadata", "rdf:Description/photoshop:CaptionWriter" },
}
pdf.setsuppressoptionalinfo(
@@ -100,6 +107,12 @@ local included = backends.included
local pdfsettrailerid = pdf.settrailerid
+local lpdfid = lpdf.id
+
+function lpdf.id() -- overload of ini
+ return lpdfid(included.date)
+end
+
pdf.disablecommand("settrailerid")
function lpdf.settrailerid(v)
@@ -144,14 +157,6 @@ function lpdf.setdates(v)
end
end
-function lpdf.id() -- overload of ini
- local banner = tex.jobname
- if included.date then
- return format("%s.%s",banner,lpdf.timestamp())
- else
- return banner
- end
-end
directives.register("backend.trailerid", lpdf.settrailerid)
directives.register("backend.date", lpdf.setdates)
@@ -251,38 +256,36 @@ local function flushxmpinfo()
commands.pushrandomseed()
commands.setrandomseed(os.time())
- local version = status.luatex_version
- local revision = status.luatex_revision
-
local documentid = "no unique document id here"
local instanceid = "no unique instance id here"
- -- local producer = format("LuaTeX-%i.%02i.%s",math.div(version,100),math.mod(version,100),revision)
- local producer = format("LuaTeX-%0.2f.%s",version/100,revision)
- local creator = "LuaTeX + ConTeXt MkIV"
- local time = lpdf.timestamp()
- local fullbanner = status.banner
+ local metadata = pdfgetmetadata()
+ local time = metadata.time
+ local producer = metadata.producer
+ local creator = metadata.creator
if included.id ~= "fake" then
documentid = "uuid:" .. os.uuid()
instanceid = "uuid:" .. os.uuid()
end
- pdfaddtoinfo("Producer", producer)
- pdfaddtoinfo("Creator", creator)
- pdfaddtoinfo("CreationDate", time)
- pdfaddtoinfo("ModDate", time)
- -- pdfaddtoinfo("PTEX.Fullbanner", fullbanner) -- no checking done on existence
+ pdfaddtoinfo("Producer",producer)
+ pdfaddtoinfo("Creator",creator)
+ pdfaddtoinfo("CreationDate",time)
+ pdfaddtoinfo("ModDate",time)
if add_xmp_blob then
- pdfaddxmpinfo("DocumentID", documentid)
- pdfaddxmpinfo("InstanceID", instanceid)
- pdfaddxmpinfo("Producer", producer)
- pdfaddxmpinfo("CreatorTool", creator)
- pdfaddxmpinfo("CreateDate", time)
- pdfaddxmpinfo("ModifyDate", time)
- pdfaddxmpinfo("MetadataDate", time)
- pdfaddxmpinfo("PTEX.Fullbanner", fullbanner)
+ pdfaddxmpinfo("DocumentID",documentid)
+ pdfaddxmpinfo("InstanceID",instanceid)
+ pdfaddxmpinfo("Producer",producer)
+ pdfaddxmpinfo("CreatorTool",creator)
+ pdfaddxmpinfo("CreateDate",time)
+ pdfaddxmpinfo("ModifyDate",time)
+ pdfaddxmpinfo("MetadataDate",time)
+ pdfaddxmpinfo("LuaTeX.Version",metadata.luatexversion)
+ pdfaddxmpinfo("LuaTeX.Functionality",metadata.luatexfunctionality)
+ pdfaddxmpinfo("LuaTeX.LuaVersion",metadata.luaversion)
+ pdfaddxmpinfo("LuaTeX.Platform",metadata.platform)
local blob = xml.tostring(xml.first(xmp or valid_xmp(),"/x:xmpmeta"))
local md = pdfdictionary {
diff --git a/tex/context/base/mkiv/sort-ini.lua b/tex/context/base/mkiv/sort-ini.lua
index 7cd28d08f..f90b70be5 100644
--- a/tex/context/base/mkiv/sort-ini.lua
+++ b/tex/context/base/mkiv/sort-ini.lua
@@ -53,14 +53,15 @@ have language etc properties that then can be used.</p>
local gsub, find, rep, sub, sort, concat, tohash, format = string.gsub, string.find, string.rep, string.sub, table.sort, table.concat, table.tohash, string.format
local utfbyte, utfchar, utfcharacters, utfvalues = utf.byte, utf.char, utf.characters, utf.values
local next, type, tonumber, rawget, rawset = next, type, tonumber, rawget, rawset
-local P, Cs, R, S, lpegmatch = lpeg.P, lpeg.Cs, lpeg.R, lpeg.S, lpeg.match
+local P, Cs, R, S, lpegmatch, lpegpatterns = lpeg.P, lpeg.Cs, lpeg.R, lpeg.S, lpeg.match, lpeg.patterns
local allocate = utilities.storage.allocate
local setmetatableindex = table.setmetatableindex
-local trace_tests = false trackers.register("sorters.tests", function(v) trace_tests = v end)
-local trace_methods = false trackers.register("sorters.methods", function(v) trace_methods = v end)
-local trace_orders = false trackers.register("sorters.orders", function(v) trace_orders = v end)
+local trace_tests = false trackers.register("sorters.tests", function(v) trace_tests = v end)
+local trace_methods = false trackers.register("sorters.methods", function(v) trace_methods = v end)
+local trace_orders = false trackers.register("sorters.orders", function(v) trace_orders = v end)
+local trace_replacements= false trackers.register("sorters.replacements", function(v) trace_replacements = v end)
local report_sorters = logs.reporter("languages","sorters")
@@ -523,7 +524,7 @@ local function prepare() -- todo: test \Ux{hex}
return pattern
end
-function sorters.strip(str) -- todo: only letters and such
+local function strip(str) -- todo: only letters and such
if str and str ~= "" then
return lpegmatch(pattern or prepare(),str)
else
@@ -531,6 +532,8 @@ function sorters.strip(str) -- todo: only letters and such
end
end
+sorters.strip = strip
+
local function firstofsplit(entry)
-- numbers are left padded by spaces
local split = entry.split
@@ -553,15 +556,35 @@ sorters.firstofsplit = firstofsplit
-- we know what combinations make sense we can optimize this
function splitters.utf(str,checked) -- we could append m and u but this is cleaner, s is for tracing
- if #replacements > 0 then
+ local nofreplacements = #replacements
+ if nofreplacements > 0 then
-- todo make an lpeg for this
- for k=1,#replacements do
- local v = replacements[k]
- local s = v[1]
- if find(str,s) then
- str = gsub(str,s,v[2])
+ local replacer = replacements.replacer
+ if not replacer then
+ local rep = { }
+ for i=1,nofreplacements do
+ local r = replacements[i]
+ rep[strip(r[1])] = strip(r[2])
+ end
+ replacer = lpeg.utfchartabletopattern(rep)
+ replacer = Cs((replacer/rep + lpegpatterns.utf8character)^0)
+ replacements.replacer = replacer
+ end
+ local rep = lpegmatch(replacer,str)
+ if rep and rep ~= str then
+ if trace_replacements then
+ report_sorters("original : %s",str)
+ report_sorters("replacement: %s",rep)
end
+ str = rep
end
+ -- for k=1,#replacements do
+ -- local v = replacements[k]
+ -- local s = v[1]
+ -- if find(str,s) then
+ -- str = gsub(str,s,v[2])
+ -- end
+ -- end
end
local m_case, z_case, p_case, m_mapping, z_mapping, p_mapping, char, byte, n = { }, { }, { }, { }, { }, { }, { }, { }, 0
local nm, nz, np = 0, 0, 0
@@ -797,3 +820,16 @@ function sorters.sort(entries,cmp)
end)
end
end
+
+-- helper
+
+function sorters.replacementlist(list)
+ local replacements = { }
+ for i=1,#list do
+ replacements[i] = {
+ list[i],
+ utfchar(replacementoffset+i),
+ }
+ end
+ return replacements
+end
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 4bb82edcf..6e2441929 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 8deebb2ec..13610af00 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/trac-log.lua b/tex/context/base/mkiv/trac-log.lua
index c7b6f6d2d..b0da12715 100644
--- a/tex/context/base/mkiv/trac-log.lua
+++ b/tex/context/base/mkiv/trac-log.lua
@@ -10,7 +10,6 @@ if not modules then modules = { } end modules ['trac-log'] = {
-- terminal handler in lua then. Ok, maybe it's slower then, so a no-go.
local next, type, select, print = next, type, select, print
-local write_nl, write = texio and texio.write_nl or print, texio and texio.write or io.write
local format, gmatch, find = string.format, string.gmatch, string.find
local concat, insert, remove = table.concat, table.insert, table.remove
local topattern = string.topattern
@@ -18,6 +17,14 @@ local utfchar = utf.char
local datetime = os.date
local openfile = io.open
+local runningtex = tex and (tex.jobname or tex.formatname)
+
+-- local write_nl = texio and texio.write_nl or print
+-- local write = texio and texio.write or io.write
+
+local write_nl = runningtex and texio and texio.write_nl or print
+local write = runningtex and texio and texio.write or io.write
+
local setmetatableindex = table.setmetatableindex
local formatters = string.formatters
local settings_to_hash = utilities.parsers.settings_to_hash
@@ -108,7 +115,7 @@ local direct, subdirect, writer, pushtarget, poptarget, setlogfile, settimedlog,
-- we don't want this overhead for single messages (not that there are that
-- many; we could have a special weak table)
-if tex and (tex.jobname or tex.formatname) then
+if runningtex then
if texio.setescape then
texio.setescape(0) -- or (false)
diff --git a/tex/context/base/mkiv/util-lua.lua b/tex/context/base/mkiv/util-lua.lua
index bd74d0843..b7de11936 100644
--- a/tex/context/base/mkiv/util-lua.lua
+++ b/tex/context/base/mkiv/util-lua.lua
@@ -42,7 +42,7 @@ luautilities.suffixes = {
-- environment.loadpreprocessedfile can be set to a preprocessor
-local function register(name)
+local function register(name) -- makes no sense runtime
if tracestripping then
report_lua("stripped bytecode from %a",name or "unknown")
end
@@ -75,18 +75,12 @@ end
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 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("--[["..fullname.."]] "..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)
+ local code, message
+ if macros then
+ code, message = macros.loaded(fullname,true,false)
else
code, message = loadfile(fullname)
end
diff --git a/tex/context/base/mkiv/util-sql-imp-ffi.lua b/tex/context/base/mkiv/util-sql-imp-ffi.lua
index 07c4752cd..2a2bc6569 100644
--- a/tex/context/base/mkiv/util-sql-imp-ffi.lua
+++ b/tex/context/base/mkiv/util-sql-imp-ffi.lua
@@ -365,10 +365,10 @@ local function connect(session,specification)
end
local function error_in_connection(specification,action)
- report_state("error in connection: [%s] %s@%s to %s:%s",
+ report_state("error in connection: [%s] user %s into %s at %s:%s",
action or "unknown",
- specification.database or "no database",
specification.username or "no username",
+ specification.database or "no database",
specification.host or "no host",
specification.port or "no port"
)
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index bdcfefbb0..97254d3ef 100644
--- a/tex/context/interface/mkiv/i-context.pdf
+++ b/tex/context/interface/mkiv/i-context.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf
index 644b9336e..1a8314fe2 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ
diff --git a/tex/context/modules/mkiv/s-fonts-shapes.lua b/tex/context/modules/mkiv/s-fonts-shapes.lua
index ebdf04c22..748c5a92a 100644
--- a/tex/context/modules/mkiv/s-fonts-shapes.lua
+++ b/tex/context/modules/mkiv/s-fonts-shapes.lua
@@ -109,12 +109,9 @@ local characters = nil
local function showglyphshape(specification)
specification = interfaces.checkedspecification(specification)
- local id, cs = fonts.definers.internal(specification,"<module:fonts:shapes:font>")
+ local id, cs = fonts.definers.internal(specification,"<module:fonts:shapes:font>")
local tfmdata = fontdata[id]
- local charnum = tonumber(specification.character)
- if not charnum then
- charnum = fonts.helpers.nametoslot(specification.character)
- end
+ local charnum = tonumber(specification.character) or fonts.helpers.nametoslot(specification.character)
local characters = tfmdata.characters
local descriptions = tfmdata.descriptions
local parameters = tfmdata.parameters
@@ -133,64 +130,75 @@ local function showglyphshape(specification)
context.startMPcode()
context("numeric lw ; lw := .125bp ;")
context("pickup pencircle scaled lw ;")
- context('picture p ; p := image(draw textext.drt("\\getuvalue{%s}\\gray\\char%s");); draw p ;',cs,charnum)
+ if width < 0.01 then
+ -- catches zero width marks
+ context('picture p ; p := textext.drt("\\hskip5sp\\getuvalue{%s}\\gray\\char%s"); draw p ;',cs,charnum)
+ else
+ context('picture p ; p := textext.drt("\\getuvalue{%s}\\gray\\char%s"); draw p ;',cs,charnum)
+ end
context('draw (%s,%s)--(%s,%s)--(%s,%s)--(%s,%s)--cycle withcolor green ;',llx,lly,urx,lly,urx,ury,llx,ury)
context('draw (%s,%s)--(%s,%s) withcolor green ;',llx,0,urx,0)
context('draw boundingbox p withcolor .2white withpen pencircle scaled .065bp ;')
context("defaultscale := 0.05 ; ")
-- inefficient but non critical
- local function slant_1(v,dx,dy,txt,xsign,ysign,loc,labloc)
- if #v > 0 then
- local l = { }
- for kk, vv in ipairs(v) do
- local h, k = vv.height or 0, vv.kern or 0
- if h and k then
- l[#l+1] = formatters["((%s,%s) shifted (%s,%s))"](xsign*k*factor,ysign*h*factor,dx,dy)
+ local slant = {
+ function(v,dx,dy,txt,xsign,ysign,loc,labloc)
+ local n = #v
+ if n > 0 then
+ local l = { }
+ for i=1,n do
+ local c = v[i]
+ local h = c.height or 0
+ local k = c.kern or 0
+ l[i] = formatters["((%s,%s) shifted (%s,%s))"](xsign*k*factor,ysign*h*factor,dx,dy)
end
- end
- context("draw ((%s,%s) shifted (%s,%s))--%s dashed (evenly scaled 1/16) withcolor .5white;", xsign*v[1].kern*factor,lly,dx,dy,l[1])
- context("draw laddered (%s) withcolor .5white ;",table.concat(l,".."))
- context("draw ((%s,%s) shifted (%s,%s))--%s dashed (evenly scaled 1/16) withcolor .5white;", xsign*v[#v].kern*factor,ury,dx,dy,l[#l])
- for k, v in ipairs(l) do
- context("draw %s withcolor blue withpen pencircle scaled 2lw ;",v)
- end
- end
- end
- local function slant_2(v,dx,dy,txt,xsign,ysign,loc,labloc)
- if #v > 0 then
- local l = { }
- for kk, vv in ipairs(v) do
- local h, k = vv.height or 0, vv.kern or 0
- if h and k then
- l[#l+1] = formatters["((%s,%s) shifted (%s,%s))"](xsign*k*factor,ysign*h*factor,dx,dy)
+ context("draw ((%s,%s) shifted (%s,%s))--%s dashed (evenly scaled 1/16) withcolor .5white;", xsign*v[1].kern*factor,lly,dx,dy,l[1])
+-- context("draw laddered (%s) withcolor .5white ;",table.concat(l,".."))
+ context("draw laddered (%..t) withcolor .5white ;",l)
+ context("draw ((%s,%s) shifted (%s,%s))--%s dashed (evenly scaled 1/16) withcolor .5white;", xsign*v[#v].kern*factor,ury,dx,dy,l[#l])
+ for i=1,n do
+ context("draw %s withcolor blue withpen pencircle scaled 2lw ;",l[i])
end
end
- if loc == "top" then
- context('label.%s("\\type{%s}",%s shifted (0,-1bp)) ;',loc,txt,l[#l])
- else
- context('label.%s("\\type{%s}",%s shifted (0,2bp)) ;',loc,txt,l[1])
- end
- for kk, vv in ipairs(v) do
- local h, k = vv.height or 0, vv.kern or 0
- if h and k then
- context('label.top("(%s,%s)",%s shifted (0,-2bp));',k,h,l[kk])
+ end,
+ function(v,dx,dy,txt,xsign,ysign,loc,labloc)
+ local n = #v
+ if n > 0 then
+ local l = { }
+ for i=1,n do
+ local c = v[i]
+ local h = c.height or 0
+ local k = c.kern or 0
+ l[i] = formatters["((%s,%s) shifted (%s,%s))"](xsign*k*factor,ysign*h*factor,dx,dy)
+ end
+ if loc == "top" then
+ context('label.%s("\\type{%s}",%s shifted (0,-1bp)) ;',loc,txt,l[n])
+ else
+ context('label.%s("\\type{%s}",%s shifted (0,2bp)) ;',loc,txt,l[1])
+ end
+ for i=1,n do
+ local c = v[i]
+ local h = c.height or 0
+ local k = c.kern or 0
+ context('label.top("(%s,%s)",%s shifted (0,-2bp));',k,h,l[i])
end
end
- end
- end
+ end,
+ }
if math then
local kerns = math.kerns
if kerns then
- for _, slant in ipairs { slant_1, slant_2 } do
- for k,v in pairs(kerns) do
+ for i=1,#slant do
+ local s = slant[i]
+ for k, v in next, kerns do
if k == "topright" then
- slant(v,width+italic,0,k,1,1,"top","ulft")
+ s(v,width+italic,0,k,1,1,"top","ulft")
elseif k == "bottomright" then
- slant(v,width,0,k,1,1,"bot","lrt")
+ s(v,width,0,k,1,1,"bot","lrt")
elseif k == "topleft" then
- slant(v,0,0,k,-1,1,"top","ulft")
+ s(v,0,0,k,-1,1,"top","ulft")
elseif k == "bottomleft" then
- slant(v,0,0,k,-1,1,"bot","lrt")
+ s(v,0,0,k,-1,1,"bot","lrt")
end
end
end
@@ -205,33 +213,34 @@ local function showglyphshape(specification)
if anchors then
local a = anchors.baselig
if a then
- for k, v in pairs(a) do
- for kk, vv in ipairs(v) do
- show(vv[1],vv[2],k .. ":" .. kk)
+ for k, v in next, a do
+ for i=1,#v do
+ local p = v[i]
+ show(p[1],p[2],k .. ":" .. i)
end
end
end
local a = anchors.mark
if a then
- for k, v in pairs(a) do
+ for k, v in next, a do
show(v[1],v[2],k)
end
end
local a = anchors.basechar
if a then
- for k, v in pairs(a) do
+ for k, v in next, a do
show(v[1],v[2],k)
end
end
local ba = anchors.centry
if a then
- for k, v in pairs(a) do
+ for k, v in next, a do
show(v[1],v[2],k)
end
end
local a = anchors.cexit
if a then
- for k, v in pairs(a) do
+ for k, v in next, a do
show(v[1],v[2],k)
end
end
diff --git a/tex/context/modules/mkiv/s-fonts-shapes.mkiv b/tex/context/modules/mkiv/s-fonts-shapes.mkiv
index 4a0377ada..53ed1b426 100644
--- a/tex/context/modules/mkiv/s-fonts-shapes.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-shapes.mkiv
@@ -109,7 +109,11 @@
% \startTEXpage[offset=0pt]\ShowGlyphShape{name:cambria-math}{50bp}{0x1D45D}\stopTEXpage
% \page
-\showallglyphshapes[name=name:cambria-math,size=100bp]
+\startTEXpage[offset=0pt]\ShowGlyphShape{file:husayninotebold.ttf}{50bp}{0xF034A}\stopTEXpage
+\startTEXpage[offset=0pt]\ShowGlyphShape{file:husayninotebold.ttf}{50bp}{0x006DD}\stopTEXpage
+
+% \showallglyphshapes[name=name:cambria-math,size=100bp]
+% \showallglyphshapes[name=file:husayninotebold.ttf,size=100bp]
% \showallglyphshapes[name=name:dejavuserif,size=100bp]
% \showallglyphshapes[name=file:brill.otf,size=100bp]
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index de4458dda..5e9caf71e 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 03/21/18 09:16:30
+-- merge date : 03/22/18 19:41:33
do -- begin closure to overcome local limits and interference
@@ -23720,7 +23720,7 @@ function handlers.gpos_pair(head,start,dataset,sequence,kerns,rlmode,skiphash,st
elseif b then
local x,y,w,h=setposition(2,snext,factor,rlmode,b,injection)
if trace_kerns then
- local startchar=getchar(snext)
+ local startchar=getchar(start)
logprocess("%s: shifting second of pair %s and %s by xy (%p,%p) and wh (%p,%p) as %s",pref(dataset,sequence),gref(startchar),gref(nextchar),x,y,w,h,injection or "injections")
end
start=snext