summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-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/anch-bck.mkvi16
-rw-r--r--tex/context/base/mkiv/anch-pos.lua12
-rw-r--r--tex/context/base/mkiv/anch-pos.mkiv2
-rw-r--r--tex/context/base/mkiv/anch-snc.mkiv60
-rw-r--r--tex/context/base/mkiv/back-exp.lua2
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv3
-rw-r--r--tex/context/base/mkiv/font-col.lua2
-rw-r--r--tex/context/base/mkiv/font-sel.lua149
-rw-r--r--tex/context/base/mkiv/good-ctx.lua2
-rw-r--r--tex/context/base/mkiv/l-sha.lua27
-rw-r--r--tex/context/base/mkiv/luat-bas.mkiv1
-rw-r--r--tex/context/base/mkiv/math-fbk.lua4
-rw-r--r--tex/context/base/mkiv/math-noa.lua8
-rw-r--r--tex/context/base/mkiv/mlib-run.lua3
-rw-r--r--tex/context/base/mkiv/mult-low.lua2
-rw-r--r--tex/context/base/mkiv/node-bck.lua2
-rw-r--r--tex/context/base/mkiv/node-fnt.lua2
-rw-r--r--tex/context/base/mkiv/node-ppt.lua2
-rw-r--r--tex/context/base/mkiv/node-rul.lua6
-rw-r--r--tex/context/base/mkiv/pack-rul.lua2
-rw-r--r--tex/context/base/mkiv/page-lin.lua8
-rw-r--r--tex/context/base/mkiv/page-sid.mkiv5
-rw-r--r--tex/context/base/mkiv/scrp-ini.lua2
-rw-r--r--tex/context/base/mkiv/spac-chr.lua4
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin26268 -> 26302 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin267506 -> 267612 bytes
-rw-r--r--tex/context/base/mkiv/strc-blk.mkiv6
-rw-r--r--tex/context/base/mkiv/strc-tag.lua1
-rw-r--r--tex/context/base/mkiv/strc-tag.mkiv1
-rw-r--r--tex/context/base/mkiv/strc-usr.lua29
-rw-r--r--tex/context/base/mkiv/strc-usr.mkiv180
-rw-r--r--tex/context/base/mkiv/syst-aux.mkiv12
-rw-r--r--tex/context/base/mkiv/typo-cln.lua2
-rw-r--r--tex/context/base/mkiv/typo-lin.lua4
-rw-r--r--tex/context/base/mkiv/typo-pnc.lua2
-rw-r--r--tex/context/base/mkiv/util-sha.lua7
-rw-r--r--tex/context/base/mkiv/util-soc.lua9
-rw-r--r--tex/context/base/mkiv/util-sql-imp-ffi.lua593
-rw-r--r--tex/context/base/mkiv/util-sql-imp-library.lua8
-rw-r--r--tex/context/base/mkiv/util-sql-users.lua8
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin853853 -> 853699 bytes
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin61223 -> 61221 bytes
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
-rw-r--r--tex/generic/context/luatex/luatex-swiglib.lua2
47 files changed, 724 insertions, 474 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 8ff20cc51..364702cad 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.08.25 10:04}
+\newcontextversion{2018.08.28 17:21}
%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 1eb03b471..956cd702b 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.08.25 10:04}
+\edef\contextversion{2018.08.28 17:21}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/anch-bck.mkvi b/tex/context/base/mkiv/anch-bck.mkvi
index f8316349b..96dd0cdf5 100644
--- a/tex/context/base/mkiv/anch-bck.mkvi
+++ b/tex/context/base/mkiv/anch-bck.mkvi
@@ -453,27 +453,27 @@
\strc_floats_mark_as_free
\plustwo
\zeropoint
- \d_page_sides_leftskip
+ \d_page_sides_rightoffset
\d_page_sides_topskip
\d_page_sides_bottomskip
\or % leftedge
\strc_floats_mark_as_free
\plustwo
\zeropoint
- \d_page_sides_leftskip
+ \d_page_sides_rightoffset
\d_page_sides_topskip
\d_page_sides_bottomskip
\or % leftmargin
\strc_floats_mark_as_free
\plustwo
\zeropoint
- \d_page_sides_leftskip
+ \d_page_sides_rightoffset
\d_page_sides_topskip
\d_page_sides_bottomskip
\or % leftside
\strc_floats_mark_as_free
\plustwo
- \d_page_sides_leftskip
+ \d_page_sides_leftskip % maybe too
\d_page_sides_margin
\d_page_sides_topskip
\d_page_sides_bottomskip
@@ -481,27 +481,27 @@
\strc_floats_mark_as_free
\plusthree
\d_page_sides_margin
- \d_page_sides_rightskip
+ \d_page_sides_rightskip % maybe too
\d_page_sides_topskip
\d_page_sides_bottomskip
\or % rightmargin
\strc_floats_mark_as_free
\plusthree
- \d_page_sides_rightskip
+ \d_page_sides_leftoffset
\zeropoint
\d_page_sides_topskip
\d_page_sides_bottomskip
\or % rightedge
\strc_floats_mark_as_free
\plusthree
- \d_page_sides_rightskip
+ \d_page_sides_leftoffset
\zeropoint
\d_page_sides_topskip
\d_page_sides_bottomskip
\or % cutspace
\strc_floats_mark_as_free
\plusthree
- \d_page_sides_rightskip
+ \d_page_sides_leftoffset
\zeropoint
\d_page_sides_topskip
\d_page_sides_bottomskip
diff --git a/tex/context/base/mkiv/anch-pos.lua b/tex/context/base/mkiv/anch-pos.lua
index 47fee067f..11883ba59 100644
--- a/tex/context/base/mkiv/anch-pos.lua
+++ b/tex/context/base/mkiv/anch-pos.lua
@@ -69,9 +69,10 @@ local getbox = nuts.getbox
local getid = nuts.getid
local getwhd = nuts.getwhd
------ hlist_code = nodes.listcodes.hlist
+local hlist_code = nodes.listcodes.hlist
local find_tail = nuts.tail
+local hpack = nuts.hpack
local new_latelua = nuts.pool.latelua
local new_latelua_node = nodes.pool.latelua
@@ -565,11 +566,10 @@ local function markregionbox(n,tag,correct,...) -- correct needs checking
local pop = new_latelua(function() e_region(correct) end)
-- maybe we should construct a hbox first (needs experimenting) so that we can avoid some at the tex end
local head = getlist(box)
- -- no :
- -- if getid(box) ~= hlist_code then
- -- -- report("mark region box assumes a hlist, fix this for %a",tag)
- -- head = nuts.hpack(head)
- -- end
+ if getid(box) ~= hlist_code then
+ -- report("mark region box assumes a hlist, fix this for %a",tag)
+ head = hpack(head)
+ end
if head then
local tail = find_tail(head)
setlink(push,head)
diff --git a/tex/context/base/mkiv/anch-pos.mkiv b/tex/context/base/mkiv/anch-pos.mkiv
index 8d011d61a..dd24bdb08 100644
--- a/tex/context/base/mkiv/anch-pos.mkiv
+++ b/tex/context/base/mkiv/anch-pos.mkiv
@@ -296,7 +296,7 @@
{\clf_markregionbox#1\relax}
\unexpanded\def\anch_mark_flow_box#1% will be extended / renamed
- {\hbox\bgroup % \hpack
+ {\hpack\bgroup % \hpack
\global\advance\c_anch_text\plusone
\clf_markregionboxtagged#1{textarea:\the\c_anch_text}%
\box#1%
diff --git a/tex/context/base/mkiv/anch-snc.mkiv b/tex/context/base/mkiv/anch-snc.mkiv
index 38cccef1d..fd6179bc4 100644
--- a/tex/context/base/mkiv/anch-snc.mkiv
+++ b/tex/context/base/mkiv/anch-snc.mkiv
@@ -30,7 +30,7 @@
\glet\flushsyncpresets \doflushsyncpresets
\expandafter\newcount\csname\s!num:\s!syncpos:#1\endcsname
\doglobal\appendtoksonce\csname\s!reset :\s!syncpos:#1\endcsname\to\resetsyncpositions
- \doglobal\appendtoksonce\csname\s!preset:\s!syncpos:#1\endcsname\to\presetsyncpositions
+ \doglobal\appendtoksonce\csname\s!preset:\s!syncpos:#1\endcsname\to\presetsyncpositions
% to be tested:
% \doglobal\expandafter\appendtoksonce\csname\s!reset :\s!syncpos:#1\endcsname\to\resetsyncpositions
% \doglobal\expandafter\appendtoksonce\csname\s!preset:\s!syncpos:#1\endcsname\to\presetsyncpositions
@@ -72,15 +72,15 @@
\def\dosetsyncpositions#1%
{\startnointerference % removing out of sync can best be done in mp
- \!!dimena\maxdimen
- \!!counta\zerocount
- \!!countc\zerocount
+ \scratchdimenone\maxdimen
+ \scratchcounterone\zerocount
+ \scratchcounterthree\zerocount
\doloop
{\doifelseposition{\s!syncpos:#1:\recurselevel}
- {\!!dimenb\MPy{\s!syncpos:#1:\recurselevel}\relax
- \!!countb\MPp{\s!syncpos:#1:\recurselevel}\relax
- \ifnum\!!countb=\!!counta % same page
- \ifdim\!!dimenb>\!!dimena
+ {\scratchdimentwo\MPy{\s!syncpos:#1:\recurselevel}\relax
+ \scratchcountertwo\MPp{\s!syncpos:#1:\recurselevel}\relax
+ \ifnum\scratchcountertwo=\scratchcounterone % same page
+ \ifdim\scratchdimentwo>\scratchdimenone
\donefalse % out of order nodes
\else
\donetrue % nodes in order
@@ -89,11 +89,11 @@
\donetrue % different page
\fi
\ifdone
- \!!counta\!!countb
- \!!dimena\!!dimenb
- \advance\!!countc\plusone
- \edef\!!stringa{[#1][\the\!!countc]:=}%
- \edef\!!stringc{\s!syncpos:#1:\the\!!countc}%
+ \scratchcounterone\scratchcountertwo
+ \scratchdimenone\scratchdimentwo
+ \advance\scratchcounterthree\plusone
+ \edef\!!stringa{[#1][\the\scratchcounterthree]:=}%
+ \edef\!!stringc{\s!syncpos:#1:\the\scratchcounterthree}%
\edef\!!stringd{\MPplus\!!stringc{1}{0}}%
\setxvalue{\s!syncpos:#1}%
{\getsyncpositions{#1}%
@@ -102,11 +102,13 @@
sync_w \!!stringa \MPw \!!stringc ;
sync_h \!!stringa \MPh \!!stringc ;
sync_d \!!stringa \MPd \!!stringc ;
- \ifx\!!stringd\empty \else sync_t \!!stringa \MPplus\!!stringc{1}{0} ; \fi}%
+ \ifx\!!stringd\empty \else
+ sync_t \!!stringa \!!stringd;
+ \fi}%
\fi}
{\setxvalue{\s!syncpos:#1}%
{\getsyncpositions{#1}%
- sync_n[#1] := \the\!!countc ;}
+ sync_n[#1] := \the\scratchcounterthree ;}
\exitloop}}%
\stopnointerference}
@@ -138,7 +140,6 @@
\setbox\scratchbox\hbox{\the#1}%
\ifvoid\scratchbox\else
\prewordbreak
- %\let\prewordbreak\relax % only once
\smashbox\scratchbox
\box\scratchbox
\fi
@@ -163,26 +164,39 @@
\starttext
+% \setuppapersize[A4][A3]
+
+\setuplayout[location=middle]
+
\setupbodyfont[dejavu]
\definesyncpositions[1]
+\startMPinclusions
+% input "mp-core.mpiv";
+ input "mp-asnc.mpiv";
+\stopMPinclusions
+
\startuseMPgraphic{sync}
StartPage ;
+vardef PlainTextArea = Field[Text][Text] enddef ;
\getsyncpositions{1} ;
SyncThreshold := 2LineHeight ;
SyncLeftOffset := -.5LeftMarginDistance ;
- % SetSyncThreshold(1,3,3LineHeight) ;
+ SetSyncThreshold(1,3,3LineHeight) ;
SyncWidth := - (BackSpace + SyncLeftOffset) ;
SetSyncColor(1,1,\MPcolor{red}) ;
SetSyncColor(1,2,\MPcolor{green}) ;
SetSyncColor(1,3,\MPcolor{blue}) ;
SetSyncColor(1,4,\MPcolor{yellow}) ;
PrepareSyncTasks(1,true,true,false) ;
+% PrepareSyncTasks(1,true,true,true) ;
for i = 1 upto NOfSyncPaths :
- fill SyncPaths[i]
- withcolor TheSyncColor(CurrentSyncClass,sync_t[CurrentSyncClass][SyncTasks[i]]) ;
+ fill SyncPaths[i]
+ withcolor TheSyncColor(CurrentSyncClass,sync_t[CurrentSyncClass][SyncTasks[i]]) ;
endfor ;
+ clip
+ currentpicture to Page ;
setbounds currentpicture to Page ;
StopPage ;
\stopuseMPgraphic
@@ -194,10 +208,10 @@
\dorecurse {10} {
\startchapter[title={Test #1}]
- \syncposition[1][1] \dorecurse{10}{\input ward \endgraf}
- \syncposition[1][2] \dorecurse {4}{\input ward \endgraf}
- \syncposition[1][3] \dorecurse {7}{\input ward \endgraf}
- \syncposition[1][4] \dorecurse {3}{\input ward \endgraf}
+ \syncposition[1][1] \dorecurse{10}{\samplefile{ward}\endgraf}
+ \syncposition[1][2] \dorecurse {4}{\samplefile{ward}\endgraf}
+ \syncposition[1][3] \dorecurse {7}{\samplefile{ward}\endgraf}
+ \syncposition[1][4] \dorecurse {3}{\samplefile{ward}\endgraf}
\stopchapter
}
diff --git a/tex/context/base/mkiv/back-exp.lua b/tex/context/base/mkiv/back-exp.lua
index 0cdeab6bb..6d403fe53 100644
--- a/tex/context/base/mkiv/back-exp.lua
+++ b/tex/context/base/mkiv/back-exp.lua
@@ -3313,7 +3313,7 @@ end
return false
end
- if LUATEXVERSION >= 1.090 then
+ if LUATEXVERSION >= 1.080 then
function builders.paragraphs.tag(head) -- traverse_list
noftextblocks = noftextblocks + 1
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index dc38380c8..9c6151011 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.08.25 10:04}
+\newcontextversion{2018.08.28 17:21}
%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 8dcee00f6..ea4327a95 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.08.25 10:04}
+\edef\contextversion{2018.08.28 17:21}
\edef\contextkind {beta}
%D For those who want to use this:
@@ -508,6 +508,7 @@
\loadmkvifile{strc-not}
\loadmkvifile{strc-lnt}
+\loadmkivfile{strc-usr}
\loadmarkfile{pack-com}
\loadmarkfile{typo-del}
diff --git a/tex/context/base/mkiv/font-col.lua b/tex/context/base/mkiv/font-col.lua
index e5fd37b1b..6d35a8e35 100644
--- a/tex/context/base/mkiv/font-col.lua
+++ b/tex/context/base/mkiv/font-col.lua
@@ -345,7 +345,7 @@ function collections.process(head) -- this way we keep feature processing
return head
end
-if LUATEXVERSION >= 1.090 then
+if LUATEXVERSION >= 1.080 then
function collections.process(head) -- this way we keep feature processing
for n, char, font in nextchar, head do
diff --git a/tex/context/base/mkiv/font-sel.lua b/tex/context/base/mkiv/font-sel.lua
index e7f56047b..15d3838f6 100644
--- a/tex/context/base/mkiv/font-sel.lua
+++ b/tex/context/base/mkiv/font-sel.lua
@@ -232,52 +232,6 @@ local m_alternative = {
["sc"] = "smallcaps"
}
---~ methods["style"] = function(data,alternative,style)
---~ local family = data.metadata.family
---~ local style = m_alternative[style] or style
---~ if trace_alternatives then
---~ report_selectfont("Alternative '%s': Using method 'style' with argument '%s'",alternative,style)
---~ end
---~ local fontweight = m_name[style] and m_name[style]["weight"] or "regular"
---~ local fontstyle = m_name[style] and m_name[style]["style"] or "normal"
---~ local fontwidth = m_name[style] and m_name[style]["width"] or "normal"
---~ local pattern = getlookups{
---~ familyname = cleanname(family),
---~ pfmweight = m_weight[fontweight],
---~ style = fontstyle
---~ }
---~ if #pattern == 1 then
---~ selectfont_savefile(data,alternative,0,"default",pattern[1])
---~ elseif #pattern > 1 then
---~ local bodyfontsize, minsize, maxsize, width = nil, nil, nil, nil
---~ for patternindex, patternentry in next, pattern do
---~ minsize = patternentry["minsize"]
---~ maxsize = patternentry["maxsize"]
---~ width = patternentry["pfmwidth"]
---~ if minsize and maxsize then
---~ for fontsize, fontstate in next, bodyfontsizes do
---~ bodyfontsize, _ = number.splitdimen(fontsize)
---~ bodyfontsize = bodyfontsize * 10
---~ if minsize < bodyfontsize and bodyfontsize < maxsize then
---~ if bodyfontsize == 100 then
---~ selectfont_savefile(data,alternative,0,"default",patternentry)
---~ end
---~ selectfont_savefile(data,alternative,bodyfontsize,fontsize,patternentry)
---~ end
---~ end
---~ else
---~ if width == m_width[fontwidth] then
---~ selectfont_savefile(data,alternative,0,"default",patternentry)
---~ end
---~ end
---~ end
---~ else
---~ if trace_alternatives then
---~ report_selectfont("Alternative '%s': No font was found for the requested style '%s' from '%s'",alternative,style,family)
---~ end
---~ end
---~ end
-
local function m_style_family(family)
local askedname = cleanname(family)
local familyname = getlookups{ familyname = askedname }
@@ -348,7 +302,7 @@ local function m_style_style(entries,style)
if style == "italic" and entry["angle"] and entry["angle"] ~= 0 then
t[#t+1] = entry
elseif style == "normal" and entry["angle"] and entry["angle"] ~= 0 then
- --~ Fix needed for fonts with wrong value for the style field
+ -- Fix needed for fonts with wrong value for the style field
elseif entry["style"] == style then
t[#t+1] = entry
end
@@ -448,10 +402,10 @@ methods[v_default] = function(data,alternative)
report_selectfont("Alternative '%s': The family '%s' contains only one font",alternative,family)
end
selectfont_savefile(data,alternative,0,"default",result[1])
- --~ if trace_alternatives then
- --~ report_selectfont("Alternative '%s': Changing method 'default' to method 'style'",alternative)
- --~ end
- --~ methods["file"](data,alternative,result[1]["filename"])
+ -- if trace_alternatives then
+ -- report_selectfont("Alternative '%s': Changing method 'default' to method 'style'",alternative)
+ -- end
+ -- methods["file"](data,alternative,result[1]["filename"])
else
if trace_alternatives then
report_selectfont("Alternative '%s': Changing method 'default' to method 'style'",alternative)
@@ -499,38 +453,6 @@ function selectfont.userdata(index)
end
end
---~ function selectfont.registerfiles(index)
---~ local data = data[index]
---~ local colon = splitat(":",true)
---~ for alternative, _ in next, alternatives do
---~ local arguments = data.alternatives[alternative]
---~ if arguments ~= "" then
---~ local entries = settings_to_array(arguments)
---~ local setmethod = false
---~ for index, entry in next, entries do
---~ method, argument = lpegmatch(colon,entry)
---~ if not argument then
---~ argument = method
---~ method = "name"
---~ end
---~ if extras[method] then
---~ extras[method](data,alternative,argument)
---~ elseif methods[method] then
---~ if not setmethod then
---~ setmethod = true
---~ methods[method](data,alternative,argument)
---~ end
---~ end
---~ end
---~ if not setmethod then
---~ methods[v_default](data,alternative)
---~ end
---~ else
---~ methods[v_default](data,alternative)
---~ end
---~ end
---~ end
-
function selectfont.registerfiles(index)
local data = data[index]
local colon = splitat(":",true)
@@ -662,8 +584,8 @@ function selectfont.fontsynonym(data,class,style,alternative,index)
local fontsizes = sortedkeys(fontfiles)
local fallback = index ~= 0
local fontclass = lower(class)
- --~ local fontfeature = data.features and data.features[alternative] or data.options.features
- --~ local fontgoodie = data.goodies and data.goodies [alternative] or data.options.goodies
+ --local fontfeature = data.features and data.features[alternative] or data.options.features
+ --local fontgoodie = data.goodies and data.goodies [alternative] or data.options.goodies
local fontfeature = selectfont.features(data,style,alternative)
local fontgoodie = selectfont.goodies (data,style,alternative)
local synonym = m_synonym[style] and m_synonym[style][alternative]
@@ -675,25 +597,25 @@ function selectfont.fontsynonym(data,class,style,alternative,index)
end
local fontfallback = formatters["fallback-%s-%s-%s"](fontclass,style,alternative)
for _, fontsize in next, fontsizes do
- --~ if trace_typescript then
- --~ report_typescript("Synonym: '%s', Size: '%s', File: '%s'",fontfile,fontfiles[fontsize][1],fontfiles[fontsize][2])
- --~ end
+ -- if trace_typescript then
+ -- report_typescript("Synonym: '%s', Size: '%s', File: '%s'",fontfile,fontfiles[fontsize][1],fontfiles[fontsize][2])
+ -- end
registerdesignsizes(fontfile,fontfiles[fontsize][1],fontfiles[fontsize][2])
end
if fallback then
- --~ if trace_typescript then
- --~ report_typescript("Synonym: '%s', File: '%s', Features: '%s'",fontsynonym,fontfile,fontfeature)
- --~ end
+ -- if trace_typescript then
+ -- report_typescript("Synonym: '%s', File: '%s', Features: '%s'",fontsynonym,fontfile,fontfeature)
+ -- end
ctx_definefontsynonym( { fontsynonym }, { fontfile }, { features = fontfeature } )
else
- --~ if trace_typescript then
- --~ report_typescript("Synonym: '%s', File: '%s', Features: '%s', Goodies: '%s', Fallbacks: '%s'",fontsynonym,fontfile,fontfeature,fontgoodie,fontfallback)
- --~ end
+ -- if trace_typescript then
+ -- report_typescript("Synonym: '%s', File: '%s', Features: '%s', Goodies: '%s', Fallbacks: '%s'",fontsynonym,fontfile,fontfeature,fontgoodie,fontfallback)
+ -- end
ctx_definefontsynonym( { fontsynonym }, { fontfile }, { features = fontfeature, goodies = fontgoodie, fallbacks = fontfallback } )
if synonym then
- --~ if trace_typescript then
- --~ report_typescript("Synonym: '%s', File: '%s'",synonym,fontsynonym)
- --~ end
+ -- if trace_typescript then
+ -- report_typescript("Synonym: '%s', File: '%s'",synonym,fontsynonym)
+ -- end
ctx_definefontsynonym( { synonym }, { fontsynonym } )
end
end
@@ -711,9 +633,9 @@ function selectfont.fontfallback(data,class,style,alternative,index)
if index == 1 then
ctx_resetfontfallback( { fontfallback } )
end
- --~ if trace_typescript then
- --~ report_typescript("Fallback: '%s', Synonym: '%s', Range: '%s', Scale: '%s', Check: '%s', Force: '%s'",fontfallback,fontsynonym,range,scale,check,force)
- --~ end
+ -- if trace_typescript then
+ -- report_typescript("Fallback: '%s', Synonym: '%s', Range: '%s', Scale: '%s', Check: '%s', Force: '%s'",fontfallback,fontsynonym,range,scale,check,force)
+ -- end
ctx_definefontfallback( { fontfallback }, { fontsynonym }, { range }, { rscale = scale, check = check, force = force } )
end
@@ -730,9 +652,9 @@ function selectfont.filefallback(data,class,style,alternative,index)
if index == 1 then
ctx_resetfontfallback( { fontfallback } )
end
- --~ if trace_typescript then
- --~ report_typescript("Fallback: '%s', File: '%s', Features: '%s', Range: '%s', Scale: '%s', Check: '%s', Force: '%s', Offset: '%s'",fontfallback,fontfile[2],fontfeature,range,scale,check,force,offset)
- --~ end
+ -- if trace_typescript then
+ -- report_typescript("Fallback: '%s', File: '%s', Features: '%s', Range: '%s', Scale: '%s', Check: '%s', Force: '%s', Offset: '%s'",fontfallback,fontfile[2],fontfeature,range,scale,check,force,offset)
+ -- end
ctx_definefontfallback( { fontfallback }, { formatters["file:%s*%s"](fontfile[2],fontfeature) }, { range }, { rscale = scale, check = check, force = force, offset = offset } )
end
@@ -763,9 +685,9 @@ function selectfont.fallback(data)
local fallbacks = fallbacks[fontclass] and fallbacks[fontclass][fontstyle]
if fallbacks then
for index, entry in next, fallbacks do
- --~ I need different fallback routines for math and text because
- --~ font synonyms can’t be used with math fonts and I have to apply
- --~ feature settings with the \definefontfallback command.
+ -- I need different fallback routines for math and text because
+ -- font synonyms can’t be used with math fonts and I have to apply
+ -- feature settings with the \definefontfallback command.
if fontstyle == "mm" then
selectfont.mathfallback(index,entry,fontclass,fontstyle)
else
@@ -792,7 +714,8 @@ function selectfont.typescript(data)
end
end
for alternative, _ in next, alternatives do
- if style == "mm" then -- Set math fonts only for upright and bold alternatives
+ if style == "mm" then
+ -- Set math fonts only for upright and bold alternatives
if alternative == "tf" or alternative == "bf" then
selectfont.fontsynonym (data,class,style,alternative,0)
end
@@ -813,9 +736,9 @@ function selectfont.bodyfont(data)
for alternative, _ in next, alternatives do
fontsynonym = formatters["synonym-%s-%s-%s"](fontclass,fontstyle,alternative)
fontlist[#fontlist+1] = formatters["%s=%s sa 1"] (alternative,fontsynonym)
- --~ if trace_typescript then
- --~ report_typescript("Alternative '%s': Synonym '%s'",alternative,fontsynonym)
- --~ end
+ -- if trace_typescript then
+ -- report_typescript("Alternative '%s': Synonym '%s'",alternative,fontsynonym)
+ -- end
end
fontlist = concat(fontlist,",")
ctx_definebodyfont( { class }, { fontsizes }, { fontstyle }, { fontlist } )
@@ -836,9 +759,9 @@ function selectfont.typeface(data)
local style = m_style[fontstyle]
local size = data.options.designsize ~= "" and data.options.designsize or "default"
local scale = data.options.rscale ~= "" and data.options.rscale or 1
- --~ if trace_typescript then
- --~ report_typescript("Class: '%s', Style: '%s', Size: '%s', Scale: '%s'",fontclass,fontstyle,size,scale)
- --~ end
+ -- if trace_typescript then
+ -- report_typescript("Class: '%s', Style: '%s', Size: '%s', Scale: '%s'",fontclass,fontstyle,size,scale)
+ -- end
ctx_definetypeface( { fontclass }, { fontstyle }, { style }, { "" }, { "default" }, { designsize = size, rscale = scale } )
end
diff --git a/tex/context/base/mkiv/good-ctx.lua b/tex/context/base/mkiv/good-ctx.lua
index c4c632ae9..5b6a02d09 100644
--- a/tex/context/base/mkiv/good-ctx.lua
+++ b/tex/context/base/mkiv/good-ctx.lua
@@ -170,7 +170,7 @@ function colorschemes.coloring(head)
return head
end
-if LUATEXVERSION >= 1.090 then
+if LUATEXVERSION >= 1.080 then
function colorschemes.coloring(head)
local lastfont = nil
diff --git a/tex/context/base/mkiv/l-sha.lua b/tex/context/base/mkiv/l-sha.lua
new file mode 100644
index 000000000..8481f7f45
--- /dev/null
+++ b/tex/context/base/mkiv/l-sha.lua
@@ -0,0 +1,27 @@
+if not modules then modules = { } end modules ['l-sha'] = {
+ version = 1.001,
+ comment = "companion to luat-lib.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+if sha2 then
+
+ local lpegmatch = lpeg.match
+ local lpegpatterns = lpeg.patterns
+ local bytestohex = lpegpatterns.bytestohex
+ local bytestoHEX = lpegpatterns.bytestoHEX
+
+ local digest256 = sha2.digest256
+ local digest384 = sha2.digest384
+ local digest512 = sha2.digest512
+
+ sha2.hash256 = function(str) return lpegmatch(bytestohex,digest256(str)) end
+ sha2.hash384 = function(str) return lpegmatch(bytestohex,digest384(str)) end
+ sha2.hash512 = function(str) return lpegmatch(bytestohex,digest512(str)) end
+ sha2.HASH256 = function(str) return lpegmatch(bytestoHEX,digest256(str)) end
+ sha2.HASH384 = function(str) return lpegmatch(bytestoHEX,digest384(str)) end
+ sha2.HASH512 = function(str) return lpegmatch(bytestoHEX,digest512(str)) end
+
+end
diff --git a/tex/context/base/mkiv/luat-bas.mkiv b/tex/context/base/mkiv/luat-bas.mkiv
index b1af4da3e..b972fc180 100644
--- a/tex/context/base/mkiv/luat-bas.mkiv
+++ b/tex/context/base/mkiv/luat-bas.mkiv
@@ -30,6 +30,7 @@
\registerctxluafile{l-file} {}
\registerctxluafile{l-gzip} {}
\registerctxluafile{l-md5} {}
+\registerctxluafile{l-sha} {}
\registerctxluafile{l-dir} {}
\registerctxluafile{l-unicode} {optimize}
%registerctxluafile{l-utils} {}
diff --git a/tex/context/base/mkiv/math-fbk.lua b/tex/context/base/mkiv/math-fbk.lua
index 0d8fda7d4..bfe2fde57 100644
--- a/tex/context/base/mkiv/math-fbk.lua
+++ b/tex/context/base/mkiv/math-fbk.lua
@@ -127,6 +127,8 @@ function fallbacks.apply(target,original)
}
target.mathrelation = data
--
+ local fullname = trace_fallbacks and target.properties.fullname
+ --
for k, v in sortedhash(virtualcharacters) do
if not characters[k] then
local tv = type(v)
@@ -144,7 +146,7 @@ function fallbacks.apply(target,original)
-- something else
end
if trace_fallbacks and characters[k] then
- report_fallbacks("extending math font %a with %U",target.properties.fullname,k)
+ report_fallbacks("extending math font %a with %U",fullname,k)
end
end
end
diff --git a/tex/context/base/mkiv/math-noa.lua b/tex/context/base/mkiv/math-noa.lua
index 1fca63e23..0e502505d 100644
--- a/tex/context/base/mkiv/math-noa.lua
+++ b/tex/context/base/mkiv/math-noa.lua
@@ -787,18 +787,18 @@ do
local data = fontdata[id]
local char = mathematics.big(data,chr,size,method)
local ht = getfield(pointer,"height")
- -- local ht = getheight(pointer) -- LUATEXVERSION >= 1.090
+ -- local ht = getheight(pointer) -- LUATEXVERSION >= 1.080
local dp = getfield(pointer,"depth")
- -- local dp = getdepth(pointer) -- LUATEXVERSION >= 1.090
+ -- local dp = getdepth(pointer) -- LUATEXVERSION >= 1.080
if ht == 1 or dp == 1 then -- 1 scaled point is a signal
local chardata = data.characters[char]
if ht == 1 then
setfield(pointer,"height",chardata.height)
- -- setheight(pointer,chardata.height) -- LUATEXVERSION >= 1.090
+ -- setheight(pointer,chardata.height) -- LUATEXVERSION >= 1.080
end
if dp == 1 then
setfield(pointer,"depth",chardata.depth)
- -- setdepth(pointer,chardata.depth) -- LUATEXVERSION >= 1.090
+ -- setdepth(pointer,chardata.depth) -- LUATEXVERSION >= 1.080
end
end
if trace_fences then
diff --git a/tex/context/base/mkiv/mlib-run.lua b/tex/context/base/mkiv/mlib-run.lua
index 7b10f6273..e1c9a9929 100644
--- a/tex/context/base/mkiv/mlib-run.lua
+++ b/tex/context/base/mkiv/mlib-run.lua
@@ -194,7 +194,8 @@ local f_preamble = formatters [ [[
local methods = {
double = "double",
scaled = "scaled",
- binary = "binary",
+ -- binary = "binary",
+ binary = "double",
decimal = "decimal",
default = "scaled",
}
diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua
index d4b38bac4..8496980aa 100644
--- a/tex/context/base/mkiv/mult-low.lua
+++ b/tex/context/base/mkiv/mult-low.lua
@@ -276,7 +276,7 @@ return {
"doifelsenumber", "doifnumberelse", "doifnumber", "doifnotnumber",
"doifelsecommon", "doifcommonelse", "doifcommon", "doifnotcommon",
"doifinstring", "doifnotinstring", "doifelseinstring", "doifinstringelse",
- "doifelseassignment", "doifassignmentelse", "docheckassignment",
+ "doifelseassignment", "doifassignmentelse", "docheckassignment", "doifelseassignmentcs", "doifassignmentelsecs",
"doiftext", "doifelsetext", "doiftextelse", "doifnottext",
--
"tracingall", "tracingnone", "loggingall",
diff --git a/tex/context/base/mkiv/node-bck.lua b/tex/context/base/mkiv/node-bck.lua
index 3c453bfb3..bfc550c81 100644
--- a/tex/context/base/mkiv/node-bck.lua
+++ b/tex/context/base/mkiv/node-bck.lua
@@ -203,7 +203,7 @@ local function add_backgrounds(head,id,list)
end
end
-if LUATEXVERSION >= 1.090 then
+if LUATEXVERSION >= 1.080 then
-- local function add_alignbackgrounds(head,list)
add_alignbackgrounds = function(head,list)
diff --git a/tex/context/base/mkiv/node-fnt.lua b/tex/context/base/mkiv/node-fnt.lua
index ee0119d49..4c46c7942 100644
--- a/tex/context/base/mkiv/node-fnt.lua
+++ b/tex/context/base/mkiv/node-fnt.lua
@@ -553,7 +553,7 @@ function handlers.characters(head,groupcode,size,packtype,direction)
return head
end
-if LUATEXVERSION >= 1.090 then
+if LUATEXVERSION >= 1.080 then
do
diff --git a/tex/context/base/mkiv/node-ppt.lua b/tex/context/base/mkiv/node-ppt.lua
index f4a3df12c..e26d1690e 100644
--- a/tex/context/base/mkiv/node-ppt.lua
+++ b/tex/context/base/mkiv/node-ppt.lua
@@ -415,7 +415,7 @@ end)
--
-- end
-if LUATEXVERSION >= 1.090 then
+if LUATEXVERSION >= 1.080 then
function properties.attach(head)
diff --git a/tex/context/base/mkiv/node-rul.lua b/tex/context/base/mkiv/node-rul.lua
index 3b5a036ea..ae837bb03 100644
--- a/tex/context/base/mkiv/node-rul.lua
+++ b/tex/context/base/mkiv/node-rul.lua
@@ -535,7 +535,7 @@ local function find_attr(head,attr)
end
function nodes.linefillers.handler(head) -- traverse_list
- for current in nexthlist, head do -- LUATEXVERSION >= 1.090
+ for current in nexthlist, head do -- LUATEXVERSION >= 1.080
if getsubtype(current) == line_code then
local list = getlist(current)
if list then
@@ -659,10 +659,10 @@ function nodes.linefillers.handler(head) -- traverse_list
return head
end
-if LUATEXVERSION >= 1.090 then
+if LUATEXVERSION >= 1.080 then
function nodes.linefillers.handler(head) -- traverse_list
- for current, subtype, list in nexthlist, head do -- LUATEXVERSION >= 1.090
+ for current, subtype, list in nexthlist, head do -- LUATEXVERSION >= 1.080
if list and subtype == line_code then
-- why doesn't leftskip take the attributes
-- or list[linefiller] or maybe first match (maybe we need a fast helper for that)
diff --git a/tex/context/base/mkiv/pack-rul.lua b/tex/context/base/mkiv/pack-rul.lua
index 80379b207..fbffa4ec3 100644
--- a/tex/context/base/mkiv/pack-rul.lua
+++ b/tex/context/base/mkiv/pack-rul.lua
@@ -167,7 +167,7 @@ local function doreshapeframedbox(n)
texsetdimen("global","framedaveragewidth",averagewidth)
end
-if LUATEXVERSION >= 1.090 then
+if LUATEXVERSION >= 1.080 then
local traverse_list = node.direct.traverse_list
diff --git a/tex/context/base/mkiv/page-lin.lua b/tex/context/base/mkiv/page-lin.lua
index b990cb223..e59bb4ed1 100644
--- a/tex/context/base/mkiv/page-lin.lua
+++ b/tex/context/base/mkiv/page-lin.lua
@@ -284,7 +284,7 @@ end
local function listisnumbered(list)
if list then
- for n in nexthlist, list do -- LUATEXVERSION >= 1.090
+ for n in nexthlist, list do -- LUATEXVERSION >= 1.080
if getsubtype(n) == line_code then
local a = getattr(n,a_linenumber)
if a then
@@ -384,7 +384,7 @@ function boxed.stage_one(n,nested)
local skip = false
local function check()
- for n in nexthlist, list do -- LUATEXVERSION >= 1.090
+ for n in nexthlist, list do -- LUATEXVERSION >= 1.080
local subtype = getsubtype(n)
if subtype ~= line_code then
-- go on
@@ -451,7 +451,7 @@ function boxed.stage_one(n,nested)
if not list then
return
end
- for n in nextvlist, list do -- LUATEXVERSION >= 1.090
+ for n in nextvlist, list do -- LUATEXVERSION >= 1.080
local p = properties[n]
if p and p.columngap then
if trace_numbers then
@@ -474,7 +474,7 @@ function boxed.stage_two(n,m)
if #current_list > 0 then
m = m or lines.scratchbox
local t, tn = { }, 0
- for l in nexthlist, getlist(getbox(m)) do -- LUATEXVERSION >= 1.090
+ for l in nexthlist, getlist(getbox(m)) do -- LUATEXVERSION >= 1.080
tn = tn + 1
t[tn] = copy_node(l) -- use take_box instead
end
diff --git a/tex/context/base/mkiv/page-sid.mkiv b/tex/context/base/mkiv/page-sid.mkiv
index 9304af6d9..812196e6f 100644
--- a/tex/context/base/mkiv/page-sid.mkiv
+++ b/tex/context/base/mkiv/page-sid.mkiv
@@ -41,6 +41,9 @@
\newdimen \d_page_sides_progress
\newdimen \d_page_sides_page_total
+\newdimen \d_page_sides_leftoffset
+\newdimen \d_page_sides_rightoffset
+
%newbox \b_page_sides_bottom
\newcount \c_page_sides_lines_done
@@ -217,6 +220,8 @@
+\compensatedinnermakeupmargin
\relax
\fi
+ \global\d_page_sides_leftoffset \d_page_sides_rightskip
+ \global\d_page_sides_rightoffset\d_page_sides_leftskip
\ifdim\d_page_sides_rightskip>\zeropoint
\global\advance\d_page_sides_rightskip\rightskip
\fi
diff --git a/tex/context/base/mkiv/scrp-ini.lua b/tex/context/base/mkiv/scrp-ini.lua
index aa16198d5..cc74df16b 100644
--- a/tex/context/base/mkiv/scrp-ini.lua
+++ b/tex/context/base/mkiv/scrp-ini.lua
@@ -933,7 +933,7 @@ function autofontfeature.handler(head)
return head
end
-if LUATEXVERSION >= 1.090 then
+if LUATEXVERSION >= 1.080 then
function autofontfeature.handler(head)
for n, font, char in nextchar, head do
diff --git a/tex/context/base/mkiv/spac-chr.lua b/tex/context/base/mkiv/spac-chr.lua
index 20b72e1b9..98b07adf5 100644
--- a/tex/context/base/mkiv/spac-chr.lua
+++ b/tex/context/base/mkiv/spac-chr.lua
@@ -169,7 +169,7 @@ function characters.replacenbspaces(head)
return head
end
-if LUATEXVERSION >= 1.090 then
+if LUATEXVERSION >= 1.080 then
function characters.replacenbspaces(head)
local wipe = false
@@ -376,7 +376,7 @@ function characters.handler(head)
return head
end
-if LUATEXVERSION >= 1.090 then
+if LUATEXVERSION >= 1.080 then
function characters.handler(head)
local wipe = false
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 5f65609f5..53d29f6f6 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 b68d254b1..6e81fe864 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/strc-blk.mkiv b/tex/context/base/mkiv/strc-blk.mkiv
index f0df6dda8..e52198721 100644
--- a/tex/context/base/mkiv/strc-blk.mkiv
+++ b/tex/context/base/mkiv/strc-blk.mkiv
@@ -63,6 +63,12 @@
\doifelsenextoptionalcs\strc_blocks_begin_yes\strc_blocks_begin_nop}
\unexpanded\def\strc_blocks_begin_yes[#1]%
+ {\doifelseassignmentcs{#1}%
+ \strc_blocks_begin_indeed
+ \strc_blocks_begin_tagged
+ {#1}}
+
+\unexpanded\def\strc_blocks_begin_tagged#1%
{\edef\m_subblock{#1}%
\doifelsenextoptionalcs\strc_blocks_begin_yes_yes\strc_blocks_begin_nop}
diff --git a/tex/context/base/mkiv/strc-tag.lua b/tex/context/base/mkiv/strc-tag.lua
index 1a3ee27b4..bcd7f49ca 100644
--- a/tex/context/base/mkiv/strc-tag.lua
+++ b/tex/context/base/mkiv/strc-tag.lua
@@ -214,6 +214,7 @@ local properties = allocate { -- todo: more "record = true" to improve forma
pubfld = { pdf = "Span", nature = "inline" },
block = { pdf = "Div", nature = "display" },
+ userdata = { pdf = "Div", nature = "display" },
}
diff --git a/tex/context/base/mkiv/strc-tag.mkiv b/tex/context/base/mkiv/strc-tag.mkiv
index 0ff5aec48..8530431ed 100644
--- a/tex/context/base/mkiv/strc-tag.mkiv
+++ b/tex/context/base/mkiv/strc-tag.mkiv
@@ -170,6 +170,7 @@
\def\t!pubfld {pubfld} % Span
\def\t!block {block} % Div
+\def\t!userdata {userdata} % Div
% \setuptaglabeltext
% [en]
diff --git a/tex/context/base/mkiv/strc-usr.lua b/tex/context/base/mkiv/strc-usr.lua
new file mode 100644
index 000000000..f121fe296
--- /dev/null
+++ b/tex/context/base/mkiv/strc-usr.lua
@@ -0,0 +1,29 @@
+if not modules then modules = { } end modules ['strc-usr'] = {
+ version = 1.000,
+ comment = "companion to strc-usr.mkiv",
+ author = "Wolfgang Schuster",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- The following is copied from \type {tabl-xtb.lua} to make the userdata environment
+-- work with \LUA\ documents.
+
+local context = context
+local ctxcore = context.core
+
+local startuserdata = ctxcore.startuserdata
+local stopuserdata = ctxcore.stopuserdata
+
+local startcollecting = context.startcollecting
+local stopcollecting = context.stopcollecting
+
+function ctxcore.startuserdata(...)
+ startcollecting()
+ startuserdata(...)
+end
+
+function ctxcore.stopuserdata()
+ stopuserdata()
+ stopcollecting()
+end
diff --git a/tex/context/base/mkiv/strc-usr.mkiv b/tex/context/base/mkiv/strc-usr.mkiv
new file mode 100644
index 000000000..97b656fa0
--- /dev/null
+++ b/tex/context/base/mkiv/strc-usr.mkiv
@@ -0,0 +1,180 @@
+%D \module
+%D [ file=strc-bkm,
+%D version=2009.04.01,
+%D title=\CONTEXT\ Structure Macros,
+%D subtitle=Bookmarks,
+%D author=Wolfgang Schuster,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Structure Macros / Userdata}
+
+\registerctxluafile{strc-usr}{}
+
+%D It's a bit like blocks that also use buffers but more lightweight and with
+%D inplace settings.
+%D
+%D \starttyping
+%D \defineuserdata [test] [style=italic]
+%D
+%D \samplefile{klein}
+%D
+%D \startuserdata [before=\blank,after=\blank,color=red]
+%D \samplefile{greenfield}
+%D \stopuserdata
+%D
+%D \samplefile{sapolsky}
+%D
+%D \startuserdata [test]
+%D \samplefile{bryson}
+%D \stopuserdata
+%D
+%D \samplefile{jojomayer}
+%D
+%D \startuserdata [test] [before=\blank,after=\blank,color=red]
+%D \samplefile{linden}
+%D \stopuserdata
+%D
+%D \samplefile{montgomery}
+%D \stoptyping
+%D
+%D Or from \LUA:
+%D
+%D \starttyping
+%D \startluacode
+%D context.startuserdata({color="blue"})
+%D context.samplefile("klein")
+%D context.stopuserdata()
+%D \stopluacode
+%D \stoptyping
+%D
+%D An example of an alternative:
+%D
+%D \starttyping
+%D \defineuserdataalternative [epigraph] [renderingsetup=userdata:epigraph]
+%D
+%D \startsetups [userdata:epigraph]
+%D \startframedtext [location=right,frame=off,align={flushleft,broad},style=\tfx,offset=.25ex,width=.5\textwidth]
+%D \begstrut\inlinebuffer[userdata]\endstrut
+%D \hairline
+%D \wordright{\userdataparameter{author}}
+%D \stopframedtext
+%D \stopsetups
+%D
+%D \defineuserdata
+%D [epigraph]
+%D [alternative=epigraph]
+%D
+%D \startuserdata [epigraph] [author={Sean B. Carrol}]
+%D The fraction of fossil olfactory receptor genes is significantly higher in
+%D all species with full color vision. This suggests that the evolution of
+%D trichromatic vision --- which allows these primates to detect food, mates,
+%D and danger with visual cues --- has reduced their reliance on the sense of
+%D smell.
+%D \stopuserdata
+%D
+%D \startuserdata [epigraph] [author={Sean B. Carrol}]
+%D \samplefile{carrol}
+%D \stopuserdata
+%D \stoptyping
+
+\unprotect
+
+\installnamespace {userdata}
+\installnamespace {userdataalternative}
+\installnamespace {userdatarenderings}
+
+\installcommandhandler \????userdata {userdata} \????userdata
+\installcommandhandler \????userdataalternative {userdataalternative} \????userdataalternative
+
+\unexpanded\def\startuserdata
+ {\begingroup
+ \let\currentuserdata\empty
+ \doifelsenextoptionalcs\userdata_start_delayed\userdata_start_indeed}
+
+% This variant works only when the userdata instance exists while the assignment check
+% can also be used with undefined instances which falls back to the global settings.
+%
+% \def\userdata_start_delayed[#1]%
+% {\ifcsname\nameduserdatahash{\detokenize\expandafter{\normalexpanded{#1}}}\s!parent\endcsname
+% \expandafter\userdata_start_delayed_name
+% \else
+% \expandafter\userdata_start_delayed_parameters
+% \fi[#1]}
+
+\def\userdata_start_delayed[#1]%
+ {\doifelseassignmentcs{#1}%
+ \userdata_start_delayed_parameters
+ \userdata_start_delayed_name
+ [#1]}
+
+\def\userdata_start_delayed_parameters[#1]%
+ {\setupcurrentuserdata[#1]%
+ \userdata_start_indeed}
+
+\def\userdata_start_delayed_name[#1]%
+ {\edef\currentuserdata{#1}%
+ \checkuserdataparent
+ \doifelsenextoptionalcs\userdata_start_delayed_parameters\userdata_start_indeed}
+
+\def\userdata_start_indeed
+ {\grabbufferdatadirect\s!userdata{\csstring\startuserdata}{\csstring\stopuserdata}}
+
+% \unexpanded\def\stopuserdata
+% {\useuserdatastyleandcolor\c!style\c!color
+% \usealignparameter\userdataparameter
+% \edef\currentuserdataalternative{\userdataparameter\c!alternative}%
+% \ifcsname\currentuserdataalternativehash\s!parent\endcsname \else
+% \let\currentuserdataalternative\s!default
+% \fi
+% \edef\p_renderingsetup{\userdataalternativeparameter\c!renderingsetup}%
+% \directsetup\p_renderingsetup
+% \endgroup}
+
+\unexpanded\def\stopuserdata
+ {\userdataparameter\c!before % HH: moved, so we obey the outer spacing
+ \dostarttagged\t!userdata\currentuserdata % HH: added, maybe move up ?
+ \begingroup
+ \useuserdatastyleandcolor\c!style\c!color
+ \usealignparameter\userdataparameter % HH: added
+ \edef\currentuserdataalternative{\userdataparameter\c!alternative}%
+ \ifcsname\currentuserdataalternativehash\s!parent\endcsname \else
+ \let\currentuserdataalternative\s!default
+ \fi
+ \usesetupsparameter\userdataparameter
+ \edef\p_renderingsetup{\userdataalternativeparameter\c!renderingsetup}%
+ \directsetup\p_renderingsetup
+ \endgroup
+ \dostoptagged
+ \userdataparameter\c!after % HH: moved
+ \endgroup}
+
+\unexpanded\def\getuserdata
+ {\getbufferdata[\s!userdata]}
+
+\unexpanded\def\getinlineuserdata
+ {\inlinebuffer[\s!userdata]}
+
+\defineuserdataalternative
+ [\s!default]
+ [\c!renderingsetup=\????userdatarenderings:\s!default]
+
+% \startsetups[\????userdatarenderings:\s!default]
+% \userdataparameter\c!before
+% \usesetupsparameter\userdataparameter
+% \getbufferdata[\s!userdata]
+% \userdataparameter\c!after
+% \stopsetups
+
+\startsetups[\????userdatarenderings:\s!default]
+ \getuserdata
+\stopsetups
+
+\setupuserdata
+ [\c!alternative=\s!default]
+
+\protect
diff --git a/tex/context/base/mkiv/syst-aux.mkiv b/tex/context/base/mkiv/syst-aux.mkiv
index 49b2ba288..faed87f2b 100644
--- a/tex/context/base/mkiv/syst-aux.mkiv
+++ b/tex/context/base/mkiv/syst-aux.mkiv
@@ -4718,14 +4718,22 @@
\def\syst_helpers_check_if_assignment_else#1=#2#3\_e_o_p_{\if#2@}%
-\unexpanded\def\doifelseassignment#1% expandable
+\unexpanded\def\doifelseassignment#1%
{\expandafter\syst_helpers_check_if_assignment_else\detokenize{#1}=@@\_e_o_p_
\expandafter\secondoftwoarguments
\else
\expandafter\firstoftwoarguments
\fi}
-\let\doifassignmentelse\doifelseassignment
+\unexpanded\def\doifelseassignmentcs#1#2#3%
+ {\expandafter\syst_helpers_check_if_assignment_else\detokenize{#1}=@@\_e_o_p_
+ \expandafter#3%
+ \else
+ \expandafter#2%
+ \fi}
+
+\let\doifassignmentelse \doifelseassignment
+\let\doifassignmentelsecs\doifelseassignmentcs
\newif\ifassignment
diff --git a/tex/context/base/mkiv/typo-cln.lua b/tex/context/base/mkiv/typo-cln.lua
index 0d5e3eb5e..a2ebe6a0a 100644
--- a/tex/context/base/mkiv/typo-cln.lua
+++ b/tex/context/base/mkiv/typo-cln.lua
@@ -81,7 +81,7 @@ function cleaners.handler(head)
return head
end
-if LUATEXVERSION >= 1.090 then
+if LUATEXVERSION >= 1.080 then
function cleaners.handler(head)
local inline = false
diff --git a/tex/context/base/mkiv/typo-lin.lua b/tex/context/base/mkiv/typo-lin.lua
index 9d7ee359e..fe780dfe7 100644
--- a/tex/context/base/mkiv/typo-lin.lua
+++ b/tex/context/base/mkiv/typo-lin.lua
@@ -252,7 +252,7 @@ function paragraphs.normalize(head,islocal)
if l_width ~= 0 or l_stretch ~= 0 or l_shrink ~= 0 then
local last = nil -- a nut
local done = false
- for line in nexthlist, head do -- LUATEXVERSION >= 1.090
+ for line in nexthlist, head do -- LUATEXVERSION >= 1.080
if getsubtype(line) == line_code and not getprop(line,"line") then
if done then
last = line
@@ -280,7 +280,7 @@ function paragraphs.normalize(head,islocal)
end
end
-- normalizer
- for line in nexthlist, head do -- LUATEXVERSION >= 1.090
+ for line in nexthlist, head do -- LUATEXVERSION >= 1.080
if getsubtype(line) == line_code and not getprop(line,"line") then
normalize(line)
if done then
diff --git a/tex/context/base/mkiv/typo-pnc.lua b/tex/context/base/mkiv/typo-pnc.lua
index 1ffff991f..e9b947807 100644
--- a/tex/context/base/mkiv/typo-pnc.lua
+++ b/tex/context/base/mkiv/typo-pnc.lua
@@ -135,7 +135,7 @@ function periodkerns.handler(head)
return head
end
-if LUATEXVERSION >= 1.090 then
+if LUATEXVERSION >= 1.080 then
function periodkerns.handler(head)
for current, font, char in nextglyph, head do
diff --git a/tex/context/base/mkiv/util-sha.lua b/tex/context/base/mkiv/util-sha.lua
index 3ff09e1bc..d84e46975 100644
--- a/tex/context/base/mkiv/util-sha.lua
+++ b/tex/context/base/mkiv/util-sha.lua
@@ -8,6 +8,13 @@ if not modules then modules = { } end modules ['util-sha'] = {
comment3 = "due to bit operators this code only works in lua(tex) 5.3",
}
+if sha2 then
+ if utilities then
+ utilities.sha2 = sha2
+ end
+ return sha2
+end
+
-- This doesn't work in luajittex ... maybe some day it will have bit operators too.
-- I'm not really in the mood for making this module aware (by compiling the
-- function depending on the engine that I use but I probably won't use luajittex in
diff --git a/tex/context/base/mkiv/util-soc.lua b/tex/context/base/mkiv/util-soc.lua
index 29b93635c..590287a25 100644
--- a/tex/context/base/mkiv/util-soc.lua
+++ b/tex/context/base/mkiv/util-soc.lua
@@ -118,3 +118,12 @@ function mail.send(specification)
return true
end
end
+
+-- for now we have this here:
+
+if socket then
+
+ math.initialseed = tonumber(string.sub(string.reverse(tostring(math.ceil(socket.gettime()*10000))),1,6))
+ math.randomseed(math.initialseed)
+
+end
diff --git a/tex/context/base/mkiv/util-sql-imp-ffi.lua b/tex/context/base/mkiv/util-sql-imp-ffi.lua
index 3ea29b058..77d32a693 100644
--- a/tex/context/base/mkiv/util-sql-imp-ffi.lua
+++ b/tex/context/base/mkiv/util-sql-imp-ffi.lua
@@ -118,6 +118,14 @@ ffi.cdef [[
MYSQL_result *result
);
+ unsigned int mysql_affected_rows (
+ MYSQL_instance *mysql
+ );
+
+ unsigned int mysql_field_count (
+ MYSQL_instance *mysql
+ );
+
unsigned int mysql_num_fields (
MYSQL_result *res
);
@@ -166,12 +174,14 @@ local dataprepared = helpers.preparetemplate
local serialize = sql.serialize
local deserialize = sql.deserialize
-local mysql_initialize = mysql.mysql_init
+local mysql_open_session = mysql.mysql_init
local mysql_open_connection = mysql.mysql_real_connect
local mysql_execute_query = mysql.mysql_real_query
local mysql_close_connection = mysql.mysql_close
+local mysql_affected_rows = mysql.mysql_affected_rows
+local mysql_field_count = mysql.mysql_field_count
local mysql_field_seek = mysql.mysql_field_seek
local mysql_num_fields = mysql.mysql_num_fields
local mysql_fetch_fields = mysql.mysql_fetch_fields
@@ -191,341 +201,361 @@ local NULL = ffi.cast("MYSQL_result *",0)
local ffi_tostring = ffi.string
local ffi_gc = ffi.gc
------ mysqldata = ffi.cast("MYSQL_instance*",mysql.malloc(1024*1024))
-local instance = mysql.mysql_init(nil) -- (mysqldata)
-
--- local instance = ffi.cast("MYSQL_instance*",mysql.malloc(1024*1024))
--- local success = mysql.mysql_init(mysqldata)
+local instance = mysql.mysql_init(nil)
local mysql_constant_false = false
local mysql_constant_true = true
-local function finish(t)
- local r = t._result_
- if r then
- ffi_gc(r,mysql_free_result)
- end
-end
+local wrapresult do
-local function getcolnames(t)
- return t.names
-end
+ local function collect(t)
+ local result = t._result_
+ if result then
+ ffi_gc(result,mysql_free_result)
+ end
+ end
-local function getcoltypes(t)
- return t.types
-end
+ local function finish(t)
+ local result = t._result_
+ if result then
+ t._result_ = nil
+ ffi_gc(result,mysql_free_result)
+ end
+ end
-local function numrows(t)
- return tonumber(t.nofrows)
-end
+ local function getcoldata(t)
+ local result = t._result_
+ local nofrows = t.nofrows
+ local noffields = t.noffields
+ local names = { }
+ local types = { }
+ local fields = mysql_fetch_fields(result)
+ for i=1,noffields do
+ local field = fields[i-1]
+ names[i] = ffi_tostring(field.name)
+ types[i] = tonumber(field.type) -- todo
+ end
+ t.names = names
+ t.types = types
+ end
-local function list(t)
- local result = t._result_
- if result then
- local row = mysql_fetch_row(result)
- -- local len = mysql_fetch_lengths(result)
- local result = { }
- for i=1,t.noffields do
- result[i] = ffi_tostring(row[i-1])
+ local function getcolnames(t)
+ local names = t.names
+ if names then
+ return names
end
- return result
+ getcoldata(t)
+ return t.names
end
-end
-local function hash(t)
- local result = t._result_
- local fields = t.names
- if result then
- local row = mysql_fetch_row(result)
- -- local len = mysql_fetch_lengths(result)
- local result = { }
- for i=1,t.noffields do
- result[fields[i]] = ffi_tostring(row[i-1])
+ local function getcoltypes(t)
+ local types = t.types
+ if types then
+ return types
end
- return result
+ getcoldata(t)
+ return t.types
end
-end
-local function wholelist(t)
- return fetch_all_rows(t._result_)
-end
+ local function numrows(t)
+ return t.nofrows
+ end
-local mt = { __index = {
- -- regular
- finish = finish,
- list = list,
- hash = hash,
- wholelist = wholelist,
- -- compatibility
- numrows = numrows,
- getcolnames = getcolnames,
- getcoltypes = getcoltypes,
- -- fallback
- _result_ = nil,
- names = { },
- types = { },
- noffields = 0,
- nofrows = 0,
+ -- local function fetch(t)
+ -- local
+ -- local row = mysql_fetch_row(result)
+ -- local result = { }
+ -- for i=1,t.noffields do
+ -- result[i] = ffi_tostring(row[i-1])
+ -- end
+ -- return unpack(result)
+ -- end
+
+ local mt = {
+ __gc = collect,
+ __index = {
+ _result_ = nil,
+ close = finish,
+ numrows = numrows,
+ getcolnames = getcolnames,
+ getcoltypes = getcoltypes,
+ -- fetch = fetch, -- not efficient
+ }
}
-}
--- session
+ wrapresult = function(connection)
+ local result = mysql_store_result(connection)
+ if result ~= NULL then
+ mysql_field_seek(result,0)
+ local t = {
+ _result_ = result,
+ nofrows = tonumber(mysql_num_rows (result) or 0) or 0,
+ noffields = tonumber(mysql_num_fields(result) or 0) or 0,
+ }
+ return setmetatable(t,mt)
+ elseif tonumber(mysql_field_count(connection) or 0) or 0 > 0 then
+ return tonumber(mysql_affected_rows(connection))
+ end
+ end
-local function close(t)
- mysql_close_connection(t._connection_)
end
-local function execute(t,query)
- if query and query ~= "" then
- local connection = t._connection_
- local result = mysql_execute_query(connection,query,#query)
- if result == 0 then
- local result = mysql_store_result(connection)
- if result ~= NULL then
- mysql_field_seek(result,0)
- local nofrows = tonumber(mysql_num_rows(result) or 0)
- local noffields = tonumber(mysql_num_fields(result))
- local names = { }
- local types = { }
- local fields = mysql_fetch_fields(result)
- for i=1,noffields do
- local field = fields[i-1]
- names[i] = ffi_tostring(field.name)
- types[i] = tonumber(field.type) -- todo
- end
- local t = {
- _result_ = result,
- names = names,
- types = types,
- noffields = noffields,
- nofrows = nofrows,
- }
- return setmetatable(t,mt)
+local initializesession do
+
+ -- timeouts = [ connect_timeout |wait_timeout | interactive_timeout ]
+
+ local timeout -- = 3600 -- to be tested
+
+ -- connection
+
+ local function close(t)
+ -- just a struct ?
+ end
+
+ local function execute(t,query)
+ if query and query ~= "" then
+ local connection = t._connection_
+ local result = mysql_execute_query(connection,query,#query)
+ if result == 0 then
+ return wrapresult(connection)
else
- -- return setmetatable({},mt)
+ -- mysql_error_number(connection)
+ return false, ffi_tostring(mysql_error_message(connection))
end
- else
-report_state()
-report_state("result : %S", result)
-report_state("error : %S", mysql_error_number(connection))
-report_state("message : %S", ffi_tostring(mysql_error_message(connection)))
-report_state("query : \n\n%S\n\n",query)
-report_state()
end
+ return false
end
- return false
-end
-local mt = {
- __index = {
- close = close,
- execute = execute,
+ local mt = {
+ __index = {
+ close = close,
+ execute = execute,
+ }
}
-}
-local function open(t,database,username,password,host,port)
- local connection = mysql_open_connection(
- t._session_,
- host or "localhost",
- username or "",
- password or "",
- database or "",
- port or 0,
- NULL,
- 0
- )
- if connection ~= NULL then
- local t = {
- _connection_ = connection,
- }
- return setmetatable(t,mt)
+ -- session
+
+ local function open(t,database,username,password,host,port)
+ local connection = mysql_open_connection(
+ t._session_,
+ host or "localhost",
+ username or "",
+ password or "",
+ database or "",
+ port or 0,
+ NULL,
+ 0
+ )
+ if connection ~= NULL then
+ if timeout then
+ execute(connection,formatters["SET SESSION connect_timeout=%s ;"](timeout))
+ end
+ local t = {
+ _connection_ = connection,
+ }
+ return setmetatable(t,mt)
+ end
end
-end
-
-local function message(t)
- return mysql_error_message(t._session_)
-end
-local function close(t)
- -- ffi_gc(t._connection_, mysql_close)
-end
+ local function message(t)
+ return mysql_error_message(t._session_)
+ end
-local mt = {
- __index = {
- connect = open,
- close = close,
- message = message,
- },
-}
+ local function close(t)
+ local connection = t._connection_
+ if connection and connection ~= NULL then
+ ffi_gc(connection, mysql_close)
+ t.connection = nil
+ end
+ end
-local function initialize()
- local session = {
- _session_ = mysql_initialize(instance) -- maybe share, single thread anyway
+ local mt = {
+ __index = {
+ connect = open,
+ close = close,
+ message = message,
+ },
}
- return setmetatable(session,mt)
-end
--- -- -- --
+ initializesession = function()
+ local session = {
+ _session_ = mysql_open_session(instance) -- maybe share, single thread anyway
+ }
+ return setmetatable(session,mt)
+ end
-local function connect(session,specification)
- return session:connect(
- specification.database or "",
- specification.username or "",
- specification.password or "",
- specification.host or "",
- specification.port
- )
end
-local function error_in_connection(specification,action)
- report_state("error in connection: [%s] user %s into %s at %s:%s",
- action or "unknown",
- specification.username or "no username",
- specification.database or "no database",
- specification.host or "no host",
- specification.port or "no port"
- )
-end
+local executequery do
-local function datafetched(specification,query,converter)
- if not query or query == "" then
- report_state("no valid query")
- return { }, { }
+ local function connect(session,specification)
+ return session:connect(
+ specification.database or "",
+ specification.username or "",
+ specification.password or "",
+ specification.host or "",
+ specification.port
+ )
end
- local id = specification.id
- local session, connection
- if id then
- local c = cache[id]
- if c then
- session = c.session
- connection = c.connection
+
+ local function fetched(specification,query,converter)
+ if not query or query == "" then
+ report_state("no valid query")
+ return false
end
- if not connection then
- session = initialize()
- connection = connect(session,specification)
+ local id = specification.id
+ local session, connection
+ if id then
+ local c = cache[id]
+ if c then
+ session = c.session
+ connection = c.connection
+ end
if not connection then
- for i=1,nofretries do
- sleep(retrydelay)
- report_state("retrying to connect: [%s.%s] %s@%s to %s:%s",
- id,i,
- specification.database or "no database",
- specification.username or "no username",
- specification.host or "no host",
- specification.port or "no port"
- )
- connection = connect(session,specification)
- if connection then
- break
- end
+ session = initializesession()
+ if not session then
+ return formatters["no session for %a"](id)
end
- end
- if connection then
- cache[id] = { session = session, connection = connection }
- end
- end
- else
- session = initialize()
- connection = connect(session,specification)
- if not connection then
- for i=1,nofretries do
- sleep(retrydelay)
- report_state("retrying to connect: [%s] %s@%s to %s:%s",
- i,
- specification.database or "no database",
- specification.username or "no username",
- specification.host or "no host",
- specification.port or "no port"
- )
connection = connect(session,specification)
- if connection then
- break
+ if not connection then
+ return formatters["no connection for %a"](id)
end
+ cache[id] = { session = session, connection = connection }
+ end
+ else
+ session = initializesession()
+ if not session then
+ return "no session"
+ end
+ connection = connect(session,specification)
+ if not connection then
+ return "no connection"
end
end
- end
- if not connection then
- report_state("error in connection: %s@%s to %s:%s",
+ if not connection then
+ report_state("error in connection: %s@%s to %s:%s",
specification.database or "no database",
specification.username or "no username",
specification.host or "no host",
specification.port or "no port"
)
- return { }, { }
- end
- query = lpegmatch(querysplitter,query)
- local result, message, okay
- for i=1,#query do
- local q = query[i]
- local r, m = connection:execute(q)
- if m then
- report_state("error in query, stage: %s",string.collapsespaces(q or "?"))
- message = message and format("%s\n%s",message,m) or m
+ return "no connection"
end
- if type(r) == "table" then
- result = r
- okay = true
- elseif not m then
- okay = true
+ query = lpegmatch(querysplitter,query)
+ local result, okay
+ for i=1,#query do
+ local q = query[i]
+ local r, m = connection:execute(q)
+ if m then
+ report_state("error in query to host %a: %s",specification.host,string.collapsespaces(q or "?"))
+ if m then
+ report_state("message: %s",m)
+ end
+ end
+ local t = type(r)
+ if t == "table" then
+ result = r
+ okay = true
+ elseif t == "number" then
+ okay = true
+ end
end
- end
-
- local data, keys
- if result then
- if converter then
- data = converter.ffi(result)
- else
- keys = result.names
- data = { }
- for i=1,result.nofrows do
- data[i] = result:hash()
+ if not okay then -- can go
+ -- why do we close a session
+ if connection then
+ connection:close()
+ end
+ if session then
+ session:close()
+ end
+ if id then
+ cache[id] = nil
+ end
+ return "execution error"
+ end
+ local data, keys
+ if result then
+ if converter then
+ data = converter.ffi(result)
+ else
+ local _result_ = result._result_
+ local noffields = result.noffields
+ local nofrows = result.nofrows
+ keys = result:getcolnames()
+ data = { }
+ if noffields > 0 and nofrows > 0 then
+ for i=1,nofrows do
+ local cells = { }
+ local row = mysql_fetch_row(_result_)
+ for j=1,noffields do
+ local s = row[j-1]
+ local k = keys[j]
+ if s == NULL then
+ cells[k] = ""
+ else
+ cells[k] = ffi_tostring(s)
+ end
+ end
+ data[i] = cells
+ end
+ end
end
+ result:close()
end
- result:finish()
- elseif message then
- report_state("message %s",message)
+ --
+ if not id then
+ if connection then
+ connection:close()
+ end
+ if session then
+ session:close()
+ end
+ end
+ return false, data, keys
end
- if not keys then
- keys = { }
- end
- if not data then
- data = { }
+ local function datafetched(specification,query,converter)
+ local callokay, connectionerror, data, keys = pcall(fetched,specification,query,converter)
+ if not callokay then
+ report_state("call error, retrying")
+ callokay, connectionerror, data, keys = pcall(fetched,specification,query,converter)
+ elseif connectionerror then
+ report_state("error: %s, retrying",connectionerror)
+ callokay, connectionerror, data, keys = pcall(fetched,specification,query,converter)
+ end
+ if not callokay then
+ report_state("persistent call error")
+ elseif connectionerror then
+ report_state("persistent error: %s",connectionerror)
+ end
+ return data or { }, keys or { }
end
- if not id then
- if connection then
- connection:close()
+ executequery = function(specification)
+ if trace_sql then
+ report_state("executing library")
+ end
+ if not validspecification(specification) then
+ report_state("error in specification")
+ return
+ end
+ local query = dataprepared(specification)
+ if not query then
+ report_state("error in preparation")
+ return
end
- if session then
- session:close()
+ local data, keys = datafetched(specification,query,specification.converter)
+ if not data then
+ report_state("error in fetching")
+ return
end
+ local one = data[1]
+ if one then
+ setmetatable(data,{ __index = one } )
+ end
+ return data, keys
end
- return data, keys
-end
-local function execute(specification)
- if trace_sql then
- report_state("executing library")
- end
- if not validspecification(specification) then
- report_state("error in specification")
- return
- end
- local query = dataprepared(specification)
- if not query then
- report_state("error in preparation")
- return
- end
- local data, keys = datafetched(specification,query,specification.converter)
- if not data then
- report_state("error in fetching")
- return
- end
- local one = data[1]
- if one then
- setmetatable(data,{ __index = one } )
- end
- return data, keys
end
local wraptemplate = [[
@@ -550,13 +580,14 @@ return function(result)
if not result then
return { }
end
- local nofrows = result.nofrows or 0
+ local nofrows = result.nofrows
if nofrows == 0 then
return { }
end
- local noffields = result.noffields or 0
- local _result_ = result._result_
+ local noffields = result.noffields
local target = { } -- no %s needed here
+ local _result_ = result._result_
+ -- we can share cells
for i=1,nofrows do
local cells = { }
local row = mysql_fetch_row(_result_)
@@ -572,7 +603,7 @@ return function(result)
%s
}
end
- result:finish() -- result:close()
+ result:close()
return target
end
]]
@@ -580,9 +611,9 @@ end
local celltemplate = "cells[%s]"
methods.ffi = {
- runner = function() end, -- never called
- execute = execute,
- initialize = initialize, -- returns session
+ runner = function() end, -- never called
+ execute = executequery,
+ initialize = initializesession, -- returns session
usesfiles = false,
wraptemplate = wraptemplate,
celltemplate = celltemplate,
diff --git a/tex/context/base/mkiv/util-sql-imp-library.lua b/tex/context/base/mkiv/util-sql-imp-library.lua
index a2b692e45..dbbeb32cc 100644
--- a/tex/context/base/mkiv/util-sql-imp-library.lua
+++ b/tex/context/base/mkiv/util-sql-imp-library.lua
@@ -156,13 +156,13 @@ local function fetched(specification,query,converter)
okay = true
end
end
- if not okay then -- can go
- if session then
- session:close()
- end
+ if not okay then
if connection then
connection:close()
end
+ if session then
+ session:close()
+ end
if id then
cache[id] = nil
end
diff --git a/tex/context/base/mkiv/util-sql-users.lua b/tex/context/base/mkiv/util-sql-users.lua
index ee1f10b74..57c99b2a7 100644
--- a/tex/context/base/mkiv/util-sql-users.lua
+++ b/tex/context/base/mkiv/util-sql-users.lua
@@ -25,12 +25,16 @@ local trace_sql = false trackers.register("sql.users.trace", function(v) trace_
local report = logs.reporter("sql","users")
local split = lpeg.splitat(":")
+
local valid = nil
local hash = function(s) return "MD5:" .. sumHEXA(s) end
+local sha2 = sha2 or (utilities and utilities.sha2)
-if LUAVERSION >= 5.3 then
+if not sha2 and LUAVERSION >= 5.3 then
+ sha2 = require("util-sha")
+end
- local sha2 = require("util-sha")
+if sha2 then
local HASH224 = sha2.HASH224
local HASH256 = sha2.HASH256
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index 5b62e358e..cb68e8fb6 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 b88e9fcce..9eb8ec988 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 386d61099..88e30479f 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 : 08/25/18 10:04:30
+-- merge date : 08/28/18 17:21:11
do -- begin closure to overcome local limits and interference
diff --git a/tex/generic/context/luatex/luatex-swiglib.lua b/tex/generic/context/luatex/luatex-swiglib.lua
index cbb6798c3..41ac91837 100644
--- a/tex/generic/context/luatex/luatex-swiglib.lua
+++ b/tex/generic/context/luatex/luatex-swiglib.lua
@@ -16,7 +16,7 @@ function requireswiglib(required,version)
if library then
return library
else
- local full = string.gsub(required,"%.","/"
+ local full = string.gsub(required,"%.","/")
local path = file.pathpart(full)
local name = file.nameonly(full) .. libsuffix
local list = kpse.show_path("clua")