beta 2012.02.08 21:04
authorMarius <mariausol@gmail.com>
Wed, 8 Feb 2012 21:00:23 +0000 (8 23:00 +0200)
committerMarius <mariausol@gmail.com>
Wed, 8 Feb 2012 21:00:23 +0000 (8 23:00 +0200)
151 files changed:
context/data/scite/lexers/data/scite-context-data-context.lua
context/data/scite/lexers/scite-context-lexer-cld.lua
context/data/scite/lexers/scite-context-lexer-lua-longstring.lua
context/data/scite/lexers/scite-context-lexer-lua.lua
context/data/scite/lexers/scite-context-lexer-mps.lua
context/data/scite/lexers/scite-context-lexer-pdf-object.lua
context/data/scite/lexers/scite-context-lexer-pdf-xref.lua
context/data/scite/lexers/scite-context-lexer-pdf.lua
context/data/scite/lexers/scite-context-lexer-tex.lua
context/data/scite/lexers/scite-context-lexer-txt.lua
context/data/scite/lexers/scite-context-lexer-xml-cdata.lua
context/data/scite/lexers/scite-context-lexer-xml-comment.lua
context/data/scite/lexers/scite-context-lexer-xml.lua
context/data/scite/lexers/scite-context-lexer.lua
context/data/scite/lexers/themes/scite-context-theme.lua
context/data/scite/scite-context-data-context.properties
context/data/scite/scite-context-external.properties
context/data/scite/scite-context.properties
context/data/scite/scite-ctx.properties
metapost/context/base/mp-core.mpiv
metapost/context/base/mp-page.mpiv
tex/context/base/anch-bck.mkvi
tex/context/base/anch-pgr.mkiv
tex/context/base/anch-pos.lua
tex/context/base/anch-pos.mkiv
tex/context/base/anch-snc.mkiv
tex/context/base/buff-imp-mp.lua
tex/context/base/buff-par.mkiv
tex/context/base/char-def.lua
tex/context/base/colo-grp.mkiv
tex/context/base/cont-fil.mkiv
tex/context/base/cont-new.mkii
tex/context/base/cont-new.mkiv
tex/context/base/context-version.pdf
tex/context/base/context-version.png
tex/context/base/context.mkii
tex/context/base/context.mkiv
tex/context/base/core-env.mkiv
tex/context/base/core-ini.mkiv
tex/context/base/core-uti.lua
tex/context/base/data-tex.lua
tex/context/base/font-con.lua
tex/context/base/font-ctx.lua
tex/context/base/font-def.lua
tex/context/base/font-gds.lua
tex/context/base/font-ini.mkvi
tex/context/base/font-set.mkvi
tex/context/base/java-imp-rhh.mkiv [new file with mode: 0644]
tex/context/base/java-ini.lua
tex/context/base/lpdf-ano.lua
tex/context/base/lpdf-fld.lua
tex/context/base/m-visual.mkii [copied from tex/context/base/m-visual.tex with 99% similarity]
tex/context/base/m-visual.mkiv [moved from tex/context/base/m-visual.tex with 64% similarity]
tex/context/base/math-act.lua
tex/context/base/math-def.mkiv
tex/context/base/math-ini.lua
tex/context/base/math-ini.mkiv
tex/context/base/math-noa.lua
tex/context/base/meta-pag.mkiv
tex/context/base/mlib-pdf.lua
tex/context/base/mlib-pps.lua
tex/context/base/mult-aux.mkiv
tex/context/base/mult-de.mkii
tex/context/base/mult-def.lua
tex/context/base/mult-en.mkii
tex/context/base/mult-fr.mkii
tex/context/base/mult-it.mkii
tex/context/base/mult-low.lua
tex/context/base/mult-nl.mkii
tex/context/base/mult-pe.mkii
tex/context/base/mult-ro.mkii
tex/context/base/mult-sys.mkiv
tex/context/base/node-aux.lua
tex/context/base/node-ref.lua
tex/context/base/node-tsk.lua
tex/context/base/pack-lyr.mkiv
tex/context/base/pack-rul.mkiv
tex/context/base/page-brk.mkiv
tex/context/base/page-flt.mkiv
tex/context/base/page-ini.mkiv
tex/context/base/page-lay.mkiv
tex/context/base/page-mis.mkiv
tex/context/base/page-mul.mkiv
tex/context/base/page-not.mkiv
tex/context/base/page-one.mkiv
tex/context/base/page-otr.mkvi [new file with mode: 0644]
tex/context/base/page-plg.mkiv
tex/context/base/page-set.mkiv
tex/context/base/page-sid.mkiv
tex/context/base/page-spr.mkiv
tex/context/base/page-str.mkiv
tex/context/base/page-txt.mkvi
tex/context/base/scrn-fld.mkvi
tex/context/base/scrn-ini.mkvi
tex/context/base/scrn-wid.lua
tex/context/base/scrn-wid.mkvi
tex/context/base/spac-ver.lua
tex/context/base/spac-ver.mkiv
tex/context/base/status-files.pdf
tex/context/base/status-lua.pdf
tex/context/base/status-mkiv.lua
tex/context/base/strc-con.lua [moved from tex/context/base/strc-des.lua with 64% similarity]
tex/context/base/strc-con.mkvi [new file with mode: 0644]
tex/context/base/strc-des.mkiv [deleted file]
tex/context/base/strc-des.mkvi [new file with mode: 0644]
tex/context/base/strc-enu.mkvi [new file with mode: 0644]
tex/context/base/strc-flt.mkvi
tex/context/base/strc-ind.mkiv [new file with mode: 0644]
tex/context/base/strc-lab.mkiv [new file with mode: 0644]
tex/context/base/strc-lnt.mkvi [moved from tex/context/base/strc-lnt.mkiv with 97% similarity]
tex/context/base/strc-lst.lua
tex/context/base/strc-lst.mkvi
tex/context/base/strc-mar.lua
tex/context/base/strc-not.lua
tex/context/base/strc-not.mkiv [deleted file]
tex/context/base/strc-not.mkvi [new file with mode: 0644]
tex/context/base/strc-ref.lua
tex/context/base/strc-ref.mkvi
tex/context/base/strc-sec.mkiv
tex/context/base/strc-tag.mkiv
tex/context/base/supp-box.mkiv
tex/context/base/syst-pln.mkiv
tex/context/base/tabl-tbl.mkiv
tex/context/base/tabl-xtb.lua
tex/context/base/tabl-xtb.mkvi
tex/context/base/type-imp-buy.mkiv [new file with mode: 0644]
tex/context/base/type-imp-cow.mkiv [moved from tex/context/base/type-cow.mkiv with 100% similarity]
tex/context/base/type-imp-ghz.mkiv [moved from tex/context/base/type-ghz.mkiv with 100% similarity]
tex/context/base/type-imp-hgz.mkiv [moved from tex/context/base/type-hgz.mkiv with 100% similarity]
tex/context/base/type-imp-informal.mkiv [moved from tex/context/base/type-buy.mkiv with 61% similarity]
tex/context/base/type-imp-latinmodern.mkiv
tex/context/base/type-imp-lmnames.mkiv
tex/context/base/type-imp-osx.mkiv [moved from tex/context/base/type-mac.mkiv with 95% similarity]
tex/context/base/type-ini.mkvi
tex/context/base/type-msw.mkiv [deleted file]
tex/context/base/type-set.mkiv
tex/context/base/type-win.mkiv [deleted file]
tex/context/base/typo-mar.lua
tex/context/base/typo-mar.mkiv
tex/context/base/util-seq.lua
tex/context/fonts/lm.lfg
tex/context/interface/cont-nl.xml
tex/context/interface/keys-cs.xml
tex/context/interface/keys-de.xml
tex/context/interface/keys-en.xml
tex/context/interface/keys-fr.xml
tex/context/interface/keys-it.xml
tex/context/interface/keys-nl.xml
tex/context/interface/keys-pe.xml
tex/context/interface/keys-ro.xml
tex/generic/context/luatex/luatex-fonts-merged.lua

index bf7aa72..1e5b405 100644 (file)
@@ -1,4 +1,4 @@
 return {
- ["constants"]={ "zerocount", "minusone", "minustwo", "plusone", "plustwo", "plusthree", "plusfour", "plusfive", "plussix", "plusseven", "pluseight", "plusnine", "plusten", "plussixteen", "plushundred", "plusthousand", "plustenthousand", "plustwentythousand", "medcard", "maxcard", "zeropoint", "onepoint", "halfapoint", "onebasepoint", "maxdimen", "scaledpoint", "thousandpoint", "points", "halfpoint", "zeroskip", "pluscxxvii", "pluscxxviii", "pluscclv", "pluscclvi", "normalpagebox", "endoflinetoken", "outputnewlinechar", "emptytoks", "empty", "undefined", "voidbox", "emptybox", "emptyvbox", "emptyhbox", "bigskipamount", "medskipamount", "smallskipamount", "fmtname", "fmtversion", "texengine", "texenginename", "texengineversion", "luatexengine", "pdftexengine", "xetexengine", "unknownengine", "etexversion", "pdftexversion", "xetexversion", "xetexrevision", "activecatcode", "bgroup", "egroup", "endline", "conditionaltrue", "conditionalfalse", "attributeunsetvalue", "uprotationangle", "rightrotationangle", "downrotationangle", "leftrotationangle", "inicatcodes", "ctxcatcodes", "texcatcodes", "notcatcodes", "txtcatcodes", "vrbcatcodes", "prtcatcodes", "nilcatcodes", "luacatcodes", "tpacatcodes", "tpbcatcodes", "xmlcatcodes", "escapecatcode", "begingroupcatcode", "endgroupcatcode", "mathshiftcatcode", "alignmentcatcode", "endoflinecatcode", "parametercatcode", "superscriptcatcode", "subscriptcatcode", "ignorecatcode", "spacecatcode", "lettercatcode", "othercatcode", "activecatcode", "commentcatcode", "invalidcatcode", "tabasciicode", "newlineasciicode", "formfeedasciicode", "endoflineasciicode", "endoffileasciicode", "spaceasciicode", "hashasciicode", "dollarasciicode", "commentasciicode", "ampersandasciicode", "colonasciicode", "backslashasciicode", "circumflexasciicode", "underscoreasciicode", "leftbraceasciicode", "barasciicode", "rightbraceasciicode", "tildeasciicode", "delasciicode", "lessthanasciicode", "morethanasciicode", "doublecommentsignal", "atsignasciicode", "exclamationmarkasciicode", "questionmarkasciicode", "doublequoteasciicode", "singlequoteasciicode", "forwardslashasciicode", "primeasciicode", "activemathcharcode", "activetabtoken", "activeformfeedtoken", "activeendoflinetoken", "batchmodecode", "nonstopmodecode", "scrollmodecode", "errorstopmodecode", "bottomlevelgroupcode", "simplegroupcode", "hboxgroupcode", "adjustedhboxgroupcode", "vboxgroupcode", "vtopgroupcode", "aligngroupcode", "noaligngroupcode", "outputgroupcode", "mathgroupcode", "discretionarygroupcode", "insertgroupcode", "vcentergroupcode", "mathchoicegroupcode", "semisimplegroupcode", "mathshiftgroupcode", "mathleftgroupcode", "vadjustgroupcode", "charnodecode", "hlistnodecode", "vlistnodecode", "rulenodecode", "insertnodecode", "marknodecode", "adjustnodecode", "ligaturenodecode", "discretionarynodecode", "whatsitnodecode", "mathnodecode", "gluenodecode", "kernnodecode", "penaltynodecode", "unsetnodecode", "mathsnodecode", "charifcode", "catifcode", "numifcode", "dimifcode", "oddifcode", "vmodeifcode", "hmodeifcode", "mmodeifcode", "innerifcode", "voidifcode", "hboxifcode", "vboxifcode", "xifcode", "eofifcode", "trueifcode", "falseifcode", "caseifcode", "definedifcode", "csnameifcode", "fontcharifcode", "fontslantperpoint", "fontinterwordspace", "fontinterwordstretch", "fontinterwordshrink", "fontexheight", "fontemwidth", "fontextraspace", "slantperpoint", "interwordspace", "interwordstretch", "interwordshrink", "exheight", "emwidth", "extraspace", "mathsupdisplay", "mathsupnormal", "mathsupcramped", "mathsubnormal", "mathsubcombined", "mathaxisheight", "startmode", "stopmode", "startnotmode", "stopnotmode", "startmodeset", "stopmodeset", "doifmode", "doifmodeelse", "doifnotmode", "startallmodes", "stopallmodes", "startnotallmodes", "stopnotallmodes", "doifallmodes", "doifallmodeselse", "doifnotallmodes", "startenvironment", "stopenvironment", "environment", "startcomponent", "stopcomponent", "component", "startproduct", "stopproduct", "product", "startproject", "stopproject", "project", "starttext", "stoptext", "startdocument", "stopdocument", "documentvariable", "startmodule", "stopmodule", "usemodule", "typescriptone", "typescripttwo", "typescriptthree", "mathsizesuffix", "mathordcode", "mathopcode", "mathbincode", "mathrelcode", "mathopencode", "mathclosecode", "mathpunctcode", "mathalphacode", "mathinnercode", "mathnothingcode", "mathlimopcode", "mathnolopcode", "mathboxcode", "mathchoicecode", "mathaccentcode", "mathradicalcode" },
- ["helpers"]={ "startsetups", "stopsetups", "startxmlsetups", "stopxmlsetups", "startluasetups", "stopluasetups", "starttexsetups", "stoptexsetups", "startrawsetups", "stoprawsetups", "startlocalsetups", "stoplocalsetups", "starttexdefinition", "stoptexdefinition", "starttexcode", "stoptexcode", "newcount", "newdimen", "newskip", "newmuskip", "newbox", "newtoks", "newread", "newwrite", "newmarks", "newinsert", "newattribute", "newif", "newlanguage", "newfamily", "newfam", "newhelp", "then", "donetrue", "donefalse", "htdp", "unvoidbox", "vfilll", "mathbox", "mathlimop", "mathnolop", "mathnothing", "mathalpha", "currentcatcodetable", "defaultcatcodetable", "catcodetablename", "newcatcodetable", "startcatcodetable", "stopcatcodetable", "startextendcatcodetable", "stopextendcatcodetable", "pushcatcodetable", "popcatcodetable", "restorecatcodes", "setcatcodetable", "letcatcodecommand", "defcatcodecommand", "uedcatcodecommand", "hglue", "vglue", "hfillneg", "vfillneg", "hfilllneg", "vfilllneg", "ruledhss", "ruledhfil", "ruledhfill", "ruledhfilneg", "ruledhfillneg", "normalhfillneg", "ruledvss", "ruledvfil", "ruledvfill", "ruledvfilneg", "ruledvfillneg", "normalvfillneg", "ruledhbox", "ruledvbox", "ruledvtop", "ruledvcenter", "ruledhskip", "ruledvskip", "ruledkern", "ruledmskip", "ruledmkern", "ruledhglue", "ruledvglue", "normalhglue", "normalvglue", "ruledpenalty", "scratchcounter", "globalscratchcounter", "scratchdimen", "globalscratchdimen", "scratchskip", "globalscratchskip", "scratchmuskip", "globalscratchmuskip", "scratchtoks", "globalscratchtoks", "scratchbox", "globalscratchbox", "nextbox", "dowithnextbox", "dowithnextboxcs", "dowithnextboxcontent", "dowithnextboxcontentcs", "scratchwidth", "scratchheight", "scratchdepth", "scratchoffset", "scratchdistance", "scratchhsize", "scratchvsize", "scratchcounterone", "scratchcountertwo", "scratchcounterthree", "scratchdimenone", "scratchdimentwo", "scratchdimenthree", "scratchskipone", "scratchskiptwo", "scratchskipthree", "scratchmuskipone", "scratchmuskiptwo", "scratchmuskipthree", "scratchtoksone", "scratchtokstwo", "scratchtoksthree", "scratchboxone", "scratchboxtwo", "scratchboxthree", "doif", "doifnot", "doifelse", "doifinset", "doifnotinset", "doifinsetelse", "doifnextcharelse", "doifnextoptionalelse", "doifnextbgroupelse", "doifnextparenthesiselse", "doiffastoptionalcheckelse", "doifundefinedelse", "doifdefinedelse", "doifundefined", "doifdefined", "doifelsevalue", "doifvalue", "doifnotvalue", "doifnothing", "doifsomething", "doifelsenothing", "doifsomethingelse", "doifvaluenothing", "doifvaluesomething", "doifelsevaluenothing", "doifdimensionelse", "doifnumberelse", "doifcommonelse", "doifcommon", "doifnotcommon", "doifinstring", "doifnotinstring", "doifinstringelse", "doifassignmentelse", "tracingall", "tracingnone", "loggingall", "appendtoks", "prependtoks", "appendtotoks", "prependtotoks", "to", "endgraf", "empty", "null", "space", "obeyspaces", "obeylines", "normalspace", "executeifdefined", "singleexpandafter", "doubleexpandafter", "tripleexpandafter", "dontleavehmode", "wait", "writestatus", "define", "redefine", "setmeasure", "setemeasure", "setgmeasure", "setxmeasure", "definemeasure", "measure", "getvalue", "setvalue", "setevalue", "setgvalue", "setxvalue", "letvalue", "letgvalue", "resetvalue", "undefinevalue", "ignorevalue", "setuvalue", "setuevalue", "setugvalue", "setuxvalue", "globallet", "glet", "getparameters", "geteparameters", "getgparameters", "getxparameters", "forgetparameters", "processcommalist", "processcommacommand", "quitcommalist", "quitprevcommalist", "processaction", "processallactions", "processfirstactioninset", "processallactionsinset", "unexpanded", "expanded", "startexpanded", "stopexpanded", "protected", "protect", "unprotect", "firstofoneargument", "firstoftwoarguments", "secondoftwoarguments", "firstofthreearguments", "secondofthreearguments", "thirdofthreearguments", "firstoffourarguments", "secondoffourarguments", "thirdoffourarguments", "fourthoffourarguments", "firstoffivearguments", "secondoffivearguments", "thirdoffivearguments", "fourthoffivearguments", "fifthoffivearguments", "firstofsixarguments", "secondofsixarguments", "thirdofsixarguments", "fourthofsixarguments", "fifthofsixarguments", "sixthofsixarguments", "firstofoneunexpanded", "gobbleoneargument", "gobbletwoarguments", "gobblethreearguments", "gobblefourarguments", "gobblefivearguments", "gobblesixarguments", "gobblesevenarguments", "gobbleeightarguments", "gobbleninearguments", "gobbletenarguments", "gobbleoneoptional", "gobbletwooptionals", "gobblethreeoptionals", "gobblefouroptionals", "gobblefiveoptionals", "dorecurse", "doloop", "exitloop", "dostepwiserecurse", "recurselevel", "recursedepth", "dofastloopcs", "newconstant", "setnewconstant", "newconditional", "settrue", "setfalse", "setconstant", "newmacro", "setnewmacro", "newfraction", "dosingleempty", "dodoubleempty", "dotripleempty", "doquadrupleempty", "doquintupleempty", "dosixtupleempty", "doseventupleempty", "dosingleargument", "dodoubleargument", "dotripleargument", "doquadrupleargument", "dosinglegroupempty", "dodoublegroupempty", "dotriplegroupempty", "doquadruplegroupempty", "doquintuplegroupempty", "nopdfcompression", "maximumpdfcompression", "normalpdfcompression", "modulonumber", "dividenumber", "getfirstcharacter", "doiffirstcharelse", "startnointerference", "stopnointerference", "strut", "setstrut", "strutbox", "strutht", "strutdp", "strutwd" },
+ ["constants"]={ "zerocount", "minusone", "minustwo", "plusone", "plustwo", "plusthree", "plusfour", "plusfive", "plussix", "plusseven", "pluseight", "plusnine", "plusten", "plussixteen", "plushundred", "plusthousand", "plustenthousand", "plustwentythousand", "medcard", "maxcard", "zeropoint", "onepoint", "halfapoint", "onebasepoint", "maxdimen", "scaledpoint", "thousandpoint", "points", "halfpoint", "zeroskip", "pluscxxvii", "pluscxxviii", "pluscclv", "pluscclvi", "normalpagebox", "endoflinetoken", "outputnewlinechar", "emptytoks", "empty", "undefined", "voidbox", "emptybox", "emptyvbox", "emptyhbox", "bigskipamount", "medskipamount", "smallskipamount", "fmtname", "fmtversion", "texengine", "texenginename", "texengineversion", "luatexengine", "pdftexengine", "xetexengine", "unknownengine", "etexversion", "pdftexversion", "xetexversion", "xetexrevision", "activecatcode", "bgroup", "egroup", "endline", "conditionaltrue", "conditionalfalse", "attributeunsetvalue", "uprotationangle", "rightrotationangle", "downrotationangle", "leftrotationangle", "inicatcodes", "ctxcatcodes", "texcatcodes", "notcatcodes", "txtcatcodes", "vrbcatcodes", "prtcatcodes", "nilcatcodes", "luacatcodes", "tpacatcodes", "tpbcatcodes", "xmlcatcodes", "escapecatcode", "begingroupcatcode", "endgroupcatcode", "mathshiftcatcode", "alignmentcatcode", "endoflinecatcode", "parametercatcode", "superscriptcatcode", "subscriptcatcode", "ignorecatcode", "spacecatcode", "lettercatcode", "othercatcode", "activecatcode", "commentcatcode", "invalidcatcode", "tabasciicode", "newlineasciicode", "formfeedasciicode", "endoflineasciicode", "endoffileasciicode", "spaceasciicode", "hashasciicode", "dollarasciicode", "commentasciicode", "ampersandasciicode", "colonasciicode", "backslashasciicode", "circumflexasciicode", "underscoreasciicode", "leftbraceasciicode", "barasciicode", "rightbraceasciicode", "tildeasciicode", "delasciicode", "lessthanasciicode", "morethanasciicode", "doublecommentsignal", "atsignasciicode", "exclamationmarkasciicode", "questionmarkasciicode", "doublequoteasciicode", "singlequoteasciicode", "forwardslashasciicode", "primeasciicode", "activemathcharcode", "activetabtoken", "activeformfeedtoken", "activeendoflinetoken", "batchmodecode", "nonstopmodecode", "scrollmodecode", "errorstopmodecode", "bottomlevelgroupcode", "simplegroupcode", "hboxgroupcode", "adjustedhboxgroupcode", "vboxgroupcode", "vtopgroupcode", "aligngroupcode", "noaligngroupcode", "outputgroupcode", "mathgroupcode", "discretionarygroupcode", "insertgroupcode", "vcentergroupcode", "mathchoicegroupcode", "semisimplegroupcode", "mathshiftgroupcode", "mathleftgroupcode", "vadjustgroupcode", "charnodecode", "hlistnodecode", "vlistnodecode", "rulenodecode", "insertnodecode", "marknodecode", "adjustnodecode", "ligaturenodecode", "discretionarynodecode", "whatsitnodecode", "mathnodecode", "gluenodecode", "kernnodecode", "penaltynodecode", "unsetnodecode", "mathsnodecode", "charifcode", "catifcode", "numifcode", "dimifcode", "oddifcode", "vmodeifcode", "hmodeifcode", "mmodeifcode", "innerifcode", "voidifcode", "hboxifcode", "vboxifcode", "xifcode", "eofifcode", "trueifcode", "falseifcode", "caseifcode", "definedifcode", "csnameifcode", "fontcharifcode", "fontslantperpoint", "fontinterwordspace", "fontinterwordstretch", "fontinterwordshrink", "fontexheight", "fontemwidth", "fontextraspace", "slantperpoint", "interwordspace", "interwordstretch", "interwordshrink", "exheight", "emwidth", "extraspace", "mathsupdisplay", "mathsupnormal", "mathsupcramped", "mathsubnormal", "mathsubcombined", "mathaxisheight", "startmode", "stopmode", "startnotmode", "stopnotmode", "startmodeset", "stopmodeset", "doifmode", "doifmodeelse", "doifnotmode", "startallmodes", "stopallmodes", "startnotallmodes", "stopnotallmodes", "doifallmodes", "doifallmodeselse", "doifnotallmodes", "startenvironment", "stopenvironment", "environment", "startcomponent", "stopcomponent", "component", "startproduct", "stopproduct", "product", "startproject", "stopproject", "project", "starttext", "stoptext", "startdocument", "stopdocument", "documentvariable", "startmodule", "stopmodule", "usemodule", "enablemode", "disablemode", "preventmode", "pushmode", "popmode", "typescriptone", "typescripttwo", "typescriptthree", "mathsizesuffix", "mathordcode", "mathopcode", "mathbincode", "mathrelcode", "mathopencode", "mathclosecode", "mathpunctcode", "mathalphacode", "mathinnercode", "mathnothingcode", "mathlimopcode", "mathnolopcode", "mathboxcode", "mathchoicecode", "mathaccentcode", "mathradicalcode", "constantnumber", "constantnumberargument", "constantdimen", "constantdimenargument", "constantemptyargument", "continueifinputfile" },
+ ["helpers"]={ "startsetups", "stopsetups", "startxmlsetups", "stopxmlsetups", "startluasetups", "stopluasetups", "starttexsetups", "stoptexsetups", "startrawsetups", "stoprawsetups", "startlocalsetups", "stoplocalsetups", "starttexdefinition", "stoptexdefinition", "starttexcode", "stoptexcode", "doifsetupselse", "doifsetups", "doifnotsetups", "setup", "setups", "texsetup", "xmlsetup", "luasetup", "directsetup", "newmode", "setmode", "resetmode", "newsystemmode", "setsystemmode", "resetsystemmode", "pushsystemmode", "popsystemmode", "booleanmodevalue", "newcount", "newdimen", "newskip", "newmuskip", "newbox", "newtoks", "newread", "newwrite", "newmarks", "newinsert", "newattribute", "newif", "newlanguage", "newfamily", "newfam", "newhelp", "then", "donothing", "dontcomplain", "donetrue", "donefalse", "htdp", "unvoidbox", "vfilll", "mathbox", "mathlimop", "mathnolop", "mathnothing", "mathalpha", "currentcatcodetable", "defaultcatcodetable", "catcodetablename", "newcatcodetable", "startcatcodetable", "stopcatcodetable", "startextendcatcodetable", "stopextendcatcodetable", "pushcatcodetable", "popcatcodetable", "restorecatcodes", "setcatcodetable", "letcatcodecommand", "defcatcodecommand", "uedcatcodecommand", "hglue", "vglue", "hfillneg", "vfillneg", "hfilllneg", "vfilllneg", "ruledhss", "ruledhfil", "ruledhfill", "ruledhfilneg", "ruledhfillneg", "normalhfillneg", "ruledvss", "ruledvfil", "ruledvfill", "ruledvfilneg", "ruledvfillneg", "normalvfillneg", "ruledhbox", "ruledvbox", "ruledvtop", "ruledvcenter", "ruledhskip", "ruledvskip", "ruledkern", "ruledmskip", "ruledmkern", "ruledhglue", "ruledvglue", "normalhglue", "normalvglue", "ruledpenalty", "scratchcounter", "globalscratchcounter", "scratchdimen", "globalscratchdimen", "scratchskip", "globalscratchskip", "scratchmuskip", "globalscratchmuskip", "scratchtoks", "globalscratchtoks", "scratchbox", "globalscratchbox", "nextbox", "dowithnextbox", "dowithnextboxcs", "dowithnextboxcontent", "dowithnextboxcontentcs", "scratchwidth", "scratchheight", "scratchdepth", "scratchoffset", "scratchdistance", "scratchhsize", "scratchvsize", "scratchcounterone", "scratchcountertwo", "scratchcounterthree", "scratchdimenone", "scratchdimentwo", "scratchdimenthree", "scratchskipone", "scratchskiptwo", "scratchskipthree", "scratchmuskipone", "scratchmuskiptwo", "scratchmuskipthree", "scratchtoksone", "scratchtokstwo", "scratchtoksthree", "scratchboxone", "scratchboxtwo", "scratchboxthree", "doif", "doifnot", "doifelse", "doifinset", "doifnotinset", "doifinsetelse", "doifnextcharelse", "doifnextoptionalelse", "doifnextbgroupelse", "doifnextparenthesiselse", "doiffastoptionalcheckelse", "doifundefinedelse", "doifdefinedelse", "doifundefined", "doifdefined", "doifelsevalue", "doifvalue", "doifnotvalue", "doifnothing", "doifsomething", "doifelsenothing", "doifsomethingelse", "doifvaluenothing", "doifvaluesomething", "doifelsevaluenothing", "doifdimensionelse", "doifnumberelse", "doifcommonelse", "doifcommon", "doifnotcommon", "doifinstring", "doifnotinstring", "doifinstringelse", "doifassignmentelse", "tracingall", "tracingnone", "loggingall", "appendtoks", "prependtoks", "appendtotoks", "prependtotoks", "to", "endgraf", "empty", "null", "space", "obeyspaces", "obeylines", "normalspace", "executeifdefined", "singleexpandafter", "doubleexpandafter", "tripleexpandafter", "dontleavehmode", "removelastspace", "removeunwantedspaces", "wait", "writestatus", "define", "redefine", "setmeasure", "setemeasure", "setgmeasure", "setxmeasure", "definemeasure", "measure", "getvalue", "setvalue", "setevalue", "setgvalue", "setxvalue", "letvalue", "letgvalue", "resetvalue", "undefinevalue", "ignorevalue", "setuvalue", "setuevalue", "setugvalue", "setuxvalue", "globallet", "glet", "getparameters", "geteparameters", "getgparameters", "getxparameters", "forgetparameters", "processcommalist", "processcommacommand", "quitcommalist", "quitprevcommalist", "processaction", "processallactions", "processfirstactioninset", "processallactionsinset", "unexpanded", "expanded", "startexpanded", "stopexpanded", "protected", "protect", "unprotect", "firstofoneargument", "firstoftwoarguments", "secondoftwoarguments", "firstofthreearguments", "secondofthreearguments", "thirdofthreearguments", "firstoffourarguments", "secondoffourarguments", "thirdoffourarguments", "fourthoffourarguments", "firstoffivearguments", "secondoffivearguments", "thirdoffivearguments", "fourthoffivearguments", "fifthoffivearguments", "firstofsixarguments", "secondofsixarguments", "thirdofsixarguments", "fourthofsixarguments", "fifthofsixarguments", "sixthofsixarguments", "firstofoneunexpanded", "gobbleoneargument", "gobbletwoarguments", "gobblethreearguments", "gobblefourarguments", "gobblefivearguments", "gobblesixarguments", "gobblesevenarguments", "gobbleeightarguments", "gobbleninearguments", "gobbletenarguments", "gobbleoneoptional", "gobbletwooptionals", "gobblethreeoptionals", "gobblefouroptionals", "gobblefiveoptionals", "dorecurse", "doloop", "exitloop", "dostepwiserecurse", "recurselevel", "recursedepth", "dofastloopcs", "newconstant", "setnewconstant", "newconditional", "settrue", "setfalse", "setconstant", "newmacro", "setnewmacro", "newfraction", "dosingleempty", "dodoubleempty", "dotripleempty", "doquadrupleempty", "doquintupleempty", "dosixtupleempty", "doseventupleempty", "dosingleargument", "dodoubleargument", "dotripleargument", "doquadrupleargument", "dosinglegroupempty", "dodoublegroupempty", "dotriplegroupempty", "doquadruplegroupempty", "doquintuplegroupempty", "nopdfcompression", "maximumpdfcompression", "normalpdfcompression", "modulonumber", "dividenumber", "getfirstcharacter", "doiffirstcharelse", "startnointerference", "stopnointerference", "strut", "setstrut", "strutbox", "strutht", "strutdp", "strutwd", "begstrut", "endstrut" },
 }
