diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-06-19 15:50:29 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-06-19 15:50:29 +0200 |
commit | d11a1200ed28c6e0058990a621d7404f821ac7fd (patch) | |
tree | a433002a97225266abf1f925beb0ed699dbee41c /tex/context/base/mkiv | |
parent | 008292817580eba8a0f0cf83d8e2d08df8fc8c3f (diff) | |
download | context-d11a1200ed28c6e0058990a621d7404f821ac7fd.tar.gz |
2017-06-19 15:35:00
Diffstat (limited to 'tex/context/base/mkiv')
-rw-r--r-- | tex/context/base/mkiv/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/font-con.lua | 76 | ||||
-rw-r--r-- | tex/context/base/mkiv/font-otl.lua | 4 | ||||
-rw-r--r-- | tex/context/base/mkiv/font-oto.lua | 95 | ||||
-rw-r--r-- | tex/context/base/mkiv/math-ini.mkiv | 69 | ||||
-rw-r--r-- | tex/context/base/mkiv/mult-prm.lua | 333 | ||||
-rw-r--r-- | tex/context/base/mkiv/mult-prm.mkiv | 61 | ||||
-rw-r--r-- | tex/context/base/mkiv/status-files.pdf | bin | 25695 -> 25686 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/status-lua.pdf | bin | 424912 -> 423550 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/strc-mat.mkiv | 7 | ||||
-rw-r--r-- | tex/context/base/mkiv/syst-ini.mkiv | 4 | ||||
-rw-r--r-- | tex/context/base/mkiv/util-lib.lua | 17 | ||||
-rw-r--r-- | tex/context/base/mkiv/util-sql-imp-sqlite.lua | 158 | ||||
-rw-r--r-- | tex/context/base/mkiv/util-sql-loggers.lua | 22 | ||||
-rw-r--r-- | tex/context/base/mkiv/util-sql.lua | 16 |
16 files changed, 447 insertions, 419 deletions
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index d8924d37a..395edf527 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{2017.06.15 22:10} +\newcontextversion{2017.06.19 15:30} %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 ab9a40429..229e59916 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -41,7 +41,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2017.06.15 22:10} +\edef\contextversion{2017.06.19 15:30} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-con.lua b/tex/context/base/mkiv/font-con.lua index 7287fe017..16dc3c05e 100644 --- a/tex/context/base/mkiv/font-con.lua +++ b/tex/context/base/mkiv/font-con.lua @@ -554,10 +554,31 @@ function constructors.scale(tfmdata,specification) local chr, description, index if changed then local c = changed[unicode] - if c then - description = descriptions[c] or descriptions[unicode] or character - character = characters[c] or character - index = description.index or c + if c and c ~= unicode then + while true do + local cc = changed[c] + if not cc then + -- we're done, no (futher) chain + break + elseif cc == unicode then + -- we probably have a bidi swap + break + elseif cc == c then + -- we have a self reference, shouldn't happen + c = nil + break + else + c = cc + end + end + if c then + description = descriptions[c] or descriptions[unicode] or character + character = characters[c] or character + index = description.index or c + else + description = descriptions[unicode] or character + index = description.index or unicode + end else description = descriptions[unicode] or character index = description.index or unicode @@ -1255,11 +1276,13 @@ do if not enhancers then - local actions = allocate() - local before = allocate() - local after = allocate() - local order = allocate() - local patches = { before = before, after = after } + local actions = allocate() -- no need to allocate thee + local before = allocate() + local after = allocate() + local order = allocate() + local known = { } + local nofsteps = 0 + local patches = { before = before, after = after } local trace = false local report = logs.reporter("fonts",format .. " enhancing") @@ -1285,7 +1308,7 @@ do report("%s enhancing file %a","start",filename) end ioflush() -- we want instant messages - for e=1,#order do + for e=1,nofsteps do local enhancer = order[e] local b = before[enhancer] if b then @@ -1295,7 +1318,7 @@ do end end end - enhance(enhancer,data,filename,raw) + enhance(enhancer,data,filename,raw) -- we have one installed: check extra features local a = after[enhancer] if a then for pattern, action in next, a do @@ -1317,7 +1340,9 @@ do if actions[what] then -- overloading, e.g."check extra features" else - order[#order+1] = what + nofsteps = nofsteps + 1 + order[nofsteps] = what + known[what] = nofsteps end actions[what] = action else @@ -1325,7 +1350,19 @@ do end end - -- fonts.constructors.otf.enhancers.patch("before","migrate metadata","cambria",function() end) + -- We used to have a lot of enhancers but no longer with the new font loader. The order of enhancers + -- is the order of definition. The before/after patches are there for old times sake and happen + -- before or after a (named) enhancer. An example of a set enhancer is "check extra features" so one + -- one set patches before or after that is applied. Unknown enhancers are auto-registered. It's a bit + -- messy but we keep it for compatibility reasons. + -- + -- fonts.handlers.otf.enhancers.patches.register("before","some patches","somefont",function(data,filename) + -- print("!!!!!!!") -- before | after + -- end) + -- + -- fonts.handlers.otf.enhancers.register("more patches",function(data,filename) + -- print("???????") -- enhance + -- end) local function patch(what,where,pattern,action) local pw = patches[what] @@ -1334,7 +1371,12 @@ do if ww then ww[pattern] = action else - pw[where] = { [pattern] = action} + pw[where] = { [pattern] = action } + if not known[where] then + nofsteps = nofsteps + 1 + order[nofsteps] = where + known[where] = nofsteps + end end end end @@ -1343,7 +1385,11 @@ do register = register, apply = apply, patch = patch, - patches = { register = patch }, -- for old times sake + report = report, + patches = { + register = patch, + report = report, + }, -- for old times sake } handler.enhancers = enhancers diff --git a/tex/context/base/mkiv/font-otl.lua b/tex/context/base/mkiv/font-otl.lua index c8006316f..a338f85a8 100644 --- a/tex/context/base/mkiv/font-otl.lua +++ b/tex/context/base/mkiv/font-otl.lua @@ -200,12 +200,12 @@ function otf.load(filename,sub,instance) otfreaders.expand(data) -- inline tables otfreaders.addunicodetable(data) -- only when not done yet -- - otfenhancers.apply(data,filename,data) + otfenhancers.apply(data,filename,data) -- in context one can also use treatments -- -- constructors.addcoreunicodes(data.resources.unicodes) -- still needed ? -- if applyruntimefixes then - applyruntimefixes(filename,data) + applyruntimefixes(filename,data) -- e.g. see treatments.lfg end -- data.metadata.math = data.resources.mathconstants diff --git a/tex/context/base/mkiv/font-oto.lua b/tex/context/base/mkiv/font-oto.lua index 9c42a54bd..22bb1d74e 100644 --- a/tex/context/base/mkiv/font-oto.lua +++ b/tex/context/base/mkiv/font-oto.lua @@ -67,21 +67,32 @@ local function cref(feature,sequence) return formatters["feature %a, type %a, chain lookup %a"](feature,sequence.type,sequence.name) end - -local function report_alternate(feature,sequence,descriptions,unicode,replacement,value,comment) - report_prepare("%s: base alternate %s => %s (%S => %S)", - cref(feature,sequence), - gref(descriptions,unicode), - replacement and gref(descriptions,replacement), - value, - comment) +local function report_substitution(feature,sequence,descriptions,unicode,substitution) + if unicode == substitution then + report_prepare("%s: base substitution %s maps onto itself", + cref(feature,sequence), + gref(descriptions,unicode)) + else + report_prepare("%s: base substitution %s => %S", + cref(feature,sequence), + gref(descriptions,unicode), + gref(descriptions,substitution)) + end end -local function report_substitution(feature,sequence,descriptions,unicode,substitution) - report_prepare("%s: base substitution %s => %S", - cref(feature,sequence), - gref(descriptions,unicode), - gref(descriptions,substitution)) +local function report_alternate(feature,sequence,descriptions,unicode,replacement,value,comment) + if unicode == replacement then + report_prepare("%s: base alternate %s maps onto itself", + cref(feature,sequence), + gref(descriptions,unicode)) + else + report_prepare("%s: base alternate %s => %s (%S => %S)", + cref(feature,sequence), + gref(descriptions,unicode), + replacement and gref(descriptions,replacement), + value, + comment) + end end local function report_ligature(feature,sequence,descriptions,unicode,ligature) @@ -221,6 +232,9 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis local trace_alternatives = trace_baseinit and trace_alternatives local trace_ligatures = trace_baseinit and trace_ligatures + -- A chain of changes is handled in font-con which is clesner because + -- we can have shared changes and such. + if not changed then changed = { } tfmdata.changed = changed @@ -233,39 +247,44 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis if kind == "gsub_single" then for i=1,#steps do for unicode, data in next, steps[i].coverage do - -- if not changed[unicode] then -- fails for multiple subs in some math fonts - if trace_singles then - report_substitution(feature,sequence,descriptions,unicode,data) - end + if unicode ~= data then changed[unicode] = data - -- end + end + if trace_singles then + report_substitution(feature,sequence,descriptions,unicode,data) + end end end elseif kind == "gsub_alternate" then for i=1,#steps do for unicode, data in next, steps[i].coverage do - if not changed[unicode] then - local replacement = data[alternate] - if replacement then + local replacement = data[alternate] + if replacement then + if unicode ~= replacement then changed[unicode] = replacement - if trace_alternatives then - report_alternate(feature,sequence,descriptions,unicode,replacement,value,"normal") - end - elseif defaultalt == "first" then - replacement = data[1] + end + if trace_alternatives then + report_alternate(feature,sequence,descriptions,unicode,replacement,value,"normal") + end + elseif defaultalt == "first" then + replacement = data[1] + if unicode ~= replacement then changed[unicode] = replacement - if trace_alternatives then - report_alternate(feature,sequence,descriptions,unicode,replacement,value,defaultalt) - end - elseif defaultalt == "last" then - replacement = data[#data] - if trace_alternatives then - report_alternate(feature,sequence,descriptions,unicode,replacement,value,defaultalt) - end - else - if trace_alternatives then - report_alternate(feature,sequence,descriptions,unicode,replacement,value,"unknown") - end + end + if trace_alternatives then + report_alternate(feature,sequence,descriptions,unicode,replacement,value,defaultalt) + end + elseif defaultalt == "last" then + replacement = data[#data] + if unicode ~= replacement then + changed[unicode] = replacement + end + if trace_alternatives then + report_alternate(feature,sequence,descriptions,unicode,replacement,value,defaultalt) + end + else + if trace_alternatives then + report_alternate(feature,sequence,descriptions,unicode,replacement,value,"unknown") end end end diff --git a/tex/context/base/mkiv/math-ini.mkiv b/tex/context/base/mkiv/math-ini.mkiv index c7f75fdc7..6fdf32531 100644 --- a/tex/context/base/mkiv/math-ini.mkiv +++ b/tex/context/base/mkiv/math-ini.mkiv @@ -289,31 +289,52 @@ % e.g.: \definemathematics[i:mp][setups=i:tight,openup=yes] -\newmuskip\defaultthickmuskip \defaultthickmuskip 5mu plus 5mu -\newmuskip\defaultmedmuskip \defaultmedmuskip 4mu plus 2mu minus 4mu -\newmuskip\defaultthinmuskip \defaultthinmuskip 3mu +\newmuskip\defaultthickmuskip \defaultthickmuskip 5mu plus 5mu +\newmuskip\defaultmedmuskip \defaultmedmuskip 4mu plus 2mu minus 4mu +\newmuskip\defaultthinmuskip \defaultthinmuskip 3mu -\newmuskip\halfthickmuskip \halfthickmuskip 2.5mu plus 2.5mu -\newmuskip\halfmedmuskip \halfmedmuskip 2.0mu plus 1.0mu minus 2.0mu -\newmuskip\halfthinmuskip \halfthinmuskip 1.5mu +\newmuskip\halfthickmuskip \halfthickmuskip 2.5mu plus 2.5mu +\newmuskip\halfmedmuskip \halfmedmuskip 2.0mu plus 1.0mu minus 2.0mu +\newmuskip\halfthinmuskip \halfthinmuskip 1.5mu -\newcount \defaultrelpenalty \defaultrelpenalty 500 -\newcount \defaultbinoppenalty \defaultbinoppenalty 700 +\newcount \defaultrelpenalty \defaultrelpenalty 500 +\newcount \defaultbinoppenalty \defaultbinoppenalty 700 +\newcount \defaultprerelpenalty \defaultprerelpenalty -100 +\newcount \defaultprebinoppenalty \defaultprebinoppenalty -100 + +% we need to control these otherwise: +% +% \prerelpenalty \defaultprerelpenalty +% \prebinoppenalty\defaultprebinoppenalty \startsetups math:spacing:default - \thickmuskip \defaultthickmuskip - \medmuskip \defaultmedmuskip - \thinmuskip \defaultthinmuskip - \relpenalty \defaultrelpenalty - \binoppenalty \defaultbinoppenalty + \thickmuskip \defaultthickmuskip + \medmuskip \defaultmedmuskip + \thinmuskip \defaultthinmuskip + \relpenalty \defaultrelpenalty + \binoppenalty \defaultbinoppenalty + \prebinoppenalty\maxdimen + \prerelpenalty \maxdimen +\stopsetups + +\startsetups math:spacing:split + \thickmuskip \defaultthickmuskip + \medmuskip \defaultmedmuskip + \thinmuskip \defaultthinmuskip + \relpenalty \defaultrelpenalty + \binoppenalty \defaultbinoppenalty + \prebinoppenalty\defaultprebinoppenalty + \prerelpenalty \defaultprerelpenalty \stopsetups \startsetups math:spacing:half - \thickmuskip \halfthickmuskip - \medmuskip \halfmedmuskip - \thinmuskip \halfthinmuskip - \relpenalty \defaultrelpenalty - \binoppenalty \defaultbinoppenalty + \thickmuskip \halfthickmuskip + \medmuskip \halfmedmuskip + \thinmuskip \halfthinmuskip + \relpenalty \defaultrelpenalty + \binoppenalty \defaultbinoppenalty + \prebinoppenalty\maxdimen + \prerelpenalty \maxdimen \stopsetups \startsetups math:spacing:tight @@ -326,8 +347,10 @@ \medmuskip 1\halfmedmuskip \thinmuskip 1\halfthinmuskip \fi - \relpenalty \defaultrelpenalty - \binoppenalty \maxdimen + \relpenalty \defaultrelpenalty + \binoppenalty \maxdimen + \prebinoppenalty\maxdimen + \prerelpenalty \maxdimen \stopsetups \startsetups math:spacing:fixed @@ -340,8 +363,10 @@ \medmuskip 1\halfmedmuskip \thinmuskip 1\halfthinmuskip \fi - \relpenalty \maxdimen - \binoppenalty \maxdimen + \relpenalty \maxdimen + \binoppenalty \maxdimen + \prebinoppenalty\maxdimen + \prerelpenalty \maxdimen \stopsetups % \dorecurse{80}{test \m[i:tight]{\red \fakeformula} test } diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index b55ac229d..69221db12 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -1,17 +1,9 @@ --- the tex table has overlap - return { ["aleph"]={ "AlephVersion", "Alephminorversion", "Alephrevision", "Alephversion", - "Omegaminorversion", - "Omegarevision", - "Omegaversion", - "boxdir", - "pagebottomoffset", - "pagerightoffset", }, ["etex"]={ "botmarks", @@ -85,9 +77,7 @@ return { "Udelimiterover", "Udelimiterunder", "Uhextensible", - "Uleft", "Umathaccent", ---"Umathaccents", "Umathaxis", "Umathbinbinspacing", "Umathbinclosespacing", @@ -97,7 +87,6 @@ return { "Umathbinordspacing", "Umathbinpunctspacing", "Umathbinrelspacing", ---"Umathbotaccent", "Umathchar", "Umathcharclass", "Umathchardef", @@ -115,7 +104,6 @@ return { "Umathcloserelspacing", "Umathcode", "Umathcodenum", - "Umathcodenumdef", "Umathconnectoroverlapmin", "Umathfractiondelsize", "Umathfractiondenomdown", @@ -137,6 +125,8 @@ return { "Umathlimitbelowbgap", "Umathlimitbelowkern", "Umathlimitbelowvgap", + "Umathnolimitsubfactor", + "Umathnolimitsupfactor", "Umathopbinspacing", "Umathopclosespacing", "Umathopenbinspacing", @@ -210,12 +200,10 @@ return { "Umathunderbarvgap", "Umathunderdelimiterbgap", "Umathunderdelimitervgap", - "Umathnolimitsupfactor", - "Umathnolimitsubfactor", - "Umiddle", + "Unosubscript", + "Unosuperscript", "Uoverdelimiter", "Uradical", - "Uright", "Uroot", "Uskewed", "Uskewedwithdelims", @@ -226,8 +214,6 @@ return { "Ustopmath", "Usubscript", "Usuperscript", - "Unosubscript", - "Unosuperscript", "Uunderdelimiter", "Uvextensible", "adjustspacing", @@ -235,14 +221,11 @@ return { "aligntab", "attribute", "attributedef", - "hyphenpenaltymode", + "automaticdiscretionary", "automatichyphenmode", "automatichyphenpenalty", - "automaticdiscretionary", - "explicithyphenpenalty", - "explicitdiscretionary", + "begincsname", "bodydir", - "boundary", "boxdir", "catcodetable", "clearmarks", @@ -256,19 +239,27 @@ return { "dvifeedback", "dvivariable", "efcode", - "hjcode", - "firstvalidlanguage", + "etoksapp", + "etokspre", + "expanded", + "expandglyphsinfont", + "explicitdiscretionary", + "explicithyphenpenalty", "fontid", "formatname", "gleaders", - "hyphenationmin", + "hjcode", "hyphenationbounds", + "hyphenationmin", + "hyphenpenaltymode", "ifabsdim", "ifabsnum", + "ifincsname", "ifprimitive", "ignoreligaturesinfont", "initcatcodetable", "insertht", + "lastnamedcs", "lastsavedboxresourceindex", "lastsavedimageresourceindex", "lastsavedimageresourcepages", @@ -286,34 +277,34 @@ return { "localrightbox", "lpcode", "luaescapestring", + "luafunction", "luatexbanner", "luatexrevision", "luatexversion", - "luafunction", "mathdir", "mathdisplayskipmode", "matheqnogapstep", "mathitalicsmode", "mathnolimitsmode", "mathoption", + "mathpenaltiesmode", + "mathrulesfam", + "mathrulesmode", "mathscriptsmode", "mathstyle", - "mathsurroundskip", "mathsurroundmode", - "mathrulesmode", - "mathrulesfam", - "noboundary", - "nokerns", + "mathsurroundskip", "nohrule", + "nokerns", "noligs", + "normaldeviate", "nospaces", "novrule", - "normaldeviate", "outputbox", "outputmode", + "pagebottomoffset", "pagedir", "pageheight", - "pagebottomoffset", "pageleftoffset", "pagerightoffset", "pagetopoffset", @@ -322,15 +313,17 @@ return { "pdfextension", "pdffeedback", "pdfvariable", + "postdisplaypenalty", "postexhyphenchar", "posthyphenchar", "predisplaygapfactor", + "predisplaypenalty", "preexhyphenchar", "prehyphenchar", "primitive", "protrudechars", - "protrusionboundary", "pxdimen", + "quitvmode", "randomseed", "rightghost", "rightmarginkern", @@ -346,41 +339,22 @@ return { "suppressfontnotfounderror", "suppressifcsnameerror", "suppresslongerror", - "suppressoutererror", "suppressmathparerror", + "suppressoutererror", "synctex", "tagcode", "textdir", + "toksapp", + "tokspre", "tracingfonts", "uniformdeviate", "useboxresource", "useimageresource", - "wordboundary", - -- - "vpack", - "hpack", - "tpack", - "csstring", - "begincsname", - "lastnamedcs", - "toksapp", - "tokspre", - "etoksapp", - "etokspre", }, ["omega"]={ - "OmegaVersion", - "bodydir", - "chardp", - "charht", - "charit", - "charwd", - "leftghost", - "localbrokenpenalty", - "localinterlinepenalty", - "localleftbox", - "localrightbox", - "mathdir", + "Omegaminorversion", + "Omegarevision", + "Omegaversion", "odelcode", "odelimiter", "omathaccent", @@ -388,23 +362,11 @@ return { "omathchardef", "omathcode", "oradical", - "pagedir", - "pageheight", - "pagewidth", - "pardir", - "rightghost", - "textdir", }, ["pdftex"]={ - "efcode", - "expanded", - "ifincsname", "ifpdfabsdim", "ifpdfabsnum", "ifpdfprimitive", - "leftmarginkern", - "letterspacefont", - "lpcode", "pdfadjustspacing", "pdfannot", "pdfcatalog", @@ -417,8 +379,8 @@ return { "pdfdest", "pdfdestmargin", "pdfdraftmode", - "pdfeachlineheight", "pdfeachlinedepth", + "pdfeachlineheight", "pdfendlink", "pdfendthread", "pdffirstlineheight", @@ -427,24 +389,22 @@ return { "pdffontname", "pdffontobjnum", "pdffontsize", - "pdfxformmargin", "pdfgamma", "pdfgentounicode", "pdfglyphtounicode", "pdfhorigin", "pdfignoreddimen", + "pdfignoreunknownimages", + "pdfimageaddfilename", "pdfimageapplygamma", "pdfimagegamma", "pdfimagehicolor", "pdfimageresolution", "pdfincludechars", "pdfinclusioncopyfonts", - "pdfignoreunknownimages", "pdfinclusionerrorlevel", - "pdfignoreunknownimages", "pdfinfo", "pdfinfoomitdate", - "pdftrailerid", "pdfinsertht", "pdflastannot", "pdflastlinedepth", @@ -474,9 +434,9 @@ return { "pdfpageresources", "pdfpagesattr", "pdfpagewidth", + "pdfpkfixeddpi", "pdfpkmode", "pdfpkresolution", - "pdfpkfixeddpi", "pdfprimitive", "pdfprotrudechars", "pdfpxdimen", @@ -493,39 +453,31 @@ return { "pdfsetrandomseed", "pdfstartlink", "pdfstartthread", + "pdfsuppressoptionalinfo", + "pdfsuppressptexinfo", "pdftexbanner", "pdftexrevision", "pdftexversion", - "pdfsuppressptexinfo", - "pdfsuppressoptionalinfo", "pdfthread", "pdfthreadmargin", "pdftracingfonts", "pdftrailer", + "pdftrailerid", "pdfuniformdeviate", "pdfuniqueresname", "pdfvorigin", "pdfxform", "pdfxformattr", + "pdfxformmargin", "pdfxformname", "pdfxformresources", "pdfximage", - "quitvmode", - "rightmarginkern", - "rpcode", - "tagcode", }, ["tex"]={ + " ", "-", "/", - "AlephVersion", - "Alephminorversion", - "Alephrevision", - "Alephversion", - "OmegaVersion", - "Omegaminorversion", - "Omegarevision", - "Omegaversion", + "Uchar", "Udelcode", "Udelcodenum", "Udelimiter", @@ -534,7 +486,6 @@ return { "Uhextensible", "Uleft", "Umathaccent", ---"Umathaccents", "Umathaxis", "Umathbinbinspacing", "Umathbinclosespacing", @@ -544,7 +495,6 @@ return { "Umathbinordspacing", "Umathbinpunctspacing", "Umathbinrelspacing", ---"Umathbotaccent", "Umathchar", "Umathcharclass", "Umathchardef", @@ -562,7 +512,6 @@ return { "Umathcloserelspacing", "Umathcode", "Umathcodenum", - "Umathcodenumdef", "Umathconnectoroverlapmin", "Umathfractiondelsize", "Umathfractiondenomdown", @@ -584,6 +533,8 @@ return { "Umathlimitbelowbgap", "Umathlimitbelowkern", "Umathlimitbelowvgap", + "Umathnolimitsubfactor", + "Umathnolimitsupfactor", "Umathopbinspacing", "Umathopclosespacing", "Umathopenbinspacing", @@ -657,9 +608,9 @@ return { "Umathunderbarvgap", "Umathunderdelimiterbgap", "Umathunderdelimitervgap", - "Umathnolimitsupfactor", - "Umathnolimitsubfactor", "Umiddle", + "Unosubscript", + "Unosuperscript", "Uoverdelimiter", "Uradical", "Uright", @@ -673,8 +624,6 @@ return { "Ustopmath", "Usubscript", "Usuperscript", - "Unosubscript", - "Unosuperscript", "Uunderdelimiter", "Uvextensible", "above", @@ -683,6 +632,7 @@ return { "abovewithdelims", "accent", "adjdemerits", + "adjustspacing", "advance", "afterassignment", "aftergroup", @@ -692,15 +642,13 @@ return { "atopwithdelims", "attribute", "attributedef", - "hyphenpenaltymode", + "automaticdiscretionary", "automatichyphenmode", "automatichyphenpenalty", - "automaticdiscretionary", - "explicithyphenpenalty", - "explicitdiscretionary", "badness", "baselineskip", "batchmode", + "begincsname", "begingroup", "belowdisplayshortskip", "belowdisplayskip", @@ -717,10 +665,6 @@ return { "catcodetable", "char", "chardef", ---"chardp", ---"charht", ---"charit", ---"charwd", "cleaders", "clearmarks", "closein", @@ -738,6 +682,7 @@ return { "crampedtextstyle", "crcr", "csname", + "csstring", "currentgrouplevel", "currentgrouptype", "currentifbranch", @@ -767,6 +712,7 @@ return { "divide", "doublehyphendemerits", "dp", + "draftmode", "dump", "dviextension", "dvifeedback", @@ -777,7 +723,6 @@ return { "eTeXversion", "edef", "efcode", - "hjcode", "else", "emergencystretch", "end", @@ -791,6 +736,8 @@ return { "errorcontextlines", "errorstopmode", "escapechar", + "etoksapp", + "etokspre", "everycr", "everydisplay", "everyeof", @@ -804,11 +751,14 @@ return { "expandafter", "expanded", "expandglyphsinfont", + "explicitdiscretionary", + "explicithyphenpenalty", "fam", "fi", "finalhyphendemerits", "firstmark", "firstmarks", + "firstvalidlanguage", "floatingpenalty", "font", "fontchardp", @@ -816,7 +766,6 @@ return { "fontcharic", "fontcharwd", "fontdimen", - "firstvalidlanguage", "fontid", "fontname", "formatname", @@ -840,18 +789,21 @@ return { "hfill", "hfilneg", "hfuzz", + "hjcode", "hoffset", "holdinginserts", + "hpack", "hrule", "hsize", "hskip", "hss", "ht", "hyphenation", + "hyphenationbounds", + "hyphenationmin", "hyphenchar", "hyphenpenalty", - "hyphenationmin", - "hyphenationbounds", + "hyphenpenaltymode", "if", "ifabsdim", "ifabsnum", @@ -870,9 +822,6 @@ return { "ifmmode", "ifnum", "ifodd", - "ifpdfabsdim", - "ifpdfabsnum", - "ifpdfprimitive", "ifprimitive", "iftrue", "ifvbox", @@ -887,6 +836,7 @@ return { "input", "inputlineno", "insert", + "insertht", "insertpenalties", "interactionmode", "interlinepenalties", @@ -897,6 +847,7 @@ return { "lastbox", "lastkern", "lastlinefit", + "lastnamedcs", "lastnodetype", "lastpenalty", "lastsavedboxresourceindex", @@ -932,6 +883,7 @@ return { "lowercase", "lpcode", "luaescapestring", + "luafunction", "luatexbanner", "luatexrevision", "luatexversion", @@ -955,15 +907,16 @@ return { "mathopen", "mathoption", "mathord", + "mathpenaltiesmode", "mathpunct", "mathrel", - "mathrulesmode", "mathrulesfam", + "mathrulesmode", "mathscriptsmode", "mathstyle", - "mathsurroundskip", - "mathsurroundmode", "mathsurround", + "mathsurroundmode", + "mathsurroundskip", "maxdeadcycles", "maxdepth", "meaning", @@ -984,36 +937,30 @@ return { "noalign", "noboundary", "noexpand", + "nohrule", "noindent", "nokerns", - "nohrule", "noligs", - "nospaces", - "novrule", "nolimits", "nolocaldirs", "nolocalwhatsits", "nonscript", "nonstopmode", "normaldeviate", + "nospaces", + "novrule", "nulldelimiterspace", "nullfont", "number", "numexpr", - "odelcode", - "odelimiter", - "omathaccent", - "omathchar", - "omathchardef", - "omathcode", "omit", "openin", "openout", "or", - "oradical", "outer", "output", "outputbox", + "outputmode", "outputpenalty", "over", "overfullrule", @@ -1046,123 +993,21 @@ return { "parskip", "patterns", "pausing", - "pdfadjustspacing", - "pdfannot", - "pdfcatalog", - "pdfcolorstack", - "pdfcolorstackinit", - "pdfcompresslevel", - "pdfcopyfont", - "pdfcreationdate", - "pdfdecimaldigits", - "pdfdest", - "pdfdestmargin", - "pdfdraftmode", - "pdfeachlineheight", - "pdfeachlinedepth", - "pdfendlink", - "pdfendthread", "pdfextension", + "pdffeedback", "pdfvariable", - "pdffirstlineheight", - "pdffontattr", - "pdffontexpand", - "pdffontname", - "pdffontobjnum", - "pdffontsize", - "pdfxformmargin", - "pdfgamma", - "pdfgentounicode", - "pdfglyphtounicode", - "pdfhorigin", - "pdfignoreddimen", - "pdfimageaddfilename", - "pdfimageapplygamma", - "pdfimagegamma", - "pdfimagehicolor", - "pdfimageresolution", - "pdfincludechars", - "pdfinclusioncopyfonts", - "pdfinclusionerrorlevel", - "pdfignoreunknownimages", - "pdfinfo", - "pdfinfoomitdate", - "pdftrailerid", - "pdfinsertht", - "pdflastannot", - "pdflastlinedepth", - "pdflastlink", - "pdflastobj", - "pdflastxform", - "pdflastximage", - "pdflastximagepages", - "pdflastxpos", - "pdflastypos", - "pdflinkmargin", - "pdfliteral", - "pdfmapfile", - "pdfmapline", - "pdfminorversion", - "pdfnames", - "pdfnoligatures", - "pdfnormaldeviate", - "pdfobj", - "pdfobjcompresslevel", - "pdfoutline", - "pdfoutput", - "pdfpageattr", - "pdfpagebox", - "pdfpageheight", - "pdfpageref", - "pdfpageresources", - "pdfpagesattr", - "pdfpagewidth", - "pdfpkmode", - "pdfpkresolution", - "pdfpkfixeddpi", - "pdfprimitive", - "pdfprotrudechars", - "pdfpxdimen", - "pdfrandomseed", - "pdfrefobj", - "pdfrefxform", - "pdfrefximage", - "pdfreplacefont", - "pdfrestore", - "pdfretval", - "pdfsave", - "pdfsavepos", - "pdfsetmatrix", - "pdfsetrandomseed", - "pdfstartlink", - "pdfstartthread", - "pdftexbanner", - "pdftexrevision", - "pdftexversion", - "pdfsuppressptexinfo", - "pdfsuppressoptionalinfo", - "pdfthread", - "pdfthreadmargin", - "pdftracingfonts", - "pdftrailer", - "pdfuniformdeviate", - "pdfuniqueresname", - "pdfvorigin", - "pdfxform", - "pdfxformattr", - "pdfxformname", - "pdfxformresources", - "pdfximage", "penalty", "postdisplaypenalty", "postexhyphenchar", "posthyphenchar", + "prebinoppenalty", "predisplaydirection", "predisplaygapfactor", "predisplaypenalty", "predisplaysize", "preexhyphenchar", "prehyphenchar", + "prerelpenalty", "pretolerance", "prevdepth", "prevgraf", @@ -1187,9 +1032,9 @@ return { "romannumeral", "rpcode", "saveboxresource", + "savecatcodetable", "saveimageresource", "savepos", - "savecatcodetable", "savinghyphcodes", "savingvdiscards", "scantextokens", @@ -1204,8 +1049,8 @@ return { "setfontid", "setlanguage", "setrandomseed", - "shapemode", "sfcode", + "shapemode", "shipout", "show", "showbox", @@ -1219,7 +1064,6 @@ return { "skewchar", "skip", "skipdef", ---"skipexpr", "spacefactor", "spaceskip", "span", @@ -1235,8 +1079,8 @@ return { "suppressfontnotfounderror", "suppressifcsnameerror", "suppresslongerror", - "suppressoutererror", "suppressmathparerror", + "suppressoutererror", "synctex", "tabskip", "tagcode", @@ -1248,11 +1092,14 @@ return { "thinmuskip", "time", "toks", + "toksapp", "toksdef", + "tokspre", "tolerance", "topmark", "topmarks", "topskip", + "tpack", "tracingassigns", "tracingcommands", "tracingfonts", @@ -1294,6 +1141,7 @@ return { "vfilneg", "vfuzz", "voffset", + "vpack", "vrule", "vsize", "vskip", @@ -1309,19 +1157,8 @@ return { "xleaders", "xspaceskip", "year", - -- - "vpack", - "hpack", - "tpack", - "csstring", - "begincsname", - "lastnamedcs", - "toksapp", - "tokspre", - "etoksapp", - "etokspre", }, ["xetex"]={ "XeTeXversion", }, -} +}
\ No newline at end of file diff --git a/tex/context/base/mkiv/mult-prm.mkiv b/tex/context/base/mkiv/mult-prm.mkiv index e385341c2..308606d7e 100644 --- a/tex/context/base/mkiv/mult-prm.mkiv +++ b/tex/context/base/mkiv/mult-prm.mkiv @@ -13,6 +13,20 @@ %D This file is only a helper for generating files that can be used in an %D editor for syntax highlighting. +% local all = table.load("mult-prm.lua") +% local tex = table.tohash(all.tex) +% for k, v in next, all do +% if k ~= "tex" then +% local h = table.tohash(v) +% for k, v in next, h do +% tex[k] = nil +% end +% all[k] = table.sortedkeys(h) +% end +% end +% all.tex = table.sortedkeys(tex) +% print((string.gsub(table.serialize(all,true),' "','\n "'))) + \startluacode context.starttext() @@ -33,6 +47,35 @@ "savingvdiscards", }, pdftex = { + "ifpdfabsdim", "ifpdfabsnum", "ifpdfprimitive", "pdfadjustspacing", + "pdfannot", "pdfcatalog", "pdfcolorstack", "pdfcolorstackinit", + "pdfcompresslevel", "pdfcopyfont", "pdfcreationdate", + "pdfdecimaldigits", "pdfdest", "pdfdestmargin", "pdfdraftmode", + "pdfeachlinedepth", "pdfeachlineheight", "pdfendlink", + "pdfendthread", "pdffirstlineheight", "pdffontattr", "pdffontexpand", + "pdffontname", "pdffontobjnum", "pdffontsize", "pdfgamma", + "pdfgentounicode", "pdfglyphtounicode", "pdfhorigin", + "pdfignoreddimen", "pdfignoreunknownimages", "pdfimageaddfilename", + "pdfimageapplygamma", "pdfimagegamma", "pdfimagehicolor", + "pdfimageresolution", "pdfincludechars", "pdfinclusioncopyfonts", + "pdfinclusionerrorlevel", "pdfinfo", "pdfinfoomitdate", + "pdfinsertht", "pdflastannot", "pdflastlinedepth", "pdflastlink", + "pdflastobj", "pdflastxform", "pdflastximage", "pdflastximagepages", + "pdflastxpos", "pdflastypos", "pdflinkmargin", "pdfliteral", + "pdfmapfile", "pdfmapline", "pdfminorversion", "pdfnames", + "pdfnoligatures", "pdfnormaldeviate", "pdfobj", + "pdfobjcompresslevel", "pdfoutline", "pdfoutput", "pdfpageattr", + "pdfpagebox", "pdfpageheight", "pdfpageref", "pdfpageresources", + "pdfpagesattr", "pdfpagewidth", "pdfpkfixeddpi", "pdfpkmode", + "pdfpkresolution", "pdfprimitive", "pdfprotrudechars", "pdfpxdimen", + "pdfrandomseed", "pdfrefobj", "pdfrefxform", "pdfrefximage", + "pdfreplacefont", "pdfrestore", "pdfretval", "pdfsave", "pdfsavepos", + "pdfsetmatrix", "pdfsetrandomseed", "pdfstartlink", "pdfstartthread", + "pdfsuppressoptionalinfo", "pdfsuppressptexinfo", "pdftexbanner", + "pdftexrevision", "pdftexversion", "pdfthread", "pdfthreadmargin", + "pdftracingfonts", "pdftrailer", "pdftrailerid", "pdfuniformdeviate", + "pdfuniqueresname", "pdfvorigin", "pdfxform", "pdfxformattr", + "pdfxformmargin", "pdfxformname", "pdfxformresources", "pdfximage", }, luatex = { }, @@ -41,10 +84,10 @@ }, omega = { "Omegaminorversion", "Omegarevision", "Omegaversion", - "omathcode", "odelcode", "omathchardef", "omathchar", "omathaccent", "odelimiter", "oradical", + "odelcode", "odelimiter", "omathaccent", "omathchar", "omathchardef", "omathcode", "oradical", }, xetex = { - "XeTeXversion", + "XeTeXversion", -- probably some more }, plain = { "TeX", @@ -63,13 +106,13 @@ } local primitives = { - tex = table.sorted( table.merged( missing.tex , table.fromhash(tex.primitives()) ) ), - etex = table.sorted( table.merged( missing.etex , tex.extraprimitives('etex') ) ), - pdftex = table.sorted( table.merged( missing.pdftex, tex.extraprimitives('pdftex') ) ), - luatex = table.sorted( table.merged( missing.luatex, tex.extraprimitives('luatex') ) ), - aleph = table.sorted( table.merged( missing.aleph , tex.extraprimitives('aleph') ) ), - omega = table.sorted( table.merged( missing.omega , tex.extraprimitives('omega') ) ), - xetex = table.sorted( table.merged( missing.xetex , { } ) ), + tex = table.sorted( table.merged( missing.tex , tex.primitives() ) ), + etex = table.sorted( table.merged( missing.etex , tex.extraprimitives('etex') ) ), + pdftex = table.sorted( table.merged( missing.pdftex, { } ) ), + luatex = table.sorted( table.merged( missing.luatex, tex.extraprimitives('luatex') ) ), + aleph = table.sorted( table.merged( missing.aleph , { } ) ), + omega = table.sorted( table.merged( missing.omega , { } ) ), + xetex = table.sorted( table.merged( missing.xetex , { } ) ), } -- table.remove(primitives.tex,1) -- get rid of \- diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex e88315d6b..61de37d39 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 9ae6f503b..ffe955c1c 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-mat.mkiv b/tex/context/base/mkiv/strc-mat.mkiv index 8f3d2cc11..7ba652818 100644 --- a/tex/context/base/mkiv/strc-mat.mkiv +++ b/tex/context/base/mkiv/strc-mat.mkiv @@ -752,6 +752,11 @@ \setformulaparameter\c!grid{\v!math:-\v!halfline}% \fi} +% when we have 1.0.6 we wil use \mathpenaltiesmode +% +% \prebinoppenalty -100 +% \prerelpenalty -100 + \def\strc_math_set_split {\edef\p_split{\formulaparameter\c!split}% \ifx\p_split\v!yes @@ -762,9 +767,11 @@ \global\c_strc_math_vertical\zerocount \fi\fi \ifcase\c_strc_math_vertical + % \mathpenaltiesmode \zerocount \clf_setmathpenalties\zerocount \clf_resetmathhang \else + % \mathpenaltiesmode \plusone \clf_setmathpenalties\plusone \edef\p_hang{\formulaparameter\c!hang}% \ifx\p_hang\v!none diff --git a/tex/context/base/mkiv/syst-ini.mkiv b/tex/context/base/mkiv/syst-ini.mkiv index 63108feb7..380f94e6d 100644 --- a/tex/context/base/mkiv/syst-ini.mkiv +++ b/tex/context/base/mkiv/syst-ini.mkiv @@ -1195,4 +1195,8 @@ \ifdefined\explicitdiscretionary \else \let\explicitdiscretionary \- \fi \ifdefined\automaticdiscretionary \else \def\automaticdiscretionary{\Uchar\exhyphenchar} \fi +\ifdefined\mathpenaltiesmode \else \newcount\mathpenaltiesmode \fi +\ifdefined\prebinoppenalty \else \newcount\prebinoppenalty \fi +\ifdefined\prerelpenalty \else \newcount\prerelpenalty \fi + \protect \endinput diff --git a/tex/context/base/mkiv/util-lib.lua b/tex/context/base/mkiv/util-lib.lua index 817ac2753..ab26afe46 100644 --- a/tex/context/base/mkiv/util-lib.lua +++ b/tex/context/base/mkiv/util-lib.lua @@ -229,10 +229,12 @@ local function locate(required,version,trace,report,action) report("load error: message %a, library %a",tostring(message or "unknown"),found_library or "no library") end end - if not library then - report("unknown library: %a",required) - elseif trace then - report("stored library: %a",required) + if trace then + if not library then + report("unknown library: %a",required) + else + report("stored library: %a",required) + end end return library end @@ -341,6 +343,8 @@ We use the same lookup logic for ffi loading. local trace_ffilib = false local savedffiload = ffi.load + -- ffi.savedload = savedffiload + trackers.register("resolvers.ffilib", function(v) trace_ffilib = v end) local function locateindeed(name) @@ -366,10 +370,11 @@ We use the same lookup logic for ffi loading. local library = ffilib(name) if type(library) == "userdata" then return library - else + end + if trace_ffilib then report_ffilib("trying to load %a using normal loader",name) - return savedffiload(name) end + return savedffiload(name) end end diff --git a/tex/context/base/mkiv/util-sql-imp-sqlite.lua b/tex/context/base/mkiv/util-sql-imp-sqlite.lua index 1a960c1c3..85ef83d45 100644 --- a/tex/context/base/mkiv/util-sql-imp-sqlite.lua +++ b/tex/context/base/mkiv/util-sql-imp-sqlite.lua @@ -6,16 +6,9 @@ if not modules then modules = { } end modules ['util-sql-imp-sqlite'] = { license = "see context related readme files" } -local next = next +local next, tonumber = next, tonumber -local sql = require("util-sql") ------ sql = utilities.sql -local sqlite = require("swiglib.sqlite.core") -local swighelpers = require("swiglib.helpers.core") - --- sql.sqlite = sqlite -- maybe in the module itself - --- inspect(table.sortedkeys(sqlite)) +local sql = utilities.sql or require("util-sql") local trace_sql = false trackers.register("sql.trace", function(v) trace_sql = v end) local trace_queries = false trackers.register("sql.queries",function(v) trace_queries = v end) @@ -25,26 +18,94 @@ local helpers = sql.helpers local methods = sql.methods local validspecification = helpers.validspecification local preparetemplate = helpers.preparetemplate -local splitdata = helpers.splitdata -local serialize = sql.serialize -local deserialize = sql.deserialize -local getserver = sql.getserver local setmetatable = setmetatable local formatters = string.formatters -local get_list_item = sqlite.char_p_array_getitem -local is_okay = sqlite.SQLITE_OK -local execute_query = sqlite.sqlite3_exec_lua_callback -local error_message = sqlite.sqlite3_errmsg +----- sqlite = require("swiglib.sqlite.core") +----- swighelpers = require("swiglib.helpers.core") +----- +----- get_list_item = sqlite.char_p_array_getitem +----- is_okay = sqlite.SQLITE_OK +----- execute_query = sqlite.sqlite3_exec_lua_callback +----- error_message = sqlite.sqlite3_errmsg +----- +----- new_db = sqlite.new_sqlite3_p_array +----- open_db = sqlite.sqlite3_open +----- get_db = sqlite.sqlite3_p_array_getitem +----- close_db = sqlite.sqlite3_close +----- dispose_db = sqlite.delete_sqlite3_p_array + +local ffi = require("ffi") + +ffi.cdef [[ + + typedef struct sqlite3 sqlite3; + + int sqlite3_initialize ( + void + ) ; + + int sqlite3_open ( + const char *filename, + sqlite3 **ppDb + ) ; + + int sqlite3_close ( + sqlite3 * + ) ; + + int sqlite3_exec ( + sqlite3*, + const char *sql, + int (*callback)(void*,int,char**,char**), + void *, + char **errmsg + ) ; + + const char *sqlite3_errmsg ( + sqlite3* + ); +]] + +local ffi_tostring = ffi.string + +local sqlite = ffi.load("sqlite3") + +sqlite.sqlite3_initialize(); + +local c_errmsg = sqlite.sqlite3_errmsg +local c_open = sqlite.sqlite3_open +local c_close = sqlite.sqlite3_close +local c_exec = sqlite.sqlite3_exec + +local is_okay = 0 +local open_db = c_open +local close_db = c_close +local execute_query = c_exec + +local function error_message(db) + return ffi_tostring(c_errmsg(db)) +end -local new_db = sqlite.new_sqlite3_p_array -local open_db = sqlite.sqlite3_open -local get_db = sqlite.sqlite3_p_array_getitem -local close_db = sqlite.sqlite3_close -local dispose_db = sqlite.delete_sqlite3_p_array +local function new_db(n) + return ffi.new("sqlite3*["..n.."]") +end -local cache = { } +local function dispose_db(db) +end + +local function get_db(db,n) + return db[n] +end + +-- local function execute_query(dbh,query,callback) +-- local c = ffi.cast("int (*callback)(void*,int,char**,char**)",callback) +-- c_exec(dbh,query,c,nil,nil) +-- c:free() +-- end + +local cache = { } setmetatable(cache, { __gc = function(t) @@ -135,30 +196,31 @@ local function execute(specification) query = preamble .. query -- only needed in open end if converter then - converter = converter.sqlite + local convert = converter.sqlite + local column = { } callback = function(data,nofcolumns,values,fields) - local column = { } - for i=0,nofcolumns-1 do - column[i+1] = get_list_item(values,i) + for i=1,nofcolumns do + -- column[i] = get_list_item(values,i-1) + column[i] = ffi_tostring(values[i-1]) end - nofrows = nofrows + 1 - result[nofrows] = converter(column) + nofrows = nofrows + 1 + result[nofrows] = convert(column) return is_okay end - -- - -- callback = converter.sqlite else + local column = { } callback = function(data,nofcolumns,values,fields) - local column = { } for i=0,nofcolumns-1 do local field if keysdone then field = keys[i+1] else - field = get_list_item(fields,i) + -- field = get_list_item(fields,i) + field = ffi_tostring(fields[i]) keys[i+1] = field end - column[field] = get_list_item(values,i) + -- column[field] = get_list_item(values,i) + column[field] = ffi_tostring(values[i]) end nofrows = nofrows + 1 keysdone = true @@ -201,34 +263,6 @@ end local celltemplate = "cells[%s]" --- todo: how to deal with result ... pass via temp global .. bah .. or --- also pass the execute here ... not now --- --- local wraptemplate = [[ --- local converters = utilities.sql.converters --- local deserialize = utilities.sql.deserialize --- --- local tostring = tostring --- local tonumber = tonumber --- local booleanstring = string.booleanstring --- --- local get_list_item = utilities.sql.sqlite.char_p_array_getitem --- local is_okay = utilities.sql.sqlite.SQLITE_OK --- --- %s --- --- return function(data,nofcolumns,values,fields) --- -- no %s (data) needed --- -- no %s (i) needed --- local cells = { } --- for i=0,nofcolumns-1 do --- cells[i+1] = get_list_item(values,i) --- end --- result[#result+1] = { %s } --- return is_okay --- end --- ]] - methods.sqlite = { execute = execute, usesfiles = false, diff --git a/tex/context/base/mkiv/util-sql-loggers.lua b/tex/context/base/mkiv/util-sql-loggers.lua index 4473f8971..7e64a435a 100644 --- a/tex/context/base/mkiv/util-sql-loggers.lua +++ b/tex/context/base/mkiv/util-sql-loggers.lua @@ -53,16 +53,16 @@ loggers.totype = totype loggers.fromtype = fromtype local template = [[ - CREATE TABLE IF NOT EXISTS %basename% ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `time` int(11) NOT NULL, - `type` int(11) NOT NULL, - `action` varchar(15) NOT NULL, - `data` longtext, - PRIMARY KEY (`id`), - UNIQUE KEY `id_unique_key` (`id`) - ) - DEFAULT CHARSET = utf8 ; +CREATE TABLE IF NOT EXISTS %basename% ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `time` int(11) NOT NULL, + `type` int(11) NOT NULL, + `action` varchar(15) NOT NULL, + `data` longtext, + PRIMARY KEY (`id`), + UNIQUE KEY `id_unique_key` (`id`) +) +DEFAULT CHARSET = utf8 ; ]] local sqlite_template = [[ @@ -79,7 +79,7 @@ function loggers.createdb(presets,datatable) local db = checkeddb(presets,datatable) db.execute { - template = db.usedmethod == "sqlite" and sqlite_template or template, + template = (db.usedmethod == "sqlite" or db.usedmethod == "sqlffi") and sqlite_template or template, variables = { basename = db.basename, }, diff --git a/tex/context/base/mkiv/util-sql.lua b/tex/context/base/mkiv/util-sql.lua index 0eff25130..d01a2267c 100644 --- a/tex/context/base/mkiv/util-sql.lua +++ b/tex/context/base/mkiv/util-sql.lua @@ -110,10 +110,14 @@ local defaults = { __index = } setmetatableindex(sql.methods,function(t,k) - report_state("start loading method %a",k) - require("util-sql-imp-"..k) - report_state("loading method %a done",k) - return rawget(t,k) + if type(k) == "string" then + report_state("start loading method %a",k) + require("util-sql-imp-"..k) + report_state("loading method %a done",k) + return rawget(t,k) + else + report_state("invalid method %a",tostring(k)) + end end) -- converters @@ -332,6 +336,10 @@ function sql.usedatabase(presets,datatable) if not method then usedmethod = sql.methods.client method = usedmethod and sqlmethods[usedmethod] + if not method then + report_state("invalid method") + return + end end local base = presets.database or "test" local basename = format("`%s`.`%s`",base,name) |