From 440c540ebb92c441725ee888eb9ad8b025f4c685 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 28 Mar 2013 23:10:00 +0100 Subject: beta 2013.03.28 23:10 --- metapost/context/base/mp-chem.mpiv | 70 ++++++----- tex/context/base/bibl-bib.mkiv | 5 +- tex/context/base/bibl-tra.mkiv | 5 +- tex/context/base/char-def.lua | 32 ++--- tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4137 -> 4132 bytes tex/context/base/context-version.png | Bin 40357 -> 40143 bytes tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/core-ini.mkiv | 6 +- tex/context/base/core-uti.lua | 45 ++++--- tex/context/base/font-ext.lua | 13 ++- tex/context/base/font-otn.lua | 6 +- tex/context/base/font-otx.lua | 9 +- tex/context/base/grph-inc.lua | 3 +- tex/context/base/grph-swf.lua | 24 ++-- tex/context/base/math-ini.lua | 1 + tex/context/base/meta-imp-dum.mkiv | 4 +- tex/context/base/mlib-pdf.mkiv | 14 +-- tex/context/base/mult-aux.mkiv | 4 +- tex/context/base/node-res.lua | 4 +- tex/context/base/page-flt.mkiv | 2 - tex/context/base/s-mat-10.mkiv | 29 ++--- tex/context/base/status-files.pdf | Bin 24719 -> 24761 bytes tex/context/base/status-lua.pdf | Bin 211539 -> 211455 bytes tex/context/base/strc-enu.mkvi | 86 ++++++++------ tex/context/base/strc-flt.mkvi | 15 +-- tex/context/base/strc-itm.mkvi | 11 +- tex/context/base/strc-lab.mkiv | 42 ++++--- tex/context/base/strc-mat.mkiv | 12 +- tex/context/base/strc-not.mkvi | 46 +++++--- tex/context/base/strc-num.mkiv | 130 ++++++++++++++++----- tex/context/base/util-pck.lua | 3 +- tex/context/base/x-mathml.lua | 41 +++---- tex/context/base/x-mathml.mkiv | 13 ++- tex/context/base/x-res-01.mkiv | 66 +++++------ tex/generic/context/luatex/luatex-fonts-merged.lua | 7 +- 38 files changed, 440 insertions(+), 316 deletions(-) diff --git a/metapost/context/base/mp-chem.mpiv b/metapost/context/base/mp-chem.mpiv index 4cb4ce78e..c3dd3e3eb 100644 --- a/metapost/context/base/mp-chem.mpiv +++ b/metapost/context/base/mp-chem.mpiv @@ -32,7 +32,7 @@ numeric chem_front_b[] ; boolean - chem_setting_axis, %chem_setting_fitwidth, chem_setting_fitheight, + chem_setting_axis, chem_doing_pb, chem_text_trace, chem_bd_wedge, chem_tracing, chem_star[], chem_front[], chem_stacked[], chem_tetra[] ; @@ -40,7 +40,6 @@ string chem_previous ; path - chem_setting_bbox, chem_path[], % scratch chem_b_path[], chem_c_path[], chem_r_path[], chem_r_path.lft[], chem_r_path.rt[] ; @@ -308,20 +307,18 @@ def chem_start_structure(expr i, l, r, t, b, scale, rotation, %fitwidth, fitheig chem_emwidth := emwidth ; % EmWidth or \the\emwidth does not work... chem_b_length := if scale<>0: scale* fi 3chem_emwidth ; -% chem_setting_fitwidth := if boolean fitwidth : fitwidth else : (fitwidth<>0) fi ; -% chem_setting_fitheight := if boolean fitheight : fitheight else : (fithheight<>0) fi ;; save chem_setting_l, chem_setting_r, chem_setting_t, chem_setting_b ; if numeric l : - chem_setting_l := l * chem_b_length ; + chem_setting_l := -l * chem_b_length ; fi if numeric r : - chem_setting_r := r * chem_b_length ; + chem_setting_r := r * chem_b_length ; fi if numeric t : - chem_setting_t := t * chem_b_length ; + chem_setting_t := t * chem_b_length ; fi if numeric b : - chem_setting_b := b * chem_b_length ; + chem_setting_b := -b * chem_b_length ; fi chem_setting_rotation := rotation ; chem_setting_offset := offset ; @@ -344,36 +341,34 @@ vardef chem_stop_structure = currentpicture := (currentpicture shifted -chem_origin) rotated chem_setting_rotation ; - if (not known chem_setting_l) and (not known chem_setting_r) : - chem_setting_l := - xpart llcorner currentpicture ; - chem_setting_r := xpart urcorner currentpicture ; - else : - if not known chem_setting_l : - chem_setting_l := xpart urcorner currentpicture - xpart llcorner currentpicture - - 2chem_setting_r ; - fi - if not known chem_setting_r : - chem_setting_r := xpart urcorner currentpicture - xpart llcorner currentpicture - - 2chem_setting_l ; - fi +% if not known chem_setting_l : +% chem_setting_l := min(xpart ulcorner currentpicture, xpart llcorner currentpicture) ; +% fi +% if not known chem_setting_r : +% chem_setting_r := max(xpart urcorner currentpicture, xpart lrcorner currentpicture) ; +% fi +% if not known chem_setting_b : +% chem_setting_b := min(ypart llcorner currentpicture, ypart lrcorner currentpicture) ; +% fi +% if not known chem_setting_t : +% chem_setting_t := max(ypart ulcorner currentpicture, ypart urcorner currentpicture) ; +% fi + + if not known chem_setting_l : + chem_setting_l := min(xpart llcorner currentpicture, xpart lrcorner currentpicture) ; fi - if (not known chem_setting_t) and (not known chem_setting_b) : - chem_setting_t := ypart urcorner currentpicture ; - chem_setting_b := - ypart llcorner currentpicture ; - else : - if not known chem_setting_t : - chem_setting_t := ypart urcorner currentpicture - ypart llcorner currentpicture - - 2chem_setting_b ; - fi - if not known chem_setting_b : - chem_setting_b := ypart urcorner currentpicture - ypart llcorner currentpicture - - 2chem_setting_t ; - fi + if not known chem_setting_r : + chem_setting_r := max(xpart llcorner currentpicture, xpart lrcorner currentpicture) ; + fi + if not known chem_setting_b : + chem_setting_b := min(ypart llcorner currentpicture, ypart ulcorner currentpicture) ; + fi + if not known chem_setting_t : + chem_setting_t := max(ypart llcorner currentpicture, ypart ulcorner currentpicture) ; fi - chem_setting_bbox := - (-chem_setting_l,-chem_setting_b) -- ( chem_setting_r,-chem_setting_b) -- - ( chem_setting_r, chem_setting_t) -- (-chem_setting_l, chem_setting_t) -- cycle ; +% draw textext(decimal chem_setting_l & "," & decimal chem_setting_r & " " & +% decimal chem_setting_b & "," & decimal chem_setting_t) ; if chem_setting_axis : % put it behind the picture chem_pic := currentpicture ; currentpicture := nullpicture ; chem_num0 := .5chem_b_length ; @@ -398,13 +393,14 @@ vardef chem_stop_structure = draw (-chem_num1,i) -- (chem_num1,i) withpen pencircle scaled chem_axis_rulethickness withcolor colorpart(chem_axis_color) ; endfor - % frame=on : draw chem_setting_bbox withcolor colorpart(chem_axis_color) ; addto currentpicture also chem_pic ; fi ; if chem_tracing : fill boundingbox currentpicture withcolor blue withtransparency(1,.25) ; fi ; - setbounds currentpicture to chem_setting_bbox ; + setbounds currentpicture to + ((chem_setting_l,chem_setting_b) -- (chem_setting_r,chem_setting_b) -- + (chem_setting_r,chem_setting_t) -- (chem_setting_l,chem_setting_t) -- cycle) ; if chem_tracing : fill boundingbox currentpicture withcolor red withtransparency(1,.25) ; fi ; diff --git a/tex/context/base/bibl-bib.mkiv b/tex/context/base/bibl-bib.mkiv index 7ca6799cf..d9010294d 100644 --- a/tex/context/base/bibl-bib.mkiv +++ b/tex/context/base/bibl-bib.mkiv @@ -340,14 +340,13 @@ % todo : lang en language % todo : directions - % variables -\newcount\bibtexblock \bibtexblock\plusone +\ifdefined\bibtexblock \else \newcount\bibtexblock \fi \bibtexblock\plusone +\ifdefined\bibtexcounter \else \newcount\bibtexcounter \fi \newtoks \everysetupbibtexpublications \newtoks \everysetupbibtexcitations -\newcount\bibtexcounter \def\bibtexrefprefix{\number\bibtexblock:} diff --git a/tex/context/base/bibl-tra.mkiv b/tex/context/base/bibl-tra.mkiv index f454f5185..511212a98 100644 --- a/tex/context/base/bibl-tra.mkiv +++ b/tex/context/base/bibl-tra.mkiv @@ -194,7 +194,8 @@ \installstructurelistprocessor{pubs:userdata}% {\ctxlua{bibtex.hacks.add(structures.lists.uservalue("\currentlist",\currentlistindex,"bibref"),\currentlistindex)}} -\newcount\bibtexblock \bibtexblock\plusone +\ifdefined\bibtexblock \else \newcount\bibtexblock \fi \bibtexblock\plusone +\ifdefined\bibtexcounter \else \newcount\bibtexcounter \fi %D \macros{bibdoif,bibdoifnot,bibdoifelse} %D @@ -640,8 +641,6 @@ %D We are coming to the end of this module, to the macros that %D do typesetting and read the \type{bbl} file. -\newcount\bibtexcounter - %D Just a \type{\dosingleempty} is the most friendly %D of doing this: there need not even be an argument %D to \type{\startpublication}. Of course, then there diff --git a/tex/context/base/char-def.lua b/tex/context/base/char-def.lua index b687ece1c..8580fb699 100644 --- a/tex/context/base/char-def.lua +++ b/tex/context/base/char-def.lua @@ -1026,7 +1026,7 @@ characters.data={ description="CIRCUMFLEX ACCENT", direction="on", linebreak="al", - mathclass="accent", + mathclass="topaccent", unicodeslot=0x005E, }, { @@ -1047,7 +1047,7 @@ characters.data={ description="GRAVE ACCENT", direction="on", linebreak="al", - mathclass="accent", + mathclass="topaccent", mathname="grave", unicodeslot=0x0060, }, @@ -1731,7 +1731,7 @@ characters.data={ description="DIAERESIS", direction="on", linebreak="ai", - mathclass="accent", + mathclass="topaccent", mathname="ddot", specials={ "compat", 0x0020, 0x0308 }, unicodeslot=0x00A8, @@ -1814,7 +1814,7 @@ characters.data={ description="MACRON", direction="on", linebreak="al", - mathclass="accent", + mathclass="topaccent", mathname="bar", specials={ "compat", 0x0020, 0x0304 }, unicodeslot=0x00AF, @@ -1871,7 +1871,7 @@ characters.data={ description="ACUTE ACCENT", direction="on", linebreak="bb", - mathclass="accent", + mathclass="topaccent", mathname="acute", specials={ "compat", 0x0020, 0x0301 }, unicodeslot=0x00B4, @@ -7524,7 +7524,7 @@ characters.data={ description="MODIFIER LETTER CIRCUMFLEX ACCENT", direction="on", linebreak="al", - mathclass="accent", + mathclass="topaccent", mathname="hat", specials={ "compat", 0x0020, 0x0302 }, unicodeslot=0x02C6, @@ -7538,7 +7538,7 @@ characters.data={ description="CARON", direction="on", linebreak="ai", - mathclass="accent", + mathclass="topaccent", mathname="check", specials={ "compat", 0x0020, 0x030C }, unicodeslot=0x02C7, @@ -7684,7 +7684,7 @@ characters.data={ description="BREVE", direction="on", linebreak="ai", - mathclass="accent", + mathclass="topaccent", mathname="breve", specials={ "compat", 0x0020, 0x0306 }, unicodeslot=0x02D8, @@ -7697,7 +7697,7 @@ characters.data={ description="DOT ABOVE", direction="on", linebreak="ai", - mathclass="accent", + mathclass="topaccent", mathname="dot", specials={ "compat", 0x0020, 0x0307 }, unicodeslot=0x02D9, @@ -7710,7 +7710,7 @@ characters.data={ description="RING ABOVE", direction="on", linebreak="ai", - mathclass="accent", + mathclass="topaccent", mathname="mathring", specials={ "compat", 0x0020, 0x030A }, unicodeslot=0x02DA, @@ -7733,7 +7733,7 @@ characters.data={ description="SMALL TILDE", direction="on", linebreak="al", - mathclass="accent", + mathclass="topaccent", mathname="tilde", specials={ "compat", 0x0020, 0x0303 }, unicodeslot=0x02DC, @@ -58657,7 +58657,7 @@ characters.data={ description="COMBINING RIGHT ARROW ABOVE", direction="nsm", linebreak="cm", - mathclass="accent", + mathclass="topaccent", mathname="vec", unicodeslot=0x20D7, }, @@ -58687,7 +58687,7 @@ characters.data={ description="COMBINING THREE DOTS ABOVE", direction="nsm", linebreak="cm", - mathclass="accent", + mathclass="topaccent", mathname="dddot", unicodeslot=0x20DB, }, @@ -58801,7 +58801,7 @@ characters.data={ description="COMBINING WIDE BRIDGE ABOVE", direction="nsm", linebreak="cm", - mathclass="accent", + mathclass="topaccent", unicodeslot=0x20E9, }, [0x20EA]={ @@ -65855,7 +65855,7 @@ characters.data={ description="TOP TORTOISE SHELL BRACKET", direction="on", linebreak="al", - mathclass="accent", + mathclass="topaccent", unicodeslot=0x23E0, }, [0x23E1]={ @@ -65863,7 +65863,7 @@ characters.data={ description="BOTTOM TORTOISE SHELL BRACKET", direction="on", linebreak="al", - mathclass="accent", + mathclass="botaccent", unicodeslot=0x23E1, }, [0x23E2]={ diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index d582a6905..204684312 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2013.03.28 09:26} +\newcontextversion{2013.03.28 23:10} %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/cont-new.mkiv b/tex/context/base/cont-new.mkiv index d03727ae2..7bb692d2a 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2013.03.28 09:26} +\newcontextversion{2013.03.28 23:10} %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/context-version.pdf b/tex/context/base/context-version.pdf index eab60a3ee..f90f966d1 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png index 2793e80f2..34ef69eda 100644 Binary files a/tex/context/base/context-version.png and b/tex/context/base/context-version.png differ diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index 1203d3724..aa7cfe2df 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2013.03.28 09:26} +\edef\contextversion{2013.03.28 23:10} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 730b358c0..7631b4075 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2013.03.28 09:26} +\edef\contextversion{2013.03.28 23:10} %D For those who want to use this: diff --git a/tex/context/base/core-ini.mkiv b/tex/context/base/core-ini.mkiv index 7b32cb3a2..1682bed1b 100644 --- a/tex/context/base/core-ini.mkiv +++ b/tex/context/base/core-ini.mkiv @@ -82,7 +82,7 @@ %D Sectioning: -\newtoks \everyheadstart +%newtoks \everyheadstart %D Par building (experimental, used in xml

..

) @@ -100,7 +100,7 @@ %D Marks: -\newtoks \everymarking +%newtoks \everymarking %D Fonts: @@ -124,7 +124,7 @@ %D Tables: -\newtoks \everytable % we need to disstinguish kinds +%newtoks \everytable % we need to disstinguish kinds %D State mess: diff --git a/tex/context/base/core-uti.lua b/tex/context/base/core-uti.lua index bf8d2c207..96ccdca48 100644 --- a/tex/context/base/core-uti.lua +++ b/tex/context/base/core-uti.lua @@ -35,7 +35,8 @@ local report_passes = logs.reporter("job","passes") job = job or { } local job = job -job.version = "1.21" +job.version = 1.22 -- make sure we don't have old lua 5.1 hash leftovers +job.packversion = 1.02 -- make sure we don't have old lua 5.1 hash leftovers -- some day we will implement loading of other jobs and then we need -- job.jobs @@ -132,7 +133,7 @@ local packlist = { -- "references", -- we need to rename of them as only one packs (not structures.lists.references) } -local jobpacker = packers.new(packlist,1.01) +local jobpacker = packers.new(packlist,job.packversion) -- jump number when changs in hash job.pack = true -- job.pack = false @@ -172,15 +173,21 @@ function job.save(filename) -- we could return a table but it can get pretty lar end local function load(filename) - local okay, data = pcall(dofile,filename) - if okay and type(data) == "table" then - local jobversion = job.version - local datacomment = data.comment - local dataversion = datacomment and datacomment.version or "?" - if dataversion ~= jobversion then - report_passes("version mismatch: %s <> %s",dataversion,jobversion) + if lfs.isfile(filename) then + local okay, data = pcall(dofile,filename) + if okay and type(data) == "table" then + local jobversion = job.version + local datacomment = data.comment + local dataversion = datacomment and datacomment.version or "?" + if dataversion ~= jobversion then + report_passes("version mismatch: %s <> %s",dataversion,jobversion) + else + return data + end else - return data + os.remove(filename) -- probably a bad file + report_passes("removing stale job data file %a, restart job",filename) + os.exit(true) -- trigger second run end end end @@ -195,10 +202,14 @@ function job.load(filename) local target = list[1] local initializer = list[3] local result = accesstable(target,utilitydata) - packers.unpack(result,jobpacker,true) - migratetable(target,mark(result)) - if type(initializer) == "function" then - initializer(result) + local done = packers.unpack(result,jobpacker,true) + if done then + migratetable(target,mark(result)) + if type(initializer) == "function" then + initializer(result) + end + else + report_passes("pack version mismatch") end end end @@ -216,8 +227,10 @@ function job.loadother(filename) local list = savelist[l] local target = list[1] local result = accesstable(target,utilitydata) - packers.unpack(result,jobpacker,true) - migratetable(target,result,unpacked) + local done = packers.unpack(result,jobpacker,true) + if done then + migratetable(target,result,unpacked) + end end unpacked.job.packed = nil -- nicer in inspecting return unpacked diff --git a/tex/context/base/font-ext.lua b/tex/context/base/font-ext.lua index 4dae48015..df8cbe160 100644 --- a/tex/context/base/font-ext.lua +++ b/tex/context/base/font-ext.lua @@ -29,6 +29,7 @@ of neutral.

local handlers = fonts.handlers local hashes = fonts.hashes +local otf = handlers.otf local registerotffeature = handlers.otf.features.register local registerafmfeature = handlers.afm.features.register @@ -386,9 +387,15 @@ local function map_opbd_onto_protrusion(tfmdata,value,opbd) end end end - tfmdata.parameters.protrusion { - auto = true - } + local parameters = tfmdata.parameters + local protrusion = tfmdata.protrusion + if not protrusion then + parameters.protrusion = { + auto = true + } + else + protrusion.auto = true + end end -- The opbd test is just there because it was discussed on the diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua index 739caa997..39a3f77dd 100644 --- a/tex/context/base/font-otn.lua +++ b/tex/context/base/font-otn.lua @@ -1899,7 +1899,11 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq -- logprocess("%s: multiple subchains for %s are not yet supported",cref(kind,chainname,chainlookupname),chainlookup and chainlookup.type or "?") i = i + 1 end - start = start.next + if start then + start = start.next + else + -- weird + end until i > nofchainlookups end else diff --git a/tex/context/base/font-otx.lua b/tex/context/base/font-otx.lua index 8185dcf1e..d276b8a15 100644 --- a/tex/context/base/font-otx.lua +++ b/tex/context/base/font-otx.lua @@ -307,15 +307,16 @@ function methods.arab(head,font,attr) end elseif classifier == s_fina then if last then - if not last[a_state] == s_init then + if last[a_state] ~= s_init then last[a_state] = s_medi end current[a_state] = s_fina first, last = nil, nil elseif first then - if not last[a_state] == s_init then - last[a_state] = s_medi - end + -- if first[a_state] ~= s_init then + -- -- needs checking + -- first[a_state] = s_medi + -- end current[a_state] = s_fina first = nil else diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua index d28b63fcf..9603419ae 100644 --- a/tex/context/base/grph-inc.lua +++ b/tex/context/base/grph-inc.lua @@ -1421,7 +1421,8 @@ bmpconverter.default = converter -- -- -- bases -- -- -- -local bases = { } +local bases = allocate() +figures.bases = bases local bases_list = nil -- index => { basename, fullname, xmlroot } local bases_used = nil -- [basename] => { basename, fullname, xmlroot } -- pointer to list diff --git a/tex/context/base/grph-swf.lua b/tex/context/base/grph-swf.lua index 0d33d89aa..8c28b76af 100644 --- a/tex/context/base/grph-swf.lua +++ b/tex/context/base/grph-swf.lua @@ -13,8 +13,8 @@ local concat = table.concat local floor = math.floor local tonumber = tonumber -local readstringr = io.readstring, io.readnumber -local readnumber = io.readstring, io.readnumber +local readstring = io.readstring +local readnumber = io.readnumber local tobitstring = number.tobitstring local todimen = number.todimen local nodeinjections = backends.nodeinjections @@ -75,16 +75,16 @@ function figures.checkers.swf(data) dr.width, dr.height = width, height du.width, du.height, du.foundname = width, height, foundname context.startfoundexternalfigure(todimen(width),todimen(height)) - nodeinjections.insertswf { - foundname = foundname, - width = width, - height = height, - -- factor = number.dimenfactors.bp, - display = dr.display, - controls = dr.controls, - -- label = dr.label, - resources = dr.resources, - } + nodeinjections.insertswf { + foundname = foundname, + width = width, + height = height, + -- factor = number.dimenfactors.bp, + display = dr.display, + controls = dr.controls, + -- label = dr.label, + resources = dr.resources, + } context.stopfoundexternalfigure() return data end diff --git a/tex/context/base/math-ini.lua b/tex/context/base/math-ini.lua index bf4df0e57..530e68568 100644 --- a/tex/context/base/math-ini.lua +++ b/tex/context/base/math-ini.lua @@ -88,6 +88,7 @@ local middle_class = 4 local close_class = 5 local accents = allocate { + accent = true, -- some can be both topaccent = true, [11] = true, botaccent = true, [12] = true, under = true, [13] = true, diff --git a/tex/context/base/meta-imp-dum.mkiv b/tex/context/base/meta-imp-dum.mkiv index 05d40b70b..1daff57ac 100644 --- a/tex/context/base/meta-imp-dum.mkiv +++ b/tex/context/base/meta-imp-dum.mkiv @@ -174,7 +174,7 @@ \defineframed [figuredummy] - [\c!background=figure:dummy, + [\c!background=figure:dummy:only, \c!foregroundcolor=\s!white, \c!backgroundcolor=\v!gray, \c!frame=\v!off, @@ -184,7 +184,7 @@ \c!width=\figurewidth] \defineoverlay - [figure:dummy] + [figure:dummy:only] [\grph_include_replacement\empty\empty\empty] \defineoverlay diff --git a/tex/context/base/mlib-pdf.mkiv b/tex/context/base/mlib-pdf.mkiv index 594a811d2..0913b3699 100644 --- a/tex/context/base/mlib-pdf.mkiv +++ b/tex/context/base/mlib-pdf.mkiv @@ -21,15 +21,15 @@ %D Some code is shared between MPLIB and MPS. The following variables %D are also available for introspection and other purposes. -\newdimen\MPwidth -\newdimen\MPheight +\ifdefined\MPwidth \else \newdimen\MPwidth \fi +\ifdefined\MPheight \else \newdimen\MPheight \fi -\newdimen\MPllx -\newdimen\MPlly -\newdimen\MPurx -\newdimen\MPury +\ifdefined\MPllx \else \newdimen\MPllx \fi +\ifdefined\MPlly \else \newdimen\MPlly \fi +\ifdefined\MPurx \else \newdimen\MPurx \fi +\ifdefined\MPury \else \newdimen\MPury \fi -\newbox \MPbox +\ifdefined\MPbox \else \newbox \MPbox \fi \def\setMPboundingbox#1#2#3#4% at some point we might pass them as base or scaled points {\global\MPllx #1\onebasepoint diff --git a/tex/context/base/mult-aux.mkiv b/tex/context/base/mult-aux.mkiv index 24eaa3366..62111a642 100644 --- a/tex/context/base/mult-aux.mkiv +++ b/tex/context/base/mult-aux.mkiv @@ -207,7 +207,9 @@ % In \MKIV\ we can probably use the english variant for all other % languages too. -\unexpanded\def\mult_interfaces_install_parameter_set_handler#1#2#3#4#5#6% we can speed this up for english +% todo: inline the \do*value + +\unexpanded\def\mult_interfaces_install_parameter_set_handler#1#2#3#4#5#6% {\ifx#2\relax\let#2\empty\fi \unexpanded\def#3{\dosetvalue {#1#2:}}% ##1 {##2} (braces are mandate) \unexpanded\def#4{\dosetevalue{#1#2:}}% ##1 {##2} (braces are mandate) diff --git a/tex/context/base/node-res.lua b/tex/context/base/node-res.lua index b651c1fa3..768aac404 100644 --- a/tex/context/base/node-res.lua +++ b/tex/context/base/node-res.lua @@ -46,7 +46,9 @@ end pool.register = register_node function pool.cleanup(nofboxes) -- todo - nodes.tracers.steppers.reset() -- todo: make a registration subsystem + if nodes.tracers.steppers then -- to be resolved + nodes.tracers.steppers.reset() -- todo: make a registration subsystem + end local nl, nr = 0, nofreserved for i=1,nofreserved do local ri = reserved[i] diff --git a/tex/context/base/page-flt.mkiv b/tex/context/base/page-flt.mkiv index fae146b8c..d641e1c7d 100644 --- a/tex/context/base/page-flt.mkiv +++ b/tex/context/base/page-flt.mkiv @@ -281,8 +281,6 @@ % \placefigure[top][]{Second}{\framed{bla 2}} % \dorecurse {40}{text } \placefigure[top][]{Third} {\framed{bla 3}} -\newbox\savedfloatbox - \appendtoks \global\setbox\savedfloatbox\box\floatbox \to \everybeforeoutput diff --git a/tex/context/base/s-mat-10.mkiv b/tex/context/base/s-mat-10.mkiv index 384371c18..3eaaf688b 100644 --- a/tex/context/base/s-mat-10.mkiv +++ b/tex/context/base/s-mat-10.mkiv @@ -13,10 +13,10 @@ %D This base module will be cleaned up and extended. -\def\enableshowmathfontvirtual +\unexpanded\def\enableshowmathfontvirtual {\ctxlua{fonts.constructors.autocleanup=false}} -\def\showmathfontcharacters +\unexpanded\def\showmathfontcharacters {\dodoubleempty\doshowmathfontcharacters} \def\doshowmathfontcharacters[#1][#2]% @@ -62,7 +62,7 @@ \startluacode local concat = table.concat -local format, lower = string.format, string.lower +local lower = string.lower local utfchar = utf.char local round = math.round @@ -76,6 +76,9 @@ local fillinthegaps = true local upperlimit = 0x0007F local upperlimit = 0xF0000 +local f_unicode = string.formatters["%U"] +local f_slot = string.formatters["%s/%0X"] + function document.showmathfont(id,slot) local tfmdata = fontdata[id] local characters = tfmdata.characters @@ -118,15 +121,15 @@ function document.showmathfont(id,slot) local v_variants = char.vert_variants local h_variants = char.horiz_variants local commands = char.commands - local slookups = desc.slookups - local mlookups = desc.mlookups + local slookups = desc and desc.slookups + local mlookups = desc and desc.mlookups local mathclass = info.mathclass local mathspec = info.mathspec local mathsymbol = info.mathsymbol local description = info.description or no_description context.startmathfontlistentry() - context.mathfontlistreference(format("U+%05X",unicode)) - context.mathfontlistentryhexdectit(format("U+%05X",code),code,lower(description)) + context.mathfontlistreference(f_unicode(unicode)) + context.mathfontlistentryhexdectit(f_unicode(code),code,lower(description)) context.mathfontlistentrywdhtdpic(round(char.width or 0),round(char.height or 0),round(char.depth or 0),round(char.italic or 0)) if virtual and commands then local t = { } @@ -134,7 +137,7 @@ function document.showmathfont(id,slot) local ci = commands[i] if ci[1] == "slot" then local fnt, idx = ci[2], ci[3] - t[#t+1] = format("%s/%0X",names[fnt] or fnt,idx) + t[#t+1] = f_slot(names[fnt] or fnt,idx) end end if #t > 0 then @@ -155,7 +158,7 @@ function document.showmathfont(id,slot) context.stopmathfontlistentryclassspec() end if mathsymbol then - context.mathfontlistentrysymbol(format("U+%05X",mathsymbol),mathsymbol) + context.mathfontlistentrysymbol(f_unicode(mathsymbol),mathsymbol) end if next_sizes then local n, done = 0, { } @@ -167,7 +170,7 @@ function document.showmathfont(id,slot) break else done[next_sizes] = true - context.mathfontlistnextentry(n,format("U+%05X",next_sizes),next_sizes) + context.mathfontlistnextentry(n,f_unicode(next_sizes),next_sizes) next_sizes = characters[next_sizes] v_variants = next_sizes.vert_variants or v_variants h_variants = next_sizes.horiz_variants or h_variants @@ -185,14 +188,14 @@ function document.showmathfont(id,slot) context.startmathfontlisthvariants() for i=1,#h_variants do -- we might go top-down in the original local vi = h_variants[i] - context.mathfontlisthvariantsentry(i,format("U+%05X",vi.glyph),vi.glyph) + context.mathfontlisthvariantsentry(i,f_unicode(vi.glyph),vi.glyph) end context.stopmathfontlisthvariants() elseif v_variants then context.startmathfontlistvvariants() for i=1,#v_variants do local vi = v_variants[#v_variants-i+1] - context.mathfontlistvvariantsentry(i,format("U+%05X",vi.glyph),vi.glyph) + context.mathfontlistvvariantsentry(i,f_unicode(vi.glyph),vi.glyph) end context.stopmathfontlistvvariants() end @@ -230,7 +233,7 @@ function document.showmathfont(id,slot) local i = 0 for variant, lookuptype in table.sortedpairs(variants) do i = i + 1 - context.mathfontlookupvariant(i,format("U+%05X",variant),variant,lookuptype) + context.mathfontlookupvariant(i,f_unicode(variant),variant,lookuptype) end context.stopmathfontlookupvariants() end diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index ee770e908..244c588ae 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index e06883ecc..3beebc8e5 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/strc-enu.mkvi b/tex/context/base/strc-enu.mkvi index 7b3f04942..62b54dbe0 100644 --- a/tex/context/base/strc-enu.mkvi +++ b/tex/context/base/strc-enu.mkvi @@ -75,6 +75,8 @@ \installcommandhandler \??enumeration {enumeration} \??enumeration +\installcounterassociation{enumeration} + \let\setupenumerations\setupenumeration \setupenumerations % check with old @@ -127,18 +129,18 @@ % % with push/pop (also at definition time) -\unexpanded\def\strc_define_commands_enumeration#1#2#3% current level parent - {\doifelsenothing{#3} - {\normalexpanded{\defineconstruction[#1][\s!handler=\v!enumeration,\c!level=#2]}% - \setevalue{\??enumeration#1:\s!parent}{\??enumeration}}% - {\normalexpanded{\defineconstruction[#1][#3][\s!handler=\v!enumeration,\c!level=#2]}% - \setevalue{\??enumeration#1:\s!parent}{\??enumeration#3}}% - \setuevalue{\e!next #1}{\strc_enumerations_next }% - \setuevalue{\c!reset#1}{\strc_enumerations_reset }% - %setuevalue{\c!set #1}{\strc_enumerations_set }% - \setuevalue {#1}{\strc_enumerations_command{#1}}% - \setuevalue{\e!start#1}{\strc_enumerations_start {#1}}% - \setuevalue{\e!stop #1}{\strc_enumerations_stop }} +\unexpanded\def\strc_define_commands_enumeration#tag#level#parent% + {\doifelsenothing{#parent} + {\normalexpanded{\defineconstruction[#tag][\s!handler=\v!enumeration,\c!level=#level]}% + \setevalue{\??enumeration#tag:\s!parent}{\??enumeration}}% + {\normalexpanded{\defineconstruction[#tag][#parent][\s!handler=\v!enumeration,\c!level=#level]}% + \setevalue{\??enumeration#tag:\s!parent}{\??enumeration#parent}}% + \setuevalue{\e!next #tag}{\strc_enumerations_next }% + \setuevalue{\c!reset#tag}{\strc_enumerations_reset }% + %setuevalue{\c!set #tag}{\strc_enumerations_set }% + \setuevalue {#tag}{\strc_enumerations_command{#tag}}% + \setuevalue{\e!start#tag}{\strc_enumerations_start {#tag}}% + \setuevalue{\e!stop #tag}{\strc_enumerations_stop }} \appendtoks \ifx\currentenumerationparent\empty @@ -172,7 +174,7 @@ \fi \doifcounterelse\p_counter\donothing{\strc_enumerations_define_counter\p_counter}% \letenumerationparameter\s!counter\p_counter - \strc_enumerations_setup_counter\currentenumeration + %\strc_enumerations_setup_counter\currentenumeration \to \everydefineenumeration \let\p_strc_constructions_title \empty @@ -217,36 +219,46 @@ \unexpanded\def\strc_enumerations_next {\strc_counters_increment_sub{\specificconstructionnumber\currentconstruction}{\currentconstructionlevel}} \unexpanded\def\strc_enumerations_reset {\strc_counters_reset_sub {\specificconstructionnumber\currentconstruction}{\currentconstructionlevel}} -%unexpanded\def\strc_enumerations_set #3{\strc_counters_set_sub {\specificconstructionnumber\currentconstruction}{\currentconstructionlevel}{#2}} +%unexpanded\def\strc_enumerations_set#tag{\strc_counters_set_sub {\specificconstructionnumber\currentconstruction}{\currentconstructionlevel}{#tag}} + +\def\currentconstructionnumber {\constructionparameter\s!counter} +\def\specificconstructionnumber#tag{\namedconstructionparameter{#tag}\s!counter} %D Counters (maybe we can share this code): (not ok yet, messy with notes) % Maybe we should move counters to the construction level as more derived mechanisms % use it \unknown\ so don't depend on names here! -\newtoks\everysetupenumerationcounter - -\let\v_strc_enumerations_counter_name\empty % or just p_counter - -\def\strc_enumerations_setup_counter#1% - {\edef\v_strc_enumerations_counter_name{#1}% only used in the token list - \the\everysetupenumerationcounter} - -\def\strc_enumerations_define_counter#1% todo: fast inheritance (was mainparameter) - {\definecounter[#1]% - \strc_enumerations_setup_counter{#1}} - -\appendtoks - \strc_counter_setup_using_parameter\v_strc_enumerations_counter_name\enumerationparameter -\to \everysetupenumerationcounter - -\def\currentconstructionnumber {\constructionparameter\s!counter} -\def\specificconstructionnumber#1{\namedconstructionparameter{#1}\s!counter} +% \newtoks\everysetupenumerationcounter +% +% \let\v_strc_enumerations_counter_name\empty % or just p_counter +% +% \def\strc_enumerations_setup_counter#tag% +% {\edef\v_strc_enumerations_counter_name{#tag}% only used in the token list +% \the\everysetupenumerationcounter} +% +% \def\strc_enumerations_define_counter#tag% todo: fast inheritance (was mainparameter) +% {\definecounter[#tag]% +% \strc_enumerations_setup_counter{#tag}} +% +% \appendtoks +% \strc_counter_setup_using_parameter\v_strc_enumerations_counter_name\enumerationparameter +% \to \everysetupenumerationcounter +% +% \appendtoks +% \ifx\currentenumeration\empty +% \synchronizeenumerationcounters % this one can also do the rest .... but we need an extra arg then +% \else +% \strc_enumerations_setup_counter\currentenumeration +% \fi +% \to \everysetupenumeration + +\def\strc_enumerations_define_counter#tag% todo: move inline + {\definecounter[#tag]% + \registerenumerationcounter{#tag}} \appendtoks - \ifx\currentenumeration\empty \else - \strc_enumerations_setup_counter\currentenumeration - \fi + \synchronizeenumerationcounters \to \everysetupenumeration %D Initializer: @@ -380,7 +392,7 @@ \fi \fi} -\unexpanded\def\strc_enumerations_skip_number_coupling[#1]% e.g. for questions with no answer - {\ctxlua{structures.references.setnextorder("construction","#1")}} +\unexpanded\def\strc_enumerations_skip_number_coupling[#tag]% e.g. for questions with no answer + {\ctxlua{structures.references.setnextorder("construction","#tag")}} \protect \endinput diff --git a/tex/context/base/strc-flt.mkvi b/tex/context/base/strc-flt.mkvi index 954748f27..696a03e99 100644 --- a/tex/context/base/strc-flt.mkvi +++ b/tex/context/base/strc-flt.mkvi @@ -140,20 +140,11 @@ %D Individial settings: -\strc_counter_preset_using_parameter\setupcaption\rootcounterparameter - -\newtoks\t_strc_parent_floats_synchronize % *1* - -\unexpanded\def\strc_floats_synchronize#1% \gobbleoneargument - {\strc_counter_setup_using_parameter{#1}\floatcaptionparameter} +\installcounterassociation{floatcaption} \appendtoks \let\currentfloat\currentfloatcaption - \ifx\currentfloat\empty - \the\t_strc_parent_floats_synchronize - \else - \strc_counter_setup_using_parameter\currentfloatcaption\floatcaptionparameter - \fi + \synchronizefloatcaptioncounters \to \everysetupfloatcaption %D Definitions: @@ -173,7 +164,7 @@ \fi\fi} \def\strc_floats_define_normal[#1][#2]% - {\appendtoks\strc_floats_synchronize{#1}\to\t_strc_parent_floats_synchronize + {\registerfloatcaptioncounter{#1}% \definefloatcaption[#1]% \definecounter[#1]% \definelist[#1]% diff --git a/tex/context/base/strc-itm.mkvi b/tex/context/base/strc-itm.mkvi index 40e9a4cbe..5840ee73e 100644 --- a/tex/context/base/strc-itm.mkvi +++ b/tex/context/base/strc-itm.mkvi @@ -611,12 +611,11 @@ \strc_itemgroups_insert_item_counter_indeed \fi} -\def\strc_itemgroups_insert_item_counter_indeed % quite slow ... every time this setup - {\begingroup % can be optimized +\def\strc_itemgroups_insert_item_counter_indeed % quite slow ... every time this setup .. but it + {\begingroup % can be optimized ... best move some to strc-num \setupcounter [\v_strc_itemgroups_counter]% - [%\c!prefix=\v!no, - \c!prefix=\itemgroupparameter\c!prefix, + [\c!prefix=\itemgroupparameter\c!prefix, \c!prefixstopper=\itemgroupparameter\c!prefixstopper, \c!prefixseparatorset=\itemgroupparameter\c!prefixseparatorset, \c!prefixconversion=\itemgroupparameter\c!prefixconversion, @@ -627,9 +626,7 @@ \c!criterium=\itemgroupparameter\c!criterium, \c!numberorder=\ifconditional\c_strc_itemgroups_reverse\v!reverse\else\v!normal\fi, \c!numberstopper=\expdoif{\itemgroupparameter\c!placestopper}\v!yes{\itemgroupparameter\c!stopper}, - %\c!numberseparatorset=, - \c!numberconversionset=\v_strc_itemgroups_counter, % itemgroup:\currentparentitemgroup, - %\c!numberconversion=\currentitemgroupsymbol, + \c!numberconversionset=\v_strc_itemgroups_counter, \c!numbersegments=\currentitemgroupsegments]% % there will be a fixedconversion key %\normalexpanded{\defineconversionset[\v_strc_itemgroups_counter][\currentitemgroupconversionset][\currentitemgroupsymbol]}% diff --git a/tex/context/base/strc-lab.mkiv b/tex/context/base/strc-lab.mkiv index 0039a68fd..28a5020ed 100644 --- a/tex/context/base/strc-lab.mkiv +++ b/tex/context/base/strc-lab.mkiv @@ -23,6 +23,8 @@ \installcommandhandler \??labels {label} \??labels % plural hash, else clash with label (or rename that one) +\installcounterassociation{label} + \let\setuplabels\setuplabel \setuplabel @@ -90,7 +92,7 @@ \fi \doifcounterelse\p_counter\donothing{\strc_labels_define_counter\p_counter}% \letlabelparameter\s!counter\p_counter - \strc_labels_setup_counter\currentlabel + %\strc_labels_setup_counter\currentlabel \to \everydefinelabel \let\p_strc_constructions_title \empty @@ -137,26 +139,34 @@ % similar to enumerations -\newtoks\everysetuplabelcounter - -\let\v_strc_labels_counter_name\empty - -\def\strc_labels_setup_counter#1% - {\edef\v_strc_labels_counter_name{#1}% - \the\everysetuplabelcounter} +% \newtoks\everysetuplabelcounter +% +% \let\v_strc_labels_counter_name\empty +% +% \def\strc_labels_setup_counter#1% +% {\edef\v_strc_labels_counter_name{#1}% +% \the\everysetuplabelcounter} +% +% \def\strc_labels_define_counter#1% +% {\definecounter[#1]% +% \strc_labels_setup_counter{#1}} +% +% \appendtoks +% \strc_counter_setup_using_parameter\v_strc_labels_counter_name\labelparameter +% \to \everysetuplabelcounter +% +% \appendtoks +% \ifx\currentlabel\empty \else +% \strc_labels_setup_counter\currentlabel +% \fi +% \to \everysetuplabel \def\strc_labels_define_counter#1% {\definecounter[#1]% - \strc_labels_setup_counter{#1}} - -\appendtoks - \strc_counter_setup_using_parameter\v_strc_labels_counter_name\labelparameter -\to \everysetuplabelcounter + \registerlabelcounter{#1}} \appendtoks - \ifx\currentlabel\empty \else - \strc_labels_setup_counter\currentlabel - \fi + \synchronizelabelcounters \to \everysetuplabel % no start stop here diff --git a/tex/context/base/strc-mat.mkiv b/tex/context/base/strc-mat.mkiv index 0d84bf8b1..933dce48a 100644 --- a/tex/context/base/strc-mat.mkiv +++ b/tex/context/base/strc-mat.mkiv @@ -50,17 +50,23 @@ \setupsubformulas % subformulas could be last in chain [\c!indentnext=\formulaparameter\c!indentnext] -\definecounter +\definecounter % one ? [\v!formula] \defineconversionset [\v!formula] [numbers,characters] % no \v! ? -\strc_counter_preset_using_parameter\setupformulas\rootcounterparameter +% \strc_counter_preset_using_parameter\setupformulas\rootcounterparameter +% +% \appendtoks +% \strc_counter_setup_using_parameter\v!formula\formulaparameter +% \to \everysetupformula + +\installcounterassociation{formula} \registerformulacounter\v!formula % currently we only have one \appendtoks - \strc_counter_setup_using_parameter\v!formula\formulaparameter + \synchronizeformulacounters \to \everysetupformula \setupformulas diff --git a/tex/context/base/strc-not.mkvi b/tex/context/base/strc-not.mkvi index 0579eb540..a7cad42aa 100644 --- a/tex/context/base/strc-not.mkvi +++ b/tex/context/base/strc-not.mkvi @@ -67,6 +67,8 @@ \installcommandhandler \??notation {notation} \??notation +\installcounterassociation{notation} + \let\setupnotations\setupnotation \definesymbol[\v!note:\v!previouspage][\llap{\low{\symbol[\v!previouspage]}}] @@ -172,7 +174,7 @@ \fi \doifcounterelse\p_counter\donothing{\strc_notes_define_counter\p_counter}% \letnotationparameter\s!counter\p_counter - \strc_notes_setup_counter\currentnotation + %\strc_notes_setup_counter\currentnotation \to \everydefinenotation \let\p_strc_constructions_title \empty @@ -411,26 +413,36 @@ % maybe we will share this at some point: -\newtoks\everysetupnotecounter - -\let\v_strc_note_counter_name\empty - -\def\strc_notes_setup_counter#tag% - {\edef\v_strc_note_counter_name{#tag}% only used in the token list - \the\everysetupnotecounter} +% \newtoks\everysetupnotecounter +% +% \let\v_strc_note_counter_name\empty +% +% \def\strc_notes_setup_counter#tag% +% {\edef\v_strc_note_counter_name{#tag}% only used in the token list +% \the\everysetupnotecounter} +% +% \def\strc_notes_define_counter#tag% todo: fast inheritance (was mainparameter +% {\definecounter[#tag]% +% \strc_notes_setup_counter{#tag}} +% +% \appendtoks +% \strc_counter_setup_using_parameter\v_strc_note_counter_name\notationparameter +% \to \everysetupnotecounter +% +% \appendtoks +% \ifx\currentnotation\empty +% \synchronizeenumerationcounters +% \else +% \strc_notes_setup_counter\currentnotation +% \fi +% \to \everysetupnotation -\def\strc_notes_define_counter#tag% todo: fast inheritance (was mainparameter +\def\strc_notes_define_counter#tag% todo: move inline {\definecounter[#tag]% - \strc_notes_setup_counter{#tag}} + \registerenumerationcounter{#tag}} \appendtoks - \strc_counter_setup_using_parameter\v_strc_note_counter_name\notationparameter -\to \everysetupnotecounter - -\appendtoks - \ifx\currentnotation\empty \else - \strc_notes_setup_counter\currentnotation - \fi + \synchronizenotationcounters \to \everysetupnotation % so far diff --git a/tex/context/base/strc-num.mkiv b/tex/context/base/strc-num.mkiv index 96d1f0816..c4d54e512 100644 --- a/tex/context/base/strc-num.mkiv +++ b/tex/context/base/strc-num.mkiv @@ -620,32 +620,10 @@ \let\m_strc_counters_last_registered_attribute \relax \let\m_strc_counters_last_registered_synchronize\relax -\def\strc_counter_setup_using_parameter#1#2% name \someparameter - {\setupcounter - [#1] - [ \c!start=#2\c!start, - \c!state=#2\c!state, % beware, "" == start - \c!way=#2\c!way, - % - \c!prefix=#2\c!prefix, - \c!prefixseparatorset=#2\c!prefixseparatorset, - \c!prefixconversion=#2\c!prefixconversion, - \c!prefixconversionset=#2\c!prefixconversionset, - \c!prefixstarter=#2\c!prefixstarter, - \c!prefixstopper=#2\c!prefixstopper, - \c!prefixset=#2\c!prefixset, - \c!prefixsegments=#2\c!prefixsegments, - \c!prefixset=#2\c!prefixset, - \c!prefixconnector=#2\c!prefixconnector, - % - \c!numberseparatorset=#2\c!numberseparatorset, - \c!numberconversion=#2\c!numberconversion, - \c!numberconversionset=#2\c!numberconversionset, - \c!numberstarter=#2\c!numberstarter, - \c!numberstopper=#2\c!numberstopper, - \c!numbersegments=#2\c!numbersegments]} - -\def\strc_counter_preset_using_parameter#1#2% \setupcommand \someparameter +% This can be improved as we don't need to pas all these variables +% each time (we can set them up once). + +\unexpanded\def\strc_counter_preset_using_parameter#1#2% \setupcommand \someparameter {#1% [\c!way =#2\c!way, \c!prefix =#2\c!prefix, @@ -664,4 +642,104 @@ \c!numberstopper =#2\c!numberstopper, \c!numbersegments =#2\c!numbersegments]} +% \unexpanded\def\strc_counter_setup_using_parameter#1#2% name \someparameter +% {\setupcounter +% [#1] +% [ \c!start=#2\c!start, +% \c!state=#2\c!state, % beware, "" == start +% \c!way=#2\c!way, +% % +% \c!prefix=#2\c!prefix, +% \c!prefixseparatorset=#2\c!prefixseparatorset, +% \c!prefixconversion=#2\c!prefixconversion, +% \c!prefixconversionset=#2\c!prefixconversionset, +% \c!prefixstarter=#2\c!prefixstarter, +% \c!prefixstopper=#2\c!prefixstopper, +% \c!prefixset=#2\c!prefixset, +% \c!prefixsegments=#2\c!prefixsegments, +% \c!prefixset=#2\c!prefixset, +% \c!prefixconnector=#2\c!prefixconnector, +% % +% \c!numberseparatorset=#2\c!numberseparatorset, +% \c!numberconversion=#2\c!numberconversion, +% \c!numberconversionset=#2\c!numberconversionset, +% \c!numberstarter=#2\c!numberstarter, +% \c!numberstopper=#2\c!numberstopper, +% \c!numbersegments=#2\c!numbersegments]} + +\unexpanded\def\strc_counter_setup_using_parameter#1#2% name \someparameter + {\edef\currentcounter{#1}% + % + \setcounterparameter \c!start{#2\c!start}% + \setcounterparameter \c!state{#2\c!state}% % beware, "" == start + \setcounterparameter \c!way{#2\c!way}% + % + \setcounterparameter \c!prefix{#2\c!prefix}% + \setcounterparameter \c!prefixseparatorset{#2\c!prefixseparatorset}% + \setcounterparameter \c!prefixconversion{#2\c!prefixconversion}% + \setcounterparameter\c!prefixconversionset{#2\c!prefixconversionset}% + \setcounterparameter \c!prefixstarter{#2\c!prefixstarter}% + \setcounterparameter \c!prefixstopper{#2\c!prefixstopper}% + \setcounterparameter \c!prefixset{#2\c!prefixset}% + \setcounterparameter \c!prefixsegments{#2\c!prefixsegments}% + \setcounterparameter \c!prefixset{#2\c!prefixset}% + \setcounterparameter \c!prefixconnector{#2\c!prefixconnector}% + % + \setcounterparameter \c!numberseparatorset{#2\c!numberseparatorset}% + \setcounterparameter \c!numberconversion{#2\c!numberconversion}% + \setcounterparameter\c!numberconversionset{#2\c!numberconversionset}% + \setcounterparameter \c!numberstarter{#2\c!numberstarter}% + \setcounterparameter \c!numberstopper{#2\c!numberstopper}% + \setcounterparameter \c!numbersegments{#2\c!numbersegments}% + % + \the\everysetupcounter} + +\unexpanded\def\mult_interfaces_counter_association#1#2#3#4#5#6#7% tag current setup parameter list sync register + {\strc_counter_preset_using_parameter#3\rootcounterparameter + \newtoks#5% + \unexpanded\def #6{\ifx#2\empty\the#5\else\strc_counter_setup_using_parameter#2#4\fi}% sync + \unexpanded\def#7##1{\normalexpanded{#5{\the#5\strc_counter_setup_using_parameter{##1}\noexpand#4}}}} % register + +\unexpanded\def\installcounterassociation#1% => synchronize#1counters register#1counter + {\normalexpanded + {\mult_interfaces_counter_association + {#1}% not \??xx but xx + \expandafter\noexpand\csname current#1\endcsname + \expandafter\noexpand\csname setup#1\endcsname + \expandafter\noexpand\csname #1parameter\endcsname + \expandafter\noexpand\csname counter_association_list_#1\endcsname + \expandafter\noexpand\csname synchronize#1counters\endcsname + \expandafter\noexpand\csname register#1counter\endcsname}} + +% needs testing: +% +% \unexpanded\def\strc_counter_setup_push#1#2#3% \someparameter \directsomeparameter \setexpandedsomeparameter +% {\let\savedcounterparameter \counterparameter +% \let\saveddirectcounterparameter \directcounterparameter +% \let\savedsetexpandedcounterparameter\setexpandedcounterparameter +% % remap +% \let\counterparameter #1% +% \let\directcounterparameter #2% +% \let\setexpandedcounterparameter #3} +% +% \unexpanded\def\strc_counter_setup_pop +% {\let\counterparameter \savedcounterparameter +% \let\directcounterparameter \saveddirectcounterparameter +% \let\setexpandedcounterparameter \savedsetexpandedcounterparameter} +% +% \unexpanded\def\mult_interfaces_counter_association#1#2#3#4#5#6#7% tag current setup parameter list sync register +% {\strc_counter_preset_using_parameter#3\rootcounterparameter +% \newtoks#5% +% \unexpanded\def#6% sync +% {\strc_counter_setup_push +% \ifx#2\empty +% \the#5% +% \else +% \let\currentcounter\empty +% \the\everysetupcounter +% \fi +% \strc_counter_setup_pop}% +% \unexpanded\def#7##1% register +% {\normalexpanded{#5{\the#5\edef\noexpand\currentcounter{##1}\noexpand\the\everysetupcounter}}}} + \protect \endinput diff --git a/tex/context/base/util-pck.lua b/tex/context/base/util-pck.lua index 7937ff557..cf1445b40 100644 --- a/tex/context/base/util-pck.lua +++ b/tex/context/base/util-pck.lua @@ -127,11 +127,12 @@ function packers.unpack(t,p,shared) if tp.version == (p and p.version or packers.version) then unpack(t,tp.keys,tp.index) else - -- fatal error, wrong version + return false end t.packer = nil end end + return true end function packers.strip(p) diff --git a/tex/context/base/x-mathml.lua b/tex/context/base/x-mathml.lua index 988758b14..31483bbea 100644 --- a/tex/context/base/x-mathml.lua +++ b/tex/context/base/x-mathml.lua @@ -481,38 +481,25 @@ function mathml.mo(id) context(simpleoperatorremapper(rep)) end --- function mathml.mi(id) --- local e = getid(id) --- local str = e.dt --- if type(str) == "string" then -- we need a helper for this in the xml namespace ... xml.type(e) --- -- local str = xmlcontent(e) or "" --- local str = gsub(str,"&.-;","") -- needed? --- local rep = i_replacements[str] --- if not rep then --- rep = gsub(str,".",i_replacements) --- end --- context(rep) --- -- context.mi(rep) --- else --- context.xmlflush(id) -- xmlsprint or so --- end --- end - function mathml.mi(id) -- we need to strip comments etc .. todo when reading in tree local e = getid(id) local str = e.dt - local n = #str - if n == 0 then - -- nothing to do - elseif n == 1 then - local str = gsub(str[1],"&.-;","") -- bah - local rep = i_replacements[str] - if not rep then - rep = gsub(str,".",i_replacements) + if type(str) == "string" then + local n = #str + if n == 0 then + -- nothing to do + elseif n == 1 then + local str = gsub(str[1],"&.-;","") -- bah + local rep = i_replacements[str] + if not rep then + rep = gsub(str,".",i_replacements) + end + context(rep) + -- context.mi(rep) + else + context.xmlflush(id) -- xmlsprint or so end - context(rep) - -- context.mi(rep) else context.xmlflush(id) -- xmlsprint or so end diff --git a/tex/context/base/x-mathml.mkiv b/tex/context/base/x-mathml.mkiv index cf861cd7b..99b9f92af 100644 --- a/tex/context/base/x-mathml.mkiv +++ b/tex/context/base/x-mathml.mkiv @@ -2171,7 +2171,7 @@ } \stopxmlsetups -\def\mmlexecuteifdefined#1% +\unexpanded\def\mmlexecuteifdefined#1% {\ifx#1\empty \expandafter\secondoftwoarguments \else\ifcsname#1\endcsname @@ -2183,7 +2183,7 @@ \startxmlsetups mml:mover \edef\mmlovertoken{\xmlraw{#1}{/mml:*[2]}} - \doifelseutfmathaccentfiltered\mmlovertoken{topaccent} { + \doifelseutfmathaccentfiltered\mmlovertoken{topaccent} {% not ok \edef\mmlovercommand{\utfmathcommandfiltered\mmlovertoken{topaccent}} \mmlexecuteifdefined\mmlovercommand\mathematics{\mmlfirst{#1}} } { @@ -2191,14 +2191,15 @@ \edef\mmlbasecommand{\utfmathfiller\mmlbasetoken} \edef\mmlovercommand{\utfmathfiller\mmlovertoken} \vbox { - \mathsurround\zeropoint \ialign { - \hss$##$\hss + \mathsurround\zeropoint + \ialign { + \hss$\alignmark\alignmark$\hss \crcr \noalign{\kern3\onepoint}% - \mmlexecuteifdefined\mmlovercommand{\mmlsecond{#1}} + \mmlexecuteifdefined\mmlovercommand{\mmlsecond{#1}}{}% extra {} is safeguard \crcr \noalign{\kern3\onepoint\nointerlineskip}% - \mmlexecuteifdefined\mmlbasecommand{\mmlfirst{#1}} + \mmlexecuteifdefined\mmlbasecommand{\mmlfirst{#1}}{}% extra {} is safeguard \crcr } } diff --git a/tex/context/base/x-res-01.mkiv b/tex/context/base/x-res-01.mkiv index 4931b5650..e234e9867 100644 --- a/tex/context/base/x-res-01.mkiv +++ b/tex/context/base/x-res-01.mkiv @@ -140,20 +140,20 @@ \xmlloadonly{main}{\inputfilename}{} -\mainlanguage[\xmlattributedef{main}{/rl:library}{language}{en}] +\mainlanguage[\xmlattributedef{main}{/rlx:library}{language}{en}] \startxmlsetups xml:resource:asis \startTEXpage[pagestate=start] - \xmldoifelsetext{#1}{/rl:label} { - \edef\CurrentLabel{\xmltext{#1}{rl:label}} + \xmldoifelsetext{#1}{/rlx:label} { + \edef\CurrentLabel{\xmltext{#1}{rlx:label}} } { - \edef\CurrentLabel{\xmltext{#1}{rl:file}} + \edef\CurrentLabel{\xmltext{#1}{rlx:file}} } \pagereference [ asis:\CurrentLabel ] \gotobox { - \externalfigure[\xmltext{#1}{/rl:file}] + \externalfigure[\xmltext{#1}{/rlx:file}] }[% tricky no space before [ data:\CurrentLabel ] @@ -195,7 +195,7 @@ ] { \externalfigure - [\xmltext{#1}{rl:file}] + [\xmltext{#1}{rlx:file}] [factor=max] } [ @@ -216,7 +216,7 @@ ] { \externalfigure [ - \xmltext{#1}{rl:file} + \xmltext{#1}{rlx:file} ] [ factor=max ] @@ -227,10 +227,10 @@ % using a layer makes more sense but we had this ... - \xmldoifelsetext{#1}{/rl:label} { - \edef\CurrentLabel{\xmltext{#1}{rl:label}} + \xmldoifelsetext{#1}{/rlx:label} { + \edef\CurrentLabel{\xmltext{#1}{rlx:label}} } { - \edef\CurrentLabel{\xmltext{#1}{rl:file}} + \edef\CurrentLabel{\xmltext{#1}{rlx:file}} } \button { @@ -241,7 +241,7 @@ %\ifnum\CurrentPage=1 \pagereference[begin]\fi - \expanded{\figureindex{\xmltext{#1}{/rl:label}}} + \expanded{\figureindex{\xmltext{#1}{/rlx:label}}} \vbox to 100pt { \hsize30pt @@ -286,7 +286,7 @@ ] { \externalfigure [ - \xmltext{#1}{rl:file} + \xmltext{#1}{rlx:file} ] [ reset=yes ] @@ -301,12 +301,12 @@ \vbox to 100pt { \blank[disable] \starttabulate[|Bel|p|] - \NC file \NC \xmltext{#1}{/rl:file} \NC \NR - \xmldoif{#1}{/rl:label} {\NC label \NC \xmltext{#1}{/rl:label} \NC \NR} + \NC file \NC \xmltext{#1}{/rlx:file} \NC \NR + \xmldoif{#1}{/rlx:label} {\NC label \NC \xmltext{#1}{/rlx:label} \NC \NR} \NC dimensions \NC \CurrentWidth\ * \CurrentHeight \NC \NR - \xmldoif{#1}{/rl:copyright} {\NC copyright \NC \xmltext{#1}{/rl:copyright} \NC \NR} - \xmldoif{#1}{/rl:status} {\NC status \NC \xmltext{#1}{/rl:status} \NC \NR} - \xmldoif{#1}{/rl:comment} {\NC comment \NC \xmltext{#1}{/rl:comment} \NC \NR} + \xmldoif{#1}{/rlx:copyright} {\NC copyright \NC \xmltext{#1}{/rlx:copyright} \NC \NR} + \xmldoif{#1}{/rlx:status} {\NC status \NC \xmltext{#1}{/rlx:status} \NC \NR} + \xmldoif{#1}{/rlx:comment} {\NC comment \NC \xmltext{#1}{/rlx:comment} \NC \NR} \stoptabulate \vfill } @@ -322,10 +322,10 @@ \startxmlsetups xml:description \starttabulate[|lBe|p|] - \xmldoif{#1}{/rl:organization} {\NC organization \NC \xmltext{#1}{/rl:organization} \NC \NR} - \xmldoif{#1}{/rl:project} {\NC project \NC \xmltext{#1}{/rl:project} \NC \NR} - \xmldoif{#1}{/rl:product} {\NC product \NC \xmltext{#1}{/rl:product} \NC \NR} - \xmldoif{#1}{/rl:comment} {\NC comment \NC \xmltext{#1}{/rl:comment} \NC \NR} + \xmldoif{#1}{/rlx:organization} {\NC organization \NC \xmltext{#1}{/rlx:organization} \NC \NR} + \xmldoif{#1}{/rlx:project} {\NC project \NC \xmltext{#1}{/rlx:project} \NC \NR} + \xmldoif{#1}{/rlx:product} {\NC product \NC \xmltext{#1}{/rlx:product} \NC \NR} + \xmldoif{#1}{/rlx:comment} {\NC comment \NC \xmltext{#1}{/rlx:comment} \NC \NR} \NC specification \NC \attachment[datafile] \NC \NR \stoptabulate @@ -333,15 +333,15 @@ \starttext - \xmlfilter{main}{/rl:library/rl:resource/command(xml:resource:asis)} + \xmlfilter{main}{/rlx:library/rlx:resource/command(xml:resource:asis)} \subject {Figure collection} - \xmlfilter{main}{/rl:library/rl:description/command(xml:description)} + \xmlfilter{main}{/rlx:library/rlx:description/command(xml:description)} \subject [list] {List of figures} - \xmlfilter{main}{/rl:library/rl:resource/command(xml:resource:data)} + \xmlfilter{main}{/rlx:library/rlx:resource/command(xml:resource:data)} \page @@ -406,19 +406,19 @@ % \def\StopFigureD % {\doglobal\increment\CurrentPage % \setupbackgrounds[page][background=page] -% \startpagefigure[\XMLflush{rl:file}][offset=20pt]% -% \doifelsenothing{\XMLflush{rl:label}} -% {\expanded{\definereference[Description][about:\XMLflush{rl:file}]}% -% \expanded{\pagereference[grid:\XMLflush{rl:file}]}} -% {\expanded{\definereference[Description][about:\XMLflush{rl:label}]}% -% \expanded{\pagereference[grid:\XMLflush{rl:label}]}} +% \startpagefigure[\XMLflush{rlx:file}][offset=20pt]% +% \doifelsenothing{\XMLflush{rlx:label}} +% {\expanded{\definereference[Description][about:\XMLflush{rlx:file}]}% +% \expanded{\pagereference[grid:\XMLflush{rlx:file}]}} +% {\expanded{\definereference[Description][about:\XMLflush{rlx:label}]}% +% \expanded{\pagereference[grid:\XMLflush{rlx:label}]}} % \stoppagefigure -% %\pagefigure[\XMLflush{rl:file}][offset=20pt] +% %\pagefigure[\XMLflush{rlx:file}][offset=20pt] % \setupbackgrounds[page][background=] % \egroup} -% \defineXMLignore [rl:description] -% \defineXMLenvironment [rl:figure] \StartFigureD \StopFigureD +% \defineXMLignore [rlx:description] +% \defineXMLenvironment [rlx:figure] \StartFigureD \StopFigureD % \doglobal\newcounter\CurrentPage diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index b3cc9cc1c..11395bd08 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 : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 03/28/13 09:26:25 +-- merge date : 03/28/13 23:10:34 do -- begin closure to overcome local limits and interference @@ -9838,7 +9838,10 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq else i=i+1 end - start=start.next + if start then + start=start.next + else + end until i>nofchainlookups end else -- cgit v1.2.3