\ No newline at end of file
index 642c469..9623e2e 100644 (file)
@@ -9,14 +9,12 @@ local info = {
 local lexer = lexer
 local token = lexer.token
 
-module(...)
-
-local cldlexer = _M
+local cldlexer = { _NAME = "cld" }
 local lualexer = lexer.load('scite-context-lexer-lua')
 
-_rules       = lualexer._rules_cld
-_tokenstyles = lualexer._tokenstyles
-_foldsymbols = lualexer._foldsymbols
-_directives  = lualexer._directives
+cldlexer._rules       = lualexer._rules_cld
+cldlexer._tokenstyles = lualexer._tokenstyles
+cldlexer._foldsymbols = lualexer._foldsymbols
+cldlexer._directives  = lualexer._directives
 
--- _rules[1] = { "whitespace", token(cldlexer.WHITESPACE, lexer.space^1) }
+return cldlexer
dissimilarity index 68%
index dd58dfe..6cc79ae 100644 (file)
@@ -1,22 +1,22 @@
-local lexer = lexer
-local token = lexer.token
-local P = lpeg.P
-
-module(...)
-
-local stringlexer = _M
-
-local whitespace = stringlexer.WHITESPACE -- triggers states
-
-local space      = lexer.space
-local nospace    = 1 - space
-
-local p_spaces   = token(whitespace, space  ^1)
-local p_string   = token("string",   nospace^1)
-
-_rules = {
-    { "whitespace", p_spaces },
-    { "string",     p_string },
-}
-
-_tokenstyles = lexer.context.styleset
+local lexer = lexer
+local token = lexer.token
+local P = lpeg.P
+
+local stringlexer = { _NAME = "string" }
+
+local whitespace  = lexer.WHITESPACE
+
+local space       = lexer.space
+local nospace     = 1 - space
+
+local p_spaces    = token(whitespace, space  ^1)
+local p_string    = token("string",   nospace^1)
+
+stringlexer._rules = {
+    { "whitespace", p_spaces },
+    { "string",     p_string },
+}
+
+stringlexer._tokenstyles = lexer.context.styleset
+
+return stringlexer
index 278c6d7..55bc309 100644 (file)
@@ -6,22 +6,24 @@ local info = {
     license   = "see context related readme files",
 }
 
+if not lexer._CONTEXTEXTENSIONS then dofile(_LEXERHOME .. "/scite-context-lexer.lua") end
+
 local lexer = lexer
 local token, style, colors, exact_match, no_style = lexer.token, lexer.style, lexer.colors, lexer.exact_match, lexer.style_nothing
 local P, R, S, C, Cg, Cb, Cs, Cmt = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cg, lpeg.Cb, lpeg.Cs, lpeg.Cmt
 local match, find = string.match, string.find
 local setmetatable = setmetatable
-local global = _G
 
 -- beware: all multiline is messy, so even if it's no lexer, it should be an embedded lexer
 
-module(...)
+local lualexer    = { _NAME = "lua" }
+local stringlexer = lexer.load("scite-context-lexer-lua-longstring")
 
-local lualexer = _M
+local whitespace  = lexer.WHITESPACE
 
-_directives = { } -- communication channel
+local directives = { } -- communication channel
 
--- this will be eextended
+-- this will be extended
 
 local keywords = {
     'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', 'function', -- 'goto',
@@ -91,8 +93,6 @@ local longcomment = Cmt(#('[[' + ('[' * C(equals) * '[')), function(input,index,
     return stop and stop + 1 or #input + 1
 end)
 
-local whitespace    = lualexer.WHITESPACE -- triggers states
-
 local space         = lexer.space -- S(" \n\r\t\f\v")
 local any           = lexer.any
 
@@ -117,18 +117,17 @@ local shortstring   = token("quote",  dquote)
                     * token("string", (escaped + (1-squote))^0)
                     * token("quote",  squote)
 
-local longstring    = token("quote",  longonestart)
-                    * token("string", longonestring)
-                    * token("quote",  longonestop)
-                    + token("quote",  longtwostart)
-                    * token("string", longtwostring)
-                    * token("quote",  longtwostop)
+----- longstring    = token("quote",  longonestart)
+-----               * token("string", longonestring)
+-----               * token("quote",  longonestop)
+-----               + token("quote",  longtwostart)
+-----               * token("string", longtwostring)
+-----               * token("quote",  longtwostop)
 
 local string        = shortstring
---                     + longstring
+-----               + longstring
 
-    local longstringlexer = lexer.load("scite-context-lexer-lua-longstring")
-    lexer.embed_lexer(lualexer, longstringlexer, token("quote",longtwostart), token("string",longtwostring_body) * token("quote",longtwostring_end))
+lexer.embed_lexer(lualexer, stringlexer, token("quote",longtwostart), token("string",longtwostring_body) * token("quote",longtwostring_end))
 
 local integer       = P('-')^-1 * (lexer.hex_num + lexer.dec_num)
 local number        = token("number", lexer.float + integer)
@@ -160,7 +159,7 @@ local csname        = token("user",    exact_match(csnames  ))
                       + ( optionalspace * token("special", P(".")) * optionalspace * token("user", validword) )^1
                     )
 
-_rules = {
+lualexer._rules = {
     { 'whitespace',   spacing      },
     { 'keyword',      keyword      },
     { 'function',     builtin      },
@@ -178,9 +177,9 @@ _rules = {
     { 'rest',         rest         },
 }
 
-_tokenstyles = lexer.context.styleset
+lualexer._tokenstyles = lexer.context.styleset
 
-_foldsymbols = {
+lualexer._foldsymbols = {
     _patterns = {
         '%l+',
      -- '[%({%)}%[%]]',
@@ -212,7 +211,7 @@ local cstoken         = R("az","AZ","\127\255") + S("@!?_")
 local texcsname       = P("\\") * cstoken^1
 local commentline     = P('%') * (1-S("\n\r"))^0
 
-local texcomment      = token('comment', Cmt(commentline, function() return _directives.cld_inline end))
+local texcomment      = token('comment', Cmt(commentline, function() return directives.cld_inline end))
 
 local longthreestart  = P("\\!!bs")
 local longthreestop   = P("\\!!es")
@@ -229,7 +228,12 @@ local texcommand      = token("warning", texcsname)
 --                    * (texcommand + token("string",P(1-texcommand-longthreestop)^1) - longthreestop)^0 -- we match long non-\cs sequences
 --                    * token("quote", longthreestop)
 
-_rules_cld = {
+-- local whitespace    = "whitespace"
+-- local spacing       = token(whitespace, space^1)
+
+lualexer._directives = directives
+
+lualexer._rules_cld = {
     { 'whitespace',   spacing      },
     { 'texstring',    texstring    },
     { 'texcomment',   texcomment   },
@@ -246,3 +250,5 @@ _rules_cld = {
     { 'operator',     operator     },
     { 'rest',         rest         },
 }
+
+return lualexer
index 22338b3..00cc7f8 100644 (file)
@@ -6,15 +6,17 @@ local info = {
     license   = "see context related readme files",
 }
 
+if not lexer._CONTEXTEXTENSIONS then dofile(_LEXERHOME .. "/scite-context-lexer.lua") end
+
 local lexer = lexer
 local global, string, table, lpeg = _G, string, table, lpeg
 local token, exact_match = lexer.token, lexer.exact_match
 local P, R, S, V, C, Cmt = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.C, lpeg.Cmt
 local type = type
 
-module(...)
+local metafunlexer       = { _NAME = "metafun" }
 
-local metafunlexer       = _M
+local whitespace         = lexer.WHITESPACE
 
 local context            = lexer.context
 
@@ -65,8 +67,6 @@ do
 
 end
 
-local whitespace = metafunlexer.WHITESPACE -- triggers states
-
 local space      = lexer.space -- S(" \n\r\t\f\v")
 local any        = lexer.any
 
@@ -99,7 +99,7 @@ local special    = token('special',   S("#()[]{}<>=:\"")) -- or else := <> etc s
 local texlike    = token('string',    P("\\") * cstokentex^1)
 local extra      = token('extra',     S("`~%^&_-+*/\'|\\"))
 
-_rules = {
+metafunlexer._rules = {
     { 'whitespace', spacing    },
     { 'comment',    comment    },
     { 'internal',   internal   },
@@ -118,9 +118,9 @@ _rules = {
     { 'rest',       rest       },
 }
 
-_tokenstyles = context.styleset
+metafunlexer._tokenstyles = context.styleset
 
-_foldsymbols = {
+metafunlexer._foldsymbols = {
     _patterns = {
         "%l+",
     },
@@ -140,3 +140,5 @@ _foldsymbols = {
         ["endfor"]        = -1,
     }
 }
+
+return metafunlexer
index 1de0068..ec950c2 100644 (file)
@@ -9,17 +9,14 @@ local info = {
 local lexer = lexer
 local token = lexer.token
 local P, R, S, C, V = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.V
-local global = _G
 
-module(...)
+local pdfobjectlexer    = { _NAME = "pdfobject" }
 
-local objectlexer       = _M
+local whitespace        = lexer.WHITESPACE -- triggers states
 
 local context           = lexer.context
 local patterns          = context.patterns
 
-local whitespace        = objectlexer.WHITESPACE -- triggers states
-
 local space             = lexer.space
 local somespace         = space^1
 
@@ -103,13 +100,15 @@ local t_object          = { "object", -- weird that we need to catch the end her
                             whatever   = V("dictionary") + V("array") + constant + reference + string + unicode + number + whatsit,
                         }
 
-_shared = {
+pdfobjectlexer._shared = {
     dictionary = t_dictionary,
 }
 
-_rules = {
+pdfobjectlexer._rules = {
     { 'whitespace', t_spacing },
     { 'object',     t_object  },
 }
 
-_tokenstyles = context.styleset
+pdfobjectlexer._tokenstyles = context.styleset
+
+return pdfobjectlexer
dissimilarity index 68%
index 8988fbb..9fd6df9 100644 (file)
@@ -1,41 +1,39 @@
-local info = {
-    version   = 1.002,
-    comment   = "scintilla lpeg lexer for pdf",
-    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
-    copyright = "PRAGMA ADE / ConTeXt Development Team",
-    license   = "see context related readme files",
-}
-
-local lexer = lexer
-local token = lexer.token
-local P = lpeg.P
-local global = _G
-
-module(...)
-
-local pdflexer          = _M
-local objectlexer       = lexer.load("scite-context-lexer-pdf-object")
-
-local context           = lexer.context
-local patterns          = context.patterns
-
-local whitespace        = pdflexer.WHITESPACE -- triggers states
-
-local space             = patterns.space
-local spacing           = patterns.spacing
-
-local t_spacing         = token(whitespace, spacing)
-
-local p_trailer         = P("trailer")
-
-local t_xref            = token("default", (1-p_trailer)^1)
-                        * token("keyword", p_trailer)
-                        * t_spacing
-                        * objectlexer._shared.dictionary
-
-_rules = {
-    { 'whitespace', t_spacing },
-    { 'xref',       t_xref    },
-}
-
-_tokenstyles = context.styleset
+local info = {
+    version   = 1.002,
+    comment   = "scintilla lpeg lexer for pdf xref",
+    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+    copyright = "PRAGMA ADE / ConTeXt Development Team",
+    license   = "see context related readme files",
+}
+
+local lexer = lexer
+local token = lexer.token
+local P = lpeg.P
+
+local pdfxreflexer   = { _NAME = "pdfxref" }
+local pdfobjectlexer = lexer.load("scite-context-lexer-pdf-object")
+
+local context        = lexer.context
+local patterns       = context.patterns
+
+local whitespace     = lexer.WHITESPACE -- triggers states
+
+local spacing        = patterns.spacing
+
+local t_spacing      = token(whitespace, spacing)
+
+local p_trailer      = P("trailer")
+
+local t_xref         = token("default", (1-p_trailer)^1)
+                     * token("keyword", p_trailer)
+                     * t_spacing
+                     * pdfobjectlexer._shared.dictionary
+
+pdfxreflexer._rules = {
+    { 'whitespace', t_spacing },
+    { 'xref',       t_xref    },
+}
+
+pdfxreflexer._tokenstyles = context.styleset
+
+return pdfxreflexer
index ebc3fba..bddcc28 100644 (file)
@@ -6,22 +6,21 @@ local info = {
     license   = "see context related readme files",
 }
 
+if not lexer._CONTEXTEXTENSIONS then dofile(_LEXERHOME .. "/scite-context-lexer.lua") end
+
 local lexer = lexer
 local token = lexer.token
 local P, R, S = lpeg.P, lpeg.R, lpeg.S
-local global = _G
 
-module(...)
+local pdflexer          = { "pdf" }
+local pdfobjectlexer    = lexer.load("scite-context-lexer-pdf-object")
+local pdfxreflexer      = lexer.load("scite-context-lexer-pdf-xref")
 
-local pdflexer          = _M
-local objectlexer       = lexer.load("scite-context-lexer-pdf-object")
-local xreflexer         = lexer.load("scite-context-lexer-pdf-xref")
+local whitespace        = lexer.WHITESPACE -- triggers states
 
 local context           = lexer.context
 local patterns          = context.patterns
 
-local whitespace        = pdflexer.WHITESPACE -- triggers states
-
 local space             = patterns.space
 local spacing           = patterns.spacing
 local nospacing         = patterns.nospacing
@@ -51,13 +50,13 @@ local t_closeobject     = token("keyword", p_endobj)
 local t_openxref        = token("keyword", p_xref)
 local t_closexref       = token("keyword", p_startxref)
 
-lexer.embed_lexer(pdflexer, objectlexer, t_openobject, t_closeobject)
-lexer.embed_lexer(pdflexer, xreflexer,   t_openxref,   t_closexref)
+lexer.embed_lexer(pdflexer, pdfobjectlexer, t_openobject, t_closeobject)
+lexer.embed_lexer(pdflexer, pdfxreflexer,   t_openxref,   t_closexref)
 
-_rules = {
+pdflexer._rules = {
     { 'whitespace', t_spacing },
     { 'comment',    t_comment },
     { 'rest',       t_rest    },
 }
 
-_tokenstyles = context.styleset
+pdflexer._tokenstyles = context.styleset
index f092962..812dfbb 100644 (file)
@@ -25,13 +25,16 @@ local info = {
   -- local interface = lexer.get_property("keywordclass.macros.context.en","")
 
   -- it seems that whitespace triggers the lexer when embedding happens, but this
-  -- is quite fragile due to duplicate styles
+  -- is quite fragile due to duplicate styles .. lexer.WHITESPACE is a number
+  -- (initially)
 
   -- this lexer does not care about other macro packages (one can of course add a fake
   -- interface but it's not on the agenda)
 
 ]]--
 
+if not lexer._CONTEXTEXTENSIONS then dofile(_LEXERHOME .. "/scite-context-lexer.lua") end
+
 local lexer = lexer
 local global, string, table, lpeg = _G, string, table, lpeg
 local token, exact_match = lexer.token, lexer.exact_match
@@ -39,12 +42,14 @@ local P, R, S, V, C, Cmt, Cp, Cc, Ct = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.C, l
 local type, next = type, next
 local find, match, lower = string.find, string.match, string.lower
 
-module(...)
+-- module(...)
 
-local contextlexer = _M
+local contextlexer = { _NAME = "context" }
 local cldlexer     = lexer.load('scite-context-lexer-cld')
 local mpslexer     = lexer.load('scite-context-lexer-mps')
 
+-- local cldlexer     = lexer.load('scite-context-lexer-lua') -- test
+
 local commands     = { en = { } }
 local primitives   = { }
 local helpers      = { }
@@ -184,7 +189,7 @@ end)
 local commentline            = P('%') * (1-S("\n\r"))^0
 local endline                = S("\n\r")^1
 
-local whitespace             = contextlexer.WHITESPACE -- triggers states
+local whitespace             = lexer.WHITESPACE
 
 local space                  = lexer.space -- S(" \n\r\t\f\v")
 local any                    = lexer.any
@@ -427,7 +432,7 @@ lexer.embed_lexer(contextlexer, mpslexer, startmetafuncode, stopmetafuncode)
 -- Watch the text grabber, after all, we're talking mostly of text (beware,
 -- no punctuation here as it can be special. We might go for utf here.
 
-_rules = {
+contextlexer._rules = {
     { "whitespace",  spacing     },
     { "preamble",    preamble    },
     { "word",        word        },
@@ -450,14 +455,14 @@ _rules = {
     { "rest",        rest        },
 }
 
-_tokenstyles = context.styleset
+contextlexer._tokenstyles = context.styleset
 
 local folds = {
     ["\\start"] = 1, ["\\stop" ] = -1,
     ["\\begin"] = 1, ["\\end"  ] = -1,
 }
 
-_foldsymbols = {
+contextlexer._foldsymbols = {
     _patterns    = {
         "\\start", "\\stop", -- regular environments
         "\\begin", "\\end",  -- (moveable) blocks
@@ -468,3 +473,5 @@ _foldsymbols = {
     ["user"]     = folds, -- csname
     ["grouping"] = folds,
 }
+
+return contextlexer
index 07dff29..d92be8e 100644 (file)
@@ -1,15 +1,26 @@
+local info = {
+    version   = 1.002,
+    comment   = "scintilla lpeg lexer for plain text (with spell checking)",
+    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+    copyright = "PRAGMA ADE / ConTeXt Development Team",
+    license   = "see context related readme files",
+}
+
+if not lexer._CONTEXTEXTENSIONS then dofile(_LEXERHOME .. "/scite-context-lexer.lua") end
+
 local lexer = lexer
 local token = lexer.token
 local P, S, Cmt = lpeg.P, lpeg.S, lpeg.Cmt
 local find, match = string.find, string.match
 
-module(...)
+-- local textlexer   = (_VERSION == "Lua 5.1" and (module(...) or true) and _M) or { }
+-- (_VERSION == "Lua 5.1" and (module(...) or true) and _M) or { }
 
-local textlexer   = _M
+local textlexer   = { _NAME = "text" }
 
 local context     = lexer.context
 
-local whitespace  = textlexer.WHITESPACE -- triggers states
+local whitespace  = lexer.WHITESPACE
 
 local space       = lexer.space
 local any         = lexer.any
@@ -57,7 +68,7 @@ local t_rest =
 local t_spacing =
     token(whitespace, space^1)
 
-_rules = {
+textlexer._rules = {
     { "whitespace", t_spacing  },
     { "preamble",   t_preamble },
     { "word",       t_word     }, -- words >= 3
@@ -65,5 +76,6 @@ _rules = {
     { "rest",       t_rest     },
 }
 
-_tokenstyles = lexer.context.styleset
+textlexer._tokenstyles = lexer.context.styleset
 
+return textlexer
index 7182609..511465b 100644 (file)
@@ -1,12 +1,18 @@
+local info = {
+    version   = 1.002,
+    comment   = "scintilla lpeg lexer for xml cdata",
+    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+    copyright = "PRAGMA ADE / ConTeXt Development Team",
+    license   = "see context related readme files",
+}
+
 local lexer = lexer
 local token = lexer.token
 local P = lpeg.P
 
-module(...)
+local xmlcdatalexer = { _NAME = "xmlcdata" }
 
-local commentlexer = _M
-
-local whitespace = commentlexer.WHITESPACE -- triggers states
+local whitespace = lexer.WHITESPACE -- triggers states
 
 local space      = lexer.space
 local nospace    = 1 - space - P("]]>")
@@ -14,9 +20,11 @@ local nospace    = 1 - space - P("]]>")
 local p_spaces   = token(whitespace, space  ^1)
 local p_cdata    = token("comment",  nospace^1)
 
-_rules = {
+xmlcdatalexer._rules = {
     { "whitespace", p_spaces },
     { "cdata",      p_cdata  },
 }
 
-_tokenstyles = lexer.context.styleset
+xmlcdatalexer._tokenstyles = lexer.context.styleset
+
+return xmlcdatalexer
index 2d9ce66..1512700 100644 (file)
@@ -1,12 +1,18 @@
+local info = {
+    version   = 1.002,
+    comment   = "scintilla lpeg lexer for xml comments",
+    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+    copyright = "PRAGMA ADE / ConTeXt Development Team",
+    license   = "see context related readme files",
+}
+
 local lexer = lexer
 local token = lexer.token
 local P = lpeg.P
 
-module(...)
+local xmlcommentlexer = { _NAME = "xmlcomment" }
 
-local commentlexer = _M
-
-local whitespace = commentlexer.WHITESPACE -- triggers states
+local whitespace = lexer.WHITESPACE
 
 local space      = lexer.space
 local nospace    = 1 - space - P("-->")
@@ -14,14 +20,14 @@ local nospace    = 1 - space - P("-->")
 local p_spaces   = token(whitespace, space  ^1)
 local p_comment  = token("comment",  nospace^1)
 
-_rules = {
+xmlcommentlexer._rules = {
     { "whitespace", p_spaces  },
     { "comment",    p_comment },
 }
 
-_tokenstyles = lexer.context.styleset
+xmlcommentlexer._tokenstyles = lexer.context.styleset
 
-_foldsymbols = {
+xmlcommentlexer._foldsymbols = {
     _patterns = {
         "<%!%-%-", "%-%->", -- comments
     },
@@ -29,3 +35,5 @@ _foldsymbols = {
         ["<!--"] = 1, ["-->" ] = -1,
     }
 }
+
+return xmlcommentlexer
index 3c7e30c..2ca814f 100644 (file)
@@ -12,6 +12,8 @@ local info = {
 
 -- todo: parse entities in attributes
 
+if not lexer._CONTEXTEXTENSIONS then dofile(_LEXERHOME .. "/scite-context-lexer.lua") end
+
 local lexer = lexer
 local global, string, table, lpeg = _G, string, table, lpeg
 local token, exact_match = lexer.token, lexer.exact_match
@@ -19,14 +21,13 @@ local P, R, S, V, C, Cmt = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.C, lpeg.Cmt
 local type = type
 local match, find = string.match, string.find
 
-module(...)
-
-local examplelexer     = _M
+local xmllexer         = { _NAME = "xml" }
+local xmlcommentlexer  = lexer.load("scite-context-lexer-xml-comment") -- indirect (some issue with the lexer framework)
+local xmlcdatalexer    = lexer.load("scite-context-lexer-xml-cdata")   -- indirect (some issue with the lexer framework)
 
+local whitespace       = lexer.WHITESPACE -- triggers states
 local context          = lexer.context
 
-local whitespace       = examplelexer.WHITESPACE -- triggers states
-
 local space            = lexer.space -- S(" \t\n\r\v\f")
 local any              = lexer.any -- P(1)
 
@@ -217,11 +218,8 @@ local p_doctype = token("command",P("<!DOCTYPE"))
                 * p_optionalwhitespace
                 * token("command",P(">"))
 
-local commentlexer = lexer.load("scite-context-lexer-xml-comment") -- indirect (some issue with the lexer framework)
-local cdatalexer   = lexer.load("scite-context-lexer-xml-cdata")   -- indirect (some issue with the lexer framework)
-
-lexer.embed_lexer(examplelexer, commentlexer, token("command",opencomment), token("command",closecomment))
-lexer.embed_lexer(examplelexer, cdatalexer,   token("command",opencdata),   token("command",closecdata))
+lexer.embed_lexer(xmllexer, xmlcommentlexer, token("command",opencomment), token("command",closecomment))
+lexer.embed_lexer(xmllexer, xmlcdatalexer,   token("command",opencdata),   token("command",closecdata))
 
 local p_name =
     token("plain",name)
@@ -280,7 +278,7 @@ local p_instruction =
 local p_invisible =
     token("invisible",invisibles^1)
 
-_rules = {
+xmllexer._rules = {
     { "whitespace",  p_spacing     },
     { "preamble",    p_preamble    },
     { "word",        p_word        },
@@ -296,9 +294,9 @@ _rules = {
     { "rest",        p_rest        },
 }
 
-_tokenstyles = context.styleset
+xmllexer._tokenstyles = context.styleset
 
-_foldsymbols = { -- somehow doesn't work yet
+xmllexer._foldsymbols = { -- somehow doesn't work yet
     _patterns = {
         "[<>]",
     },
@@ -306,3 +304,5 @@ _foldsymbols = { -- somehow doesn't work yet
         ["<"] = 1, [">"] = -1,
     },
 }
+
+return xmllexer
index d9d5782..166ee96 100644 (file)
@@ -9,8 +9,19 @@ local info = {
 -- The fold and lex functions are copied and patched from original code by Mitchell (see
 -- lexer.lua). All errors are mine.
 --
--- I'll probably make a whole copy and patch the other functions too as we need an extra
--- nesting model.
+-- I've considered making a whole copy and patch the other functions too as we need
+-- an extra nesting model. However, I don't want to maintain too much. An unfortunate
+-- change in 3.03 is that no longer a script can be specified. This means that instead
+-- of loading the extensions via the properties file, we now need to load them in our
+-- own lexers, unless of course we replace lexer.lua completely (which adds another
+-- installation issue). The loading takes place with:
+--
+-- if not lexer._CONTEXTEXTENSIONS then
+--   dofile(_LEXERHOME .. "/scite-context-lexer.lua")
+-- end
+--
+-- So, where pre 3.03 we loaded that file and in that file th eoriginal lexing code, we
+-- now do the reverse.
 --
 -- Also needed: preamble scan once. Can be handled in caller below and _M.preamble.
 --
@@ -25,9 +36,8 @@ local info = {
 -- means that we need to have it frozen at the moment we load another lexer. Because spacing
 -- is used to revert to a parent lexer we need to make sure that we load children as late
 -- as possible in order not to get the wrong whitespace trigger. This took me quite a while
--- to figure out (not being that familiar with the internals). BTW, if performance becomes
--- an issue we can rewrite the main lex function (memorize the grammars and speed up the
--- byline variant).
+-- to figure out (not being that familiar with the internals). The lex and fold functions
+-- hav ebeen optimized. It is a pitty that there is no proper print available.
 
 -- Maybe it's safer to copy the other methods here so that we have no dependencies, apart
 -- from the the library.
@@ -41,7 +51,9 @@ local concat = table.concat
 local global = _G
 local type, next, setmetatable, rawset = type, next, setmetatable, rawset
 
-dofile(_LEXERHOME .. '/lexer.lua')
+if not lexer then
+    dofile(_LEXERHOME .. '/lexer.lua') -- pre 3.03 situation
+end
 
 lexer.context    = lexer.context or { }
 local context    = lexer.context
@@ -49,6 +61,8 @@ local context    = lexer.context
 context.patterns = context.patterns or { }
 local patterns   = context.patterns
 
+lexer._CONTEXTEXTENSIONS = true
+
 local locations = {
  -- lexer.context.path,
     _LEXERHOME .. "/data", -- optional data directory
@@ -541,6 +555,8 @@ function context.lex(text,init_style)
         else
             for style, style_num in next, lexer._TOKENS do
                 if style_num == init_style then
+                    -- the name of the lexers is filtered from the whitespace
+                    -- specification
                     local lexer_name = match(style,'^(.+)_whitespace') or lexer._NAME
                     if lexer._INITIALRULE ~= lexer_name then
                         grammar = hash[lexer_name]
index d961761..2407553 100644 (file)
@@ -17,11 +17,12 @@ if not WIN32 then
     font_name = '!' .. font_name
 end
 
-local global = _G
-
 -- dofile(_LEXERHOME .. '/themes/scite.lua') -- starting point so we miss nothing
 
-module('lexer', package.seeall)
+-- module('lexer', package.seeall)
+
+local color = lexer.color
+local style = lexer.style
 
 lexer.context      = lexer.context or { }
 lexer.context.path = context_path
index 0699862..b5a4d1b 100644 (file)
@@ -2,10 +2,14 @@ keywordclass.context.helpers=\
 startsetups stopsetups startxmlsetups stopxmlsetups \
 startluasetups stopluasetups starttexsetups stoptexsetups startrawsetups \
 stoprawsetups startlocalsetups stoplocalsetups starttexdefinition stoptexdefinition \
-starttexcode stoptexcode newcount newdimen newskip \
-newmuskip newbox newtoks newread newwrite \
-newmarks newinsert newattribute newif newlanguage \
-newfamily newfam newhelp then donetrue \
+starttexcode stoptexcode doifsetupselse doifsetups doifnotsetups \
+setup setups texsetup xmlsetup luasetup \
+directsetup newmode setmode resetmode newsystemmode \
+setsystemmode resetsystemmode pushsystemmode popsystemmode booleanmodevalue \
+newcount newdimen newskip newmuskip newbox \
+newtoks newread newwrite newmarks newinsert \
+newattribute newif newlanguage newfamily newfam \
+newhelp then donothing dontcomplain donetrue \
 donefalse htdp unvoidbox vfilll mathbox \
 mathlimop mathnolop mathnothing mathalpha currentcatcodetable \
 defaultcatcodetable catcodetablename newcatcodetable startcatcodetable stopcatcodetable \
@@ -36,33 +40,34 @@ doifinstringelse doifassignmentelse tracingall tracingnone loggingall \
 appendtoks prependtoks appendtotoks prependtotoks to \
 endgraf empty null space obeyspaces \
 obeylines normalspace executeifdefined singleexpandafter doubleexpandafter \
-tripleexpandafter dontleavehmode wait writestatus define \
-redefine setmeasure setemeasure setgmeasure setxmeasure \
-definemeasure measure getvalue setvalue setevalue \
-setgvalue setxvalue letvalue letgvalue resetvalue \
-undefinevalue ignorevalue setuvalue setuevalue setugvalue \
-setuxvalue globallet glet getparameters geteparameters \
-getgparameters getxparameters forgetparameters processcommalist processcommacommand \
-quitcommalist quitprevcommalist processaction processallactions processfirstactioninset \
-processallactionsinset unexpanded expanded startexpanded stopexpanded \
-protected protect unprotect firstofoneargument firstoftwoarguments \
-secondoftwoarguments firstofthreearguments secondofthreearguments thirdofthreearguments firstoffourarguments \
-secondoffourarguments thirdoffourarguments fourthoffourarguments firstoffivearguments secondoffivearguments \
-thirdoffivearguments fourthoffivearguments fifthoffivearguments firstofsixarguments secondofsixarguments \
-thirdofsixarguments fourthofsixarguments fifthofsixarguments sixthofsixarguments firstofoneunexpanded \
-gobbleoneargument gobbletwoarguments gobblethreearguments gobblefourarguments gobblefivearguments \
-gobblesixarguments gobblesevenarguments gobbleeightarguments gobbleninearguments gobbletenarguments \
-gobbleoneoptional gobbletwooptionals gobblethreeoptionals gobblefouroptionals gobblefiveoptionals \
-dorecurse doloop exitloop dostepwiserecurse recurselevel \
-recursedepth dofastloopcs newconstant setnewconstant newconditional \
-settrue setfalse setconstant newmacro setnewmacro \
-newfraction dosingleempty dodoubleempty dotripleempty doquadrupleempty \
-doquintupleempty dosixtupleempty doseventupleempty dosingleargument dodoubleargument \
-dotripleargument doquadrupleargument dosinglegroupempty dodoublegroupempty dotriplegroupempty \
-doquadruplegroupempty doquintuplegroupempty nopdfcompression maximumpdfcompression normalpdfcompression \
-modulonumber dividenumber getfirstcharacter doiffirstcharelse startnointerference \
-stopnointerference strut setstrut strutbox strutht \
-strutdp strutwd 
+tripleexpandafter dontleavehmode removelastspace removeunwantedspaces wait \
+writestatus define redefine setmeasure setemeasure \
+setgmeasure setxmeasure definemeasure measure getvalue \
+setvalue setevalue setgvalue setxvalue letvalue \
+letgvalue resetvalue undefinevalue ignorevalue setuvalue \
+setuevalue setugvalue setuxvalue globallet glet \
+getparameters geteparameters getgparameters getxparameters forgetparameters \
+processcommalist processcommacommand quitcommalist quitprevcommalist processaction \
+processallactions processfirstactioninset processallactionsinset unexpanded expanded \
+startexpanded stopexpanded protected protect unprotect \
+firstofoneargument firstoftwoarguments secondoftwoarguments firstofthreearguments secondofthreearguments \
+thirdofthreearguments firstoffourarguments secondoffourarguments thirdoffourarguments fourthoffourarguments \
+firstoffivearguments secondoffivearguments thirdoffivearguments fourthoffivearguments fifthoffivearguments \
+firstofsixarguments secondofsixarguments thirdofsixarguments fourthofsixarguments fifthofsixarguments \
+sixthofsixarguments firstofoneunexpanded gobbleoneargument gobbletwoarguments gobblethreearguments \
+gobblefourarguments gobblefivearguments gobblesixarguments gobblesevenarguments gobbleeightarguments \
+gobbleninearguments gobbletenarguments gobbleoneoptional gobbletwooptionals gobblethreeoptionals \
+gobblefouroptionals gobblefiveoptionals dorecurse doloop exitloop \
+dostepwiserecurse recurselevel recursedepth dofastloopcs newconstant \
+setnewconstant newconditional settrue setfalse setconstant \
+newmacro setnewmacro newfraction dosingleempty dodoubleempty \
+dotripleempty doquadrupleempty doquintupleempty dosixtupleempty doseventupleempty \
+dosingleargument dodoubleargument dotripleargument doquadrupleargument dosinglegroupempty \
+dodoublegroupempty dotriplegroupempty doquadruplegroupempty doquintuplegroupempty nopdfcompression \
+maximumpdfcompression normalpdfcompression modulonumber dividenumber getfirstcharacter \
+doiffirstcharelse startnointerference stopnointerference strut setstrut \
+strutbox strutht strutdp strutwd begstrut \
+endstrut 
 
 keywordclass.context.constants=\
 zerocount minusone minustwo plusone \
@@ -114,9 +119,11 @@ doifallmodeselse doifnotallmodes startenvironment stopenvironment environment \
 startcomponent stopcomponent component startproduct stopproduct \
 product startproject stopproject project starttext \
 stoptext startdocument stopdocument documentvariable startmodule \
-stopmodule usemodule typescriptone typescripttwo typescriptthree \
+stopmodule usemodule enablemode disablemode preventmode \
+pushmode popmode typescriptone typescripttwo typescriptthree \
 mathsizesuffix mathordcode mathopcode mathbincode mathrelcode \
 mathopencode mathclosecode mathpunctcode mathalphacode mathinnercode \
 mathnothingcode mathlimopcode mathnolopcode mathboxcode mathchoicecode \
-mathaccentcode mathradicalcode 
+mathaccentcode mathradicalcode constantnumber constantnumberargument constantdimen \
+constantdimenargument constantemptyargument continueifinputfile 
 
index 723f198..b492e29 100644 (file)
@@ -3,7 +3,17 @@
 import $(SciteDefaultHome)/lexers/lpeg
 
 lexer.lpeg.home=$(SciteDefaultHome)/lexers
-lexer.lpeg.script=$(lexer.lpeg.home)/scite-context-lexer.lua
+
+# # pre 3.03:
+#
+# lexer.lpeg.script=$(lexer.lpeg.home)/scite-context-lexer.lua
+#
+# # post 3.03:
+#
+lexer.lpeg.script=$(lexer.lpeg.home)/lexer.lua
+#
+# where we load the extensions in the lexers themselves.
+
 lexer.lpeg.color.theme=$(lexer.lpeg.home)/themes/scite-context-theme.lua
 
 # alas, only a few properties are passed (only indentation)
@@ -20,8 +30,6 @@ if PLAT_GTK
 
 lexer.*.lpeg=lpeg
 
-# an xml lexer will also be provided
-
 lexer.$(file.patterns.metapost)=lpeg_scite-context-lexer-mps
 lexer.$(file.patterns.metafun)=lpeg_scite-context-lexer-mps
 lexer.$(file.patterns.context)=lpeg_scite-context-lexer-tex
index a4c4f8f..1664aff 100644 (file)
@@ -38,6 +38,7 @@ output.code.page=65001
 
 textwrapper.margin=4
 textwrapper.length=68
+#~ textwrapper.length=80
 
 # ConTeXt: suffixes (really needed)
 
index 94a51ae..8b2651c 100644 (file)
@@ -49,7 +49,7 @@ ctx.menulist.example=\
     check=check_text|\
     reset=reset_text
 
-ctx.wraptext.length=65
+ctx.wraptext.length=80
 
 ctx.spellcheck.language=auto
 ctx.spellcheck.wordsize=4
index 2d1a807..25ad04a 100644 (file)
@@ -348,6 +348,7 @@ boolean obey_multi_par_hang    ; obey_multi_par_hang    := true  ;
 boolean obey_multi_par_more    ; obey_multi_par_more    := true  ;
 boolean snap_multi_par_tops    ; snap_multi_par_tops    := true  ;
 boolean local_multi_par_area   ; local_multi_par_area   := false ;
+boolean use_multi_par_region   ; use_multi_par_region   := false ;
 boolean ignore_multi_par_page  ; ignore_multi_par_page  := false ;
 boolean force_multi_par_chain  ; force_multi_par_chain  := true  ;
 boolean one_piece_multi_par    ; one_piece_multi_par    := false ;
@@ -374,6 +375,9 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd,
                              pn,px,py,pw,ph,pd,
                              rw,rl,rr,rh,ra,ri) =
 
+% fill PlainTextArea withcolor red ;
+% fill RegionTextArea withcolor green;
+
     if span_multi_column_pars :
         begingroup ;
         save TextAreas ; path TextAreas[] ;
@@ -398,6 +402,13 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd,
         TextAreas[1] := TextAreas[0] ;
         TextColumns[1] := TextColumns[0] ;
         nxy[fpos] := nxy[tpos] := nxy[wpos] := nxy[ppos] := RealPageNumber ;
+    elseif use_multi_par_region :
+        RealPageNumber := fn ;
+        NOfTextAreas := 1 ;
+        NOfSavedTextAreas := 0 ;
+        TextAreas[1] := RegionTextArea ;
+        TextColumns[1] := RegionTextArea ;
+        nxy[fpos] := nxy[tpos] := nxy[wpos] := nxy[ppos] := RealPageNumber ;
     elseif ignore_multi_par_page :
         RealPageNumber := fn ;
         nxy[fpos] := nxy[tpos] := nxy[wpos] := nxy[ppos] := RealPageNumber ;
index e33324b..ba6dcd6 100644 (file)
@@ -54,7 +54,7 @@ def SaveTextAreas =
 enddef ;
 
 def ResetTextAreas =
-    path TextAreas[], TextColumns[] ;
+    path TextAreas[], TextColumns[], PlainTextArea, RegionTextArea ;
     numeric NOfTextAreas   ; NOfTextAreas   := 0 ;
     numeric NOfTextColumns ; NOfTextColumns := 0 ;
     numeric nofmultipars   ; nofmultipars   := 0 ;
@@ -103,6 +103,15 @@ enddef ;
 
 %D We store a local area in slot zero.
 
+def RegisterPlainTextArea(expr x,y,w,h,d) =
+    PlainTextArea := unitsquare xyscaled(w,h+d) shifted (x,y-d) ;
+enddef ;
+
+def RegisterRegionTextArea(expr x,y,w,h,d) =
+    RegionTextArea := unitsquare xyscaled(w,h+d) shifted (x,y-d) ;
+%     RegionTextArea := RegionTextArea enlarged 2mm ;
+enddef ;
+
 def RegisterLocalTextArea (expr x, y, w, h, d) =
     TextAreas[0] := TextColumns[0] := unitsquare xyscaled(w,h+d) shifted (x,y-d) ;
 enddef ;
index a20a254..7dd1906 100644 (file)
@@ -81,8 +81,6 @@
 \def\MPeself       {e:\MPvar{self}}
 \def\MPwself       {w:\MPvar{self}}
 \def\MPparanchor   {p:\number\MPparcounter}
-\def\MPl       #tag{\MPplus{#tag}20} % slot 2 default 0
-\def\MPr       #tag{\MPplus{#tag}30} % slot 3 default 0
 
 \def\textbackgroundoverlay#tag{\iflocalpositioning\v!local\else\v!text\fi#tag}
 \def\MPanchornumber           {\iflocalpositioning\the\localpositionnumber\else\the\realpageno\fi}
        \ifx#par\relax
          \makeupwidth % \textwidth
        \else
-         \MPw\MPparanchor-\MPl\MPparanchor-\MPr\MPparanchor
+         \MPw\MPparanchor-\MPleftskip\MPparanchor-\MPrightskip\MPparanchor
        \fi
      \fi
    \relax}
 \stopuseMPgraphic
 
 \startMPpositionmethod{mpos:par} %%%%%%%%%%% will become obsolete
-    \MPparcounter\MPv\MPbself{1}\zerocount\relax
+    \MPparcounter\MPn\MPbself\relax
     \directsetup{mpos:par:variant:\doifpositionelse\MPwself{w}{b}}
     \MPpositiongraphic{mpos:par}{}%
 \stopMPpositionmethod
 
 \startsetups mpos:par:variant:b
     \startMPpositiongraphic{mpos:par}{fillcolor,filloffset,linecolor,gridcolor,linewidth,gridwidth,gridshift,lineradius}
-        initialize_par(\MPpos\MPbself,\MPpos\MPeself,\MPpos\textanchor,\MPpos\MPparanchor,\MPvv\MPparanchor{0pt,0pt,0pt,0pt,0,0pt}) ;
+        initialize_par(\MPpos\MPbself,\MPpos\MPeself,\MPpos\textanchor,\MPpos\MPparanchor,\MPpardata\MPparanchor) ;
         \includeMPgraphic{mpos:par:setup} ;
         \includeMPgraphic{mpos:par:extra} ;
         \includeMPgraphic{\MPvar{mp}} ;
     endgroup ;
 \stopuseMPgraphic
 
+% we can flush 5 in one call (saved 4 lua calls) .. brrr wself .. will change
+
+% \def\MPposset#1{\ctxcommand{MPposset("#1")}}
+
 \startMPpositionmethod{mpos:par:columnset}
-    \MPparcounter\MPv\MPbself{1}\zerocount\relax
+    \MPparcounter\MPn\MPbself\relax
+\def\regionanchor{\MPr\MPbself}%
+\ifx\regionanchor\empty
+    \regionpositioningfalse
+\else
+    \regionpositioningtrue
+\fi
     \startMPpositiongraphic{mpos:par}{fillcolor,filloffset,linecolor,gridcolor,linewidth,gridwidth,gridshift,lineradius}
         \includeMPgraphic{mpos:par:setup} ;
         \includeMPgraphic{mpos:par:extra} ;
-        prepare_multi_pars(\MPpos\MPbself,\MPpos\MPeself,\MPpos\MPwself,\MPpos\MPparanchor,\MPvv\MPparanchor{0pt,0pt,0pt,0pt,0,0pt}) ;
+        prepare_multi_pars(\MPpos\MPbself,\MPpos\MPeself,\MPpos\MPwself,\MPpos\MPparanchor,\MPpardata\MPparanchor) ;
+      % prepare_multi_pars(\MPposset{\MPvar{self}}) ;
         relocate_multipars(-\MPxy\MPanchorid) ; % inside layerpos
         \includeMPgraphic{\MPvar{mp}} ;
     \stopMPpositiongraphic
 %D We need to treat floats in a special way.
 
 \startMPinitializations
-    local_multi_par_area:=\iflocalpositioning true\else false\fi;
+    local_multi_par_area:=\iflocalpositioning  true\else false\fi;
+    use_multi_par_region:=\ifregionpositioning true\else false\fi;
 \stopMPinitializations
 
 %D As an example we define a grid background:
index 8c47581..8b586c5 100644 (file)
 
 %D The next macros do some housekeeping.
 
-\def\pageanchor{page:0} % for the moment only one pagesize
-\def\textanchor{text:\the\realpageno}
+\def\pageanchor  {page:0}               % for the moment only one pagesize
+\def\textanchor  {text:\the\realpageno}
+\def\regionanchor{region:0}             % placeholder
 
 %D The first version of this module implemented head and tail
 %D anchors. Currently we stick to just one anchor and derive
index bd766fa..60fc985 100644 (file)
@@ -12,17 +12,30 @@ can we store much more information in <l n='lua'/> but it's also
 more efficient.</p>
 --ldx]]--
 
--- to be considered: store as numbers instead of string
+-- plus (extra) is obsolete but we will keep it for a while
+
 -- maybe replace texsp by our own converter (stay at the lua end)
 -- eventually mp will have large numbers so we can use sp there too
 
 local tostring = tostring
-local concat, format, gmatch = table.concat, string.format, string.gmatch
+local concat, format, gmatch, match = table.concat, string.format, string.gmatch, string.match
+local rawget = rawget
 local lpegmatch = lpeg.match
+local insert, remove = table.insert, table.remove
 local allocate, mark = utilities.storage.allocate, utilities.storage.mark
-local texsp, texcount = tex.sp, tex.count
+local texsp, texcount, texbox, texdimen, texsetcount = tex.sp, tex.count, tex.box, tex.dimen, tex.setcount
 ----- texsp = string.todimen -- because we cache this is much faster but no rounding
 
+local setmetatableindex = table.setmetatableindex
+
+local variables   = interfaces.variables
+
+local v_text      = variables.text
+local v_column    = variables.column
+
+local new_latelua = nodes.pool.latelua
+local find_tail   = node.slide
+
 local pt  = number.dimenfactors.pt
 local pts = number.pts
 
@@ -45,176 +58,573 @@ end
 
 job.register('job.positions.collected', tobesaved, initializer)
 
-function jobpositions.setraw(name,val)
-    tobesaved[name] = val
+local regions    = { }
+local nofregions = 0
+local region     = nil
+local nofcolumns = 0
+local column     = nil
+local nofpages   = nil
+
+-- beware ... we're not sparse here as lua will reserve slots for the nilled
+
+local function setdim(name,w,h,d,extra) -- will be used when we move to sp allover
+    local x = pdf.h
+    local y = pdf.v
+    if x == 0 then x = nil end
+    if y == 0 then y = nil end
+    if w == 0 then w = nil end
+    if h == 0 then h = nil end
+    if d == 0 then d = nil end
+    if extra == "" then extra = nil end
+    -- todo: sparse
+    tobesaved[name] = {
+        p = texcount.realpageno,
+        x = x,
+        y = y,
+        w = w,
+        h = h,
+        d = d,
+        e = extra,
+        r = region,
+        c = column,
+    }
+end
+
+local function setall(name,p,x,y,w,h,d,extra)
+    if x == 0 then x = nil end
+    if y == 0 then y = nil end
+    if w == 0 then w = nil end
+    if h == 0 then h = nil end
+    if d == 0 then d = nil end
+    if extra == "" then extra = nil end
+    -- todo: sparse
+    tobesaved[name] = {
+        p = p,
+        x = x,
+        y = y,
+        w = w,
+        h = h,
+        d = d,
+        e = extra,
+        r = region,
+        c = column,
+    }
+end
+
+local function enhance(data)
+    if not data then
+        return nil
+    end
+    if data.r == true then -- or ""
+        data.r = region
+    end
+    if data.x == true then
+        data.x = pdf.h
+    end
+    if data.y == true then
+        data.y = pdf.v
+    end
+    if data.p == true then -- or 0
+        data.p = texcount.realpageno
+    end
+    if data.c == true then -- or 0
+        data.c = column
+    end
+    if data.w == 0 then
+        data.w = nil
+    end
+    if data.h == 0 then
+        data.h = nil
+    end
+    if data.d == 0 then
+        data.d = nil
+    end
+    return data
+end
+
+local function set(name,index,val)
+    local data = enhance(val or index)
+    if val then
+        container = tobesaved[name]
+        if not container then
+            tobesaved[name] = {
+                [index] = data
+            }
+        else
+            container[index] = data
+        end
+    else
+        tobesaved[name] = data
+    end
 end
 
-function jobpositions.setdim(name,wd,ht,dp,plus) -- will be used when we move to sp allover
-    if plus then
-        tobesaved[name] = { texcount.realpageno, pdf.h, pdf.v, wd, ht, dp, plus }
-    elseif wd then
-        tobesaved[name] = { texcount.realpageno, pdf.h, pdf.v, wd, ht, dp }
+local function get(id,index)
+    if index then
+        local container = collected[id]
+        return container and container[index]
     else
-        tobesaved[name] = { texcount.realpageno, pdf.h, pdf.v }
+        return collected[id]
     end
 end
 
-function jobpositions.setall(name,p,x,y,wd,ht,dp,plus) -- will be used when we move to sp allover
-    if plus then
-        tobesaved[name] = { p, x, y, wd, ht, dp, plus }
-    elseif wd then
-        tobesaved[name] = { p, x, y, wd, ht, dp }
+jobpositions.setdim = setdim
+jobpositions.setall = setall
+jobpositions.set    = set
+jobpositions.get    = get
+
+-- function jobpositions.pushregion(tag,w,h,d)
+--     if w then
+--         setdim(tag,w,h,d)
+--     end
+--     insert(regions,tag)
+--     region = tag
+-- end
+
+-- function jobpositions.popregion()
+--     remove(regions)
+--     region = regions[#regions]
+-- end
+
+-- function jobpositions.markregionbox(n,tag)
+--     if not tag or tag == "" then
+--         nofregions = nofregions + 1
+--         tag = nofregions
+--     end
+--     local box = texbox[n]
+--     local push = new_latelua(format("_plib_.pushregion(%q,%s,%s,%s)",tag,box.width,box.height,box.depth))
+--     local pop  = new_latelua("_plib_.popregion()")
+--     local head = box.list
+--     local tail = find_tail(head)
+--     head.prev = push
+--     push.next = head
+--     pop .prev = tail
+--     tail.next = pop
+--     box.list = push
+-- end
+
+function jobpositions.b_region(tag)
+    local last = tobesaved[tag]
+    last.x = pdf.h
+    last.p = texcount.realpageno
+    insert(regions,tag)
+    region = tag
+end
+
+function jobpositions.e_region()
+    remove(regions)
+    tobesaved[region].y = pdf.v
+    region = regions[#regions]
+end
+
+function jobpositions.markregionbox(n,tag)
+    if not tag or tag == "" then
+        nofregions = nofregions + 1
+        tag = format("region:%s",nofregions)
+    end
+    local box = texbox[n]
+    tobesaved[tag] = {
+        p = true,
+        x = true,
+        y = true,
+        w = box.width,
+        h = box.height,
+        d = box.depth,
+    }
+    local push = new_latelua(format("_plib_.b_region(%q)",tag))
+    local pop  = new_latelua("_plib_.e_region()")
+    local head = box.list
+    local tail = find_tail(head)
+    head.prev = push
+    push.next = head
+    pop .prev = tail
+    tail.next = pop
+    box.list = push
+end
+
+-- here the page is part of the column so we can only save when we reassign
+-- the table (column:* => column:*:*)
+
+function jobpositions.b_column(w,h,d) -- there can be multiple column ranges per page
+    local page = texcount.realpageno -- we could have a nice page synchronizer (saves calls)
+    if page ~= nofpages then
+        nofpages = page
+        nofcolumns = 1
     else
-        tobesaved[name] = { p, x, y }
+        nofcolumns = nofcolumns + 1
+    end
+    column = nofcolumns
+    if w then
+        set(format("column:%s:%s",page,column), {
+            x = true,
+            y = true,
+            w = w,
+            h = h,
+            d = d,
+        })
     end
 end
 
--- _praw_ = jobpositions.setraw
--- _pdim_ = jobpositions.setdim
--- _pall_ = jobpositions.setall
+function jobpositions.e_column()
+    column = nil
+end
+
+function jobpositions.markcolumnbox(n,column)
+    local box = texbox[n]
+    local push = new_latelua(format("_plib_.b_column(%s,%s,%s)",box.width,box.height,box.depth))
+    local pop  = new_latelua("_plib_.e_column()")
+    local head = box.list
+    if head then
+        local tail = find_tail(head)
+        head.prev = push
+        push.next = head
+        pop .prev = tail
+        tail.next = pop
+    else -- we can have a simple push/pop
+        push.next = pop
+        pop.prev = push
+    end
+    box.list = push
+end
+
+function jobpositions.enhance(name)
+    enhance(tobesaved[name])
+end
+
+function commands.pos(name,t)
+    tobesaved[name] = t
+    context(new_latelua(format("_plib_.enhance(%q)",name)))
+end
+
+local nofparagraphs = 0
+
+function commands.parpos() -- todo: relate to localpar (so this is an intermediate variant)
+    nofparagraphs = nofparagraphs + 1
+    texsetcount("global","parposcounter",nofparagraphs)
+    local strutbox = texbox.strutbox
+    local t = {
+        p  = true,
+     -- c  = true,
+        x  = true,
+        y  = true,
+        h  = strutbox.height,
+        d  = strutbox.depth,
+        hs = tex.hsize,
+    }
+    local leftskip   = tex.leftskip.width
+    local rightskip  = tex.rightskip.width
+    local hangindent = tex.hangindent
+    local hangafter  = tex.hangafter
+    local parindent  = tex.parindent
+    if leftskip ~= 0 then
+        t.ls = leftskip
+    end
+    if rightskip ~= 0 then
+        t.rs = rightskip
+    end
+    if hangindent ~= 0 then
+        t.hi = hangindent
+    end
+    if hangafter ~= 1 and hangafter ~= 0 then -- can not be zero .. so it needs to be 1 if zero
+        t.ha = hangafter
+    end
+    if parindent ~= 0 then
+        t.pi = parindent
+    end
+    local tag = format("p:%s",nofparagraphs)
+    tobesaved[tag] = t
+    context(new_latelua(format("_plib_.enhance(%q)",tag)))
+end
+
+function commands.posxy(name) -- can node.write be used here?
+    tobesaved[name] = {
+        p = true,
+     -- c = true,
+        r = true,
+        x = true,
+        y = true,
+        n = nofparagraphs > 0 and nofparagraphs or nil,
+    }
+    context(new_latelua(format("_plib_.enhance(%q)",name)))
+end
+
+function commands.poswhd(name,w,h,d)
+    tobesaved[name] = {
+        p = true,
+     -- c = true,
+        r = true,
+        x = true,
+        y = true,
+        w = w,
+        h = h,
+        d = d,
+        n = nofparagraphs > 0 and nofparagraphs or nil,
+    }
+    context(new_latelua(format("_plib_.enhance(%q)",name)))
+end
+
+function commands.posplus(name,w,h,d,extra)
+    tobesaved[name] = {
+        p = true,
+     -- c = true,
+        r = true,
+        x = true,
+        y = true,
+        w = w,
+        h = h,
+        d = d,
+        n = nofparagraphs > 0 and nofparagraphs or nil,
+        e = extra,
+    }
+    context(new_latelua(format("_plib_.enhance(%q)",name)))
+end
+
+function commands.posstrut(name,w,h,d)
+    local strutbox = texbox.strutbox
+    tobesaved[name] = {
+        p = true,
+     -- c = true,
+        r = true,
+        x = true,
+        y = true,
+        h = strutbox.height,
+        d = strutbox.depth,
+        n = nofparagraphs > 0 and nofparagraphs or nil,
+    }
+    context(new_latelua(format("_plib_.enhance(%q)",name)))
+end
+
+function jobpositions.getreserved(tag,n)
+    if tag == v_column then
+        local fulltag = format("%s:%s:%s",tag,texcount.realpageno,n or 1)
+        local data = collected[fulltag]
+        if data then
+            return data, fulltag
+        end
+        tag = v_text
+    end
+    if tag == v_text then
+        local fulltag = format("%s:%s",tag,texcount.realpageno)
+        return collected[fulltag] or false, fulltag
+    end
+    return collected[tag] or false, tag
+end
 
 function jobpositions.copy(target,source)
-    collected[target] = collected[source] or tobesaved[source]
+    collected[target] = collected[source]
 end
 
-function jobpositions.replace(name,...)
-    collected[name] = {...}
+function jobpositions.replace(id,p,x,y,w,h,d)
+--     local t = collected[id]
+--     if t then
+--         t.p = p or t.p
+--         t.x = x or t.x
+--         t.y = y or t.y
+--         t.w = w or t.w
+--         t.h = h or t.h
+--         t.d = d or t.d
+--     else
+        collected[id] = { p = p, x = x, y = y, w = w, h = h, d = d }
+--     end
 end
 
-function jobpositions.v(id,default)
-    return collected[id] or tobesaved[id] or default
+function jobpositions.page(id)
+    local jpi = collected[id]
+    return jpi and jpi.p or 0
 end
 
-function jobpositions.page(id)
-    local jpi = collected[id] or tobesaved[id]
-    return jpi and jpi[1] or 0
+function jobpositions.region(id)
+    local jpi = collected[id]
+    return jpi and jpi.r or false
+end
+
+function jobpositions.column(id)
+    local jpi = collected[id]
+    return jpi and jpi.c or false
 end
 
+function jobpositions.paragraph(id)
+    local jpi = collected[id]
+    return jpi and jpi.n or 0
+end
+
+jobpositions.p = jobpositions.page
+jobpositions.r = jobpositions.region
+jobpositions.c = jobpositions.column
+jobpositions.n = jobpositions.paragraph
+
 function jobpositions.x(id)
-    local jpi = collected[id] or tobesaved[id]
-    return jpi and jpi[2] or 0
+    local jpi = collected[id]
+    return jpi and jpi.x or 0
 end
 
 function jobpositions.y(id)
-    local jpi = collected[id] or tobesaved[id]
-    return jpi and jpi[3] or 0
+    local jpi = collected[id]
+    return jpi and jpi.y or 0
 end
 
 function jobpositions.width(id)
-    local jpi = collected[id] or tobesaved[id]
-    return jpi and jpi[4] or 0
+    local jpi = collected[id]
+    return jpi and jpi.w or 0
 end
 
 function jobpositions.height(id)
-    local jpi = collected[id] or tobesaved[id]
-    return jpi and jpi[5] or 0
+    local jpi = collected[id]
+    return jpi and jpi.h or 0
 end
 
 function jobpositions.depth(id)
-    local jpi = collected[id] or tobesaved[id]
-    return jpi and jpi[6] or 0
+    local jpi = collected[id]
+    return jpi and jpi.d or 0
+end
+
+function jobpositions.leftskip(id)
+    local jpi = collected[id]
+    return jpi and jpi.ls or 0
+end
+
+function jobpositions.rightskip(id)
+    local jpi = collected[id]
+    return jpi and jpi.rs or 0
+end
+
+function jobpositions.hsize(id)
+    local jpi = collected[id]
+    return jpi and jpi.hs or 0
+end
+
+function jobpositions.parindent(id)
+    local jpi = collected[id]
+    return jpi and jpi.pi or 0
+end
+
+function jobpositions.hangindent(id)
+    local jpi = collected[id]
+    return jpi and jpi.hi or 0
+end
+
+function jobpositions.hangafter(id)
+    local jpi = collected[id]
+    return jpi and jpi.ha or 1
 end
 
 function jobpositions.xy(id)
-    local jpi = collected[id] or tobesaved[id]
+    local jpi = collected[id]
     if jpi then
-        return jpi[2], jpi[3]
+        local x = jpi.x or 0
+        local y = jpi.y or 0
+        return x, y
     else
         return 0, 0
     end
 end
 
 function jobpositions.lowerleft(id)
-    local jpi = collected[id] or tobesaved[id]
+    local jpi = collected[id]
     if jpi then
-        return jpi[2], jpi[3] - jpi[6]
+        local x = jpi.x or 0
+        local y = jpi.y or 0
+        local d = jpi.d or 0
+        return x, y - d
     else
         return 0, 0
     end
 end
 
 function jobpositions.lowerright(id)
-    local jpi = collected[id] or tobesaved[id]
+    local jpi = collected[id]
     if jpi then
-        return jpi[2] + jpi[4], jpi[3] - jpi[6]
+        local x = jpi.x or 0
+        local y = jpi.y or 0
+        local w = jpi.w or 0
+        local d = jpi.d or 0
+        return x + w, y - d
     else
         return 0, 0
     end
 end
 
 function jobpositions.upperright(id)
-    local jpi = collected[id] or tobesaved[id]
+    local jpi = collected[id]
     if jpi then
-        return jpi[2] + jpi[4], jpi[3] + jpi[5]
+        local x = jpi.x or 0
+        local y = jpi.y or 0
+        local w = jpi.w or 0
+        local h = jpi.h or 0
+        return x + w, y + h
     else
         return 0, 0
     end
 end
 
 function jobpositions.upperleft(id)
-    local jpi = collected[id] or tobesaved[id]
+    local jpi = collected[id]
     if jpi then
-        return jpi[2], jpi[3] + jpi[5]
+        local x = jpi.x or 0
+        local y = jpi.y or 0
+        local h = jpi.h or 0
+        return x, y + h
     else
         return 0, 0
     end
 end
 
 function jobpositions.position(id)
-    local jpi = collected[id] or tobesaved[id]
+    local jpi = collected[id]
     if jpi then
-        return jpi[1], jpi[2], jpi[3], jpi[4], jpi[5], jpi[6]
+        return jpi.p or 0, jpi.x or 0, jpi.y or 0, jpi.w or 0, jpi.h or 0, jpi.d or 0
     else
         return 0, 0, 0, 0, 0, 0
     end
 end
 
 function jobpositions.extra(id,n,default) -- assume numbers
-    local jpi = collected[id] or tobesaved[id]
-    if not jpi then
-        return default
-    else
-        local split = jpi[0]
-        if not split then
-            split = lpegmatch(splitter,jpi[7])
-            jpi[0] = split
+    local jpi = collected[id]
+    if jpi then
+        local e = jpi.e
+        if e then
+            local split = jpi.split
+            if not split then
+                split = lpegmatch(splitter,jpi.e)
+                jpi.split = split
+            end
+            return texsp(split[n]) or default -- watch the texsp here
         end
-        return texsp(split[n]) or default -- watch the texsp here
     end
+    return default
 end
 
 local function overlapping(one,two,overlappingmargin) -- hm, strings so this is wrong .. texsp
-    one = collected[one] or tobesaved[one]
-    two = collected[two] or tobesaved[two]
-    if one and two and one[1] == two[1] then
+    one = collected[one]
+    two = collected[two]
+    if one and two and one.p == two.p then
         if not overlappingmargin then
             overlappingmargin = 2
         end
-        local x_one = one[2]
-        local x_two = two[2]
-        local w_two = two[4]
+        local x_one = one.x or 0
+        local x_two = two.x or 0
+        local w_two = two.w or 0
         local llx_one = x_one         - overlappingmargin
         local urx_two = x_two + w_two + overlappingmargin
         if llx_one > urx_two then
             return false
         end
-        local w_one = one[4]
+        local w_one = one.w or 0
         local urx_one = x_one + w_one + overlappingmargin
         local llx_two = x_two         - overlappingmargin
         if urx_one < llx_two then
             return false
         end
-        local y_one = one[3]
-        local y_two = two[3]
-        local d_one = one[6]
-        local h_two = two[5]
+        local y_one = one.y or 0
+        local y_two = two.y or 0
+        local d_one = one.d or 0
+        local h_two = two.h or 0
         local lly_one = y_one - d_one - overlappingmargin
         local ury_two = y_two + h_two + overlappingmargin
         if lly_one > ury_two then
             return false
         end
-        local h_one = one[5]
-        local d_two = two[6]
+        local h_one = one.h or 0
+        local d_two = two.d or 0
         local ury_one = y_one + h_one + overlappingmargin
         local lly_two = y_two - d_two - overlappingmargin
         if ury_one < lly_two then
@@ -226,10 +636,12 @@ end
 
 local function onsamepage(list,page)
     for id in gmatch(list,"(, )") do
-        local jpi = collected[id] or tobesaved[id]
+        local jpi = collected[id]
         if jpi then
-            local p = jpi[1]
-            if not page then
+            local p = jpi.p
+            if not p then
+                return false
+            elseif not page then
                 page = p
             elseif page ~= p then
                 return false
@@ -248,138 +660,284 @@ commands.replacepospxywhd = jobpositions.replace
 commands.copyposition     = jobpositions.copy
 
 function commands.MPp(id)
-    local jpi = collected[id] or tobesaved[id]
+    local jpi = collected[id]
     if jpi then
-        context(jpi[1])
-    else
-        context('0')
+        local p = jpi.p
+        if p then
+            context(p)
+            return
+        end
     end
+    context('0')
 end
 
 function commands.MPx(id)
-    local jpi = collected[id] or tobesaved[id]
+    local jpi = collected[id]
     if jpi then
-        context("%spt",jpi[2]*pt)
-    else
-        context('0pt')
+        local x = jpi.x
+        if x then
+            context("%spt",x*pt)
+            return
+        end
     end
+    context('0pt')
 end
 
 function commands.MPy(id)
-    local jpi = collected[id] or tobesaved[id]
+    local jpi = collected[id]
     if jpi then
-        context("%spt",jpi[3]*pt)
-    else
-        context('0pt')
+        local y = jpi.y
+        if y then
+            context("%spt",y*pt)
+            return
+        end
     end
+    context('0pt')
 end
 
 function commands.MPw(id)
-    local jpi = collected[id] or tobesaved[id]
+    local jpi = collected[id]
     if jpi then
-        context("%spt",jpi[4]*pt)
-    else
-        context('0pt')
+        local w = jpi.w
+        if w then
+            context("%spt",w*pt)
+            return
+        end
     end
+    context('0pt')
 end
 
 function commands.MPh(id)
-    local jpi = collected[id] or tobesaved[id]
+    local jpi = collected[id]
     if jpi then
-        context("%spt",jpi[5]*pt)
-    else
-        context('0pt')
+        local h = jpi.h
+        if h then
+            context("%spt",h*pt)
+            return
+        end
     end
+    context('0pt')
 end
 
 function commands.MPd(id)
-    local jpi = collected[id] or tobesaved[id]
     if jpi then
-        context("%spt",jpi[6]*pt)
-    else
-        context('0pt')
+        local d = jpi.d
+        if d then
+            context("%spt",d*pt)
+            return
+        end
     end
+    context('0pt')
 end
 
 function commands.MPxy(id)
-    local jpi = collected[id] or tobesaved[id]
+    local jpi = collected[id]
     if jpi then
-        context('(%spt,%spt)',jpi[2]*pt,jpi[3]*pt)
+        context('(%spt,%spt)',
+            (jpi.x or 0)*pt,
+            (jpi.y or 0)*pt
+        )
     else
         context('(0,0)')
     end
 end
 
 function commands.MPll(id)
-    local jpi = collected[id] or tobesaved[id]
+    local jpi = collected[id]
     if jpi then
-        context('(%spt,%spt)',jpi[2]*pt,(jpi[3]-jpi[6])*pt)
+        context('(%spt,%spt)',
+             (jpi.x or 0)              *pt,
+            ((jpi.y or 0)-(jpi.d or 0))*pt
+        )
     else
         context('(0,0)')
     end
 end
 
 function commands.MPlr(id)
-    local jpi = collected[id] or tobesaved[id]
+    local jpi = collected[id]
     if jpi then
-        context('(%spt,%spt)',(jpi[2]+jpi[4])*pt,(jpi[3]-jpi[6])*pt)
+        context('(%spt,%spt)',
+            ((jpi.x or 0)+(jpi.w or 0))*pt,
+            ((jpi.y or 0)-(jpi.d or 0))*pt
+        )
     else
         context('(0,0)')
     end
 end
 
 function commands.MPur(id)
-    local jpi = collected[id] or tobesaved[id]
+    local jpi = collected[id]
     if jpi then
-        context('(%spt,%spt)',(jpi[2]+jpi[4])*pt,(jpi[3]+jpi[5])*pt)
+        context('(%spt,%spt)',
+            ((jpi.x or 0)+(jpi.w or 0))*pt,
+            ((jpi.y or 0)+(jpi.h or 0))*pt
+        )
     else
         context('(0,0)')
     end
 end
 
 function commands.MPul(id)
-    local jpi = collected[id] or tobesaved[id]
+    local jpi = collected[id]
     if jpi then
-        context('(%spt,%spt)',jpi[2]*pt,(jpi[3]+jpi[5])*pt)
+        context('(%spt,%spt)',
+             (jpi.x or 0)              *pt,
+            ((jpi.y or 0)+(jpi.h or 0))*pt
+        )
     else
         context('(0,0)')
     end
 end
 
-function commands.MPpos(id)
-    local jpi = collected[id] or tobesaved[id]
+local function MPpos(id)
+    local jpi = collected[id]
+    if jpi then
+        local p = jpi.p
+        if p then
+            context("%s,%spt,%spt,%spt,%spt,%spt",
+                p,
+                (jpi.x or 0)*pt,
+                (jpi.y or 0)*pt,
+                (jpi.w or 0)*pt,
+                (jpi.h or 0)*pt,
+                (jpi.d or 0)*pt
+            )
+            return
+        end
+    end
+    context('0,0,0,0,0,0')
+end
+
+commands.MPpos = MPpos
+
+function commands.MPn(id)
+    local jpi = collected[id]
+    if jpi then
+        local n = jpi.n
+        if n then
+            context(n)
+            return
+        end
+    end
+    context(0)
+end
+
+function commands.MPc(id)
+    local jpi = collected[id]
+    if jpi then
+        local c = jpi.c
+        if c then
+            context(c)
+            return
+        end
+    end
+    context(c) -- number
+end
+
+function commands.MPr(id)
+    local jpi = collected[id]
     if jpi then
-        context("%s,%spt,%spt,%spt,%spt,%spt",jpi[1],jpi[2]*pt,jpi[3]*pt,jpi[4]*pt,jpi[5]*pt,jpi[6]*pt)
+        local r = jpi.r
+        if r then
+            context(r)
+            return
+        end
+    end
+ -- context("") -- empty so that we can test
+end
+
+local function MPpardata(n)
+    local t = collected[n]
+    if not t then
+        local tag = format("p:%s",n)
+        t = collected[tag]
+    end
+    if t then
+        context("%spt,%spt,%spt,%spt,%s,%spt", -- can be %.5f
+            (t.hs or 0)*pt,
+            (t.ls or 0)*pt,
+            (t.rs or 0)*pt,
+            (t.hi or 0)*pt,
+            (t.ha or 1),
+            (t.pi or 0)*pt
+        )
     else
-        context('0,0,0,0,0,0')
+        context("0,0,0,0,0,0") -- meant for MP
+    end
+end
+
+commands.MPpardata = MPpardata
+
+-- function commands.MPposset(id) -- special helper, used in backgrounds
+--     local b = format("b:%s",id)
+--     local e = format("e:%s",id)
+--     local w = format("w:%s",id)
+--     local p = format("p:%s",jobpositions.n(b))
+--     MPpos(b) context(",") MPpos(e) context(",") MPpos(w) context(",") MPpos(p) context(",") MPpardata(p)
+-- end
+
+function commands.MPls(id)
+    local t = collected[id]
+    if t then
+        context((t.ls or 0)*pt)
+    else
+        context("0pt")
+    end
+end
+
+function commands.MPrs(id)
+    local t = collected[id]
+    if t then
+        context((t.rs or 0)*pt)
+    else
+        context("0pt")
     end
 end
 
 local splitter = lpeg.tsplitat(",")
 
 function commands.MPplus(id,n,default)
-    local jpi = collected[id] or tobesaved[id]
-    if not jpi then
-        context(default)
-    else
-        local split = jpi[0]
-        if not split then
-            split = lpegmatch(splitter,jpi[7])
-            jpi[0] = split
+    local jpi = collected[id]
+    if jpi then
+        local e = jpi.e
+        if e then
+            local split = jpi.split
+            if not split then
+                split = lpegmatch(splitter,jpi.e)
+                jpi.split = split
+            end
+            context(split[n] or default)
+            return
         end
-        context(split[n] or default)
     end
+    context(default)
 end
 
 function commands.MPrest(id,default)
-    local jpi = collected[id] or tobesaved[id]
-    context(jpi and jpi[7] or default)
+    local jpi = collected[id]
+    context(jpi and jpi.e or default)
+end
+
+function commands.MPxywhd(id)
+    local t = collected[id]
+    if t then
+        context("%spt,%spt,%spt,%spt,%spt", -- can be %.5f
+            (t.x or 0)*pt,
+            (t.y or 0)*pt,
+            (t.w or 0)*pt,
+            (t.h or 0)*pt,
+            (t.d or 0)*pt
+        )
+    else
+        context("0,0,0,0,0") -- meant for MP
+    end
 end
 
 -- is testcase already defined? if so, then local
 
 function commands.doifpositionelse(name)
-    commands.testcase(collected[name] or tobesaved[name])
+    commands.testcase(collected[name])
 end
 
 function commands.doifoverlappingelse(one,two,overlappingmargin)
@@ -393,3 +951,6 @@ end
 function commands.doifpositionsonthispageelse(list)
     commands.testcase(onsamepage(list,tostring(tex.count.realpageno)))
 end
+
+commands.markcolumnbox = jobpositions.markcolumnbox
+commands.markregionbox = jobpositions.markregionbox
index a801a57..c28747c 100644 (file)
 \def\dosavepositionwhd   #1#2#3#4#5#6#7{\normalexpanded{\ctxlua    {_plib_.setall("#1",\number#2,\number\dimexpr#3,\number\dimexpr#4,\number\dimexpr#5,\number\dimexpr#6,\number\dimexpr#7)}}}
 \def\dosavepositionplus#1#2#3#4#5#6#7#8{\normalexpanded{\ctxlua    {_plib_.setall("#1",\number#2,\number\dimexpr#3,\number\dimexpr#4,\number\dimexpr#5,\number\dimexpr#6,\number\dimexpr#7,"#8")}}}
 
-\def\dosetposition                   #1{\normalexpanded{\ctxlatelua{_plib_.setdim("#1")}}}
-\def\dosetpositionwhd          #1#2#3#4{\normalexpanded{\ctxlatelua{_plib_.setdim("#1",\number\dimexpr#2,\number\dimexpr#3,\number\dimexpr#4)}}}
-\def\dosetpositionplus       #1#2#3#4#5{\normalexpanded{\ctxlatelua{_plib_.setdim("#1",\number\dimexpr#2,\number\dimexpr#3,\number\dimexpr#4,"#5")}}}
+\def\dosetposition                   #1{\normalexpanded{\ctxlatelua{_plib_.setdim("#1")}}}
+\def\dosetpositionwhd          #1#2#3#4{\normalexpanded{\ctxlatelua{_plib_.setdim("#1",\number\dimexpr#2,\number\dimexpr#3,\number\dimexpr#4)}}}
+\def\dosetpositionplus       #1#2#3#4#5{\normalexpanded{\ctxlatelua{_plib_.setdim("#1",\number\dimexpr#2,\number\dimexpr#3,\number\dimexpr#4,"#5")}}}
 
-% % %
+\def\dosetposition            #1{\ctxcommand{posxy("#1")}}
+\def\dosetpositionwhd   #1#2#3#4{\ctxcommand{poswhd("#1",\number\dimexpr#2,\number\dimexpr#3,\number\dimexpr#4)}}
+\def\dosetpositionplus#1#2#3#4#5{\ctxcommand{posplus("#1",\number\dimexpr#2,\number\dimexpr#3,\number\dimexpr#4,"#5")}}
+\def\dosetpositionbox       #1#2{\ctxcommand{poswhd("#1",\number\wd#2,\number\ht#2,\number\dp#2)}}
+\def\dosetpositionstrut       #1{\ctxcommand{posstrut("#1")}}
 
 \let\dosetpositionpapersize\gobbletwoarguments
 
 %D not applicable when the content floats indeed. In such
 %D situations one can treat positions and graphics local.
 
-\newif\iflocalpositioning % todo: conditional
+\newif\iflocalpositioning  % todo: conditional
+\newif\ifregionpositioning % todo: conditional
 
 %D Watch out: sometimes a pagebreak occurs inside a float
 %D placement, so there we need to disable local mode.
 \to \everyinsidefloat
 
 \appendtoks
+    \regionpositioningfalse
     \localpositioningfalse
 \to \everybeforepagebody
 
 %D \macros
 %D   {MPp, MPx, MPy, MPw, MPh, MPd,
-%D    MPxy, MPll, MPlr, MPur, MPul, MPpos}
+%D    MPxy, MPll, MPlr, MPur, MPul, MPpos,MPanchor}
 %D
 %D Access to the positional information is provided by macros
 %D with short names that are clearly meant for \METAPOST\ but
 %D nowadays also used for other purposes.
 
-\def\MPp  #1{\ctxcommand{MPp("#1")}}
+\def\MPp  #1{\ctxcommand{MPp("#1")}}     \let\MPpage     \MPp
+\def\MPr  #1{\ctxcommand{MPr("#1")}}     \let\MPregion   \MPr
+\def\MPc  #1{\ctxcommand{MPc("#1")}}     \let\MPcolumn   \MPc
+\def\MPn  #1{\ctxcommand{MPn("#1")}}     \let\MPparagraph\MPn
 \def\MPx  #1{\ctxcommand{MPx("#1")}}
 \def\MPy  #1{\ctxcommand{MPy("#1")}}
-\def\MPw  #1{\ctxcommand{MPw("#1")}}
+\def\MPw  #1{\ctxcommand{MPw("#1")}}     % first we need to replace \MPwidth etc
 \def\MPh  #1{\ctxcommand{MPh("#1")}}
 \def\MPd  #1{\ctxcommand{MPd("#1")}}
 \def\MPxy #1{\ctxcommand{MPxy("#1")}}
 \def\MPlr #1{\ctxcommand{MPlr("#1")}}
 \def\MPur #1{\ctxcommand{MPur("#1")}}
 \def\MPul #1{\ctxcommand{MPul("#1")}}
-\def\MPpos#1{\ctxcommand{MPpos("#1")}}
+\def\MPpos#1{\ctxcommand{MPpos("#1")}}    \def\MPanchor{\MPpos}
+\def\MPe  #1{\ctxcommand{MPe("#1")}}
+
+\def\MPls #1{\ctxcommand{MPls("#1")}}     \let\MPleftskip\MPls % compatible feature
+\def\MPrs #1{\ctxcommand{MPrs("#1")}}     \let\MPrightkip\MPrs % compatible feature
+
+\def\MPpardata#1{\ctxcommand{MPpardata("#1")}}
+\def\MPxywhd  #1{\ctxcommand{MPxywhd("#1")}}
 
 %D \macros
 %D  {MPplus, MPrest, MPv, MPvv}
 \def\MPplus#1#2#3{\ctxcommand{MPplus("#1",#2,"#3")}}  \let\MPv \MPplus
 \def\MPrest  #1#2{\ctxcommand{MPrest("#1","#2")}}     \let\MPvv\MPrest
 
-%D \macros
-%D   {MPanchor}
-%D
-%D For readability we define a few synonyms:
-
-\def\MPanchor{\MPpos}
-
 %D There are two low level positioning macros. Both store the
 %D position as well as execute an action associated with that
 %D position.
   {\anch_positions_initialize
    \hbox to \wd\nextbox
      {\edef\currentposition{#1}%
-      \dosetpositionwhd\currentposition{\wd\nextbox}{\ht\nextbox}{\dp\nextbox}% already \the\dimexpr
+      \dosetpositionbox\currentposition\nextbox
       \traceposstring\llap\green{\currentposition>}%
       \setbox\positionbox\box\nextbox
       \dopositionaction\currentposition
       \box\positionbox
       \hss}}
 
+\unexpanded\def\setpositionstrut
+  {\iftrialtypesetting
+     \expandafter\anch_positions_set_strut_nop
+   \else
+     \expandafter\anch_positions_set_strut_yes
+   \fi}
+
+\def\anch_positions_set_strut_nop#1%
+  {\strut}
+
+\def\anch_positions_set_strut_yes#1%
+  {\anch_positions_initialize
+   \hbox to \zeropoint
+     {\edef\currentposition{#1}%
+      \dosetpositionstrut\currentposition
+      \traceposstring\llap\green{\currentposition>}%
+      \dopositionaction\currentposition
+      \strut
+      \hss}}
+
 \def\setpositiondataplus
   {\iftrialtypesetting
      \expandafter\gobblefivearguments
 
 \let\currentposition\s!unknown
 
+%D A few special ones:
+
+\unexpanded\def\anch_mark_column_box
+  {\ifpositioning
+     \expandafter\gobbleoneargument
+   \else
+     \expandafter\anch_mark_column_box_indeed
+   \fi}
+
+\unexpanded\def\anch_mark_column_box#1%
+  {\ctxcommand{markcolumnbox(\number#1)}}
+
+\unexpanded\def\anch_mark_region_box
+  {\iftrialtypesetting
+     \singleexpandafter\gobbleoneargument
+   \else\ifpositioning
+     \doubleexpandafter\gobbleoneargument
+   \else
+     \doubleexpandafter\anch_mark_region_box_indeed
+   \fi\fi}
+
+\unexpanded\def\anch_mark_region_box#1%
+  {\ctxcommand{markregionbox(\number#1)}}
+
 %D We can copy a position with:
 %D
 %D \starttyping
 
 \let\xypos\setpositiononly
 
-\unexpanded\def\hpos#1{\dontleavehmode\setpositionbox{#1}\hbox}
-\unexpanded\def\vpos#1{\setpositionbox{#1}\vbox}
-
-\unexpanded\def\bpos#1{\hpos{b:#1}{\strut}\ignorespaces}
-\unexpanded\def\epos#1{\removelastspace\hpos{e:#1}{\strut}}
+\unexpanded\def\hpos #1{\dontleavehmode\setpositionbox{#1}\hbox}
+\unexpanded\def\vpos #1{\setpositionbox{#1}\vbox}
 
-\unexpanded\def\fpos#1%
-  {\setpositionplus{b:#1}{\number\parposcounter}\horizontalstrut
-   \ignorespaces}
+\unexpanded\def\bpos #1{\dontleavehmode      \setpositionstrut{b:#1}\ignorespaces}
+\unexpanded\def\epos #1{\removeunwantedspaces\setpositionstrut{e:#1}}
+%unexpanded\def\fpos #1{\dontleavehmode      \setpositionstrut{b:#1}\ignorespaces}
+%unexpanded\def\tpos #1{\removeunwantedspaces\setpositionstrut{e:#1}}
+\unexpanded\def\ffpos#1{\dontleavehmode      \setpositionstrut{b:#1}\wpos{#1}\ignorespaces}
+%unexpanded\def\ttpos#1{\removeunwantedspaces\setpositionstrut{e:#1}}
 
-\unexpanded\def\tpos#1%
-  {\removelastspace
-   \setpositionplus{e:#1}{\number\parposcounter}\horizontalstrut}
+\let\fpos \bpos
+\let\tpos \epos
+\let\ttpos\epos
 
-\unexpanded\def\ffpos#1%
-  {\setpositionplus{b:#1}{\number\parposcounter}\horizontalstrut\wpos{#1}%
-   \ignorespaces}
+%D Crap:
 
-\unexpanded\def\ttpos#1%
-  {\removelastspace
-   \setpositionplus{e:#1}{\number\parposcounter}\horizontalstrut}
-
-\unexpanded\def\wpos#1%
+\unexpanded\def\wpos#1% will be redone
   {\dontleavehmode\vadjust % may disappear if buried
      {\setbox\scratchbox\hbox{\raise\strutdp\hbox{\rawwpos{#1}}}%
-      \rlap
-        {\smashedbox\scratchbox}}}
+      \rlap{\smashedbox\scratchbox}}}
 
 \unexpanded\def\wwpos#1% \hsmashed{\llap{\rawwpos{#1}}}
   {\rlap
 \unexpanded\def\rawwpos#1%
   {\hpos{w:#1}
      {\strut
-%       \hskip-\leftskip
-%       \hskip\hsize
-%       \hskip-\rightskip}}
       \hskip\dimexpr\hsize-\leftskip-\rightskip\relax}}
 
 % the next macro disables par positions (in inner boxes) and
      \fi \fi \fi
    \fi}
 
+% \def\anch_positions_register_par_options
+%   {\global\advance\parposcounter\plusone
+%    \setpositiondataplus
+%      {p:\number\parposcounter}\zeropoint\strutht\strutdp
+%      {\the\hsize,\the\dimexpr\leftskip\relax,\the\dimexpr\rightskip\relax,\the\hangindent,\the\hangafter,\the\parindent}%
+%   %\hbox{\registerparsymbol}%
+%    \iftracepositions\registerparsymbol\fi}
+
 \def\anch_positions_register_par_options
-  {\global\advance\parposcounter\plusone
-   \setpositiondataplus
-     {p:\number\parposcounter}\zeropoint\strutht\strutdp
-     {\the\hsize,\the\dimexpr\leftskip\relax,\the\dimexpr\rightskip\relax,\the\hangindent,\the\hangafter,\the\parindent}%
-  %\hbox{\registerparsymbol}%
+  {\dontleavehmode\ctxcommand{parpos()}%
    \iftracepositions\registerparsymbol\fi}
 
 \unexpanded\def\traceposstring#1#2#3%
 
 % \appendtoks \registerparoptions \to \everypar
 
-%D Eperimental code, don't use this yet: (must be sped up anyway)
+%D Eperimental code, don't use this yet: (must be sped up anyway) .. obsolete
 
 \def\@@noden{node:n:}
 \def\@@nodeo{node:o:}
 \def\doifpositionsonsamepageelse#1{\ctxcommand{doifpositionsonsamepageelse("#1")}}
 \def\doifpositionsonthispageelse#1{\ctxcommand{doifpositionsonthispageelse("#1")}}
 
-%D Plugins:
-
-\let\MPv     \MPplus
-\let\MPvv    \MPrest
-\let\MPanchor\MPpos
-
 %D \macros
 %D   {POSp, POSx, POSy, POSh, POSd, POSw}
 %D
index 32222bb..c7448f3 100644 (file)
@@ -17,6 +17,7 @@
 
 \unprotect
 
+\ifx\s!num    \undefined \def\s!num    {num}     \fi
 \ifx\s!set    \undefined \def\s!set    {set}     \fi
 \ifx\s!reset  \undefined \def\s!reset  {reset}   \fi
 \ifx\s!preset \undefined \def\s!preset {preset}  \fi
 %
 % \appendtoks \flushsyncpositions \to \neverypar
 
-\protect \endinput
+\protect
+
+\continueifinputfile{anch-snc.mkiv}
 
 \starttext
 
+\setupbodyfont[dejavu]
+
 \definesyncpositions[1]
 
 \startuseMPgraphic{sync}
 
 \setupbackgrounds[page][background=tempoverlay]
 
-\syncposition[1][1] \input ward \endgraf
-\syncposition[1][2] \input ward \endgraf
-\syncposition[1][3] \input ward \endgraf
-\syncposition[1][4] \input ward \endgraf
+\dorecurse {100} {
+
+    \startchapter[title={Test #1}]
+        \syncposition[1][1] \dorecurse{10}{\input ward \endgraf}
+        \syncposition[1][2] \dorecurse{4}{\input ward \endgraf}
+        \syncposition[1][3] \dorecurse{7}{\input ward \endgraf}
+        \syncposition[1][4] \dorecurse{3}{\input ward \endgraf}
+    \stopchapter
+}
 
 \stoptext
index 24ca597..f219df7 100644 (file)
@@ -16,12 +16,6 @@ if not modules then modules = { } end modules ['buff-imp-mp'] = {
 
 local P, S, V, patterns = lpeg.P, lpeg.S, lpeg.V, lpeg.patterns
 
-local mps = dofile(resolvers.findfile("mult-mps.lua","tex"))
-
-local primitives = table.tohash(mps.primitives)
-local plain      = table.tohash(mps.plain)
-local metafun    = table.tohash(mps.metafun)
-
 local context                      = context
 local verbatim                     = context.verbatim
 local makepattern                  = visualizers.makepattern
@@ -39,7 +33,23 @@ local MetapostSnippetNamePlain     = verbatim.MetapostSnippetNamePlain
 local MetapostSnippetNameMetafun   = verbatim.MetapostSnippetNameMetafun
 local MetapostSnippetName          = verbatim.MetapostSnippetName
 
+local primitives, plain, metafun
+
+local function initialize()
+    local mps = dofile(resolvers.findfile("mult-mps.lua","tex")) or {
+        primitives = { },
+        plain      = { },
+        metafun    = { },
+    }
+    primitives = table.tohash(mps.primitives)
+    plain      = table.tohash(mps.plain)
+    metafun    = table.tohash(mps.metafun)
+end
+
 local function visualizename(s)
+    if not primitives then
+        initialize()
+    end
     if primitives[s] then
         MetapostSnippetNamePrimitive(s)
     elseif plain[s] then
index 02e250b..7d35676 100644 (file)
@@ -85,7 +85,7 @@
 \def\doflushparalleldefault{\directsetup{\parallelparameter\c!setups}}
 
 \startsetups parallel:place:default
-    \hangafter1
+    \hangafter\plusone
     \hangindent4em
     \dontleavehmode
     \hbox to 3em \bgroup
index 4757735..ba844ff 100644 (file)
@@ -60627,9 +60627,11 @@ characters.data={
  [0x2212]={
   adobename="minus",
   category="sm",
+--comment="the mathclass is needed for mathsymbol remapping",
   description="MINUS SIGN",
   direction="es",
   linebreak="pr",
+--mathclass="binary",
   mathspec={
    {
     class="binary",
index 8c6d4df..11b7590 100644 (file)
@@ -76,7 +76,7 @@
 
 \def\colo_groups_define_entry#1#2#3% name mode specification
   {\advance\c_colo_groups_n\plusone
-   \csname\??colorgroupsetter\ifcsname\??colorgroupssetter#2\endcsname#2\else\s!rgb\fi\endcsname[#1:\the\c_colo_groups_n][#3:0:0:0:0]}
+   \csname\??colorgroupsetter\ifcsname\??colorgroupsetter#2\endcsname#2\else\s!rgb\fi\endcsname[#1:\the\c_colo_groups_n][#3:0:0:0:0]}
 
 \setvalue{\??colorgroupsetter\s!gray}[#1][#2:#3]{\definecolor[#1][s=#2]}
 \setvalue{\??colorgroupsetter\s!rgb }[#1][#2:#3:#4:#5]{\definecolor[#1][r=#2,g=#3,b=#4]}
index e6d69b9..db7505b 100644 (file)
@@ -98,5 +98,6 @@
 
 \definefilesynonym [letter]          [cor-01]
 \definefilesynonym [memo]            [cor-02]
+\definefilesynonym [resume]          [cor-03]
 
 \endinput
index 6f341ac..fb4ee48 100644 (file)
@@ -11,7 +11,7 @@
 %C therefore copyrighted by \PRAGMA. See mreadme.pdf for
 %C details.
 
-\newcontextversion{2012.01.25 14:16}
+\newcontextversion{2012.02.08 21:04}
 
 %D This file is loaded at runtime, thereby providing an
 %D excellent place for hacks, patches, extensions and new
index ee45720..ebf6aa3 100644 (file)
@@ -11,7 +11,7 @@
 %C therefore copyrighted by \PRAGMA. See mreadme.pdf for
 %C details.
 
-\newcontextversion{2012.01.25 14:16}
+\newcontextversion{2012.02.08 21:04}
 
 %D This file is loaded at runtime, thereby providing an
 %D excellent place for hacks, patches, extensions and new
 
 % \startplaatsen[links] bla \stopplaatsen
 \f
-% we don't register the paragraph characteristics, only the
-% width
-
-\appendtoks
-  \setinnerparpositions % see "techniek" for application
-\to \everytabulate
-\f
 \def\startcolumnmakeup % don't change
   {\bgroup
    \getrawnoflines\textheight % teksthoogte kan topskip hebben, dus raw
    \wd\scratchbox\textwidth
    \box\scratchbox
    \egroup
-   \synchronizehsize}
+   \page_otr_command_synchronize_hsize}
 \f
 \long\def\startexternalfigure
   {\dotripleempty\dostartexternalfigure}
dissimilarity index 61%
index a4d31a8..f1efd3a 100644 (file)
Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ
dissimilarity index 98%
index e0bdc7a..08b8916 100644 (file)
Binary files a/tex/context/base/context-version.png and b/tex/context/base/context-version.png differ
index 3b58fa3..e62b4e5 100644 (file)
@@ -20,7 +20,7 @@
 %D your styles an modules.
 
 \edef\contextformat {\jobname}
-\edef\contextversion{2012.01.25 14:16}
+\edef\contextversion{2012.02.08 21:04}
 
 %D For those who want to use this:
 
index ec46764..eaa4c3a 100644 (file)
@@ -23,7 +23,7 @@
 %D up and the dependencies are more consistent.
 
 \edef\contextformat {\jobname}
-\edef\contextversion{2012.01.25 14:16}
+\edef\contextversion{2012.02.08 21:04}
 
 %D For those who want to use this:
 
 \loadmarkfile{pack-obj}
 
 \loadmkvifile{strc-itm}
-\loadmarkfile{strc-des}
+
+\loadmkvifile{strc-con}
+\loadmkvifile{strc-des}
+\loadmkvifile{strc-enu}
+
+\loadmarkfile{strc-ind}
+\loadmarkfile{strc-lab}
 \loadmarkfile{strc-syn}
 
 \loadmarkfile{core-sys}
 
 \loadmarkfile{page-var}
+\loadmkvifile{page-otr}
 \loadmarkfile{page-ini}
 \loadmarkfile{page-fac}
 \loadmarkfile{page-brk}
 \loadmarkfile{page-lay}
 \loadmkvifile{page-box}
 \loadmkvifile{page-txt}
-\loadmarkfile{page-sid}
+\loadmarkfile{page-sid} % when
 
 \loadmkvifile{strc-flt}
 
 \loadmarkfile{node-rul}
 \loadmarkfile{node-spl}
 
-\loadmarkfile{strc-not}
-\loadmarkfile{strc-lnt}
+\loadmkvifile{strc-not}
+\loadmkvifile{strc-lnt}
 
 \loadmarkfile{core-mis}
 \loadmarkfile{pack-com}
index cc30cb8..1819d08 100644 (file)
 \let\directsetup\syst_setups
 \let\texsetup   \syst_setups % nicer than \directsetup and more en par with xmlsetup and luasetup
 
-\def\doifsetupselse#1% to be done: grid
+\unexpanded\def\doifsetupselse#1% to be done: grid
   {\ifcsname\??setup:#1\endcsname
      \expandafter\firstoftwoarguments
    \else
      \expandafter\secondoftwoarguments
    \fi}
 
+\unexpanded\def\doifsetups#1% to be done: grid
+  {\ifcsname\??setup:#1\endcsname
+     \expandafter\firstofoneargument
+   \else
+     \expandafter\gobbleoneargument
+   \fi}
+
+\unexpanded\def\doifnotsetups#1% to be done: grid
+  {\ifcsname\??setup:#1\endcsname
+     \expandafter\gobbleoneargument
+   \else
+     \expandafter\firstofoneargument
+   \fi}
+
 % \startluasetups oeps
 %     context("DONE")
 %     a = 1
dissimilarity index 70%
index 0c369ff..75a0ed5 100644 (file)
@@ -1,60 +1,79 @@
-%D \module
-%D   [       file=core-ini,
-%D        version=2003.12.01,
-%D          title=\CONTEXT\ Core Macros,
-%D       subtitle=Additional Initialization,
-%D         author=Hans Hagen,
-%D           date=\currentdate,
-%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\writestatus{loading}{ConTeXt Core Macros / Additional Initialization}
-
-%D We will move more code to here, so that we become less dependent of the
-%D orde in which modules are loaded.
-
-\unprotect
-
-\everypar  \emptytoks
-\neverypar \emptytoks
-
-%appendtoks \flushnotes                  \to \everypar
-\appendtoks \synchronizesidefloats       \to \everypar
-
-\appendtoks \checkindentation            \to \everypar
-\appendtoks \showparagraphnumber         \to \everypar
-\appendtoks \restoreinterlinepenalty     \to \everypar
-%appendtoks \flushmargincontents         \to \everypar
-%appendtoks \flushcommentanchors         \to \everypar
-\appendtoks \flushnotes                  \to \everypar
-\appendtoks \synchronizenotes            \to \everypar
-\appendtoks \OTRSETshowstatus            \to \everypar
-\appendtoks \flushpostponedbookmark      \to \everypar
-\appendtoks \registerparoptions          \to \everypar
-\appendtoks \flushsyncpositions          \to \everypar
-\appendtoks \flushpostponednodedata      \to \everypar
-\appendtoks \typo_delimited_repeat       \to \everypar
-\appendtoks \insertparagraphintro        \to \everypar
-
-\appendtoks \flushpostponedbookmark      \to \neverypar
-\appendtoks \flushpostponedbookmark      \to \everylistentry
-
-\appendtoks \flushnotes                  \to \everydisplay
-\appendtoks \adjustsidefloatdisplaylines \to \everydisplay
-
-\appendtoks \flushsyncpositions          \to \everyheadstart
-
-\appendtoks \flushsyncresets             \to \everyendoftextbody
-
-\appendtoks \ignorespaces                \to \everybeginofpar
-
-\appendtoks \removeunwantedspaces        \to \everyendofpar
-%appendtoks \strut                       \to \everyendofpar % option ?
-\appendtoks \flushsyncresets             \to \everyendofpar
-%appendtoks \setlastlinewidth            \to \everyendofpar % gone, will be done in lua
-\appendtoks \endgraf                     \to \everyendofpar
-
-\protect \endinput
+%D \module
+%D   [       file=core-ini,
+%D        version=2003.12.01,
+%D          title=\CONTEXT\ Core Macros,
+%D       subtitle=Additional Initialization,
+%D         author=Hans Hagen,
+%D           date=\currentdate,
+%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Core Macros / Additional Initialization}
+
+%D We will move more code to here, so that we become less dependent of the
+%D orde in which modules are loaded.
+
+\unprotect
+
+\everypar  \emptytoks
+\neverypar \emptytoks
+
+\appendtoks
+    %flushnotes
+    \page_otr_command_synchronize_side_floats % an otr specific command
+    \checkindentation
+    \showparagraphnumber
+    \restoreinterlinepenalty
+    %flushmargincontents
+    %flushcommentanchors
+    \flushnotes
+    \synchronizenotes
+    \OTRSETshowstatus
+    \flushpostponedbookmark
+    \registerparoptions
+    \flushsyncpositions
+    \flushpostponednodedata
+    \typo_delimited_repeat
+    \insertparagraphintro
+\to \everypar
+
+\appendtoks
+    \flushpostponedbookmark
+\to \neverypar
+
+\appendtoks
+    \flushpostponedbookmark
+\to \everylistentry
+
+\appendtoks
+    \flushnotes
+\to \everydisplay
+
+\appendtoks
+    \adjustsidefloatdisplaylines
+\to \everydisplay
+
+\appendtoks
+    \flushsyncpositions
+\to \everyheadstart
+
+\appendtoks
+    \flushsyncresets
+\to \everyendoftextbody
+
+\appendtoks
+    \ignorespaces
+\to \everybeginofpar
+
+\appendtoks
+    \removeunwantedspaces
+    %strut                % option ?
+    \flushsyncresets
+    %setlastlinewidth     % gone, will be done in lua
+    \endgraf
+\to \everyendofpar
+
+\protect \endinput
index 7834be9..cfe95a6 100644 (file)
@@ -34,7 +34,7 @@ local report_jobcontrol = logs.reporter("jobcontrol")
 job                     = job or { }
 local job               = job
 
-job.version             = 1.17
+job.version             = 1.18
 
 -- some day we will implement loading of other jobs and then we need
 -- job.jobs
index c225729..6cb3616 100644 (file)
@@ -19,16 +19,16 @@ local methodhandler = resolvers.methodhandler
 local splitlines    = string.splitlines
 local utffiletype   = unicode.filetype
 
-local fileprocessor = nil
-local lineprocessor = nil
+-- local fileprocessor = nil
+-- local lineprocessor = nil
 
-local textfileactions = sequencers.reset {
+local textfileactions = sequencers.new {
     arguments    = "str,filename,coding",
     returnvalues = "str",
     results      = "str",
 }
 
-local textlineactions = sequencers.reset {
+local textlineactions = sequencers.new {
     arguments    = "str,filename,linenumber,noflines,coding",
     returnvalues = "str",
     results      = "str",
@@ -78,10 +78,10 @@ function helpers.textopener(tag,filename,filehandle,coding)
         elseif coding == "utf-32-le" then
             lines = unicode.utf32_to_utf8_le(lines)
         else -- utf8 or unknown (could be a mkvi file)
-            if textfileactions.dirty then -- maybe use autocompile
-                fileprocessor = sequencers.compile(textfileactions) -- no need for dummy test .. always one
+            local runner = textfileactions.runner
+            if runner then
+                lines = runner(lines,filename,coding) or lines
             end
-            lines = fileprocessor(lines,filename,coding) or lines
             lines = splitlines(lines)
         end
     elseif trace_locating then
@@ -119,11 +119,9 @@ function helpers.textopener(tag,filename,filehandle,coding)
              -- elseif content == ctrl_d or ctrl_z then
              --     return nil -- we need this as \endinput does not work in prints
                 else
-                    if textlineactions.dirty then -- no dummy
-                        lineprocessor = sequencers.compile(textlineactions,false,true) -- maybe use autocompile
-                    end
-                    if lineprocessor then
-                        return lineprocessor(content,filename,currentline,noflines,coding) or content
+                    local runner = textlineactions.runner
+                    if runner then
+                        return runner(content,filename,currentline,noflines,coding) or content
                     else
                         return content
                     end
index 9329fbb..9280996 100644 (file)
@@ -44,7 +44,6 @@ local setmetatableindex      = table.setmetatableindex
 -- will be directives
 
 constructors.dontembed       = allocate()
-constructors.mathactions     = { }
 constructors.autocleanup     = true
 constructors.namemode        = "fullpath" -- will be a function
 
@@ -278,6 +277,14 @@ function constructors.assignmathparameters(target,original) -- simple variant, n
     end
 end
 
+function constructors.beforecopyingcharacters(target,original)
+    -- can be used for additional tweaking
+end
+
+function constructors.aftercopyingcharacters(target,original)
+    -- can be used for additional tweaking
+end
+
 function constructors.enhanceparameters(parameters)
     local xheight = parameters.x_height
     local quad    = parameters.quad
@@ -527,7 +534,7 @@ function constructors.scale(tfmdata,specification)
     --
     local italickey = "italic"
     --
-    -- some context specific trickery (we might move this to a plug in into here
+    -- some context specific trickery (this will move to a plugin)
     --
     if hasmath then
         if properties.mathitalics then
@@ -553,6 +560,8 @@ function constructors.scale(tfmdata,specification)
     --
     -- end of context specific trickery
     --
+    constructors.beforecopyingcharacters(target,tfmdata)
+    --
     local sharedkerns = { }
     --
     -- we can have a dumb mode (basemode without math etc) that skips most
@@ -795,6 +804,9 @@ function constructors.scale(tfmdata,specification)
         end
         targetcharacters[unicode] = chr
     end
+    --
+    constructors.aftercopyingcharacters(target,tfmdata)
+    --
     return target
 end
 
index 8031299..5680ee6 100644 (file)
@@ -58,6 +58,10 @@ local registerotffeature  = otffeatures.register
 local baseprocessors      = otffeatures.processors.base
 local baseinitializers    = otffeatures.initializers.base
 
+local sequencers          = utilities.sequencers
+local appendgroup         = sequencers.appendgroup
+local appendaction        = sequencers.appendaction
+
 specifiers.contextsetups  = specifiers.contextsetups  or { }
 specifiers.contextnumbers = specifiers.contextnumbers or { }
 specifiers.contextmerged  = specifiers.contextmerged  or { }
@@ -223,81 +227,6 @@ local privatefeatures = {
     anum = true,
 }
 
--- local function modechecker(tfmdata,features,mode) -- we cannot adapt features as they are shared!
---     if trace_features then
---         report_features(serialize(features,"used"))
---     end
---     local rawdata   = tfmdata.shared.rawdata
---     local resources = rawdata and rawdata.resources
---     local script    = features.script
---     if script == "auto" then
---         local latn = false
---         for g, list in next, resources.features do
---             for f, scripts in next, list do
---                 if privatefeatures[f] then
---                     -- skip
---                 elseif scripts.dflt then
---                     script = "dflt"
---                     break
---                 elseif scripts.latn then
---                     latn = true
---                 end
---             end
---         end
---         if script == "auto" then
---             script = latn and "latn" or "dflt"
---         end
---         features.script = script
---         if trace_automode then
---             report_defining("auto script mode: using script '%s' in font '%s'",script,file.basename(tfmdata.properties.name))
---         end
---     end
---     if mode == "auto" then
---         local sequences = resources.sequences
---         if sequences and #sequences > 0 then
---             local script    = features.script   or "dflt"
---             local language  = features.language or "dflt"
---             for feature, value in next, features do
---                 if value then
---                     local found = false
---                     for i=1,#sequences do
---                         local sequence = sequences[i]
---                         local features = sequence.features
---                         if features then
---                             local scripts = features[feature]
---                             if scripts then
---                                 local languages = scripts[script]
---                                 if languages and languages[language] then
---                                     if found then
---                                         -- more than one lookup
---                                         if trace_automode then
---                                             report_defining("forcing node mode in font %s for feature %s, script %s, language %s (multiple lookups)",file.basename(tfmdata.properties.name),feature,script,language)
---                                         end
---                                         features.mode = "node"
---                                         return "node"
---                                     elseif needsnodemode[sequence.type] then
---                                         if trace_automode then
---                                             report_defining("forcing node mode in font %s for feature %s, script %s, language %s (no base support)",file.basename(tfmdata.properties.name),feature,script,language)
---                                         end
---                                         features.mode = "node"
---                                         return "node"
---                                     else
---                                         -- at least one lookup
---                                         found = true
---                                     end
---                                 end
---                             end
---                         end
---                     end
---                 end
---             end
---         end
---         return "base"
---     else
---         return mode
---     end
--- end
-
 local function checkedscript(tfmdata,resources,features)
     local latn = false
     local script = false
@@ -415,6 +344,38 @@ registerotffeature {
 --     },
 -- }
 
+local beforecopyingcharacters = sequencers.new {
+    name      = "beforecopyingcharacters",
+    arguments = "target,original",
+}
+
+appendgroup(beforecopyingcharacters,"before") -- user
+appendgroup(beforecopyingcharacters,"system") -- private
+appendgroup(beforecopyingcharacters,"after" ) -- user
+
+function constructors.beforecopyingcharacters(original,target)
+    local runner = beforecopyingcharacters.runner
+    if runner then
+        runner(original,target)
+    end
+end
+
+local aftercopyingcharacters = sequencers.new {
+    name      = "aftercopyingcharacters",
+    arguments = "target,original",
+}
+
+appendgroup(aftercopyingcharacters,"before") -- user
+appendgroup(aftercopyingcharacters,"system") -- private
+appendgroup(aftercopyingcharacters,"after" ) -- user
+
+function constructors.aftercopyingcharacters(original,target)
+    local runner = aftercopyingcharacters.runner
+    if runner then
+        runner(original,target)
+    end
+end
+
 --[[ldx--
 <p>So far we haven't really dealt with features (or whatever we want
 to pass along with the font definition. We distinguish the following
@@ -672,8 +633,11 @@ end
 
 -- todo: support a,b,c
 
+-- we need a copy as we will add (fontclass) goodies to the features and
+-- that is bad for a shared table
+
 local function splitcontext(features) -- presetcontext creates dummy here
-    return setups[features] or (presetcontext(features,"","") and setups[features])
+    return fastcopy(setups[features] or (presetcontext(features,"","") and setups[features]))
 end
 
 --~ local splitter = lpeg.splitat("=")
@@ -843,13 +807,13 @@ function commands.definefont_two(global,cs,str,size,inheritancemode,classfeature
     local lookup, name, sub, method, detail = getspecification(str or "")
     -- new (todo: inheritancemode)
     local designsize = fontdesignsize ~= "" and fontdesignsize or classdesignsize or ""
-    if designsize == "auto" or designsize == "default" then -- or any value
-        local okay = designsizefilename(name,size)
-        -- we don't catch detail here
+    local designname = designsizefilename(name,designsize,size)
+    if designname and designname ~= "" then
         if trace_defining or trace_designsize then
-            report_defining("remapping name: %s + size: %s => designsize: %s",name,size,okay)
+            report_defining("remapping name: %s, specification: %s, size: %s => designsize: %s",name,designsize,size,designname)
         end
-        local o_lookup, o_name, o_sub, o_method, o_detail = getspecification(okay)
+        -- we don't catch detail here
+        local o_lookup, o_name, o_sub, o_method, o_detail = getspecification(designname)
         if o_lookup and o_lookup ~= "" then lookup = o_lookup end
         if o_method and o_method ~= "" then method = o_method end
         if o_detail and o_detail ~= "" then detail = o_detail end
@@ -1067,6 +1031,50 @@ function constructors.calculatescale(tfmdata,scaledpoints,relativeid)
     return scaledpoints, delta
 end
 
+-- We overload the (generic) resolver:
+
+local resolvers    = definers.resolvers
+local hashfeatures = constructors.hashfeatures
+
+function definers.resolve(specification) -- overload function in font-con.lua
+    if not specification.resolved or specification.resolved == "" then -- resolved itself not per se in mapping hash
+        local r = resolvers[specification.lookup]
+        if r then
+            r(specification)
+        end
+    end
+    if specification.forced == "" then
+        specification.forced = nil
+    else
+        specification.forced = specification.forced
+    end
+    -- goodies are a context specific thing and not always defined
+    -- as feature, so we need to make sure we add them here before
+    -- hashing because otherwise we get funny goodies applied
+    local goodies = specification.goodies
+    if goodies and goodies ~= "" then
+        -- this adapts the features table so it has best be a copy
+        local normal = specification.features.normal
+        if not normal then
+            specification.features.normal = { goodies = goodies }
+        elseif not normal.goodies then
+            local g = normal.goodies
+            if g and g ~= "" then
+                normal.goodies = format("%s,%s",g,goodies)
+            else
+                normal.goodies = goodies
+            end
+        end
+    end
+    -- so far for goodie hacks
+    specification.hash = lower(specification.name .. ' @ ' .. hashfeatures(specification))
+    if specification.sub and specification.sub ~= "" then
+        specification.hash = specification.sub .. ' @ ' .. specification.hash
+    end
+    return specification
+end
+
+
 -- soon to be obsolete:
 
 local mappings = fonts.mappings
index 5f79170..10958cf 100644 (file)
@@ -214,17 +214,6 @@ function definers.resolve(specification)
     else
         specification.forced = specification.forced
     end
-    -- for the moment here (goodies set outside features)
-    local goodies = specification.goodies
-    if goodies and goodies ~= "" then
-        local normal = specification.features.normal
-        if not normal then
-            specification.features.normal = { goodies = goodies }
-        elseif not normal.goodies then
-            normal.goodies = goodies
-        end
-    end
-    --
     specification.hash = lower(specification.name .. ' @ ' .. constructors.hashfeatures(specification))
     if specification.sub and specification.sub ~= "" then
         specification.hash = specification.sub .. ' @ ' .. specification.hash
index 03eb207..97e97a6 100644 (file)
@@ -104,6 +104,9 @@ local function setgoodies(tfmdata,value)
         -- we need to check for duplicates
         local ok = loadgoodies(filename)
         if ok then
+            if trace_goodies then
+                report_goodies("assigning goodie '%s'",filename)
+            end
             goodies[#goodies+1] = ok
         end
     end
@@ -472,6 +475,7 @@ local function initialize(tfmdata)
                         -- As we want to set italic_correction (the context one) we need a
                         -- postprocessor instead of messing with the (unscaled) descriptions.
                         fontgoodies.registerpostprocessor(tfmdata, function(tfmdata) -- this is another tfmdata (a copy)
+                            -- better make a helper so that we have less code being defined
                             local properties = tfmdata.properties
                             local parameters = tfmdata.parameters
                             local characters = tfmdata.characters
@@ -581,7 +585,7 @@ fontgoodies.designsizes = designsizes
 local designdata        = allocate()
 designsizes.data        = designdata
 
-local function initialize(goodies)
+local function initialize(goodies) -- design sizes are registered global
     local gd = goodies.designsizes
     if gd then
         for name, data in next, gd do
@@ -622,21 +626,26 @@ function fontgoodies.designsizes.register(name,size,specification)
     end
 end
 
-function fontgoodies.designsizes.filename(name,size)
-    local data = designdata[lower(name)]
-    if data then
-        local ranges = data.ranges
-        if ranges and size ~= "default" then
-            for i=1,#ranges do
-                local r = ranges[i]
-                if r[1] >= size then -- todo: rounding so maybe size - 100
-                    return r[2]
+function fontgoodies.designsizes.filename(name,spec,size) -- returns nil of no match
+    if spec and spec ~= "" then
+        local data = designdata[lower(name)]
+        if data then
+            if spec == "default" then
+                return data.default
+            elseif spec == "auto" then
+                local ranges = data.ranges
+                if ranges then
+                    for i=1,#ranges do
+                        local r = ranges[i]
+                        if r[1] >= size then -- todo: rounding so maybe size - 100
+                            return r[2]
+                        end
+                    end
                 end
+                return data.default or (ranges and ranges[#ranges][2])
             end
         end
-        return data.default or (ranges and ranges[#ranges][2]) or name
     end
-    return name
 end
 
 -- The following file (husayni.lfg) is the experimental setup that we used
index 7351e71..ea0c0de 100644 (file)
       "\m_font_fallbacks",
       0\currentmathsize,
       \number\d_font_scaled_text_face,
-      "\number\relativefontid",                  % experiment
+      "\number\relativefontid",           % experiment
       "\m_font_class_goodies",            % experiment (not yet used)
       "\m_font_goodies",
       "\m_font_class_designsize",
index 2d7a588..d692c6c 100644 (file)
 %D runtime we have to load the default bodyfont size just before
 %D we start typesetting.
 
+\def\fallbacktypeface{modern-designsize} % at some point we might prefer just modern
+
 \def\font_preloads_reset_nullfont % this is needed because some macro packages (tikz) misuse \nullfont
-  {%\dorecurse7{\fontdimen\recurselevel\nullfont\zeropoint}% keep en eye on this as:
+  {\dorecurse\plusseven{\fontdimen\recurselevel\nullfont\zeropoint}% keep en eye on this as:
    \ctxcommand{resetnullfont()}% in luatex 0.70 this will also do the previous
    \globallet\font_preloads_reset_nullfont\relax}
 
 \def\font_preload_default_fonts
   {\font_preloads_reset
-   \setupbodyfont[modern,\fontstyle,\fontbody]%
+   \setupbodyfont[\fallbacktypeface,\fontstyle,\fontbody]%
    \showmessage\m!fonts6{fallback modern \fontstyle\normalspace\normalizedbodyfontsize}}
 
 \def\font_preload_default_fonts_mm
@@ -97,6 +99,7 @@
   {\ifx\fontclass\empty
      \writestatus\m!fonts{preloading latin modern fonts (third stage)}%
      \font_preload_default_fonts
+     \font_preloads_reset
    \else
      \font_preloads_reset
      \pushmacro\fontstyle
 % \unexpanded\def\checkpreloadedbodyfont % no \let here
 %   {\font_preloads_at_start_text}
 
-
 \protect \endinput
diff --git a/tex/context/base/java-imp-rhh.mkiv b/tex/context/base/java-imp-rhh.mkiv
new file mode 100644 (file)
index 0000000..5f057f5
--- /dev/null
@@ -0,0 +1,34 @@
+%D \module
+%D   [       file=java-rhh,
+%D        version=2010.02.01,
+%D          title=\CONTEXT\ JavaScript Macros,
+%D       subtitle=Runtime Highlight Hack,
+%D         author=Hans Hagen,
+%D           date=\currentdate,
+%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D As hightlighting is rather intrusive it makes sense to turn it off when
+%D using nice appearances.
+
+% app.runtimeHighlightColor = [ "T" ] ;
+%
+% var SavedAlwaysShowFocus = app.alwaysShowFocus ;
+% app.alwaysShowFocus  = true ;
+% "app.alwaysShowFocus  = SavedAlwaysShowFocus ; "
+
+\startJSpreamble RuntimeHighlightHack used now
+    var SavedHighlightState = app.runtimeHighlight ;
+    var SavedFocusRectState = app.focusRect ;
+    app.runtimeHighlight = false ;
+    app.focusRect        = true ;
+    this.setAction("WillClose",
+        "app.runtimeHighlight = SavedHighlightState ; " +
+        "app.focusRect        = SavedFocusRectState ; "
+    ) ;
+\stopJSpreamble
+
+\endinput
index ff9afe2..1e98de7 100644 (file)
@@ -174,7 +174,7 @@ end
 
 function javascripts.flushpreambles()
     local t = { }
-    if used then
+--     if used then -- we want to be able to enforce inclusion
         for i=1,#preambles do
             local preamble = preambles[i]
             if preamble[2] == "now" then
@@ -184,7 +184,7 @@ function javascripts.flushpreambles()
                 t[#t+1] = { preamble[1], preamble[3] }
             end
         end
-    end
+--     end
     return t
 end
 
index 1777f26..1aebe4e 100644 (file)
@@ -8,6 +8,8 @@ if not modules then modules = { } end modules ['lpdf-ano'] = {
 
 -- when using rotation: \disabledirectives[refences.sharelinks] (maybe flag links)
 
+-- todo: /AA << WC << ... >> >> : WillClose actions etc
+
 local next, tostring = next, tostring
 local rep, format = string.rep, string.format
 local texcount = tex.count
@@ -147,7 +149,7 @@ local function link(url,filename,destination,page,actions)
                     pdf_fit,
                 }
             }
-        else
+        elseif trace_references then
             report_reference("invalid page reference: %s",tostring(page))
         end
     end
index 1ccf418..3005253 100644 (file)
@@ -18,6 +18,42 @@ if not modules then modules = { } end modules ['lpdf-fld'] = {
 -- generated) MK behaviour built in. So ... hard to test. Unfortunately
 -- not even the default appearance is generated. This will probably be
 -- solved at some point.
+--
+-- Also, for some reason the viewer does not always show custom appearances
+-- when fields are being rolled over or clicked upon, and circles or checks
+-- pop up when you don't expect them. I fear that this kind of instability
+-- eventually will kill pdf forms. After all, the manual says: "individual
+-- annotation handlers may ignore this entry and provide their own appearances"
+-- and one might wonder what 'individual' means here, but effectively this
+-- renders the whole concept of appearances useless.
+--
+-- Okay, here is one observation. A pdf file contains objects and one might
+-- consider each one to be a static entity when read in. However, acrobat
+-- starts rendering and seems to manipulate (appearance streams) of objects
+-- in place (this is visible when the file is saved again). And, combined
+-- with some other caching and hashing, this might give side effects for
+-- shared objects. So, it seems that for some cases one can best be not too
+-- clever and not share but duplicate information. Of course this defeats the
+-- whole purpose of these objects. Of course I can be wrong.
+--
+-- A rarther weird side effect of the viewer is that the highlighting of fields
+-- obscures values, unless you uses one of the BS variants, and this makes
+-- custum appearances rather useless as there is no way to control this apart
+-- from changing the viewer preferences. It could of course be a bug but it would
+-- be nice if the highlighting was at least transparent. I have no clue why the
+-- built in shapes work ok (some xform based appearances are generated) while
+-- equally valid other xforms fail. It looks like acrobat appearances come on
+-- top (being refered to in the MK) while custom ones are behind the highlight
+-- rectangle. One can disable the "Show border hover color for fields" option
+-- in the preferences. If you load java-imp-rhh this side effect gets disabled
+-- and you get what you expect (it took me a while to figure out this hack).
+--
+-- When highlighting is enabled, those default symbols flash up, so it looks
+-- like we have some inteference between this setting and custom appearances.
+--
+-- Anyhow, the NeedAppearances is really needed in order to get a rendering
+-- for printing especially when highlighting (those colorfull foregrounds) is
+-- on.
 
 local gmatch, lower, format = string.gmatch, string.lower, string.format
 local lpegmatch = lpeg.match
@@ -71,7 +107,7 @@ local pdf_widget              = pdfconstant("Widget")
 local pdf_tx                  = pdfconstant("Tx")
 local pdf_ch                  = pdfconstant("Ch")
 local pdf_btn                 = pdfconstant("Btn")
-local pdf_yes                 = pdfconstant("Yes")
+----- pdf_yes                 = pdfconstant("Yes")
 local pdf_off                 = pdfconstant("Off")
 local pdf_p                   = pdfconstant("P") -- None Invert Outline Push
 local pdf_n                   = pdfconstant("N") -- None Invert Outline Push
@@ -88,31 +124,40 @@ function codeinjections.setformsmethod(name)
     submitoutputformat = formats[lower(name)] or formats.xml
 end
 
-local flag = {
-    MultiLine       =     4096, --  13
-    NoToggleToOff   =    16384, --  15
-    Radio           =    32768, --  16
-    PushButton      =    65536, --  17
-    PopUp           =   131072, --  18
-    Edit            =   262144, --  19
-    RadiosInUnison  = 33554432, --  26
-    DoNotSpellCheck =  4194304, --  23
-    DoNotScroll     =  8388608, --  24
-    ReadOnly        =        1, --   1
-    Required        =        2, --   2
-    NoExport        =        4, --   3
-    Password        =     8192, --  14
-    Sort            =   524288, --  20
-    FileSelect      =  1048576, --  21
+local flag = { -- /Ff
+    ReadOnly          =         1, --   1
+    Required          =         2, --   2
+    NoExport          =         4, --   3
+    MultiLine         =      4096, --  13
+    Password          =      8192, --  14
+    NoToggleToOff     =     16384, --  15
+    Radio             =     32768, --  16
+    PushButton        =     65536, --  17
+    PopUp             =    131072, --  18
+    Edit              =    262144, --  19
+    Sort              =    524288, --  20
+    FileSelect        =   1048576, --  21
+    DoNotSpellCheck   =   4194304, --  23
+    DoNotScroll       =   8388608, --  24
+    Comb              =  16777216, --  25
+    RichText          =  33554432, --  26
+    RadiosInUnison    =  33554432, --  26
+    CommitOnSelChange =  67108864, --  27
 }
 
-local plus = {
-    Invisible       =        1, --   1
-    Hidden          =        2, --   2
-    Printable       =        4, --   3
-    NoView          =       32, --   6
-    ToggleNoView    =      256, --   9
-    AutoView        =      256, -- 288 (6+9)
+local plus = { -- /F
+    Invisible         =         1, --   1
+    Hidden            =         2, --   2
+    Printable         =         4, --   3
+    Print             =         4, --   3
+    NoZoom            =         8, --   4
+    NoRotate          =        16, --   5
+    NoView            =        32, --   6
+    ReadOnly          =        64, --   7
+    Locked            =       128, --   8
+    ToggleNoView      =       256, --   9
+    LockedContents    =       512, --  10,
+    AutoView          =       256, -- 288 (6+9)
 }
 
 -- todo: check what is interfaced
@@ -132,7 +177,7 @@ plus.auto        = plus.AutoView
 
 -- some day .. lpeg with function or table
 
-local function fieldflag(specification)
+local function fieldflag(specification) -- /Ff
     local o, n = specification.option, 0
     if o and o ~= "" then
         for f in gmatch(o,"[^, ]+") do
@@ -142,13 +187,14 @@ local function fieldflag(specification)
     return n
 end
 
-local function fieldplus(specification)
+local function fieldplus(specification) -- /F
     local o, n = specification.option, 0
     if o and o ~= "" then
         for p in gmatch(o,"[^, ]+") do
             n = n + (plus[p] or 0)
         end
     end
+-- n = n + 4
     return n
 end
 
@@ -310,11 +356,17 @@ local function fieldappearances(specification)
         N = registeredsymbol(n), R = registeredsymbol(r), D = registeredsymbol(d),
     }
     return pdfshareobjectreference(appearance)
+--     return pdfreference(pdfflushobject(appearance))
 end
 
 local YesorOn = "Yes" -- somehow On is not always working out well any longer (why o why this change)
 
-local function fieldstates(specification,forceyes,values,default)
+-- beware ... maybe we should have unique /Yes1 ... we will probably
+-- change this one too.
+--
+-- TODO: the same as radio .. play safe and use different names.
+
+local function fieldstates_check(specification,forceyes,values,default,yesdefault)
     -- we don't use Opt here (too messy for radio buttons)
     local values, default = values or specification.values, default or specification.default
     if not values or values == "" then
@@ -353,13 +405,13 @@ local function fieldstates(specification,forceyes,values,default)
         offn, offr, offd = off[1], off[2], off[3]
     end
     if not yesvalue then
-        yesvalue = yesn
+        yesvalue = yesdefault or yesn
     end
     if not offvalue then
         offvalue = offn
     end
     if forceyes == true then
-        forceyes = forceyes and YesorOn -- spec likes Yes more but we've used On for ages now
+        forceyes = YesorOn -- spec likes Yes more but we've used On for ages now
     else
         -- false or string
     end
@@ -383,6 +435,91 @@ local function fieldstates(specification,forceyes,values,default)
         }
     end
     local appearanceref = pdfshareobjectreference(appearance)
+ -- local appearanceref = pdfreference(pdfflushobject(appearance))
+    return appearanceref, default, yesvalue
+end
+
+-- It looks like there is always a (MK related) symbol used and that
+-- the appearances are only used as ornaments behind a symbol. So,
+-- contrary to what we did when widgets showed up, we now limit
+-- ourself to more dumb definitions. Especially when highlighting is
+-- enabled weird interferences happen. So, we play safe (some nice code
+-- has been removed that worked well till recently).
+
+local function fieldstates_radio(specification,name,parent)
+    local values  = values  or specification.values
+    local default = default or parent.default -- specification.default
+    if not values or values == "" then
+        -- error
+        return
+    end
+    local v = settings_to_array(values)
+    local yes, off, yesn, yesr, yesd, offn, offr, offd
+    if #v == 1 then
+        yes, off = v[1], v[1]
+    else
+        yes, off = v[1], v[2]
+    end
+    -- yes keys might be the same in the three appearances within a field
+    -- but can best be different among fields ... don't ask why
+    local yessymbols, yesvalue = lpegmatch(splitter,yes) -- n,r,d=>x
+    if not (yessymbols and yesvalue) then
+        yessymbols = yes
+    end
+    if not yesvalue then
+        yesvalue = name
+    end
+    yessymbols = settings_to_array(yessymbols)
+    if #yessymbols == 1 then
+        yesn = yessymbols[1]
+        yesr = yesn
+        yesd = yesr
+    elseif #yessymbols == 2 then
+        yesn = yessymbols[1]
+        yesr = yessymbols[2]
+        yesd = yesr
+    else
+        yesn = yessymbols[1]
+        yesr = yessymbols[2]
+        yesd = yessymbols[3]
+    end
+    -- we don't care about names, as all will be /Off
+    local offsymbols = lpegmatch(splitter,off) or off
+    offsymbols = settings_to_array(offsymbols)
+    if #offsymbols == 1 then
+        offn = offsymbols[1]
+        offr = offn
+        offd = offr
+    elseif #offsymbols == 2 then
+        offn = offsymbols[1]
+        offr = offsymbols[2]
+        offd = offr
+    else
+        offn = offsymbols[1]
+        offr = offsymbols[2]
+        offd = offsymbols[3]
+    end
+    if default == name then
+        default = pdfconstant(name)
+    else
+        default = pdf_off
+    end
+    --
+    local appearance
+    if false then -- needs testing
+        appearance = pdfdictionary { -- maybe also cache components
+            N = pdfshareobjectreference(pdfdictionary { [name] = registeredsymbol(yesn), Off = registeredsymbol(offn) }),
+            R = pdfshareobjectreference(pdfdictionary { [name] = registeredsymbol(yesr), Off = registeredsymbol(offr) }),
+            D = pdfshareobjectreference(pdfdictionary { [name] = registeredsymbol(yesd), Off = registeredsymbol(offd) }),
+        }
+    else
+        appearance = pdfdictionary { -- maybe also cache components
+            N = pdfdictionary { [name] = registeredsymbol(yesn), Off = registeredsymbol(offn) },
+            R = pdfdictionary { [name] = registeredsymbol(yesr), Off = registeredsymbol(offr) },
+            D = pdfdictionary { [name] = registeredsymbol(yesd), Off = registeredsymbol(offd) }
+        }
+    end
+    local appearanceref = pdfshareobjectreference(appearance) -- pdfreference(pdfflushobject(appearance))
     return appearanceref, default, yesvalue
 end
 
@@ -433,14 +570,17 @@ local function todingbat(n)
     end
 end
 
+-- local zero_bc = pdfarray { 0, 0, 0 }
+-- local zero_bg = pdfarray { 1, 1, 1 }
+
 local function fieldrendering(specification)
     local bvalue = tonumber(specification.backgroundcolorvalue)
     local fvalue = tonumber(specification.framecolorvalue)
     local svalue = specification.fontsymbol
     if bvalue or fvalue or (svalue and svalue ~= "") then
         return pdfdictionary {
-            BG = bvalue and pdfarray { lpdf.colorvalues(3,bvalue) } or nil,
-            BC = fvalue and pdfarray { lpdf.colorvalues(3,fvalue) } or nil,
+            BG = bvalue and pdfarray { lpdf.colorvalues(3,bvalue) } or nil, -- or zero_bg,
+            BC = fvalue and pdfarray { lpdf.colorvalues(3,fvalue) } or nil, -- or zero_bc,
             CA = svalue and pdfstring (svalue) or nil,
         }
     end
@@ -775,7 +915,10 @@ local function save_kid(field,specification,d,optname)
     local kn = pdfreserveannotation()
     field.kids[#field.kids+1] = pdfreference(kn)
     if optname then
-        field.opt[#field.opt+1] = optname
+        local opt = field.opt
+        if opt then
+            opt[#opt+1] = optname
+        end
     end
     local width, height, depth = specification.width or 0, specification.height or 0, specification.depth
     local box = hpack_node(pdfannotation_node(width,height,depth,d(),kn))
@@ -959,7 +1102,7 @@ local function makecheckchild(name,specification)
         d.MK = fieldrendering(specification)
         return save_kid(parent,specification,d)
     else
-        local appearance, default, value = fieldstates(field,true)
+        local appearance, default, value = fieldstates_check(field,true)
         d.AS = default
         d.AP = appearance
         return save_kid(parent,specification,d,value)
@@ -1034,18 +1177,78 @@ function methods.push(name,specification)
 end
 
 local function makeradioparent(field,specification)
-    specification = enhance(specification,"Radio,RadiosInUnison")
+--     specification = enhance(specification,"Radio,RadiosInUnison")
+    specification = enhance(specification,"Radio,RadiosInUnison,Print,NoToggleToOff")
+--     specification = enhance(specification,"Radio,Print,NoToggleToOff")
     local d = pdfdictionary {
         T  = field.name,
         FT = pdf_btn,
-        F  = fieldplus(specification),
+--         F  = fieldplus(specification),
         Ff = fieldflag(specification),
-        H  = pdf_n,
+--         H  = pdf_n,
         V  = fielddefault(field),
     }
     save_parent(field,specification,d,true)
 end
 
+-- local function makeradiochild(name,specification)
+--     local field, parent = clones[name], nil
+--     if field then
+--         field = radios[field.parent]
+--         parent = fields[field.parent]
+--         if not parent.pobj then
+--             if trace_fields then
+--                 report_fields("forcing parent radio '%s'",parent.name)
+--             end
+--             makeradioparent(parent,parent)
+--         end
+--     else
+--         field = radios[name]
+--         if not field then
+--             report_fields("there is some problem with field '%s'",name)
+--             return nil
+--         end
+--         parent = fields[field.parent]
+--         if not parent.pobj then
+--             if trace_fields then
+--                 report_fields("using parent radio '%s'",name)
+--             end
+--             makeradioparent(parent,parent)
+--         end
+--     end
+--     if trace_fields then
+--         report_fields("using child radio '%s' with values '%s' and default '%s'",name,field.values or "?",field.default or "?")
+--     end
+--     local fontsymbol = specification.fontsymbol
+-- fontsymbol="star"
+--     local d = pdfdictionary {
+--         Subtype = pdf_widget,
+--         Parent  = pdfreference(parent.pobj),
+--         F       = fieldplus(specification),
+--         OC      = fieldlayer(specification),
+--         AA      = fieldactions(specification),
+--         H       = pdf_n,
+--     }
+--     if fontsymbol and fontsymbol ~= "" then
+-- local appearance, default, value = fieldstates_radio(field,true,false,false,name) -- false is also ok
+--         specification.fontsymbol = todingbat(fontsymbol)
+--         specification.fontstyle = "symbol"
+--         specification.fontalternative = "dingbats"
+--         d.DA = fieldsurrounding(specification)
+--         d.MK = fieldrendering(specification)
+-- d.AS = pdfconstant(value) -- default -- mandate when AP but confuses viewers
+-- d.AP = appearance
+--         return save_kid(parent,specification,d,value)
+--     --         return save_kid(parent,specification,d,name)
+--     else
+--     --         local appearance, default, value = fieldstates_radio(field,true) -- false is also ok
+--         local appearance, default, value = fieldstates_radio(field,true,false,false,name) -- false is also ok
+--         d.AS = default -- mandate when AP but confuses viewers
+--         d.AP = appearance
+--         return save_kid(parent,specification,d,value)
+--     end
+-- end
+
 local function makeradiochild(name,specification)
     local field, parent = clones[name], nil
     if field then
@@ -1075,6 +1278,7 @@ local function makeradiochild(name,specification)
         report_fields("using child radio '%s' with values '%s' and default '%s'",name,field.values or "?",field.default or "?")
     end
     local fontsymbol = specification.fontsymbol
+ -- fontsymbol = "circle"
     local d = pdfdictionary {
         Subtype = pdf_widget,
         Parent  = pdfreference(parent.pobj),
@@ -1089,13 +1293,11 @@ local function makeradiochild(name,specification)
         specification.fontalternative = "dingbats"
         d.DA = fieldsurrounding(specification)
         d.MK = fieldrendering(specification)
-        return save_kid(parent,specification,d)
-    else
-        local appearance, default, value = fieldstates(field,true) -- false is also ok
-        d.AS = default -- needed ?
-        d.AP = appearance
-        return save_kid(parent,specification,d,value)
     end
+    local appearance, default, value = fieldstates_radio(field,name,fields[field.parent])
+    d.AP = appearance
+    d.AS = default -- /Whatever
+    return save_kid(parent,specification,d,value)
 end
 
 function methods.sub(name,specification)
similarity index 99%
copy from tex/context/base/m-visual.tex
copy to tex/context/base/m-visual.mkii
index 314630e..ae52f65 100644 (file)
 %D test \type{\bodyfontgrid}\space test
 %D test \type{\emexgrid}    \space test
 
-
 \def\smashedgrid
   {\dosingleempty\dosmashedgrid}
 
similarity index 64%
rename from tex/context/base/m-visual.tex
rename to tex/context/base/m-visual.mkiv
index 314630e..5d259f6 100644 (file)
 %D needed them for manuals and styles. The macros are documented
 %D in a my way document.
 
-%D For Mojca:
-%D
-%D \starttyping
-%D \def\simplethesis
-%D   {\setupsystem[random=1234]
-%D    \title{\fakewords{3}{4}}
-%D    \placelist[chapter,section]
-%D    \dorecurse{6}
-%D      {\chapter{\fakewords{5}{10}}
-%D       \dorecurse{5}
-%D         {\section{\fakewords{2}{5}}
-%D          \dorecurse{2}
-%D            {\dorecurse{3}{\fakewords{100}{200}\endgraf}
-%D             \placefigure{\fakewords{8}{15}}{\fakefigure{5cm}{3cm}{10cm}{5cm}}
-%D             \dorecurse{2}{\fakewords{100}{200}\endgraf}}}}}
-%D
-%D \starttext
-%D   \simplethesis
-%D \stoptext
-%D \stoptyping
-
 \definecolor[fakerulecolor]     [black]
 \definecolor[fakebaselinecolor] [green]
 \definecolor[fakeparindentcolor][blue]
 
 \newif\iffakebaseline \fakebaselinetrue
 
-\def\fakerule#1%
+\unexpanded\def\fakerule#1%
   {\strut
-   \startcolor[fakerulecolor]%
+   \begingroup
+   \directcolored[fakerulecolor]%
    \iffakebaseline
      \vrule\!!height1.25ex\!!depth-.05ex\!!width#1%
      \kern-#1%
    \else
      \vrule\!!height1.25ex\!!depth .25ex\!!width#1%
    \fi
-   \stopcolor
+   \endgroup
    \allowbreak}
 
-\def\dorandomrecurse#1%
+\unexpanded\def\dorandomrecurse#1%
   {\getrandomcount\scratchcounter{1}{#1}%
    \dorecurse\scratchcounter}
 
    \removeunwantedspaces
    \egroup}
 
-\def\showfakewords{\let\dofakewords\doshowfakewords}
+\unexpanded\def\showfakewords
+  {\let\dofakewords\doshowfakewords}
 
-\def\fakeword
+\unexpanded\def\fakeword
   {\fakewords{1}{1}} % no \plusone
 
-\def\fakeparindent
+\unexpanded\def\fakeparindent
   {\noindent
    \ifindentation
      \ifx\dofakedroppedcaps\relax
         \llap{\fakeparindentcolor\box\scratchbox}}%
    \fi}
 
-\newcounter\noffakedfigures
-
-\unexpanded\def\showfakefigure
-  {\donetrue\dodoubleempty\dofakefigure}
-
 \unexpanded\def\fakefigure
-  {\donefalse\dodoubleempty\dofakefigure}
+  {\dodoubleempty\dofakefigure}
 
 \def\dofakefigure[#1][#2]#3#4#5#6% [] [] minwidth maxwidth minheight maxheight
-  {\doglobal\increment\noffakedfigures
-   \ifdone
-     \endgraf
-     \hbox to \hsize
-      {\hss\fakeparindentcolor
-       \strut\bf Figure \noffakedfigures
-       \doifsomething{#1}{\space(#1)}%
-       \hss}
-     \endgraf
-   \fi
-   \getvalue{\e!place\v!figure}
+  {\getvalue{\e!place\v!figure}
      [#1][#2]%
      {\freezerandomseed
       \let\endstrut\relax
       \doifinsetelse{#1}{\v!left,\v!right}
         {\fakewords{2}{4}}
         {\fakewords{4}{10}}}%
-     {\getrandomdimen{\dimen0}{#3}{#4}%
-      \getrandomdimen{\dimen2}{#5}{#6}%
-      \doifinset{#1}{\v!left,\v!right}
+     {\doifinset{#1}{\v!left,\v!right}
         {\dimen0=.75\dimen0
          \ifdim\dimen0>.6\hsize \dimen0=.5\hsize\fi
          \ifdim\dimen0<.3\hsize \dimen0=.3\hsize\fi}%
         {\bf\white#1}}%
    \defrostrandomseed}
 
-\def\fakeformula
+\unexpanded\def\fakeimage#1#2#3#4%
+  {\getrandomdimen{\dimen0}{#1}{#3}%
+   \getrandomdimen{\dimen2}{#2}{#4}%
+   \framed
+     [\c!width=\dimen0,
+      \c!height=\dimen2,
+      \c!frame=\v!off,
+      \c!background=\v!color,
+      \c!backgroundcolor=fakeparindentcolor]
+     {}}
+
+\unexpanded\def\fakeformula
   {\dimen0\zeropoint
    \getrandomcount\scratchcounter{3}{6}%
    \dorecurse\scratchcounter
       \advance\scratchdimen\dimen0}%
    =\mathinner{\red\fakerule\scratchdimen}}
 
-\def\fakespacingformula
+\unexpanded\def\fakespacingformula
   {\color[fakebaselinecolor]{\ruledbaseline}\fakeformula}
 
 %D test \type{\bodyfontgrid}\space test
 %D test \type{\emexgrid}    \space test
 
-
-\def\smashedgrid
+\unexpanded\def\smashedgrid
   {\dosingleempty\dosmashedgrid}
 
 \def\dosmashedgrid[#1]%
          \black\vrule\!!width6\linewidth\!!height3\linewidth\!!depth3\linewidth
          \hss}}}
 
-\def\bodyfontgrid
+\unexpanded\def\bodyfontgrid
   {\hbox
      {{\linewidth.1pt\yellow\smashedgrid[\c!nx=30,\c!ny=30,\c!scale=.3333]}%
       {\linewidth.2pt\green \smashedgrid[\c!nx=20,\c!ny=20,\c!scale=.5]}%
       {\linewidth.3pt\red   \smashedgrid[\c!nx=10,\c!ny=10,\c!scale=1]}}}
 
-\def\emexgrid
+\unexpanded\def\emexgrid
   {\hbox
      {{\linewidth.15pt\green\smashedgrid[\c!nx=20,\c!ny=20,\c!unit=ex]}%
       {\linewidth.15pt\red  \smashedgrid[\c!nx=10,\c!ny=10,\c!unit=em]}}}
 
-%D The next few macros are not really public and kind of low
-%D level. They are obscure and a bit perverse.
-
-\definecolor[llblack][s=0.01]
-
-\def\lowlevelstream#1#2#3%
-  {\ifinotr \else
-     \dontleavehmode
-     \prewordbreak
-     \bgroup\bgroup % make sure aftergroup stuff is handled
-    %\let#1#2\optimizetransparencyfalse\black
-     \infofont\clap{\vl}\ignorespaces#3\unskip\clap{\vl}%
-     \egroup\egroup
-     \prewordbreak
-   \fi
-   #2{#3}}
-
-\let\normalPDFcode\PDFcode
-
-\def\showlowlevelstream
-  {\def\PDFcode{\lowlevelstream\PDFcode\normalPDFcode}%
-   \def\special{\lowlevelstream\special\normalspecial}}
-
-\def\showlowlevelstreamonly
-  {\def\PDFcode{\lowlevelstream\PDFcode\gobbleoneargument}%
-   \def\special{\lowlevelstream\special\gobbleoneargument}}
-
-\startnotmode[mkiv]
-
-    \let\normaldostartgraymode     \dostartgraymode
-    \let\normaldostartgraycolormode\dostartgraycolormode
-    \let\normaldostartrgbcolormode \dostartrgbcolormode
-    \let\normaldostartcmykcolormode\dostartcmykcolormode
-    \let\normaldostartspotcolormode\dostartspotcolormode
-
-    \def\traceddostartgraymode#1%
-      {#1\normaldostartgraymode{#1}}
-
-    \def\traceddostartgraycolormode#1%
-      {#1\normaldostartgraycolormode{#1}}
-
-    \def\traceddostartrgbcolormode#1#2#3%
-      {#1 #2 #3\normaldostartrgbcolormode{#1}{#2}{#3}}
-
-    \def\traceddostartcmykcolormode#1#2#3#4%
-      {#1 #2 #3 #4\normaldostartcmykcolormode{#1}{#2}{#3}{#4}}
-
-    \def\traceddostartspotcolormode#1#2%
-      {#1 #2\normaldostartspotcolormode{#1}{#2}}
-
-    \def\showcolormodes
-      {\let\dostartgraymode     \traceddostartgraymode
-       \let\dostartgraycolormode\traceddostartgraycolormode
-       \let\dostartrgbcolormode \traceddostartrgbcolormode
-       \let\dostartcmykcolormode\traceddostartcmykcolormode
-       \let\dostartspotcolormode\traceddostartspotcolormode}
+%D For Mojca:
 
-\stopnotmode
+\unexpanded\def\simplethesis
+  {\setupsystem[random=1234]
+   \title{\fakewords{3}{4}}
+   \placelist[chapter,section]
+   \dorecurse{6}
+     {\chapter{\fakewords{5}{10}}
+      \dorecurse{5}
+        {\section{\fakewords{2}{5}}
+         \dorecurse{2}
+           {\dorecurse{3}{\fakewords{100}{200}\endgraf}
+            \placefigure{\fakewords{8}{15}}{\fakeimage{5cm}{3cm}{10cm}{5cm}}
+            \dorecurse{2}{\fakewords{100}{200}\endgraf}}}}}
+
+\continueifinputfile{m-visual.mkiv}
+
+\starttext
+    \simplethesis
+\stoptext
 
 \protect \endinput
index cc058bf..278d323 100644 (file)
@@ -14,23 +14,23 @@ local mathematics    = mathematics
 local sequencers     = utilities.sequencers
 local appendgroup    = sequencers.appendgroup
 local appendaction   = sequencers.appendaction
-local mathprocessor  = nil
 
-local mathactions = sequencers.reset {
+local mathfontparameteractions = sequencers.new {
+    name      = "mathparameters",
     arguments = "target,original",
 }
 
+appendgroup("mathparameters","before") -- user
+appendgroup("mathparameters","system") -- private
+appendgroup("mathparameters","after" ) -- user
+
 function fonts.constructors.assignmathparameters(original,target)
-    if mathactions.dirty then -- maybe use autocompile
-        mathprocessor = sequencers.compile(mathactions)
+    local runner = mathfontparameteractions.runner
+    if runner then
+        runner(original,target)
     end
-    mathprocessor(original,target)
 end
 
-appendgroup(mathactions,"before") -- user
-appendgroup(mathactions,"system") -- private
-appendgroup(mathactions,"after" ) -- user
-
 function mathematics.initializeparameters(target,original)
     local mathparameters = original.mathparameters
     if mathparameters and next(mathparameters) then
@@ -38,7 +38,7 @@ function mathematics.initializeparameters(target,original)
     end
 end
 
-sequencers.appendaction(mathactions,"system","mathematics.initializeparameters")
+sequencers.appendaction("mathparameters","system","mathematics.initializeparameters")
 
 local how = {
  -- RadicalKernBeforeDegree         = "horizontal",
@@ -50,9 +50,9 @@ local how = {
 
 function mathematics.scaleparameters(target,original)
     if not target.properties.math_is_scaled then
--- print("\n",target.properties.fontname)
--- print(original.mathparameters.DisplayOperatorMinHeight)
--- print(target.mathparameters.DisplayOperatorMinHeight)
+     -- print("\n",target.properties.fontname)
+     -- print(original.mathparameters.DisplayOperatorMinHeight)
+     -- print(target.mathparameters.DisplayOperatorMinHeight)
         local mathparameters = target.mathparameters
         if mathparameters and next(mathparameters) then
             local parameters = target.parameters
@@ -70,18 +70,18 @@ function mathematics.scaleparameters(target,original)
                 else
                     value = value * factor
                 end
--- if name == "DisplayOperatorMinHeight" then
---     report_math("f: %s, p: %s, h: %s, b: %s, a: %s",target.properties.fontname,name,h or "scaled",mathparameters[name],value)
--- end
+             -- if name == "DisplayOperatorMinHeight" then
+             --     report_math("f: %s, p: %s, h: %s, b: %s, a: %s",target.properties.fontname,name,h or "scaled",mathparameters[name],value)
+             -- end
                 mathparameters[name] = value
             end
         end
--- print(mathparameters.DisplayOperatorMinHeight)
+     -- print(mathparameters.DisplayOperatorMinHeight)
         target.properties.math_is_scaled = true
     end
 end
 
-sequencers.appendaction(mathactions,"system","mathematics.scaleparameters")
+sequencers.appendaction("mathparameters","system","mathematics.scaleparameters")
 
 function mathematics.checkaccentbaseheight(target,original)
     local mathparameters = target.mathparameters
@@ -90,7 +90,7 @@ function mathematics.checkaccentbaseheight(target,original)
     end
 end
 
-sequencers.appendaction(mathactions,"system","mathematics.checkaccentbaseheight")
+sequencers.appendaction("mathparameters","system","mathematics.checkaccentbaseheight")
 
 function mathematics.checkprivateparameters(target,original)
     local mathparameters = target.mathparameters
@@ -104,7 +104,7 @@ function mathematics.checkprivateparameters(target,original)
     end
 end
 
-sequencers.appendaction(mathactions,"system","mathematics.checkprivateparameters")
+sequencers.appendaction("mathparameters","system","mathematics.checkprivateparameters")
 
 function mathematics.overloadparameters(target,original)
     local mathparameters = target.mathparameters
@@ -149,4 +149,56 @@ function mathematics.overloadparameters(target,original)
     end
 end
 
-sequencers.appendaction(mathactions,"system","mathematics.overloadparameters")
+sequencers.appendaction("mathparameters","system","mathematics.overloadparameters")
+
+local function applytweaks(when,target,original)
+    local goodies = original.goodies
+    if goodies then
+        for i=1,#goodies do
+            local goodie = goodies[i]
+            local mathematics = goodie.mathematics
+            local tweaks = mathematics and mathematics.tweaks
+            if tweaks then
+                tweaks = tweaks[when]
+                if tweaks then
+                    if trace_defining then
+                        report_math("tweaking math of '%s' @ %s (%s)",target.properties.fullname,target.parameters.size,when)
+                    end
+                    for i=1,#tweaks do
+                        local tweak= tweaks[i]
+                        local tvalue = type(tweak)
+                        if tvalue == "function" then
+                            tweak(target,original)
+                        end
+                    end
+                end
+            end
+        end
+    end
+end
+
+function mathematics.tweakbeforecopyingfont(target,original)
+    local mathparameters = target.mathparameters -- why not hasmath
+    if mathparameters then
+        applytweaks("beforecopying",target,original)
+    end
+end
+
+function mathematics.tweakaftercopyingfont(target,original)
+    local mathparameters = target.mathparameters -- why not hasmath
+    if mathparameters then
+        applytweaks("aftercopying",target,original)
+    end
+end
+
+sequencers.appendaction("beforecopyingcharacters","system","mathematics.tweakbeforecopyingfont")
+sequencers.appendaction("aftercopyingcharacters", "system","mathematics.tweakaftercopyingfont")
+
+-- a couple of predefined tewaks:
+
+local tweaks       = { }
+mathematics.tweaks = tweaks
+
+function tweaks.fixbadprime(target,original)
+    target.characters[0xFE325] = target.characters[0x2032]
+end
index 96c122f..43a511e 100644 (file)
 
 %D Now we define all the colon relations .. needs checking with char-def.lua:
 
-\definemathcommand [centercolon]      [rel] {\mathpalette\vcenter{\hbox{$\mathsurround\zeropoint\colon$}}}
+\definemathcommand [centercolon]      [rel] {\mathstylevcenteredhbox\colon}
 \definemathcommand [colonminus]       [rel] {\centercolon\colonsep\mathrel{-}}
 \definemathcommand [minuscolon]       [rel] {\mathrel{-}\colonsep\centercolon}
 \definemathcommand [colonequals]      [rel] {\centercolon\colonsep=}
index 663f6bb..5445228 100644 (file)
@@ -134,16 +134,19 @@ local escapes = characters.filters.utf.private.escapes
 
 local setmathcharacter, setmathsynonym, setmathsymbol -- once updated we will inline them
 
+-- beware ... we only set the math character once ... which is why we
+-- have the 'done' checking below
+
 if setmathcode then
 
-    setmathcharacter = function(class,family,slot,unicode,firsttime)
-        if not firsttime and class <= 7 then
+    setmathcharacter = function(class,family,slot,unicode)
+        if class <= 7 then
             setmathcode(slot,{class,family,unicode or slot})
         end
     end
 
-    setmathsynonym = function(class,family,slot,unicode,firsttime)
-        if not firsttime and class <= 7 then
+    setmathsynonym = function(class,family,slot,unicode,setcode)
+        if setcode and class <= 7 then
             setmathcode(slot,{class,family,unicode})
         end
         if class == classes.open or class == classes.close then
@@ -180,14 +183,14 @@ if setmathcode then
 
 else
 
-    setmathcharacter = function(class,family,slot,unicode,firsttime)
-        if not firsttime and class <= 7 then
+    setmathcharacter = function(class,family,slot,unicode)
+        if class <= 7 then
             contextsprint(mathcode(slot,class,family,unicode or slot))
         end
     end
 
-    setmathsynonym = function(class,family,slot,unicode,firsttime)
-        if not firsttime and class <= 7 then
+    setmathsynonym = function(class,family,slot,unicode,setcode)
+        if setcode and class <= 7 then
             contextsprint(mathcode(slot,class,family,unicode))
         end
         if class == classes.open or class == classes.close then
@@ -241,6 +244,7 @@ function mathematics.define(family)
     local data = characters.data
     for unicode, character in next, data do
         local symbol = character.mathsymbol
+        local setcode = true
         if symbol then
             local other = data[symbol]
             local class = other.mathclass
@@ -249,7 +253,8 @@ function mathematics.define(family)
                 if trace_defining then
                     report(class,family,unicode,symbol)
                 end
-                setmathsynonym(class,family,unicode,symbol)
+                setmathsynonym(class,family,unicode,symbol,setcode)
+                setcode = false
             end
             local spec = other.mathspec
             if spec then
@@ -257,7 +262,8 @@ function mathematics.define(family)
                     local class = m.class
                     if class then
                         class = classes[class] or class -- no real checks needed
-                        setmathsynonym(class,family,unicode,symbol,i)
+                        setmathsynonym(class,family,unicode,symbol,setcode)
+                        setcode = false
                     end
                 end
             end
@@ -288,7 +294,10 @@ function mathematics.define(family)
                             end
                         end
                     end
-                    setmathcharacter(class,family,unicode,unicode,i)
+                    if setcode then
+                        setmathcharacter(class,family,unicode,unicode)
+                        setcode = false
+                    end
                 end
             end
         end
index 0e65c8d..fa29e49 100644 (file)
 %
 % \typebuffer \getbuffer
 
+% most math fonts have messed up primes, just test this: $\prime^{\prime^{\prime}}$
+
 { \catcode\circumflexasciicode\othercatcode       \global\let\othercircumflextoken      ^ }
 { \catcode\circumflexasciicode\superscriptcatcode \global\let\superscriptcircumflextoken^ }
 
 \let\math_prime_indeed_normal\prime
 
 \appendtoks
-    \let\math_prime_indeed_normal\prime       % gets defined later
-    \let\prime\math_prime_indeed % so this is needed
+    \let\math_prime_indeed_normal\prime    % gets defined later
+    \let\mathfontprime\prime               % for tracing
+    \let\prime\math_prime_indeed           % so this is needed
 \to \everydump
 
 \unexpanded\def\math_prime_indeed
      {#1\scriptstyle      {#2}}%
      {#1\scriptscriptstyle{#2}}}
 
+%D Often we can use:
+%D
+%D \startbuffer
+%D $x^{\mathstylehbox{x^{\mathstylehbox{x}}}}$
+%D \stopbuffer
+%D
+%D \typebuffer \getbuffer
+
+\unexpanded\def\mathstylehbox#1%
+  {\normalexpanded{\hbox\bgroup
+     $\triggermathstyle\normalmathstyle}\mathsurround\zeropoint#1$\egroup}
+
+\unexpanded\def\mathstylevbox#1%
+  {\normalexpanded{\vbox\bgroup
+     $\triggermathstyle\normalmathstyle}\mathsurround\zeropoint#1$\egroup}
+
+\unexpanded\def\mathstylevcenter#1%
+  {\normalexpanded{\vcenter\bgroup
+     $\triggermathstyle\normalmathstyle}\mathsurround\zeropoint#1$\egroup}
+
+\unexpanded\def\mathstylevcenteredhbox#1%
+  {\normalexpanded{\vcenter\bgroup\hbox\bgroup
+     $\triggermathstyle\normalmathstyle}\mathsurround\zeropoint#1$\egroup\egroup}
+
+\unexpanded\def\mathstylevcenteredvbox#1%
+  {\normalexpanded{\vcenter\bgroup\vbox\bgroup
+     $\triggermathstyle\normalmathstyle}\mathsurround\zeropoint#1$\egroup\egroup}
+
 %D Something similar can be used in the (re|)|definition
 %D of \type {\text}. This version is a variation on the one
 %D in the math module (see \type{m-math} and|/|or \type
index fe50b47..8caf21c 100644 (file)
@@ -38,7 +38,7 @@ local trace_collapsing    = false  trackers.register("math.collapsing",  functio
 local trace_goodies       = false  trackers.register("math.goodies",     function(v) trace_goodies     = v end)
 local trace_variants      = false  trackers.register("math.variants",    function(v) trace_variants    = v end)
 local trace_italics       = false  trackers.register("math.italics",     function(v) trace_italics     = v end)
-local trace_italics       = false  trackers.register("math.families",    function(v) trace_families    = v end)
+local trace_families      = false  trackers.register("math.families",    function(v) trace_families    = v end)
 
 local check_coverage      = true   directives.register("math.checkcoverage", function(v) check_coverage = v end)
 
@@ -57,6 +57,7 @@ local mlist_to_hlist      = node.mlist_to_hlist
 local font_of_family      = node.family_font
 local insert_node_after   = node.insert_after
 local free_node           = node.free
+local new_node            = node.new -- todo: pool: math_noad math_sub
 
 local new_kern            = nodes.pool.kern
 
@@ -389,7 +390,7 @@ respace[math_char] = function(pointer,what,n,parent) -- not math_noad .. math_ch
                                         local lc = chardata[last_char]
                                         lc = lc and lc.category
                                         if lc == "nd" or lc == "ll" or lc == "lu" then
-                                            local ord = node.new(math_noad) -- todo: pool
+                                            local ord = new_node(math_noad) -- todo: pool
                                             ord.subtype, ord.nucleus, ord.sub, ord.sup, ord.attr = noad_ord, next_noad.nucleus, next_noad.sub, next_noad.sup, next_noad.attr
                                         --  next_noad.nucleus, next_noad.sub, next_noad.sup, next_noad.attr = nil, nil, nil, nil
                                             next_noad.nucleus, next_noad.sub, next_noad.sup = nil, nil, nil -- else crash with attributes ref count
@@ -545,7 +546,7 @@ local function replace(pointer,what,n,parent)
         if start_super == stop_super then
             pointer.sup = start_super.nucleus
         else
-            local list = node.new(math_sub) -- todo attr
+            local list = new_node(math_sub) -- todo attr
             list.head = start_super
             pointer.sup = list
         end
@@ -558,7 +559,7 @@ local function replace(pointer,what,n,parent)
         if start_sub == stop_sub then
             pointer.sub = start_sub.nucleus
         else
-            local list = node.new(math_sub) -- todo attr
+            local list = new_node(math_sub) -- todo attr
             list.head = start_sub
             pointer.sub = list
         end
@@ -933,12 +934,13 @@ end
 tasks.new {
     name      = "math",
     arguments = 2,
+    processor = utilities.sequencers.nodeprocessor,
     sequence  = {
         "before",
         "normalizers",
         "builders",
         "after",
-    }
+    },
 }
 
 tasks.freezegroup("math", "normalizers") -- experimental
index 366d69d..f117b6b 100644 (file)
 \def\MPonrightpage{true}
 \def\MPonoddpage  {true}
 
-% obsolete (but keep the code)
-%
-% \def\freezeMPpagelayout
-%   {\edef\MPonrightpage{\doifbothsides  {tru}{tru}{fals}e}%
-%    \edef\MPonoddpage  {\doifoddpageelse     {tru}{fals}e}}
-%
-% \let\freezeMPlayout\relax % obsolete
+\def\freezeMPpagelayout
+  {\edef\MPonrightpage{\doifbothsides  {tru}{tru}{fals}e}%
+   \edef\MPonoddpage  {\doifoddpageelse     {tru}{fals}e}}
 
 %D We need to freeze the pagelayout before the backgrounds
 %D are build, because the overlay will temporarily become
 %D zero (overlay).
 
-% obsolete (but keep the code)
-%
-% \appendtoks
-%     \freezeMPpagelayout
-% \to \everybeforepagebody
+\appendtoks
+    \freezeMPpagelayout
+\to \everybeforepagebody
 
 %D By freezing these value every graphic, we can use layout
 %D variables that change halfways a page, whatever use that
 \newtoks\MPsavedtextareadata
 \newtoks\MPtextareadata
 \newtoks\MPlocaltextareadata
+\newtoks\MPregionareadata
 
 % optimaliseren voor herhaling
 
 \newif\iftracetextareas
 
-% \def\registerMPtextarea#1%
-%   {\ifpositioning
-%      \bgroup
-%      \global\advance\currentMPtextareadata\plusone
-%     %\hpos{gbd:\the\currentMPtextareadata}{#1}%
-%      \hpos{gbd:\the\currentMPtextareadata}%
-%        {\iftracetextareas\boxrulewidth1.5pt\ruledhbox\fi{#1}}%
-%      \edef\!!stringa{gbd:\the\currentMPtextareadata}%
-%      \edef\!!stringa{RegisterTextArea(%
-%        \MPx\!!stringa,\MPy\!!stringa,%
-%        \MPw\!!stringa,\MPh\!!stringa,\MPd\!!stringa);}%
-%      \@EA \doglobal \@EA \appendtoks \!!stringa \to \MPtextareadata
-%      \egroup
-%    \else
-%      \hbox{#1}%
-%    \fi}
-
-% \def\registerMPlocaltextarea#1%
-%   {\ifpositioning
-%      \bgroup
-%      \global\advance\currentMPtextareadata\plusone
-%     %\hpos{gbd:\the\currentMPtextareadata}{#1}%
-%      \hpos{gbd:\the\currentMPtextareadata}%
-%        {\iftracetextareas\boxrulewidth3pt\ruledhbox\fi{#1}}%
-%      \edef\!!stringa{gbd:\the\currentMPtextareadata}%
-%      \edef\!!stringa{RegisterLocalTextArea(%
-%        \MPx\!!stringa,\MPy\!!stringa,%
-%        \MPw\!!stringa,\MPh\!!stringa,\MPd\!!stringa);}%
-%      \global\MPlocaltextareadata\@EA{\!!stringa}%
-%      \egroup
-%    \else
-%      \hbox{#1}%
-%    \fi}
-
 \unexpanded\def\globalregisterMPtextarea{\normalexpanded{\global\MPtextareadata{\the\MPtextareadata
-  RegisterTextArea(%
-   \MPx\currentMPtextarea,%
-   \MPy\currentMPtextarea,%
-   \MPw\currentMPtextarea,%
-   \MPh\currentMPtextarea,%
-   \MPd\currentMPtextarea%
-  );}}}
+  RegisterTextArea(\MPxywhd\currentMPtextarea);}}}
 
 \unexpanded\def\localregisterMPtextarea{\normalexpanded{\global\MPlocaltextareadata{%
-  RegisterLocalTextArea(%
-   \MPx\currentMPtextarea,%
-   \MPy\currentMPtextarea,%
-   \MPw\currentMPtextarea,%
-   \MPh\currentMPtextarea,%
-   \MPd\currentMPtextarea%
-  );}}}
+  RegisterLocalTextArea(\MPxywhd\currentMPtextarea);}}}
 
 \unexpanded\def\registerMPtextareaindeed#1#2%
   {\ifpositioning
 \unexpanded\def\resetMPlocaltextarea
   {\global\MPlocaltextareadata\emptytoks}
 
-\startMPextensions
-    path PlainTextArea;
-\stopMPextensions
-
 \startMPinitializations
     ResetTextAreas;
     \the\MPsavedtextareadata;
     ResetTextAreas;
     \the\MPtextareadata;
     \the\MPlocaltextareadata;
-    PlainTextArea:=boundingbox(\MPxy{text:\realfolio}--\MPxy{text:\realfolio}
-        shifted (\MPw{text:\realfolio},\MPh{text:\realfolio}));
+    RegisterPlainTextArea(\MPxywhd\textanchor);
+    RegisterRegionTextArea(\MPxywhd\regionanchor);
 \stopMPinitializations
 
 \appendtoks
index 0827b43..deac9d5 100644 (file)
@@ -274,9 +274,9 @@ function metapost.flush(result,flusher,askedfig)
         local figures = result.fig
         if figures then
             flusher = flusher or metapost.flushers.pdf
-            local resetplugins = metapost.resetplugins or ignore
-            local processplugins = metapost.processplugins or ignore
-            local pluginactions = metapost.pluginactions or ignore
+            local resetplugins = metapost.resetplugins or ignore -- before figure
+            local processplugins = metapost.processplugins or ignore -- each object
+            local pluginactions = metapost.pluginactions or ignore -- before / after
             local startfigure = flusher.startfigure
             local stopfigure = flusher.stopfigure
             local flushfigure = flusher.flushfigure
@@ -447,7 +447,7 @@ function metapost.parse(result,askedfig)
     if result then
         local figures = result.fig
         if figures then
-            local analyzeplugins = metapost.analyzeplugins
+            local analyzeplugins = metapost.analyzeplugins -- each object
             for f=1, #figures do
                 local figure = figures[f]
                 local fignum = figure:charcode() or 0
index 85766a8..e6459df 100644 (file)
@@ -624,9 +624,9 @@ local resetter  = nil
 local analyzer  = nil
 local processor = nil
 
-local resetteractions  = sequencers.reset { arguments = "" }
-local analyzeractions  = sequencers.reset { arguments = "object,prescript" }
-local processoractions = sequencers.reset { arguments = "object,prescript,before,after" }
+local resetteractions  = sequencers.new { arguments = "" }
+local analyzeractions  = sequencers.new { arguments = "object,prescript" }
+local processoractions = sequencers.new { arguments = "object,prescript,before,after" }
 
 appendgroup(resetteractions, "system")
 appendgroup(analyzeractions, "system")
@@ -654,12 +654,12 @@ local function splitscript(script)
     return hash
 end
 
-function metapost.pluginactions(what,t,flushfigure) -- to be checked: too many 0 g 0 G
+function metapost.pluginactions(what,t,flushfigure) -- before/after object, depending on what
     for i=1,#what do
         local wi = what[i]
         if type(wi) == "function" then
             -- assume injection
-            flushfigure(t)
+            flushfigure(t) -- to be checked: too many 0 g 0 G
             t = { }
             wi()
         else
@@ -669,18 +669,23 @@ function metapost.pluginactions(what,t,flushfigure) -- to be checked: too many 0
     return t
 end
 
-function metapost.resetplugins()
+function metapost.resetplugins() -- intialize plugins, before figure
+    -- plugins can have been added
+    resetter  = resetteractions .runner
+    analyzer  = analyzeractions .runner
+    processor = processoractions.runner
+    -- let's apply one runner
     resetter()
 end
 
-function metapost.analyzeplugins(object)
+function metapost.analyzeplugins(object) -- each object (first pass)
     local prescript = object.prescript   -- specifications
     if prescript and #prescript > 0 then
         return analyzer(object,splitscript(prescript))
     end
 end
 
-function metapost.processplugins(object) -- maybe environment table
+function metapost.processplugins(object) -- each object (second pass)
     local prescript = object.prescript   -- specifications
     if prescript and #prescript > 0 then
         local before = { }
@@ -1048,8 +1053,8 @@ appendaction(processoractions,"system",tr_process) -- last, as color can be rese
 
 appendaction(processoractions,"system",la_process)
 
--- no auto here
+-- we're nice and set them already
 
-resetter  = sequencers.compile(resetteractions )
-analyzer  = sequencers.compile(analyzeractions )
-processor = sequencers.compile(processoractions)
+resetter  = resetteractions .runner
+analyzer  = analyzeractions .runner
+processor = processoractions.runner
index af36a1e..b4c6ad0 100644 (file)
     \unexpanded\def\mult_interfaces_install_parameter_set_handler#1#2#3#4#5#6%
       {\ifx#2\relax\let#2\empty\fi
        \unexpanded\def#3##1{\expandafter \def\csname#1#2:##1\endcsname}%        ##1 {##2} (braces are mandate)
-       \unexpanded\def#4##1{\expandafter\edef\csname#1#2:##1\endcsname}%       ##1 {##2} (braces are mandate)
+       \unexpanded\def#4##1{\expandafter\edef\csname#1#2:##1\endcsname}%        ##1 {##2} (braces are mandate)
        \unexpanded\def#5##1{\expandafter \let\csname#1#2:##1\endcsname}%        ##1 ##2
        \unexpanded\def#6##1{\expandafter \let\csname#1#2:##1\endcsname\empty}}% ##1
 
         \edef#8{##2}%
         \mult_interfaces_get_parameters{#1#4:}[\s!parent=#1##2,##3]%
       \else\ifsecondargument
-%         \doifassignmentelse{##2}
-%           {\let#8\empty
-%            \mult_interfaces_get_parameters{#1#4:}[\s!parent=#3,##2]}
-%           {\edef#8{##2}%
-%            \mult_interfaces_get_parameters{#1#4:}[\s!parent=#1##2]}%
         \mult_check_for_assignment##2=@@\_end_
         \ifassignment
           \let#8\empty
         \expandafter\noexpand\csname current#2parent\endcsname
         \expandafter\noexpand\csname saved_defined_#2\endcsname}}
 
-\unexpanded\def\mult_interfaces_install_setup_handler#1#2#3#4#5#6#7%
+\unexpanded\def\mult_interfaces_install_setup_handler#1#2#3#4#5#6#7#8%
   {\ifx#3\relax\let#3\empty\fi
    \unexpanded\def#2{\dodoubleempty#4}%
    \unexpanded\def#6{\mult_interfaces_get_parameters{#1#3:}}% no every ! don't change it
    \newtoks#5%
+   \newtoks#8%
    \def#4[##1][##2]% maybe helper
      {\let#7#3%
       \ifsecondargument
         \mult_interfaces_get_parameters{#1:}[##1]%
         \the#5%
       \fi
-      \let#3#7}}
+      \let#3#7%
+      \the#8}}
 
 \unexpanded\def\installsetuphandler#1#2%
   {\normalexpanded
         \expandafter\noexpand\csname setup_#2\endcsname % semi-public
         \expandafter\noexpand\csname everysetup#2\endcsname
         \expandafter\noexpand\csname setupcurrent#2\endcsname
-        \expandafter\noexpand\csname saved_setup_current#2\endcsname}}
+        \expandafter\noexpand\csname saved_setup_current#2\endcsname
+        \expandafter\noexpand\csname everysetup#2root\endcsname}}
 
 \let\doingrootsetupnamed\plusone    % \setuplayout[name][key=value]
 \let\doingrootsetuproot \plustwo    % \setuplayout      [key=value]
    \unexpanded\def#2{\dodoubleempty#4}%
    \unexpanded\def#5{\mult_interfaces_get_parameters{#1#3:}}}
 
-\unexpanded\def\mult_interfaces_install_switch_setup_handler_b#1#2#3#4#5#6#7#8%
+\unexpanded\def\mult_interfaces_install_switch_setup_handler_b#1#2#3#4#5#6#7#8#9%
   {\newtoks#5%
    \newconstant#2%
    \newtoks#8%
+   \newtoks#9%
    \ifx#6\relax\let#6\empty\fi
    \def#4[##1][##2]% maybe helper
      {\ifsecondargument % no commalist here
         \the#5%
         \the#8% switchsetups
       \fi\fi
-      #2\zerocount}} % mode is always zero at the end
+      #2\zerocount % mode is always zero at the end
+      \the#9}}
 
 \unexpanded\def\installswitchsetuphandler#1#2%
   {\normalexpanded
         \expandafter\noexpand\csname everysetup#2\endcsname
         \expandafter\noexpand\csname previous#2\endcsname
         \expandafter\noexpand\csname saved_setup_current#2\endcsname
-        \expandafter\noexpand\csname everyswitch#2\endcsname}}
+        \expandafter\noexpand\csname everyswitch#2\endcsname
+        \expandafter\noexpand\csname everysetup#2root\endcsname}}
 
 \unexpanded\def\mult_interfaces_install_auto_setup_handler#1#2#3#4#5#6#7#8%
   {\ifx#3\relax\let#3\empty\fi
index 78421a5..98c60cb 100644 (file)
 \setinterfaceconstant{alignsymbol}{alignsymbol}
 \setinterfaceconstant{aligntitle}{titelausrichten}
 \setinterfaceconstant{alternative}{alternative}
+\setinterfaceconstant{anchor}{anchor}
 \setinterfaceconstant{andtext}{andtext}
 \setinterfaceconstant{apa}{apa}
 \setinterfaceconstant{arrow}{pfeil}
 \setinterfaceconstant{reference}{referenz}
 \setinterfaceconstant{referenceprefix}{referenceprefix}
 \setinterfaceconstant{referencing}{referieren}
+\setinterfaceconstant{region}{region}
 \setinterfaceconstant{regionin}{regionin}
 \setinterfaceconstant{regionout}{regionaus}
 \setinterfaceconstant{repeat}{wiederholen}
 \setinterfaceconstant{textcolor}{textfarbe}
 \setinterfaceconstant{textcommand}{textbefehl}
 \setinterfaceconstant{textdistance}{textdistance}
+\setinterfaceconstant{textheight}{texthoehe}
 \setinterfaceconstant{textlayer}{textlayer}
 \setinterfaceconstant{textmargin}{textmargin}
 \setinterfaceconstant{textmethod}{textmethod}
index d311452..1af1c96 100644 (file)
@@ -6449,6 +6449,10 @@ return {
   },
  },
  ["constants"]={
+  ["anchor"]={
+   ["en"]="anchor",
+   ["nl"]="anker",
+  },
   ["buffer"]={
    ["en"]="buffer",
   },
@@ -7529,7 +7533,7 @@ return {
    ["en"]="directory",
    ["fr"]="repertoire",
    ["it"]="directory",
-   ["nl"]="gebied",
+   ["nl"]="directory",
    ["pe"]="پوشه",
    ["ro"]="director",
   },
@@ -9589,6 +9593,10 @@ return {
    ["pe"]="مراجعه",
    ["ro"]="referinta",
   },
+  ["region"]={
+   ["en"]="region",
+   ["nl"]="gebied",
+  },
   ["regionin"]={
    ["cs"]="oblastuvnitr",
    ["de"]="regionin",
@@ -10561,6 +10569,16 @@ return {
    ["pe"]="سبک‌متن",
    ["ro"]="stiltext",
   },
+  ["textheight"]={
+   ["cs"]="vyskatextu",
+   ["de"]="texthoehe",
+   ["en"]="textheight",
+   ["fr"]="hauteurtexte",
+   ["it"]="altezzatesto",
+   ["nl"]="teksthoogte",
+   ["pe"]="ارتفاع‌متن",
+   ["ro"]="inaltimetext",
+  },
   ["textwidth"]={
    ["cs"]="sirkatextu",
    ["de"]="textbreite",
index 8213150..681fb2a 100644 (file)
 \setinterfaceconstant{alignsymbol}{alignsymbol}
 \setinterfaceconstant{aligntitle}{aligntitle}
 \setinterfaceconstant{alternative}{alternative}
+\setinterfaceconstant{anchor}{anchor}
 \setinterfaceconstant{andtext}{andtext}
 \setinterfaceconstant{apa}{apa}
 \setinterfaceconstant{arrow}{arrow}
 \setinterfaceconstant{reference}{reference}
 \setinterfaceconstant{referenceprefix}{referenceprefix}
 \setinterfaceconstant{referencing}{referencing}
+\setinterfaceconstant{region}{region}
 \setinterfaceconstant{regionin}{regionin}
 \setinterfaceconstant{regionout}{regionout}
 \setinterfaceconstant{repeat}{repeat}
 \setinterfaceconstant{textcolor}{textcolor}
 \setinterfaceconstant{textcommand}{textcommand}
 \setinterfaceconstant{textdistance}{textdistance}
+\setinterfaceconstant{textheight}{textheight}
 \setinterfaceconstant{textlayer}{textlayer}
 \setinterfaceconstant{textmargin}{textmargin}
 \setinterfaceconstant{textmethod}{textmethod}
index 6a9275c..fa545c4 100644 (file)
 \setinterfaceconstant{alignsymbol}{alignsymbol}
 \setinterfaceconstant{aligntitle}{alignementtitre}
 \setinterfaceconstant{alternative}{alternative}
+\setinterfaceconstant{anchor}{anchor}
 \setinterfaceconstant{andtext}{andtext}
 \setinterfaceconstant{apa}{apa}
 \setinterfaceconstant{arrow}{fleche}
 \setinterfaceconstant{reference}{reference}
 \setinterfaceconstant{referenceprefix}{referenceprefix}
 \setinterfaceconstant{referencing}{referencing}
+\setinterfaceconstant{region}{region}
 \setinterfaceconstant{regionin}{entreregion}
 \setinterfaceconstant{regionout}{regionexterieure}
 \setinterfaceconstant{repeat}{repete}
 \setinterfaceconstant{textcolor}{couleurtexte}
 \setinterfaceconstant{textcommand}{commandetexte}
 \setinterfaceconstant{textdistance}{distancetexte}
+\setinterfaceconstant{textheight}{hauteurtexte}
 \setinterfaceconstant{textlayer}{calquetexte}
 \setinterfaceconstant{textmargin}{margetexte}
 \setinterfaceconstant{textmethod}{textmethod}
index 2431539..34fa737 100644 (file)
 \setinterfaceconstant{alignsymbol}{alignsymbol}
 \setinterfaceconstant{aligntitle}{allineatitolo}
 \setinterfaceconstant{alternative}{alternativa}
+\setinterfaceconstant{anchor}{anchor}
 \setinterfaceconstant{andtext}{andtext}
 \setinterfaceconstant{apa}{apa}
 \setinterfaceconstant{arrow}{freccia}
 \setinterfaceconstant{reference}{riferimento}
 \setinterfaceconstant{referenceprefix}{referenceprefix}
 \setinterfaceconstant{referencing}{referencing}
+\setinterfaceconstant{region}{region}
 \setinterfaceconstant{regionin}{entraregione}
 \setinterfaceconstant{regionout}{esciregione}
 \setinterfaceconstant{repeat}{ripeti}
 \setinterfaceconstant{textcolor}{coloretesto}
 \setinterfaceconstant{textcommand}{comandotesto}
 \setinterfaceconstant{textdistance}{distanzatesto}
+\setinterfaceconstant{textheight}{altezzatesto}
 \setinterfaceconstant{textlayer}{textlayer}
 \setinterfaceconstant{textmargin}{textmargin}
 \setinterfaceconstant{textmethod}{textmethod}
index 2a68e0c..c08247a 100644 (file)
@@ -97,11 +97,17 @@ return {
         "starttext", "stoptext", "startdocument", "stopdocument", "documentvariable",
         "startmodule", "stopmodule", "usemodule",
         --
+        "enablemode", "disablemode", "preventmode", "pushmode", "popmode",
+        --
         "typescriptone", "typescripttwo", "typescriptthree", "mathsizesuffix",
         --
         "mathordcode", "mathopcode", "mathbincode", "mathrelcode", "mathopencode", "mathclosecode",
         "mathpunctcode", "mathalphacode", "mathinnercode", "mathnothingcode", "mathlimopcode",
         "mathnolopcode", "mathboxcode", "mathchoicecode", "mathaccentcode", "mathradicalcode",
+        --
+        "constantnumber", "constantnumberargument", "constantdimen", "constantdimenargument", "constantemptyargument",
+        --
+        "continueifinputfile",
     },
     ["helpers"] = {
         --
@@ -114,11 +120,19 @@ return {
         "starttexdefinition", "stoptexdefinition",
         "starttexcode", "stoptexcode",
         --
+        "doifsetupselse", "doifsetups", "doifnotsetups", "setup", "setups", "texsetup", "xmlsetup", "luasetup", "directsetup",
+        --
+        "newmode", "setmode", "resetmode",
+        "newsystemmode", "setsystemmode", "resetsystemmode", "pushsystemmode", "popsystemmode",
+        "booleanmodevalue",
+        --
         "newcount", "newdimen", "newskip", "newmuskip", "newbox", "newtoks", "newread", "newwrite", "newmarks", "newinsert", "newattribute", "newif",
         "newlanguage", "newfamily", "newfam", "newhelp", -- not used
         --
         "then",
         --
+        "donothing", "dontcomplain",
+        --
         "donetrue", "donefalse",
         --
         "htdp",
@@ -182,7 +196,7 @@ return {
         --
         "singleexpandafter", "doubleexpandafter", "tripleexpandafter",
         --
-        "dontleavehmode",
+        "dontleavehmode", "removelastspace", "removeunwantedspaces",
         --
         "wait", "writestatus", "define", "redefine",
         --
@@ -228,6 +242,6 @@ return {
         --
         "startnointerference", "stopnointerference",
         --
-        "strut", "setstrut", "strutbox", "strutht", "strutdp", "strutwd",
+        "strut", "setstrut", "strutbox", "strutht", "strutdp", "strutwd", "begstrut", "endstrut",
     }
 }
index f817876..5d1d4dc 100644 (file)
 \setinterfaceconstant{alignsymbol}{alignsymbol}
 \setinterfaceconstant{aligntitle}{titeluitlijnen}
 \setinterfaceconstant{alternative}{variant}
+\setinterfaceconstant{anchor}{anker}
 \setinterfaceconstant{andtext}{andtext}
 \setinterfaceconstant{apa}{apa}
 \setinterfaceconstant{arrow}{pijl}
 \setinterfaceconstant{depth}{diepte}
 \setinterfaceconstant{depthcorrection}{dieptecorrectie}
 \setinterfaceconstant{direction}{richting}
-\setinterfaceconstant{directory}{gebied}
+\setinterfaceconstant{directory}{directory}
 \setinterfaceconstant{display}{scherm}
 \setinterfaceconstant{distance}{afstand}
 \setinterfaceconstant{dot}{punt}
 \setinterfaceconstant{reference}{verwijzing}
 \setinterfaceconstant{referenceprefix}{referenceprefix}
 \setinterfaceconstant{referencing}{refereren}
+\setinterfaceconstant{region}{gebied}
 \setinterfaceconstant{regionin}{gebiedin}
 \setinterfaceconstant{regionout}{gebieduit}
 \setinterfaceconstant{repeat}{herhaal}
 \setinterfaceconstant{textcolor}{tekstkleur}
 \setinterfaceconstant{textcommand}{tekstcommando}
 \setinterfaceconstant{textdistance}{tekstafstand}
+\setinterfaceconstant{textheight}{teksthoogte}
 \setinterfaceconstant{textlayer}{tekstlaag}
 \setinterfaceconstant{textmargin}{tekstmarge}
 \setinterfaceconstant{textmethod}{tekstmethode}
index 98bfcb4..5c7da3b 100644 (file)
 \setinterfaceconstant{alignsymbol}{alignsymbol}
 \setinterfaceconstant{aligntitle}{عنوان‌تنظیم}
 \setinterfaceconstant{alternative}{جایگزین}
+\setinterfaceconstant{anchor}{anchor}
 \setinterfaceconstant{andtext}{andtext}
 \setinterfaceconstant{apa}{apa}
 \setinterfaceconstant{arrow}{پیکان}
 \setinterfaceconstant{reference}{مرجع}
 \setinterfaceconstant{referenceprefix}{referenceprefix}
 \setinterfaceconstant{referencing}{مراجعه}
+\setinterfaceconstant{region}{region}
 \setinterfaceconstant{regionin}{ناحیه‌درون}
 \setinterfaceconstant{regionout}{ناحیه‌بیرون}
 \setinterfaceconstant{repeat}{تکرار}
 \setinterfaceconstant{textcolor}{رنگ‌متن}
 \setinterfaceconstant{textcommand}{فرمان‌متن}
 \setinterfaceconstant{textdistance}{فاصله‌متن}
+\setinterfaceconstant{textheight}{ارتفاع‌متن}
 \setinterfaceconstant{textlayer}{لایه‌متن}
 \setinterfaceconstant{textmargin}{حاشیه‌متن}
 \setinterfaceconstant{textmethod}{روش‌متن}
index d16f1cc..2590b5e 100644 (file)
 \setinterfaceconstant{alignsymbol}{alignsymbol}
 \setinterfaceconstant{aligntitle}{alinieretitlu}
 \setinterfaceconstant{alternative}{alternativ}
+\setinterfaceconstant{anchor}{anchor}
 \setinterfaceconstant{andtext}{andtext}
 \setinterfaceconstant{apa}{apa}
 \setinterfaceconstant{arrow}{sageata}
 \setinterfaceconstant{reference}{referinta}
 \setinterfaceconstant{referenceprefix}{referenceprefix}
 \setinterfaceconstant{referencing}{referinta}
+\setinterfaceconstant{region}{region}
 \setinterfaceconstant{regionin}{regiuneintrare}
 \setinterfaceconstant{regionout}{regiuneiesire}
 \setinterfaceconstant{repeat}{repeta}
 \setinterfaceconstant{textcolor}{culoaretext}
 \setinterfaceconstant{textcommand}{comandatext}
 \setinterfaceconstant{textdistance}{textdistance}
+\setinterfaceconstant{textheight}{inaltimetext}
 \setinterfaceconstant{textlayer}{textlayer}
 \setinterfaceconstant{textmargin}{textmargin}
 \setinterfaceconstant{textmethod}{textmethod}
index b9bb640..beb069a 100644 (file)
 \definesystemconstant  {counter}
 \definesystemconstant  {single}
 \definesystemconstant  {multi}
+\definesystemconstant  {indeed}
 
 \definesystemconstant  {hasnumber}
 \definesystemconstant  {hastitle}
 \definesystemvariable {gi}   % Graphic Instance
 \definesystemvariable {gv}   % Graphic Variable
 \definesystemvariable {ha}   % HAng
-\definesystemvariable {hf}   % Helpers Framed
 \definesystemvariable {id}   % Index
 \definesystemvariable {ih}   % InHoudsopgave
 \definesystemvariable {il}   % stelInvulRegelsin
 \definesystemvariable {xp}   % XML Processing (xtag, so still needed)
 \definesystemvariable {za}   % layout adapt % ZetspiegelAanpassing
 \definesystemvariable {zc}   % columns
-\definesystemvariable {zo}   % otr
 
 % still used but defined locally
 
index a7246e9..43624ad 100644 (file)
@@ -312,6 +312,8 @@ local function link(head,tail,list,currentfont,currentattr)
                     tail = n
                 end
             end
+        else
+            -- permitting nil is convenient
         end
     end
     return head, tail
index b19ef55..dc14102 100644 (file)
@@ -180,6 +180,7 @@ local function inject_list(id,current,reference,make,stack,pardir,txtdir)
         width = - width
     end
     local result, resolved = make(width,height,depth,reference)
+    -- todo: only when width is ok
     if result and resolved then
         if trace_backend then
             report_area("box: %04i %s %s: w=%s, h=%s, d=%s, c=%s",reference,pardir or "---",txtdir or "----",width,height,depth,resolved)
@@ -296,7 +297,6 @@ end
 
 -- tracing
 
-
 local nodepool       = nodes.pool
 
 local new_rule       = nodepool.rule
@@ -312,7 +312,7 @@ local u_transparency = nil
 local u_colors       = { }
 local force_gray     = true
 
-local function colorize(width,height,depth,n)
+local function colorize(width,height,depth,n,reference,what)
     if force_gray then n = 0 end
     u_transparency = u_transparency or transparencies.register(nil,2,.65)
     local ucolor = u_colors[n]
@@ -330,11 +330,12 @@ local function colorize(width,height,depth,n)
         u_colors[n] = u_color
     end
     if width == 0 then
-        report_area("reference %s has no horizontal dimensions: width=%s, height=%s, depth=%s",reference,width,height,depth)
+        -- probably a strut as placeholder
+        report_area("%s %s has no horizontal dimensions: width=%s, height=%s, depth=%s",what,reference,width,height,depth)
         width = 65536
     end
     if height + depth <= 0 then
-        report_area("reference %s has no vertical dimensions: width=%s, height=%s, depth=%s",reference,width,height,depth)
+        report_area("%s %s has no vertical dimensions: width=%s, height=%s, depth=%s",what,reference,n,width,height,depth)
         height = 65536/2
         depth  = height
     end
@@ -407,7 +408,7 @@ local function makereference(width,height,depth,reference)
             local result, current
             if trace_references then
                 local step = 65536
-                result = hpack_list(colorize(width,height-step,depth-step,2,reference)) -- step subtracted so that we can see seperate links
+                result = hpack_list(colorize(width,height-step,depth-step,2,reference,"reference")) -- step subtracted so that we can see seperate links
                 result.width = 0
                 current = result
             end
@@ -476,7 +477,7 @@ local function makedestination(width,height,depth,reference)
                 width, height, depth = 5*step, 5*step, 0
             end
             for n=1,#name do
-                local rule = hpack_list(colorize(width,height,depth,3,reference))
+                local rule = hpack_list(colorize(width,height,depth,3,reference,"destination"))
                 rule.width = 0
                 if not result then
                     result, current = rule, rule
index a78393b..efc5191 100644 (file)
@@ -18,16 +18,18 @@ local report_tasks = logs.reporter("tasks")
 
 local allocate = utilities.storage.allocate
 
-local nodes      = nodes
+local nodes         = nodes
 
-nodes.tasks      = nodes.tasks or { }
-local tasks      = nodes.tasks
+nodes.tasks         = nodes.tasks or { }
+local tasks         = nodes.tasks
 
-local tasksdata  = { } -- no longer public
+local tasksdata     = { } -- no longer public
 
-local sequencers = utilities.sequencers
+local sequencers    = utilities.sequencers
+local compile       = sequencers.compile
+local nodeprocessor = sequencers.nodeprocessor
 
-local frozengroups = "no"
+local frozengroups  = "no"
 
 function tasks.freeze(kind)
     frozengroups = kind or "tolerant" -- todo: hook into jobname
@@ -38,13 +40,16 @@ function tasks.new(specification) -- was: name,arguments,list
     local arguments = specification.arguments or 0
     local sequence  = specification.sequence
     if name and sequence then
-        local tasklist = sequencers.reset()
+        local tasklist = sequencers.new {
+            -- we can move more to the sequencer now .. todo
+        }
         tasksdata[name] = {
             list      = tasklist,
             runner    = false,
             arguments = arguments,
          -- sequence  = sequence,
             frozen    = { },
+            processor = specification.processor or nodeprocessor
         }
         for l=1,#sequence do
             sequencers.appendgroup(tasklist,sequence[l])
@@ -154,7 +159,7 @@ end
 function tasks.showactions(name,group,action,where,kind)
     local data = valid(name)
     if data then
-        report_tasks("task %s, list:\n%s",name,sequencers.nodeprocessor(data.list))
+        report_tasks("task %s, list:\n%s",name,nodeprocessor(data.list))
     end
 end
 
@@ -173,8 +178,6 @@ statistics.register("node list callback tasks", function()
     end
 end)
 
-local compile, nodeprocessor = sequencers.compile, sequencers.nodeprocessor
-
 function tasks.actions(name) -- we optimize for the number or arguments (no ...)
     local data = tasksdata[name]
     if data then
@@ -188,7 +191,7 @@ function tasks.actions(name) -- we optimize for the number or arguments (no ...)
                     if trace_tasks then
                         report_tasks("creating runner '%s'",name)
                     end
-                    runner = compile(data.list,nodeprocessor,0)
+                    runner = compile(data.list,data.processor,0)
                     data.runner = runner
                 end
                 return runner(head)
@@ -202,7 +205,7 @@ function tasks.actions(name) -- we optimize for the number or arguments (no ...)
                     if trace_tasks then
                         report_tasks("creating runner '%s' with 1 extra arguments",name)
                     end
-                    runner = compile(data.list,nodeprocessor,1)
+                    runner = compile(data.list,data.processor,1)
                     data.runner = runner
                 end
                 return runner(head,one)
@@ -216,7 +219,7 @@ function tasks.actions(name) -- we optimize for the number or arguments (no ...)
                     if trace_tasks then
                         report_tasks("creating runner '%s' with 2 extra arguments",name)
                     end
-                    runner = compile(data.list,nodeprocessor,2)
+                    runner = compile(data.list,data.processor,2)
                     data.runner = runner
                 end
                 return runner(head,one,two)
@@ -230,7 +233,7 @@ function tasks.actions(name) -- we optimize for the number or arguments (no ...)
                     if trace_tasks then
                         report_tasks("creating runner '%s' with 3 extra arguments",name)
                     end
-                    runner = compile(data.list,nodeprocessor,3)
+                    runner = compile(data.list,data.processor,3)
                     data.runner = runner
                 end
                 return runner(head,one,two,three)
@@ -244,7 +247,7 @@ function tasks.actions(name) -- we optimize for the number or arguments (no ...)
                     if trace_tasks then
                         report_tasks("creating runner '%s' with 4 extra arguments",name)
                     end
-                    runner = compile(data.list,nodeprocessor,4)
+                    runner = compile(data.list,data.processor,4)
                     data.runner = runner
                 end
                 return runner(head,one,two,three,four)
@@ -258,7 +261,7 @@ function tasks.actions(name) -- we optimize for the number or arguments (no ...)
                     if trace_tasks then
                         report_tasks("creating runner '%s' with 5 extra arguments",name)
                     end
-                    runner = compile(data.list,nodeprocessor,5)
+                    runner = compile(data.list,data.processor,5)
                     data.runner = runner
                 end
                 return runner(head,one,two,three,four,five)
@@ -272,7 +275,7 @@ function tasks.actions(name) -- we optimize for the number or arguments (no ...)
                     if trace_tasks then
                         report_tasks("creating runner '%s' with n extra arguments",name)
                     end
-                    runner = compile(data.list,nodeprocessor,"n")
+                    runner = compile(data.list,data.processor,"n")
                     data.runner = runner
                 end
                 return runner(head,...)
@@ -315,6 +318,7 @@ end
 tasks.new {
     name      = "processors",
     arguments = 4,
+    processor = nodeprocessor,
     sequence  = {
         "before",      -- for users
         "normalizers",
@@ -329,6 +333,7 @@ tasks.new {
 tasks.new {
     name      = "finalizers",
     arguments = 1,
+    processor = nodeprocessor,
     sequence  = {
         "before",      -- for users
         "normalizers",
@@ -343,6 +348,7 @@ tasks.new {
 tasks.new {
     name      = "shipouts",
     arguments = 0,
+    processor = nodeprocessor,
     sequence  = {
         "before",      -- for users
         "normalizers",
@@ -354,6 +360,7 @@ tasks.new {
 tasks.new {
     name      = "mvlbuilders",
     arguments = 1,
+    processor = nodeprocessor,
     sequence  = {
         "before",      -- for users
         "normalizers",
@@ -364,6 +371,7 @@ tasks.new {
 tasks.new {
     name      = "vboxbuilders",
     arguments = 5,
+    processor = nodeprocessor,
     sequence  = {
         "before",      -- for users
         "normalizers",
@@ -371,22 +379,24 @@ tasks.new {
     }
 }
 
---~ tasks.new {
---~     name      = "parbuilders",
---~     arguments = 1,
---~     sequence  = {
---~         "before",      -- for users
---~         "lists",
---~         "after",       -- for users
---~     }
---~ }
-
---~ tasks.new {
---~     name      = "pagebuilders",
---~     arguments = 5,
---~     sequence  = {
---~         "before",      -- for users
---~         "lists",
---~         "after",       -- for users
---~     }
---~ }
+-- tasks.new {
+--     name      = "parbuilders",
+--     arguments = 1,
+--     processor = nodeprocessor,
+--     sequence  = {
+--         "before",      -- for users
+--         "lists",
+--         "after",       -- for users
+--     }
+-- }
+
+-- tasks.new {
+--     name      = "pagebuilders",
+--     arguments = 5,
+--     processor = nodeprocessor,
+--     sequence  = {
+--         "before",      -- for users
+--         "lists",
+--         "after",       -- for users
+--     }
+-- }
index 68201a6..05e0df6 100644 (file)
    \dontcomplain
    \edef\p_pack_layers_option{\layerparameter\c!option}%
    \ifx\p_pack_layers_option\v!test
+     \settrue\c_pack_layers_trace
      \traceboxplacementtrue
    \fi
    \edef\m_pack_layers_target{#2}%
    \edef\p_pack_layers_method{\layerparameter\c!method}%
    \edef\p_pack_layers_option{\layerparameter\c!option}%
    \ifx\p_pack_layers_option\v!test
+     \settrue\c_pack_layers_trace
      \traceboxplacementtrue
    \fi
    \ifcase#1\relax
index 6980f0b..43dcef7 100644 (file)
    \c!frameradius=\framedparameter\c!radius,
    \c!framedepth=\framedparameter\c!depth,
   %\c!component=,
+  %\c!region=,
   %\c!align=,
    \c!bottom=\vss,
   %\c!top=,
    \c!depth=\zeropoint,
    \c!offset=\v!overlay,
   %\c!component=,
+  %\c!region=,
    \c!radius=.5\bodyfontsize,
    \c!rulethickness=\linewidth,
    \c!corner=\v!rectangular,
 \let\p_framed_backgroundscreen\empty
 \let\p_framed_framecolor      \empty
 \let\p_framed_component       \empty
+\let\p_framed_region          \empty
 \let\p_framed_background      \empty
 \let\p_framed_rulethickness   \empty
 \let\p_framed_foregroundcolor \empty
 \def\pack_framed_background_box_content% fuzzy but needed hack, this \vss, otherwise
   {\vbox to \framedbackgroundheight{\vss\box\b_framed_normal\vss}} % vertical shift \backgroundheight
 
+\def\pack_framed_add_region % experiment
+  {\anch_mark_region_box\b_framed_normal}
+
 \def\pack_framed_add_background
   {\setbox\b_framed_normal\hbox % was vbox
      {\pack_framed_forgetall % can be relaxed
 
 \def\defaultframeoffset{.25ex}
 
-\def\presetlocalframed       [#1]{\letvalue{#1\s!parent}\??oi}
+\def\presetlocalframed       [#1]{\letvalue {#1\s!parent}\??oi}
 \def\inheritlocalframed[#1]#2[#3]{\setevalue{#1\s!parent}{#3}}
 
 \presetlocalframed[\??ol]
   {\bgroup
    \pack_framed_initialize{#1}%
    \setbox\b_framed_normal\hbox{#4}%
+   \edef\p_framed_region{\framedparameter\c!region}%
+   \ifx\p_framed_region\v!yes % maybe later named
+     \pack_framed_add_region
+   \fi
    \getparameters[\currentframed][#3]% no \expanded !
    \edef\p_framed_rulethickness{\framedparameter\c!rulethickness}% also used in backgrounds
    \d_framed_frameoffset\framedparameter\c!frameoffset\relax     % also used in backgrounds
      \fi
      \pack_framed_add_outline % real or invisible frame
    \fi \fi
+   \fi
    \ifx\p_framed_background\empty \else
      \edef\p_framed_backgroundoffset{\framedparameter\c!backgroundoffset}%
      \d_framed_backgroundoffset
   {\bgroup
    \pack_framed_initialize{#1}%
    \setbox\b_framed_normal\box#3%
+   \edef\p_framed_region{\framedparameter\c!region}%
+   \ifx\p_framed_region\v!yes % maybe later named
+     \pack_framed_add_region
+   \fi
    \edef\p_framed_rulethickness{\framedparameter\c!rulethickness}% also used in backgrounds
    \d_framed_frameoffset\framedparameter\c!frameoffset\relax     % also used in backgrounds
    \edef\p_framed_frame{\framedparameter\c!frame}%
    \ifx\p_framed_empty\v!yes
      \pack_framed_fake_box
    \fi
-   %
+   \iftrialtypesetting \else
+     \edef\p_framed_region{\framedparameter\c!region}%
+     \ifx\p_framed_region\v!yes % maybe later named
+       \pack_framed_add_region
+    \fi
+   \fi
    \d_framed_applied_offset
      \ifconditional\c_framed_is_overlaid
        \zeropoint
    \egroup
    \egroup}
 
+\installcorenamespace{framedlocatorbefore}
+\installcorenamespace{framedlocatorafter}
+
 \newconstant\frameddimensionstate % global state: 0=unknown 1=width 2=height 3=both
 
 \def\pack_framed_fake_box
    \setbox\b_framed_normal\box\scratchbox}
 
 \def\installframedlocator#1#2#3%
-  {\setvalue{\??hf:b:#1}{#2}%
-   \setvalue{\??hf:a:#1}{#3}}
-
-\def\pack_framed_locator_before#1%
-  {\csname\??hf:b:#1\endcsname}
+  {\setvalue{\??framedlocatorbefore#1}{#2}%
+   \setvalue{\??framedlocatorafter #1}{#3}}
 
-\def\pack_framed_locator_after#1%
-  {\csname\??hf:a:#1\endcsname}
+\def\pack_framed_locator_before#1{\csname\??framedlocatorbefore#1\endcsname}
+\def\pack_framed_locator_after #1{\csname\??framedlocatorafter #1\endcsname}
 
 \newdimen\d_framed_locator_ht
 \newdimen\d_framed_locator_dp
 
-\def\doprelocframedbox#1%
+\def\pack_framed_locater_set#1%
   {\d_framed_locator_ht\dimexpr
      #1+\d_framed_linewidth
      \ifconditional\c_framed_has_offset
 
 \installframedlocator \v!high
   {}
-  {\doprelocframedbox\strutht
+  {\pack_framed_locater_set\strutht
    \setbox\b_framed_normal\hbox{\lower\d_framed_locator_dp\box\b_framed_normal}%
    \ht\b_framed_normal\strutht
    \dp\b_framed_normal\strutdp
 
 \installframedlocator \v!low
   {}
-  {\doprelocframedbox\strutdp
+  {\pack_framed_locater_set\strutdp
    \setbox\b_framed_normal\hbox{\lower\d_framed_locator_ht\box\b_framed_normal}%
    \ht\b_framed_normal\strutht
    \dp\b_framed_normal\strutdp
 
 \installframedlocator \v!top
   {}
-  {\doprelocframedbox\strutht
+  {\pack_framed_locater_set\strutht
    \setbox\b_framed_normal\hbox{\lower\d_framed_locator_dp\box\b_framed_normal}%
    \ht\b_framed_normal\d_framed_locator_ht
    \dp\b_framed_normal\d_framed_locator_dp
   {}
   {\scratchdimen.5\ht\b_framed_normal
    \setbox\b_framed_normal\hbox{\lower\scratchdimen\box\b_framed_normal}%
-   \ht\b_framed_normal\d_framed_locator_ht
-   \dp\b_framed_normal\d_framed_locator_ht
+   \ht\b_framed_normal\scratchdimen
+   \dp\b_framed_normal\scratchdimen
    \hbox{\box\b_framed_normal}}
 
 \installframedlocator \v!lohi
 
 \installframedlocator \v!bottom
   {}
-  {\doprelocframedbox\strutdp
+  {\pack_framed_locater_set\strutdp
    \setbox\b_framed_normal\hbox{\lower\d_framed_locator_ht\box\b_framed_normal}%
    \ht\b_framed_normal\d_framed_locator_dp
    \dp\b_framed_normal\d_framed_locator_ht
 
 \newcount\c_framed_mstyle
 
-\unexpanded\def\mframed  {\dosingleempty\pack_framed_math_display}
-\unexpanded\def\inmframed{\dosingleempty\pack_framed_math_inline }
+\unexpanded\def\pack_framed_math_strut
+  {\Ustartmath
+   \triggermathstyle\c_framed_mstyle
+   \vphantom{(}%
+   \Ustopmath}
 
-\def\pack_framed_math_inline[#1]#2%
-  {\begingroup
-   \c_framed_mstyle\mathstyle
-   \inframed[#1]{\Ustartmath\triggermathstyle\c_framed_mstyle#2\Ustopmath}%
-   \endgroup}
+% \unexpanded\def\mframed  {\dosingleempty\pack_framed_math_display}
+% \unexpanded\def\inmframed{\dosingleempty\pack_framed_math_inline }
+%
+% \def\pack_framed_math_inline[#1]#2%
+%   {\begingroup
+%    \c_framed_mstyle\mathstyle
+%    \inframed[#1]{\Ustartmath\triggermathstyle\c_framed_mstyle#2\Ustopmath}%
+%    \endgroup}
+%
+% \def\pack_framed_math_display[#1]#2%
+%   {\begingroup
+%    \c_framed_mstyle\mathstyle
+%    \let\normalstrut\pack_framed_math_strut
+%    \framed[#1]{\Ustartmath\triggermathstyle\c_framed_mstyle#2\Ustopmath}%
+%    \endgroup}
+
+\installcorenamespace{mathframed}
 
-\unexpanded\def\funnymathstrut
-  {\Ustartmath\triggermathstyle\c_framed_mstyle\vphantom{(}\Ustopmath}
+\installframedcommandhandler \??mathframed {mathframed} \??mathframed
 
-\def\pack_framed_math_display[#1]#2%
+\appendtoks
+    \setuevalue{\currentmathframed}{\pack_framed_mathframed{\currentmathframed}}%
+\to \everydefinemathframed
+
+\unexpanded\def\pack_framed_mathframed#1%
   {\begingroup
+   \edef\currentmathframed{#1}%
+   \dosingleempty\pack_framed_mathframed_indeed}
+
+\def\pack_framed_mathframed_indeed[#1]#2% no fancy nesting supported here
+  {\iffirstargument
+      \setupcurrentmathframed[#1]%
+   \fi
    \c_framed_mstyle\mathstyle
-   \let\normalstrut\funnymathstrut
-   \framed[#1]{\Ustartmath\triggermathstyle\c_framed_mstyle#2\Ustopmath}%
+   \doifnot{\mathframedparameter\c!location}\v!low{\let\normalstrut\pack_framed_math_strut}%
+   \inheritedmathframedframed{\Ustartmath\triggermathstyle\c_framed_mstyle#2\Ustopmath}%
    \endgroup}
 
+\definemathframed[mframed]
+\definemathframed[inmframed][\c!location=\v!low]
+
 %D So instead of the rather versatile \type {\framed}, we ue
 %D the \type {\mframed}.
 %D
    \c!framedepth=\framedparameter\c!depth,
    %
   %\c!component=,
+  %\c!region=,
   %\c!align=,
    \c!bottom=\vss,
   %\c!top=,
index f3bddda..01e4beb 100644 (file)
 
 \installpagebreakmethod \s!dummy
   {\page_otr_flush_all_floats
-   \gotonextpage
+   \page_otr_command_next_page
    \page_otr_insert_dummy_page}
 
 \installpagebreakmethod \v!frame
 \installpagebreakmethod \s!unknown
   {\doifinstringelse{+}\page_breaks_current_option
      {\page_otr_flush_all_floats
-      \gotonextpage
+      \page_otr_command_next_page
       \dorecurse\page_breaks_current_option\page_otr_insert_dummy_page}
      {\doifnumberelse\page_breaks_current_option
         {\page_otr_flush_all_floats
-         \gotonextpage
+         \page_otr_command_next_page
          \doloop
            {\ifnum\userpageno<\page_breaks_current_option\relax
               \page_otr_insert_dummy_page
 \installpagebreakmethod \v!yes
   {\ifconditional\c_page_breaks_enabled
      \page_otr_flush_all_floats
-     \gotonextpage
+     \page_otr_command_next_page
      \ifinsidecolumns       % this will move to MUL
        \page_otr_eject_page % otherwise sometimes no change
      \fi
 
 \installpagebreakmethod \v!right
   {\page_otr_flush_all_floats
-   \gotonextpageX % will become \gotonextpage
+   \page_otr_command_next_page_and_inserts
    \doifbothsidesoverruled{}{}{\resetcurrentstructuremarkswithpage\page_otr_insert_dummy_page}}
 
 \installpagebreakmethod \v!even
 
 \installpagebreakmethod \v!last
   {\page_otr_flush_all_floats
-   \gotonextpageX % will become \gotonextpage
+   \page_otr_command_next_page_and_inserts
    \relax
    \doifbothsidesoverruled
      {\page_facings_flush}% hm
 
 \def\page_breaks_columns_handle_indeed#1%
   {\edef\page_breaks_columns_current_option{#1}%
-   \ifcsname\??columnbreakmethod\OTRidentifier:\page_breaks_columns_current_option\endcsname
-     \csname\??columnbreakmethod\OTRidentifier:\page_breaks_columns_current_option\endcsname
+   \ifcsname\??columnbreakmethod\currentoutputroutine:\page_breaks_columns_current_option\endcsname
+     \csname\??columnbreakmethod\currentoutputroutine:\page_breaks_columns_current_option\endcsname
    \else\ifcsname\??columnbreaks\page_breaks_columns_current_option\endcsname
      \expandafter\csname\page_breaks_columns_handle\??columnbreaks\page_breaks_columns_current_option\endcsname
    \else
-     \csname\??columnbreakmethod\OTRidentifier:\s!unknown\endcsname
+     \csname\??columnbreakmethod\currentoutputroutine:\s!unknown\endcsname
    \fi\fi}
 
 \def\page_breaks_columns_handle_direct#1%
-  {\csname\??columnbreakmethod\OTRidentifier:#1\endcsname}
+  {\csname\??columnbreakmethod\currentoutputroutine:#1\endcsname}
 
 \unexpanded\def\installcolumnbreakmethod#1#2#3% #1=otr-id #2=tag #3=action
   {\setvalue{\??columnbreakmethod#1:#2}{#3}}
index 4eef6f2..e4f4b0d 100644 (file)
 \def\doreversesavefloat
   {\dofloatsresave\s!text}
 
-\def\doflushsavedfloats % simplified \OTRONEdodoflushfloats
+\def\doflushsavedfloats % simplified \OTRONEdodoflushfloats .. nothing special in otr ... in place
   {\doloop
      {\ifsomefloatwaiting
-        \docheckiffloatfits
+        \page_otr_command_check_if_float_fits
         \ifroomforfloat
           \dogetfloat
           \doplacefloatbox
      \box\floatbox
    \fi}
 
-% \ifdefined\doflushfloats\else \let\doflushfloats\relax \fi
-% \ifdefined\flushfloatbox\else \let\flushfloatbox\relax \fi
-
 % temp hack, needed to prevent floatbox being forgotten during
 % output, this will change to using another box for flushing
 %
index 7573025..aad08ef 100644 (file)
 
 \writestatus{loading}{ConTeXt Page Macros / Initializations}
 
-% still a dutch/english mess
-
-%D This class of modules implements the output routines and
-%D floating body support. Although the modules are relatively
-%D new, the code herein is rather old. This reordering was
-%D needed when column sets were implemented and sharing code
-%D started to make sense.
+%D The \type {\processpage} command has become obsolete. It's original
+%D purpose was to flush only parts of a document but nowadays we have
+%D project structure and modes. This is just one of those very early
+%D features that no longer makes sense.
 
-%D The history shows from the code, since both column
-%D mechanism use a different way of looping over columns.
+%D The \type {\couplepage} command has become obsolete. It's original
+%D purpose was to provide hooks for printer directives (like choosing
+%D different paper trays).
 
 \unprotect
 
-\def\m!otr{otr}
-
-\newbox     \pagebox
-\newcount   \nofshipouts
-
-\newconstant\c_page_otr_eject_penalty \c_page_otr_eject_penalty -\plustenthousand
-\newconstant\c_page_otr_super_penalty \c_page_otr_super_penalty -\plustwentythousand
+%D Shipout control.
 
-\let\ejectpenalty\c_page_otr_eject_penalty % for old times sake
+\newcount\nofshipouts
 
 \appendtoks
     \global\advance\nofshipouts\plusone
 \to \everyaftershipout
 
-\ifx\mkprocesscolumncontents\undefined\let\mkprocesscolumncontents\gobbleoneargument\fi
-\ifx\mkprocesspagecontents  \undefined\let\mkprocesspagecontents  \gobbleoneargument\fi
-\ifx\mkprocessboxcontents   \undefined\let\mkprocessboxcontents   \gobbleoneargument\fi
-
-%D As we have several fundamentally different output routines
-%D available we need commands that adapt themselves to the
-%D current output routine. Such commands are implemented
-%D in the respective modules and prefixed:
-%D
-%D \starttabulate[|T|T|]
-%D \NC OTRONE \NC single column \NC \NR
-%D \NC OTRMUL \NC multi column  \NC \NR
-%D \NC OTRSET \NC columns sets  \NC \NR
-%D \stoptabulate
-%D
-%D The following macros are not to be changed by users:
-
-\let\OTRidentifier\empty % public
-\let\OTRdefault   \empty % public
-\let\OTRunknown   \empty
-\def\OTRprefix    {OTR}
-
-%D We keep a list of registered commands so that we can
-%D bind them when we switch to a specific routine.
-
-\newtoks\t_page_otr_registered_commands
-
-\def\registerotrcommand#1%
-  {\t_page_otr_registered_commands\expandafter
-     {\the\t_page_otr_registered_commands
-      \page_otr_with_command#1}}
-
-\def\page_otr_preset_command#1%
-  {\expandafter\let\expandafter#1\csname\OTRprefix
-     \ifcsname\OTRprefix\OTRidentifier\expandafter\gobbleoneargument\string#1\endcsname
-       \OTRidentifier % dedicated
-     \else\ifcsname\OTRprefix\OTRdefault\expandafter\gobbleoneargument\string#1\endcsname
-       \OTRdefault    % fallback
-     \else
-       \s!unknown     % dummy
-     \fi\fi
-   \expandafter\gobbleoneargument\string#1\endcsname}
-
-\def\page_otr_activate#1#2%
-  {\def\OTRidentifier{#1}%
-   \def\OTRdefault   {#2}%
-   \let\page_otr_with_command\page_otr_preset_command
-   \the\t_page_otr_registered_commands}
-
-\appendtoks
-    \page_otr_activate{ONE}\empty
-\to \everydump
-
-%D The next commands is a direct call to a specific command but is
-%D normally only used if one wants to call a command inside another
-%D one or for the main (not triggered) outputroutines.
-
-\def\OTRcommand#1%
-  {\csname\OTRprefix
-     \ifcsname\OTRprefix\OTRidentifier\expandafter\gobbleoneargument\string#1\endcsname
-       \OTRidentifier % dedicated
-     \else\ifcsname\OTRprefix\OTRdefault\expandafter\gobbleoneargument\string#1\endcsname
-       \OTRdefault    % fallback
-     \else
-       \s!unknown     % dummy
-     \fi\fi
-   \expandafter\gobbleoneargument\string#1\endcsname}
-
-%D The initialization of the \type {\hsize} and \type {\vsize}
-%D depends on the OTR used, as do some other commands.
-
-% These definitions will move to where they are introduced.
-
-\registerotrcommand\setvsize
-\registerotrcommand\sethsize
-\registerotrcommand\finalsidefloatoutput
-\registerotrcommand\dopagecontents
-\registerotrcommand\dosettopinserts
-\registerotrcommand\dosetbotinserts
-\registerotrcommand\dotopinsertions
-\registerotrcommand\dobotinsertions
-\registerotrcommand\dosetbothinserts
-\registerotrcommand\doflushfloats
-\registerotrcommand\flushfloatbox
-\registerotrcommand\docheckiffloatfits
-\registerotrcommand\flushsavedfloats
-\registerotrcommand\synchronizehsize
-\registerotrcommand\gotonextpage
-\registerotrcommand\gotonextpageX
-
-\registerotrcommand\setfloathsize
-
-% \registerotrcommand\_specific_final_side_float_output % todo
-
-%registerotrcommand\someherefloat % not ok this way
-%registerotrcommand\somefixdfloat % not ok this way
-%registerotrcommand\somepagefloat % not ok this way
-%registerotrcommand\sometopsfloat % not ok this way
-%registerotrcommand\somebotsfloat % not ok this way
-%registerotrcommand\somesidefloat % not ok this way
-
-% When issuing two \par\penalty-\plustenthousand's, only the first
-% triggers the otr. Is this an obscure feature or an optimization?
-
-\newif  \iftraceotr   % will change
-\newif  \ifinotr      % might change
-
-\newcount\c_page_otf_trigger_penalty \c_page_otf_trigger_penalty=-100010 % -10010
-
-\unexpanded\def\page_otr_trigger
-  {\iftraceotr
-     \expandafter\page_otr_trigger_traced
-   \else
-     \expandafter\page_otr_trigger_normal
-   \fi}
-
-\def\page_otr_message_b#1#2%
-  {\writestatus\m!otr{+ #1 \number#1}}
-
-\def\page_otr_message_e#1#2%
-  {\writestatus\m!otr{- #1 \number#2}}
-
-\def\page_otr_message_s
-  {\writestatus\m!otr{c:\number\mofcolumns,v:\the\vsize,g:\the\pagegoal,t:\the\pagetotal}}
-
-\def\page_otr_trigger_normal#1%
-  {\begingroup\par\penalty#1\endgroup}
-
-\def\page_otr_trigger_traced#1%
-  {\page_otr_message_b{traced}{#1}%
-   \page_otr_message_s
-   \page_otr_trigger_normal{#1}%
-   \page_otr_message_s
-   \page_otr_message_e{traced}{#1}}
-
-\def\installoutputroutine#1#2% \invoke \action
-  {\global\advance\c_page_otf_trigger_penalty\minusone
-   \edef#1{\page_otr_trigger{\number\c_page_otf_trigger_penalty}}%
-   \setvalue{\??zo\number\c_page_otf_trigger_penalty}{#2}}
-
-\def\page_otr_triggered_output_routine_traced
-  {\page_otr_message_b{trying}\outputpenalty
-   \ifcsname\??zo\the\outputpenalty\endcsname
-     \page_otr_message_b{special}\outputpenalty
-     \csname\??zo\the\outputpenalty\endcsname
-     \page_otr_message_e{special}\outputpenalty
-   \else
-     \page_otr_message_b{normal}\outputpenalty
-     \the\OTRcommand\output % currently a toks but this will become a normal command
-     \page_otr_message_e{normal}\outputpenalty
-   \fi
-   \page_otr_message_e{trying}\outputpenalty}
-
-\def\page_otr_triggered_output_routine_normal
-  {\ifcsname\??zo\the\outputpenalty\endcsname
-     \csname\??zo\the\outputpenalty\endcsname
-   \else
-     \the\OTRcommand\output
-   \fi}
+\newconditional\c_otr_shipout_enabled \settrue\c_otr_shipout_enabled
 
-\def\page_otr_triggered_output_routine
-  {\iftraceotr
-     \expandafter\page_otr_triggered_output_routine_traced
+\unexpanded\def\page_otr_shipout
+  {\ifconditional\c_otr_shipout_enabled
+     \expandafter\page_otr_shipout_yes
    \else
-     \expandafter\page_otr_triggered_output_routine_normal
-   \fi}
-
-%D Some hooks:
-
-\def\page_otf_set_engine_output_routine#1%
-  {\global\output
-     {\inotrtrue
-      \the\everybeforeoutput
-      #1\relax
-      \the\everyafteroutput}}
-
-\page_otf_set_engine_output_routine{\page_otr_triggered_output_routine}
-
-\installoutputroutine\synchronizeoutput
-  {\ifvoid\normalpagebox\else
-     \unvbox\normalpagebox
-     \pagediscards
+     \expandafter\page_otr_shipout_nop
    \fi}
 
-\installoutputroutine\discardpage
-  {\setbox\scratchbox\box\normalpagebox}
+\let\page_otr_shipout_yes\normalshipout
 
-\def\page_otr_trigger_output_routine
-  {\par
-   \ifvmode
-     \penalty\c_page_otr_eject_penalty
-   \fi
-   \resetpagebreak}
+\unexpanded\def\page_otr_shipout_nop
+  {\writestatus\m!system{ignoring shipout of real page \the\realpageno}%
+   \global\advance\realpageno\minusone % else no flush of resources
+   \dowithnextbox{\deadcycles\zerocount}}
 
-\def\page_otr_fill_and_eject_page
-  {\par
-   \ifvmode
-     \vfill
-     \penalty\c_page_otr_eject_penalty
-   \fi
-   \resetpagebreak}
+% We don't support direct user \shipouts (weird: this does not work, bug?)
+%
+% \let\shipout\page_otr_shipout_nop
 
-\def\page_otr_eject_page
-  {\par
-   \ifvmode
-     \ifdim\pagetotal>\pagegoal \else
-       \normalvfil
-     \fi
-     \penalty\c_page_otr_eject_penalty
-   \fi
-   \resetpagebreak}
-
-\def\page_otr_eject_page_and_flush_inserts % can be an installed one
-  {\par
-   \ifvmode
-     \ifdim\pagetotal>\pagegoal \else
-       \normalvfil
-     \fi
-     \penalty\c_page_otr_super_penalty
-   \fi
-   \resetpagebreak}
-
-\def\page_otr_check_for_pending_inserts
-  {\ifnum\outputpenalty>\c_page_otr_super_penalty \else
-     \ifnum\insertpenalties>\zerocount
-       % something is being held over so we force a new page
-       \page_otr_force_another_page
-     \fi
-   \fi}
+%D Building pages.
 
-\def\page_otr_force_another_page
-  {% we should actually remove the dummy line in the otr
-   \hbox to \hsize{}%
-   \kern-\topskip
-   \nobreak
-   \vfill
-   \penalty\c_page_otr_super_penalty
-   \resetpagebreak}
+\newbox\pagebox
 
-\unexpanded\def\bye
-  {\writestatus\m!system{Sorry, you're not done yet, so no goodbye!}}
+\ifx\mkprocesscolumncontents\undefined\let\mkprocesscolumncontents\gobbleoneargument\fi
+\ifx\mkprocesspagecontents  \undefined\let\mkprocesspagecontents  \gobbleoneargument\fi
+\ifx\mkprocessboxcontents   \undefined\let\mkprocessboxcontents   \gobbleoneargument\fi
 
-% floats
+%D Floats.
 
 \def\page_otr_flush_all_floats
   {%\flushnotes already done
      % when just flushing; so now we have (maybe optional):
      \pagebaselinecorrection % hm, needs checking, not needed when no floats
      % alas, this is tricky but needed (first surfaced in prikkels)
-     \doflushfloats
+     \page_otr_command_flush_floats
      \endgroup
    \fi}
 
      \page_otr_flush_all_floats
      \fixedspace
      \vfill
-     \gotonextpage
+     \page_otr_command_next_page
    \fi}
 
-\def\finaloutput#1#2%
-  {\forgetall
-   \page_boxes_shipout{\page_boxes_constructed_page#1#2}% \hbox removed
-   \vskip\zeropoint\relax
+\def\page_otr_flush_pending_content
+  {\vskip\zeropoint\relax % brrr .. get rid of this
    \ifvoid\normalpagebox \else
      \unvbox\normalpagebox
      \penalty\outputpenalty
-   \fi
+   \fi}
+
+\def\page_otr_construct_and_shipout#1#2%
+  {\forgetall
+   \page_boxes_shipout{\page_boxes_constructed_page#1#2}% \hbox removed
+   \page_otr_flush_pending_content
    % not really needed, replaced by \flushsavedfloats
    \page_otr_check_for_pending_inserts
    % but does not hurt either (we're still in the otr!)
-   \inpagebodytrue      % needed for enabling \blank !
-   \flushsavedfloats    % was \dosetbothinserts; only otr one !
-   \setvsize            % this is needed for interacting components, like floats and multicolumns
+   \inpagebodytrue      % needed for enabling \blank ! brrr
+   \page_otr_command_flush_saved_floats
+   \page_otr_command_set_vsize   % this is needed for interacting components, like floats and multicolumns
    \doincrementpageboundcounters % should hook into an every
    \page_adapts_synchronize
    \page_otr_check_for_pending_inserts
 
 \let\flushatshipout\page_otr_add_special_content
 
-% \def\dooutput{\finaloutput\unvbox\normalpagebox}
-
 \maxdeadcycles=1000
 
 \newtoks\afterpage     \newtoks\aftereverypage
   {\ifconditional\c_page_boxes_save_page_body \global\setbox\b_page_boxes_saved_page_body \fi \vbox \bgroup
       \boxmaxdepth\maxdimen % new
       \dontcomplain
-      \page_marks_synchronize_page{#2}%   we could consider doing this for \pagebox (needs testting)
-      \page_boxes_construct_content#1#2%  % this one fills pagebox
+      \page_marks_synchronize_page                    {#2}%  we could consider doing this for \pagebox (needs testing)
+      \page_boxes_construct_content       \pagebox{#1}{#2}%
       \page_backgrounds_add_to_main       \pagebox
       \page_boxes_apply_offsets           \pagebox
       \page_info_add_to_box               \pagebox
       \ifcase\pageornamentstate
         \page_backgrounds_add_to_paper    \pagebox
       \fi
-      \anch_positions_register_page            \pagebox
+      \anch_positions_register_page       \pagebox
       \ifarrangingpages
         \page_boxes_apply_shift_paper     \pagebox % \v!paper
       \else
      \the\everyafterpagebody
    \egroup}
 
-%D Shipout control.
-
-\newconditional\c_otr_shipout_enabled \settrue\c_otr_shipout_enabled
-
-\def\page_otr_shipout
-  {\ifconditional\c_otr_shipout_enabled
-     \expandafter\page_otr_shipout_yes
-   \else
-     \expandafter\page_otr_shipout_nop
-   \fi}
-
-\let\page_otr_shipout_yes\normalshipout
-
-\unexpanded\def\page_otr_shipout_nop
-  {\writestatus\m!system{ignoring shipout of real page \the\realpageno}%
-   \global\advance\realpageno\minusone % else no flush of resources
-   \dowithnextbox{\deadcycles\zerocount}}
-
-% \let\shipout\page_otr_shipout_nop % we don't support direct user \shipouts (weird: this does not work, bug?)
-
-%D The \type {\processpage} command has become obsolete. It's original
-%D purpose was to flush only parts of a document but nowadays we have
-%D project structure and modes. This is just one of those very early
-%D features that no longer makes sense.
-%D
-%D The \type {\couplepage} command has become obsolete. It's original
-%D purpose was to provide hooks for printer directives (like choosing
-%D different paper trays).
-
 \protect \endinput
-
-% bewaren tvb documentatie
-%
-% \hbox to \hsize
-%   {\en
-%    \switchnaarkorps[5pt]%
-%    \emergencystretch2em
-%    \dimen0=\baselineskip
-%    \baselineskip=\dimen0 plus 1pt
-%    \hsize=.2\hsize
-%    \vsize=2\hsize
-%    \ruledvbox to \vsize{\input tufte \par}\hss
-%    \ruledvbox to \vsize{\input tufte \par\kern-\prevdepth}\hss
-%    \ruledvbox to \vsize{\input tufte \par\kern0pt}\hss
-%    \ruledvbox to \vsize{\input tufte \par\vfill}\hss
-%    \ruledvbox to \vsize{\input tufte \par\kern-\prevdepth\vfill}}
-%
-% \hbox to \hsize
-%   {\en
-%    \switchnaarkorps[5pt]%
-%    \emergencystretch2em
-%    \dimen0=\baselineskip
-%    \baselineskip=\dimen0 plus 1pt
-%    \hsize=.18\hsize
-%    \vsize=2.5\hsize
-%    \setbox0=\vbox{\input tufte\relax}%
-%    \ruledvbox to \vsize{\unvcopy0}\hss
-%    \ruledvbox to \vsize{\unvcopy0\kern-\dp0}\hss
-%    \ruledvbox to \vsize{\unvcopy0\kern0pt}\hss
-%    \ruledvbox to \vsize{\unvcopy0\vfill}\hss
-%    \ruledvbox to \vsize{\unvcopy0\kern-\dp0\vfill}}
index 4e2c254..78839ea 100644 (file)
                                                     \global\c_page_target_paper_reverse    \zerocount}
 \setvalue{\??layoutpaper\number\leftrotationangle }{\global\c_page_target_paper_orientation\leftrotationangle
                                                     \global\c_page_target_paper_reverse    \rightrotationangle}
-\setvalue{\??layoutpaper\v!reset                  }{\global\setfalse\c_page_target_print_landscape
+
+\setvalue{\??layoutprint\v!reset                  }{\global\setfalse\c_page_target_print_landscape
                                                     \global\setfalse\c_page_target_print_mirror
                                                     \global\setfalse\c_page_target_print_negate
                                                     \global\c_page_target_print_orientation\uprotationangle
                                                     \global\c_page_target_print_reverse    \uprotationangle}
-
 \setvalue{\??layoutprint\v!landscape              }{\global\settrue\c_page_target_print_landscape}
 \setvalue{\??layoutprint\v!mirrored               }{\global\settrue\c_page_target_print_mirror}
 \setvalue{\??layoutprint\v!negative               }{\global\settrue\c_page_target_print_negate}
 \def\installlayoutalternative#1#2%
   {\setgvalue{\??layoutalternative#1}{#2}}
 
-\def\page_boxes_construct_content_default#1#2% #1 and #2 will become variables
-  {\setbox\pagebox\vbox
+\def\page_boxes_construct_content_default#1#2#3% targetbox flusher box
+  {\setbox#1\vbox
      {\offinterlineskip
       \begingroup % needed ?
       \uselayoutstyleandcolor\c!style\c!color
       \offinterlineskip
       \page_layouts_insert_elements % zero size
       \endgroup
-      \page_insert_body#1#2}}% including footnotes
+      \page_insert_body#2#3}}% including footnotes
 
 \installlayoutalternative\v!default{\page_boxes_construct_content_default}
 \installlayoutalternative\v!normal {\page_boxes_construct_content_default}
 
-\def\page_boxes_construct_content
+\def\page_boxes_construct_content % targetbox flusher box
   {\csname\??layoutalternative\ifcsname\??layoutalternative\layoutparameter\c!alternative\endcsname
      \layoutparameter\c!alternative
    \else
    \global\advance\footerheight-\d_page_adepts_height
    \showmessage\m!layouts1{\the\d_page_adepts_height,\the\realpageno}%
    % this will become a better one (do we need insert correction?)
-   \setvsize
+   \page_otr_command_set_vsize
    \global\pagegoal\vsize
    %
    \page_backgrounds_recalculate
    \doifelselayoutsomeline\v!footer\compensatevsizefooter\donothing
    \page_layouts_set_modes
    \resetglobal
-   \setvsize}
+   \page_otr_command_set_vsize}
 
 \def\calculateglobalvsizes % name will change
   {\global\textheight\makeupheight
    \doifelselayoutsomeline\v!header\globalcompensatevsizeheader\donothing
    \doifelselayoutsomeline\v!footer\globalcompensatevsizefooter\donothing
    \page_layouts_set_modes
-   \setvsize}
+   \page_otr_command_set_vsize}
 
 \def\calculatereducedvsizes % name will change
   {\textheight\makeupheight
 
 \def\calculatehsizes % name will change
   {\freezetextwidth
-   \sethsize}
+   \page_otr_command_set_hsize}
 
 % The next few are better off in page-ini.mkiv
 
index 98fd78b..532fdde 100644 (file)
@@ -73,7 +73,7 @@
    \restoreglobalbodyfont             % otherwise problems inside split verbatim
    \ctxcommand{flushpostponedblocks()}%
    \relax
-   \doflushfloats                     % new but potential dangerous, maybe we need a classification
+   \page_otr_command_flush_floats     % new but potential dangerous, maybe we need a classification
    \egroup}                           % of blocks: with and without flush
 
 \def\page_postponed_blocks_flush_indeed
index 0a0ba5b..4901c1e 100644 (file)
 %C therefore copyrighted by \PRAGMA. See mreadme.pdf for
 %C details.
 
+% SEE PAGE-MUL-NEW.MKIV
+
+% BEWARE: TEMPORARY ISSUES WITH VSIZE AND HSIZE BUT WILL BE REDONE
+
 \writestatus{loading}{ConTeXt Page Macros / Simple Multi Column}
 
 %D This module is mostly a copy from the original multi column
 
 \unprotect
 
-% TO DO !
-
-\let\OTRMULsetvsize            \OTRONEsetvsize
-\let\OTRMULsethsize            \OTRONEsethsize
-\let\OTRMULdopagecontents      \OTRONEdopagecontents
-\let\OTRMULfinalsidefloatoutput\OTRONEfinalsidefloatoutput % ???
-\let\OTRMULflushfloatbox       \OTRONEflushfloatbox
+\unexpanded\def\page_mul_command_side_float_output
+  {\page_otr_construct_and_shipout\unvbox\normalpagebox}
 
-\let\OTRMULdosettopinserts   \relax
-\let\OTRMULdosetbotinserts   \relax
-\let\OTRMULdotopinsertions   \relax
-\let\OTRMULdobotinsertions   \relax
-\let\OTRMULdosetbothinserts  \relax
-\let\OTRMULflushsavedfloats  \relax
+\unexpanded\def\page_mul_command_flush_side_floats
+  {\page_sides_forget_floats}
 
-\let\OTRMULflushsidefloats      \forgetsidefloats % \relax
-\let\OTRMULsynchronizesidefloats\forgetsidefloats % \relax
+\unexpanded\def\page_mul_command_synchronize_side_floats
+  {\page_sides_forget_floats}
 
-\newtoks \OTRMULoutput
-
-\def\OTRMULgotonextpage
+\unexpanded\def\page_mul_command_next_page
   {\page_otr_eject_page}
 
-\def\OTRMULgotonextpageX % will become obsolete
+\unexpanded\def\page_mul_command_next_page_and_inserts
   {\page_otr_eject_page_and_flush_inserts}
-\f
+
 % check \count<insert> multiplications
 
-%D The following macro's implement a multi||column output
-%D routine. The original implementation was based on Donald
-%D Knuth's implementation, which was adapted by Craig Platt to
-%D support balancing of the last page. I gradually adapted
-%D Platt's version to our needs but under certain
-%D circumstances things still went wrong. I considered all
-%D calls to Platt's \type{\balancingerror} as undesirable.
-
-%D This completely new implementation can handle enough
-%D situations for everyday documents, but is still far from
-%D perfect. While at the moment the routine doesn't support
-%D all kind of floats, it does support:
+%D The following macro's implement a multi||column output routine. The original
+%D implementation was based on Donald Knuth's implementation, which was adapted by
+%D Craig Platt to support balancing of the last page. I gradually adapted Platt's
+%D version to our needs but under certain circumstances things still went wrong. I
+%D considered all calls to Platt's \type{\balancingerror} as undesirable.
+%D
+%D This completely new implementation can handle enough situations for everyday
+%D documents, but is still far from perfect. While at the moment the routine doesn't
+%D support all kind of floats, it does support:
 %D
 %D \startitemize[packed]
 %D \item  an unlimitted number of columns
 %D \item  ragged or not ragged bottoms
 %D \item  optional balancing without \type{\balancingerrors}
-%D \item  different \type{\baselineskips}, \type{\spacing},
-%D       \type{\topskip} and \type{\maxdepth}
+%D \item  different \type{\baselineskips}, \type{\spacing}, \type {\topskip} and
+%D        \type {\maxdepth}
 %D \item  left- and right indentation, e.g. within lists
 %D \item  moving columns floats to the next column or page
 %D \item  handling of floats that are to wide for a columns
 %D \stopitemize
 %D
-%D One could wonder why single and multi||columns modes are
-%D still separated. One reason for this is that \TeX\ is not
-%D suited well for handling multi||columns. As a result, the
-%D single columns routines are more robust. Handling one
-%D column as a special case of multi||columns is posible but at
-%D the cost of worse float handling, worse page breaking,
-%D worse etc. Complicated multi||column page handling should
-%D be done in \cap{DTP}||systems anyway.
+%D One could wonder why single and multi||columns modes are still separated. One
+%D reason for this is that \TeX\ is not suited well for handling multi||columns. As
+%D a result, the single columns routines are more robust. Handling one column as a
+%D special case of multi||columns is posible but at the cost of worse float
+%D handling, worse page breaking, worse etc. Complicated multi||column page handling
+%D should be done in \cap{DTP}||systems anyway.
 %D
-%D There are three commands provided for entering and leaving
-%D multi||column mode and for going to the next column:
+%D There are three commands provided for entering and leaving multi||column mode and
+%D for going to the next column:
 %D
 %D \interface \type{\beginmulticolumns} \\ \\
 %D \interface \type{\endmulticolumns}   \\ \\
 %D \interface \type{\ejectcolumn}       \\ \\
-%D
-%D This routines are sort of stand||alone. They communicate
-%D with the rest of \CONTEXT\ by means of some interface
-%D macro's, which we only mention.
-%D
-%D \interface \type{\nofcolumns} \\
-%D   the number of columns \\
-%D \interface \type{\minbalancetoplines} \\
-%D   the minimum number op balanced top lines \\
-%D \interface \type{\betweencolumns} \\
-%D   the stuff between columns \\
-%D \interface \type{\finaloutput{action}{box}} \\
-%D   some kind of \type{\pagebody} and \type{\shipout} \\
-%D
-%D \interface \type{\ifbalancecolumns} \\
-%D   balancing the colums or not \\
-%D \interface \type{\ifstretchcolumns} \\
-%D   ragging the bottom or not \\
-%D
-%D \interface \type{\ifheightencolumns} \\
-%D     fix the heigh tor not \\
-%D \interface \type{\fixedcolumnheight} \\
-%D     the optional fixed height \\
-%D
-%D \interface \type{\ifinheritcolumns} \\
-%D     handle ragging or not \\
-%D
-%D \interface \type{\ifreversecolumns} \\
-%D     reverse the order in wich columns are flushed \\
-%D
-%D \interface \type{\usercolumnwidth} \\
-%D     the calculated width of a column \\
-%D \interface \type{\columntextwidth} \\
-%D     the maximum width of a column \\
-%D \interface \type{\columntextheight} \\
-%D     the minimum width of a column \\
-%D
-%D \interface \type{\spacingfactor} \\
-%D     the spacing factor \\
-%D \interface \type{\bodyfontsize} \\
-%D     the (local) bodyfontsize \\
-%D \interface \type{\openlineheight} \\
-%D     the lineheight (including \type{\spacing}) \\
-%D
-%D \interface \type{\EveryBodyFont} \\
-%D     communication channel to font switching routines \\
-%D
-%D \interface \type{\global\settopskip} \\
-%D   set \type{\topskip} \\
-%D \interface \type{\setvsize} \\
-%D   set \type{\vsize} and \type{\pagegoal} \\
-%D \interface \type{\sethsize} \\
-%D   set \type{\hsize} \\
-%D
-%D \interface \type{\flushcolumnfloats} \\
-%D   push saved column floats (next page) \\
-%D \interface \type{\flushcolumnfloat} \\
-%D   push saved column floats (next column) \\
-%D \interface \type{\setcolumnfloats} \\
-%D   initialize column floats \\
-%D
-%D \interface \type{\finishcolumnbox} \\
-%D   do something special (a hook) \\
-%D \interface \type{\postprocesscolumnpagebox} \\
-%D   do something with each columnbox (also a hook) \\
-%D \interface \type{\postprocesscolumnbox} \\
-%D   do something with each columnbox (also a hook) \\
-%D \interface \type{\postprocesscolumnline} \\
-%D   do something with each columnline (also a hook) \\
-%D \interface \type{\currentcolumn} \\
-%D   the current column \\
-%D
-%D These interface macro's are called upon or initialized
-%D by the multi||column macro's.
-
-%D A lot of footnote stuff added!
 
 \def\finalcolumntextwidth   {\makeupwidth}
 \def\finalcolumntextheight  {\textheight}
 \let\flushcolumnfloat       \relax % in CONTEXT used for floats
 \let\finishcolumnbox        \relax % in CONTEXT used for backgrounds
 
-% %D In fact, the column height and width are set by means of
-% %D two macro's. One can change their meaning if needed:
-%
-% \def\setcolumntextheight
-%   {\def\columntextheight{\teksthoogte}}
-%
-% \def\setcolumntextwidth
-%   {\def\columntextwidth{\zetbreedte}}
-
-%D Both macros are redefined in \CONTEXT\ when backgrounds
-%D are applied to columns. The final values are used when
-%D flushing the columns.
-
-\newtoks\singlecolumnout % remove that one
+%D Both macros are redefined in \CONTEXT\ when backgrounds are applied to
+%D columns. The final values are used when flushing the columns.
 
-%D It's more convenient to use \type {\columnwidth} instead
-%D of messing around with boxes each time.
+%D It's more convenient to use \type {\columnwidth} instead of messing around
+%D with boxes each time.
 
 \newdimen\columnwidth
 \newdimen\gutterwidth
 \def\determinecolumnwidth
   {\bgroup
    \setbox\scratchbox\hbox
-     {\setcolumnhsize
+     {\page_mul_command_set_hsize
       \global\columnwidth\usercolumnwidth
       \global\gutterwidth\intercolumnwidth}%
    \egroup}
 
-%D Going to a new columns is done by means of a
-%D \type{\ejectcolumn}. The following definition does not
-%D always work.
+%D Going to a new columns is done by means of a \type {\ejectcolumn}. The
+%D following definition does not always work.
 
 \def\ejectcolumn
   {\goodbreak
    \showmessage\m!columns2\empty}
 
-%D The next macro should never be called so let's deal with it.
-%D There were several solutions to these kind of errors. First
-%D we check for a good breakpoint before firing up the
-%D multi||column routine (\type{\break} or \type{\allowbreak}).
-%D We do the same at the end of the routine
-%D (\type{\allowbreak}). These allowances are definitely
-%D needed!
-%D
-%D Some on first sight redundant calls to for instance
-%D \type{\setvsize} in the flushing, splitting and balancing
-%D macro's can definitely not be omitted! Some are just there
-%D to handle situations that only few times arise. One of
-%D those can be that&