summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--context/data/scite/lexers/data/scite-context-data-context.lua2
-rw-r--r--context/data/scite/lexers/data/scite-context-data-metafun.lua4
-rw-r--r--context/data/scite/scite-context-data-context.properties5
-rw-r--r--context/data/scite/scite-context-data-interfaces.properties1264
-rw-r--r--context/data/scite/scite-context-data-metafun.properties48
-rw-r--r--context/data/scite/scite-context-data-metapost.properties22
-rw-r--r--context/data/scite/scite-context-data-tex.properties114
-rw-r--r--metapost/context/base/mp-chem.mpiv613
-rw-r--r--metapost/context/base/mp-mlib.mpiv48
-rw-r--r--metapost/context/base/mp-tool.mpiv141
-rw-r--r--scripts/context/lua/mtxrun.lua571
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua571
-rw-r--r--scripts/context/stubs/unix/mtxrun571
-rw-r--r--tex/context/base/char-ent.lua3
-rw-r--r--tex/context/base/chem-str.lua47
-rw-r--r--tex/context/base/chem-str.mkiv9
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4146 -> 4089 bytes
-rw-r--r--tex/context/base/context-version.pngbin40530 -> 40551 bytes
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/font-def.lua4
-rw-r--r--tex/context/base/l-file.lua539
-rw-r--r--tex/context/base/l-lpeg.lua26
-rw-r--r--tex/context/base/l-url.lua35
-rw-r--r--tex/context/base/lang-lab.lua2
-rw-r--r--tex/context/base/lxml-tex.lua19
-rw-r--r--tex/context/base/math-frc.mkiv28
-rw-r--r--tex/context/base/math-ini.lua100
-rw-r--r--tex/context/base/math-ini.mkiv6
-rw-r--r--tex/context/base/meta-ini.mkiv79
-rw-r--r--tex/context/base/mlib-ctx.lua44
-rw-r--r--tex/context/base/mlib-pps.lua61
-rw-r--r--tex/context/base/mlib-run.lua30
-rw-r--r--tex/context/base/mult-def.mkiv3
-rw-r--r--tex/context/base/mult-fun.lua2
-rw-r--r--tex/context/base/mult-low.lua5
-rw-r--r--tex/context/base/ppchtex.mkii3
-rw-r--r--tex/context/base/s-mod-00.mkiv8
-rw-r--r--tex/context/base/s-mod-02.mkiv8
-rw-r--r--tex/context/base/status-files.pdfbin24548 -> 24378 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin199334 -> 199955 bytes
-rw-r--r--tex/context/base/syst-con.lua20
-rw-r--r--tex/context/base/util-prs.lua14
-rw-r--r--tex/context/base/x-mathml.mkiv60
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua567
47 files changed, 2885 insertions, 2819 deletions
diff --git a/context/data/scite/lexers/data/scite-context-data-context.lua b/context/data/scite/lexers/data/scite-context-data-context.lua
index 798d9d908..acc65770a 100644
--- a/context/data/scite/lexers/data/scite-context-data-context.lua
+++ b/context/data/scite/lexers/data/scite-context-data-context.lua
@@ -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", "zeromuskip", "onemuskip", "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", "startnotext", "stopnotext", "startdocument", "stopdocument", "documentvariable", "startmodule", "stopmodule", "usemodule", "startTEXpage", "stopTEXpage", "enablemode", "disablemode", "preventmode", "globalenablemode", "globaldisablemode", "globalpreventmode", "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", "startcontextcode", "stopcontextcode", "doifsetupselse", "doifsetups", "doifnotsetups", "setup", "setups", "texsetup", "xmlsetup", "luasetup", "directsetup", "doifelsecommandhandler", "doifnotcommandhandler", "doifcommandhandler", "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", "firstargumentfalse", "firstargumenttrue", "secondargumentfalse", "secondargumenttrue", "thirdargumentfalse", "thirdargumenttrue", "fourthargumentfalse", "fourthargumenttrue", "fifthargumentfalse", "fifthsargumenttrue", "sixthargumentfalse", "sixtsargumenttrue", "doglobal", "dodoglobal", "redoglobal", "resetglobal", "donothing", "dontcomplain", "forgetall", "donetrue", "donefalse", "htdp", "unvoidbox", "hfilll", "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", "availablehsize", "localhsize", "setlocalhsize", "nextbox", "dowithnextbox", "dowithnextboxcs", "dowithnextboxcontent", "dowithnextboxcontentcs", "scratchwidth", "scratchheight", "scratchdepth", "scratchoffset", "scratchdistance", "scratchhsize", "scratchvsize", "scratchxoffset", "scratchyoffset", "scratchhoffset", "scratchvoffset", "scratchxposition", "scratchyposition", "scratchtopoffset", "scratchbottomoffset", "scratchleftoffset", "scratchrightoffset", "scratchcounterone", "scratchcountertwo", "scratchcounterthree", "scratchdimenone", "scratchdimentwo", "scratchdimenthree", "scratchskipone", "scratchskiptwo", "scratchskipthree", "scratchmuskipone", "scratchmuskiptwo", "scratchmuskipthree", "scratchtoksone", "scratchtokstwo", "scratchtoksthree", "scratchboxone", "scratchboxtwo", "scratchboxthree", "scratchnx", "scratchny", "scratchmx", "scratchmy", "scratchleftskip", "scratchrightskip", "scratchtopskip", "scratchbottomskip", "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", "doifnumber", "doifnotnumber", "doifcommonelse", "doifcommon", "doifnotcommon", "doifinstring", "doifnotinstring", "doifinstringelse", "doifassignmentelse", "docheckassignment", "tracingall", "tracingnone", "loggingall", "removetoks", "appendtoks", "prependtoks", "appendtotoks", "prependtotoks", "to", "endgraf", "endpar", "everyendpar", "reseteverypar", "finishpar", "empty", "null", "space", "quad", "enspace", "obeyspaces", "obeylines", "normalspace", "executeifdefined", "singleexpandafter", "doubleexpandafter", "tripleexpandafter", "dontleavehmode", "removelastspace", "removeunwantedspaces", "keepunwantedspaces", "wait", "writestatus", "define", "redefine", "setmeasure", "setemeasure", "setgmeasure", "setxmeasure", "definemeasure", "freezemeasure", "measure", "getvalue", "setvalue", "setevalue", "setgvalue", "setxvalue", "letvalue", "letgvalue", "resetvalue", "undefinevalue", "ignorevalue", "setuvalue", "setuevalue", "setugvalue", "setuxvalue", "globallet", "glet", "udef", "ugdef", "uedef", "uxdef", "getparameters", "geteparameters", "getgparameters", "getxparameters", "forgetparameters", "copyparameters", "getdummyparameters", "dummyparameter", "directdummyparameter", "setdummyparameter", "letdummyparameter", "usedummystyleandcolor", "usedummystyleparameter", "usedummycolorparameter", "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", "newsignal", "dosingleempty", "dodoubleempty", "dotripleempty", "doquadrupleempty", "doquintupleempty", "dosixtupleempty", "doseventupleempty", "dosingleargument", "dodoubleargument", "dotripleargument", "doquadrupleargument", "doquintupleargument", "dosixtupleargument", "doseventupleargument", "dosinglegroupempty", "dodoublegroupempty", "dotriplegroupempty", "doquadruplegroupempty", "doquintuplegroupempty", "nopdfcompression", "maximumpdfcompression", "normalpdfcompression", "modulonumber", "dividenumber", "getfirstcharacter", "doiffirstcharelse", "startnointerference", "stopnointerference", "twodigits", "threedigits", "strut", "setstrut", "strutbox", "strutht", "strutdp", "strutwd", "struthtdp", "begstrut", "endstrut", "lineheight", "ordordspacing", "ordopspacing", "ordbinspacing", "ordrelspacing", "ordopenspacing", "ordclosespacing", "ordpunctspacing", "ordinnerspacing", "opordspacing", "opopspacing", "opbinspacing", "oprelspacing", "opopenspacing", "opclosespacing", "oppunctspacing", "opinnerspacing", "binordspacing", "binopspacing", "binbinspacing", "binrelspacing", "binopenspacing", "binclosespacing", "binpunctspacing", "bininnerspacing", "relordspacing", "relopspacing", "relbinspacing", "relrelspacing", "relopenspacing", "relclosespacing", "relpunctspacing", "relinnerspacing", "openordspacing", "openopspacing", "openbinspacing", "openrelspacing", "openopenspacing", "openclosespacing", "openpunctspacing", "openinnerspacing", "closeordspacing", "closeopspacing", "closebinspacing", "closerelspacing", "closeopenspacing", "closeclosespacing", "closepunctspacing", "closeinnerspacing", "punctordspacing", "punctopspacing", "punctbinspacing", "punctrelspacing", "punctopenspacing", "punctclosespacing", "punctpunctspacing", "punctinnerspacing", "innerordspacing", "inneropspacing", "innerbinspacing", "innerrelspacing", "inneropenspacing", "innerclosespacing", "innerpunctspacing", "innerinnerspacing", "normalreqno" },
+ ["helpers"]={ "startsetups", "stopsetups", "startxmlsetups", "stopxmlsetups", "startluasetups", "stopluasetups", "starttexsetups", "stoptexsetups", "startrawsetups", "stoprawsetups", "startlocalsetups", "stoplocalsetups", "starttexdefinition", "stoptexdefinition", "starttexcode", "stoptexcode", "startcontextcode", "stopcontextcode", "doifsetupselse", "doifsetups", "doifnotsetups", "setup", "setups", "texsetup", "xmlsetup", "luasetup", "directsetup", "doifelsecommandhandler", "doifnotcommandhandler", "doifcommandhandler", "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", "firstargumentfalse", "firstargumenttrue", "secondargumentfalse", "secondargumenttrue", "thirdargumentfalse", "thirdargumenttrue", "fourthargumentfalse", "fourthargumenttrue", "fifthargumentfalse", "fifthsargumenttrue", "sixthargumentfalse", "sixtsargumenttrue", "doglobal", "dodoglobal", "redoglobal", "resetglobal", "donothing", "dontcomplain", "forgetall", "donetrue", "donefalse", "htdp", "unvoidbox", "hfilll", "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", "availablehsize", "localhsize", "setlocalhsize", "nextbox", "dowithnextbox", "dowithnextboxcs", "dowithnextboxcontent", "dowithnextboxcontentcs", "scratchwidth", "scratchheight", "scratchdepth", "scratchoffset", "scratchdistance", "scratchhsize", "scratchvsize", "scratchxoffset", "scratchyoffset", "scratchhoffset", "scratchvoffset", "scratchxposition", "scratchyposition", "scratchtopoffset", "scratchbottomoffset", "scratchleftoffset", "scratchrightoffset", "scratchcounterone", "scratchcountertwo", "scratchcounterthree", "scratchdimenone", "scratchdimentwo", "scratchdimenthree", "scratchskipone", "scratchskiptwo", "scratchskipthree", "scratchmuskipone", "scratchmuskiptwo", "scratchmuskipthree", "scratchtoksone", "scratchtokstwo", "scratchtoksthree", "scratchboxone", "scratchboxtwo", "scratchboxthree", "scratchnx", "scratchny", "scratchmx", "scratchmy", "scratchleftskip", "scratchrightskip", "scratchtopskip", "scratchbottomskip", "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", "doifnumber", "doifnotnumber", "doifcommonelse", "doifcommon", "doifnotcommon", "doifinstring", "doifnotinstring", "doifinstringelse", "doifassignmentelse", "docheckassignment", "tracingall", "tracingnone", "loggingall", "removetoks", "appendtoks", "prependtoks", "appendtotoks", "prependtotoks", "to", "endgraf", "endpar", "everyendpar", "reseteverypar", "finishpar", "empty", "null", "space", "quad", "enspace", "obeyspaces", "obeylines", "normalspace", "executeifdefined", "singleexpandafter", "doubleexpandafter", "tripleexpandafter", "dontleavehmode", "removelastspace", "removeunwantedspaces", "keepunwantedspaces", "wait", "writestatus", "define", "redefine", "setmeasure", "setemeasure", "setgmeasure", "setxmeasure", "definemeasure", "freezemeasure", "measure", "getvalue", "setvalue", "setevalue", "setgvalue", "setxvalue", "letvalue", "letgvalue", "resetvalue", "undefinevalue", "ignorevalue", "setuvalue", "setuevalue", "setugvalue", "setuxvalue", "globallet", "glet", "udef", "ugdef", "uedef", "uxdef", "getparameters", "geteparameters", "getgparameters", "getxparameters", "forgetparameters", "copyparameters", "getdummyparameters", "dummyparameter", "directdummyparameter", "setdummyparameter", "letdummyparameter", "usedummystyleandcolor", "usedummystyleparameter", "usedummycolorparameter", "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", "newsignal", "dosingleempty", "dodoubleempty", "dotripleempty", "doquadrupleempty", "doquintupleempty", "dosixtupleempty", "doseventupleempty", "dosingleargument", "dodoubleargument", "dotripleargument", "doquadrupleargument", "doquintupleargument", "dosixtupleargument", "doseventupleargument", "dosinglegroupempty", "dodoublegroupempty", "dotriplegroupempty", "doquadruplegroupempty", "doquintuplegroupempty", "nopdfcompression", "maximumpdfcompression", "normalpdfcompression", "modulonumber", "dividenumber", "getfirstcharacter", "doiffirstcharelse", "startnointerference", "stopnointerference", "twodigits", "threedigits", "strut", "setstrut", "strutbox", "strutht", "strutdp", "strutwd", "struthtdp", "begstrut", "endstrut", "lineheight", "ordordspacing", "ordopspacing", "ordbinspacing", "ordrelspacing", "ordopenspacing", "ordclosespacing", "ordpunctspacing", "ordinnerspacing", "opordspacing", "opopspacing", "opbinspacing", "oprelspacing", "opopenspacing", "opclosespacing", "oppunctspacing", "opinnerspacing", "binordspacing", "binopspacing", "binbinspacing", "binrelspacing", "binopenspacing", "binclosespacing", "binpunctspacing", "bininnerspacing", "relordspacing", "relopspacing", "relbinspacing", "relrelspacing", "relopenspacing", "relclosespacing", "relpunctspacing", "relinnerspacing", "openordspacing", "openopspacing", "openbinspacing", "openrelspacing", "openopenspacing", "openclosespacing", "openpunctspacing", "openinnerspacing", "closeordspacing", "closeopspacing", "closebinspacing", "closerelspacing", "closeopenspacing", "closeclosespacing", "closepunctspacing", "closeinnerspacing", "punctordspacing", "punctopspacing", "punctbinspacing", "punctrelspacing", "punctopenspacing", "punctclosespacing", "punctpunctspacing", "punctinnerspacing", "innerordspacing", "inneropspacing", "innerbinspacing", "innerrelspacing", "inneropenspacing", "innerclosespacing", "innerpunctspacing", "innerinnerspacing", "normalreqno", "startimath", "stopimath", "normalstartimath", "normalstopimath", "startdmath", "stopdmath", "normalstartdmath", "normalstopdmath", "uncramped", "cramped", "triggermathstyle", "mathstylefont", "mathstyleface" },
} \ No newline at end of file
diff --git a/context/data/scite/lexers/data/scite-context-data-metafun.lua b/context/data/scite/lexers/data/scite-context-data-metafun.lua
index 076cf2839..faa5eee4b 100644
--- a/context/data/scite/lexers/data/scite-context-data-metafun.lua
+++ b/context/data/scite/lexers/data/scite-context-data-metafun.lua
@@ -1,4 +1,4 @@
return {
- ["commands"]={ "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", "invsin", "invcos", "acosh", "asinh", "sinh", "cosh", "paired", "tripled", "unitcircle", "fulldiamond", "unitdiamond", "fullsquare", "llcircle", "lrcircle", "urcircle", "ulcircle", "tcircle", "bcircle", "lcircle", "rcircle", "lltriangle", "lrtriangle", "urtriangle", "ultriangle", "smoothed", "cornered", "superellipsed", "randomized", "squeezed", "enlonged", "shortened", "punked", "curved", "unspiked", "simplified", "blownup", "stretched", "enlarged", "leftenlarged", "topenlarged", "rightenlarged", "bottomenlarged", "crossed", "laddered", "randomshifted", "interpolated", "paralleled", "cutends", "peepholed", "llenlarged", "lrenlarged", "urenlarged", "ulenlarged", "llmoved", "lrmoved", "urmoved", "ulmoved", "rightarrow", "leftarrow", "centerarrow", "boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox", "bottomboundary", "leftboundary", "topboundary", "rightboundary", "xsized", "ysized", "xysized", "sized", "xyscaled", "intersection_point", "intersection_found", "penpoint", "bbwidth", "bbheight", "withshade", "withlinearshading", "withcircularshading", "withfromshadecolor", "withtoshadecolor", "withshading", "shadedinto", "withcircularshade", "withlinearshade", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "withmask", "figure", "register", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "textext", "thetextext", "rawtextext", "textextoffset", "verbatim", "thelabel", "label", "autoalign", "transparent", "withtransparency", "asgroup", "infont", "set_linear_vector", "linear_shade", "define_linear_shade", "define_circular_linear_shade", "define_sampled_linear_shade", "set_circular_vector", "circular_shade", "define_circular_shade", "define_circular_linear_shade", "define_sampled_circular_shade", "space", "CRLF", "grayscale", "greyscale", "withgray", "withgrey", "colorpart", "readfile", "clearxy", "unitvector", "center", "epsed", "anchored", "originpath", "infinite", "break", "xstretched", "ystretched", "snapped", "pathconnectors", "function", "constructedpath", "constructedpairs", "punkedfunction", "curvedfunction", "tightfunction", "punkedpath", "curvedpath", "tightpath", "punkedpairs", "curvedpairs", "tightpairs", "evenly", "oddly", "condition", "pushcurrentpicture", "popcurrentpicture", "arrowpath", "tensecircle", "roundedsquare", "colortype", "whitecolor", "blackcolor", "normalfill", "normaldraw", "visualizepaths", "naturalizepaths", "drawboundary", "drawwholepath", "visualizeddraw", "visualizedfill", "draworigin", "drawboundingbox", "drawpath", "drawpoint", "drawpoints", "drawcontrolpoints", "drawcontrollines", "drawpointlabels", "drawlineoptions", "drawpointoptions", "drawcontroloptions", "drawlabeloptions", "draworiginoptions", "drawboundoptions", "drawpathoptions", "resetdrawoptions", "decorated", "redecorated", "undecorated" },
- ["internals"]={ "nocolormodel", "greycolormodel", "graycolormodel", "rgbcolormodel", "cmykcolormodel", "shadefactor", "textextoffset", "normaltransparent", "multiplytransparent", "screentransparent", "overlaytransparent", "softlighttransparent", "hardlighttransparent", "colordodgetransparent", "colorburntransparent", "darkentransparent", "lightentransparent", "differencetransparent", "exclusiontransparent", "huetransparent", "saturationtransparent", "colortransparent", "luminositytransparent" },
+ ["commands"]={ "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", "invsin", "invcos", "acosh", "asinh", "sinh", "cosh", "paired", "tripled", "unitcircle", "fulldiamond", "unitdiamond", "fullsquare", "llcircle", "lrcircle", "urcircle", "ulcircle", "tcircle", "bcircle", "lcircle", "rcircle", "lltriangle", "lrtriangle", "urtriangle", "ultriangle", "smoothed", "cornered", "superellipsed", "randomized", "squeezed", "enlonged", "shortened", "punked", "curved", "unspiked", "simplified", "blownup", "stretched", "enlarged", "leftenlarged", "topenlarged", "rightenlarged", "bottomenlarged", "crossed", "laddered", "randomshifted", "interpolated", "paralleled", "cutends", "peepholed", "llenlarged", "lrenlarged", "urenlarged", "ulenlarged", "llmoved", "lrmoved", "urmoved", "ulmoved", "rightarrow", "leftarrow", "centerarrow", "boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox", "bottomboundary", "leftboundary", "topboundary", "rightboundary", "xsized", "ysized", "xysized", "sized", "xyscaled", "intersection_point", "intersection_found", "penpoint", "bbwidth", "bbheight", "withshade", "withlinearshading", "withcircularshading", "withfromshadecolor", "withtoshadecolor", "withshading", "shadedinto", "withcircularshade", "withlinearshade", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "withmask", "figure", "register", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "textext", "thetextext", "rawtextext", "textextoffset", "verbatim", "thelabel", "label", "autoalign", "transparent", "withtransparency", "property", "properties", "withproperties", "asgroup", "infont", "set_linear_vector", "linear_shade", "define_linear_shade", "define_circular_linear_shade", "define_sampled_linear_shade", "set_circular_vector", "circular_shade", "define_circular_shade", "define_circular_linear_shade", "define_sampled_circular_shade", "space", "CRLF", "grayscale", "greyscale", "withgray", "withgrey", "colorpart", "readfile", "clearxy", "unitvector", "center", "epsed", "anchored", "originpath", "infinite", "break", "xstretched", "ystretched", "snapped", "pathconnectors", "function", "constructedpath", "constructedpairs", "punkedfunction", "curvedfunction", "tightfunction", "punkedpath", "curvedpath", "tightpath", "punkedpairs", "curvedpairs", "tightpairs", "evenly", "oddly", "condition", "pushcurrentpicture", "popcurrentpicture", "arrowpath", "tensecircle", "roundedsquare", "colortype", "whitecolor", "blackcolor", "normalfill", "normaldraw", "visualizepaths", "naturalizepaths", "drawboundary", "drawwholepath", "visualizeddraw", "visualizedfill", "draworigin", "drawboundingbox", "drawpath", "drawpoint", "drawpoints", "drawcontrolpoints", "drawcontrollines", "drawpointlabels", "drawlineoptions", "drawpointoptions", "drawcontroloptions", "drawlabeloptions", "draworiginoptions", "drawboundoptions", "drawpathoptions", "resetdrawoptions", "decorated", "redecorated", "undecorated" },
+ ["internals"]={ "nocolormodel", "greycolormodel", "graycolormodel", "rgbcolormodel", "cmykcolormodel", "shadefactor", "textextoffset", "normaltransparent", "multiplytransparent", "screentransparent", "overlaytransparent", "softlighttransparent", "hardlighttransparent", "colordodgetransparent", "colorburntransparent", "darkentransparent", "lightentransparent", "differencetransparent", "exclusiontransparent", "huetransparent", "saturationtransparent", "colortransparent", "luminositytransparent", "metapostversion" },
} \ No newline at end of file
diff --git a/context/data/scite/scite-context-data-context.properties b/context/data/scite/scite-context-data-context.properties
index 9b0aeb207..6e6a26da9 100644
--- a/context/data/scite/scite-context-data-context.properties
+++ b/context/data/scite/scite-context-data-context.properties
@@ -95,7 +95,10 @@ closebinspacing closerelspacing closeopenspacing closeclosespacing closepunctspa
closeinnerspacing punctordspacing punctopspacing punctbinspacing punctrelspacing \
punctopenspacing punctclosespacing punctpunctspacing punctinnerspacing innerordspacing \
inneropspacing innerbinspacing innerrelspacing inneropenspacing innerclosespacing \
-innerpunctspacing innerinnerspacing normalreqno
+innerpunctspacing innerinnerspacing normalreqno startimath stopimath \
+normalstartimath normalstopimath startdmath stopdmath normalstartdmath \
+normalstopdmath uncramped cramped triggermathstyle mathstylefont \
+mathstyleface
keywordclass.context.constants=\
zerocount minusone minustwo plusone \
diff --git a/context/data/scite/scite-context-data-interfaces.properties b/context/data/scite/scite-context-data-interfaces.properties
index c205bb568..44f315053 100644
--- a/context/data/scite/scite-context-data-interfaces.properties
+++ b/context/data/scite/scite-context-data-interfaces.properties
@@ -1,165 +1,152 @@
-keywordclass.context.it=\
-CAP Cap Caps GIORNOSETTIMANA \
-Lettera Lettere MESE Numeri Numeriromani \
-PAROLA PAROLE Parola Parole accoppiacarta \
-accoppiadocumento accoppiamarcatura accoppiapagina accoppiaregistro adattacampo \
-adattalayout al allineacentro allineadestra allineasinistra \
-altezzacarta altezzacartastampa altezzacima altezzaelenco altezzafondo \
-altezzaintestazione altezzamakeup altezzapdp altezzatesto ambiente \
-ampiezzabordo ampiezzabordodestro ampiezzabordosinistro ampiezzacarta ampiezzacartastampa \
-ampiezzaelenco ampiezzamakeup ampiezzamargine ampiezzamarginedestro ampiezzamarginesinistro \
-ampiezzatesto ap apagina appendix arg \
-atleftmargin atrightmargin barracolori barrainterazione barrasincronizzazione \
-bastablocchi bastafile cambiaafontdeltesto campi camporiempimento \
-cap capello chapter chim circondato \
-citazione clip clonacampo colonna colore \
-coloregrigio comment commento completecombinedlist completelistoffloats \
-completelistofsorts completelistofsynonyms completeregister componenet confrontagruppocolori \
-confrontatavolozza convertinumero copiacampo correggispaziobianco coupledregister \
-crlf cutspace da daqualcheparte data \
-datadioggi datareferral decrementnumber definebodyfontDEF definebodyfontREF \
-definecolumnbreak definecombination definedfont definefontfeature definefonthandling \
-defineindentedtext defineinmargin defineitemgroup definelayer definemathalignment \
-definepagebreak defineplacement definetypeface definisci definisciaccento \
-definisciambientefontdeltesto definisciblocco definiscibloccosezione definiscibuffer definiscicampo \
-definiscicampoprincipale definiscicapoversi definiscicarattere definiscicolore definiscicomando \
-definisciconversione definiscidescrizione definiscidimensionicarta definiscielenco definiscielencocombinato \
-definiscienumerazione definiscietichetta definiscifigurasimbolo definiscifont definiscifontdeltesto \
-definiscifontgrezzo definisciformatoriferimento definiscigruppocolonne definiscigruppocolori definiscihbox \
-definisciincorniciato definisciiniziatermina definiscilayout definiscilinea definiscilistariferimenti \
-definiscilogo definiscimakeup definiscimarcatura definiscimenuinterazione definiscimodellotabella \
-definiscioggettomobile definisciordinamento definiscioutput definisciposizionetesto definisciprofilo \
-definisciprogramma definisciregistro definisciriferimento definiscirigovuoto definiscisezione \
-definiscisimbolo definiscisinonimi definiscisinonimofont definiscisottocampo definiscisovrapposizione \
-definiscistackcampi definiscistile definiscistilefont definiscitabulato definiscitavolozza \
-definiscitesta definiscitesto definiscitestoincorniciato definiscitype definiscityping \
-definiscivariabiletesto definisciversion description determinacaratteristicheregistro determinacarattersticheelenco \
-determinanumerotesta dimensione disabilitamenuinterazione distanzabordo distanzabordodestro \
-distanzabordosinistro distanzacima distanzafondo distanzaintestazione distanzamargine \
-distanzamarginedestro distanzamarginesinistro distanzapdp domicilio el \
-elaborablocchi elaborapagina elementi elemento emptylines \
-enumeration etichetta etichette fatto figuraesterna \
-fondo forzablocchi framedtext frazione getnumber \
-giornosettimana griglia headsym hl ignoto \
-immediatebetweenlist immediatetolist impaccato impostaallineamento impostaambientefontdeltesto \
-impostaampiezzariga impostabarrainterazione impostabarrasincronizzazione impostablocchimargine impostablocco \
-impostabloccosezione impostabuffer impostacampi impostacampo impostacapoversi \
-impostacaption impostacaptions impostacima impostaclippling impostacolonne \
-impostacolore impostacolori impostacombinazioni impostacommento impostacommentopagina \
-impostadefinizionenotepdp impostadescrizioni impostadimensionicarta impostaelementi impostaelencazioni \
-impostaelenco impostaelencocombinato impostaenumerazioni impostafigureesterne impostafondo \
-impostafontdeltesto impostaforms impostaformule impostagruppocolonne impostaincorniciato \
-impostainiziatermina impostainmargine impostainstestazione impostainterazione impostainterlinea \
-impostalayout impostalegenda impostalinea impostalineemargine impostalineenere \
-impostalineeriempimento impostalineesottili impostalineetesto impostalingua impostalistariferimenti \
-impostamaiuscole impostamakeup impostamarcatura impostamenuinterazione impostamenzione \
-impostanotepdp impostanumerazione impostanumerazionecapoversi impostanumerazionepagina impostanumerazionerighe \
-impostanumeropagina impostanumerosottopagina impostanumerotesta impostaoggettimobili impostaoggettomobile \
-impostaordinamento impostaoutput impostaparranging impostapdp impostapiustretto \
-impostaposizionamento impostaposizionamentoopposti impostaposizionetesto impostaprofili impostaprogrammi \
-impostapubblicazioni impostapulsanti impostaregistro impostarientro impostariferimento \
-impostarighe impostarigheriempimento impostarigovuoto impostarotazione impostaschermi \
-impostaschermointerazione impostasegnosillabazione impostasetsimboli impostasezione impostasfondi \
-impostasfondo impostasincronizzazione impostasinonimi impostasistema impostasottolinea \
-impostaspaziatura impostaspaziobianco impostaspezzamentooggettomobile impostastrut impostatab \
-impostatabelle impostatabulato impostatavolozza impostatesta impostateste \
-impostatesticima impostatestifondo impostatestiincorniciati impostatestiintestazioni impostatestipdp \
-impostatesto impostatestoetichette impostatestointestazioni impostatestotesti impostatolleranza \
-impostatransizionepagina impostatype impostatyping impostaurl impostavariabiletesto \
-impostaversioni impostazioni in inaltromargine incorniciato \
-incrementanumero indentation indestra ininner iniziaallineamento \
-iniziaambiente iniziabloccomargine iniziacitazione iniziacodifica iniziacolonne \
-iniziacolore iniziacombinazione iniziacomponente iniziacorrezioneriga iniziadocumento \
-iniziafigura iniziaglobale iniziagruppocolonne iniziaimpaccato inizialineamargine \
-inizialineatesto inizialocale iniziamakeup inizianotepdplocali inizianumerazionerighe \
-iniziaopposto iniziaoverview iniziapiustretto iniziaposizionamento iniziaprodotto \
-iniziaprofilo iniziaprogetto iniziaraster iniziariga iniziarighe \
-iniziasetsimboli iniziasfondo iniziasincronizzazione iniziasovrapposizione iniziatabella \
-iniziatabelle iniziatesto iniziaunpacked iniziaversione inlatodestro \
-inlatosinistro inmaframed inmargine inmarginedestro inmarginesinistro \
-inneredgedistance inneredgewidth innermargindistance innermarginwidth inouter \
-inriga insinistra installalingua intorno labeling \
-leg lettera lettere lineamargine lineanera \
-lineasottile lineatesto lineenere lineeriempimento lineesottili \
-lingua linguaprincipale listsymbol livellotesta loadsorts \
-loadsynonyms logcampi lunghezzaelenco maframed mapfontsize \
-mar marcatura marcaversione matematica mediaeval \
-menuinterattivo menzione mese mettielenco mettielencocombinato \
-mettifiancoafianco mettiformula mettiingriglia mettilegenda mettilinea \
-mettiloghi mettinotepdp mettinotepdplocali mettinumeropagina mettiregistro \
-mettisegnalibro mettisottoformula mettiunosullaltro mettivariabiletesto mostraambientefontdeltesto \
-mostracampi mostracolore mostracornice mostrafiguresterne mostrafontdeltesto \
-mostragriglia mostragruppocolori mostraimpostazioni mostralyout mostramakeup \
-mostrasetsimboli mostrastampa mostrastruts mostratavolozza movesidefloat \
-name nascondiblocchi navigating nextsection nientedimensioni \
-nienteelenco nientelineecimafondo nientelineintestazionepdp nientemarcatura nienterientro \
-nientespazio nientespaziobianco nocap nome nomeunita \
-nop nota notapdp notest numberofsubpages \
-numeri numeriromani numeroformula numeropagina numeropaginacompleto \
-numerosottoformula numerotesta numerotestacorrente numerototaledipagine outeredgedistance \
-outeredgewidth outermargindistance outermarginwidth overbar overbars \
-overstrike overstrikes pagedepth pageoffset pagina \
-paragraph paroladestra parolainmargine part passaafontgrezzo \
-ped pedap perlungo placefloat placelistoffloats \
-placelistofsorts placelistofsynonyms placerawlist placereferencelist posizionanumerotesta \
-posizionatesto posizionatestotesta posizione prendibuffer prendimarcatura \
-prodotto progetto programma pubblicazione pulsante \
-pulsantemenu pulsantinterazione punti qualcheriga ran \
-referral referring register reimposta reimpostamarcatura \
-reservefloat resetnumber resettextcontent rientro rif \
-rifai riferimento riferimentopagina riferimentotesto riflessione \
-rigariempimento rigovuoto ruota saltablocchi scala \
-schermo scrividentroelenco scriviinelenco scriviinlistariferimenti scriviinregistro \
-section seeregister segnalibro seguiprofilo seguiversione \
-seguiversioneprofilo selezionablocchi selezionacarta selezionaversione separamarcatura \
-setnumber settext setupanswerarea setupcolumnsetlines setupcolumnsetstart \
-setupfonthandling setupfontsynonym setupindentedtext setupinterlinespace2 setupitemgroup \
-setuplistalternative setupmathalignment setuppaper setupplacement setvariabiletesto \
-sfondo sim simbolo sincronizza sort \
-spazifissi spazio spaziobianco spaziocima spaziodietro \
-spaziofisso spaziofondo spessoreriga spezzaoggettomobile spostaagriglia \
-spostaformula stackcampi startalignment startambiente startbuffer \
-startcitazione startcolore startcolumnmakeup startcolumns startcombination \
-startcomment startcomponenet startdescription startdocument startenumeration \
-startfatto startfigure startfloattext startformula startframedtext \
-starthiding startimpaccato startitemgroup startlegend startline \
-startlineamargine startlineatesto startlinecorrection startlinenumbering startlines \
+keywordclass.context.en=\
+CAP Cap Caps Character \
+Characters MONTH Numbers Romannumerals WEEKDAY \
+WORD WORDS Word Words about \
+adaptlayout adding appendix arg at \
+atleftmargin atpage atrightmargin background backspace \
+blackrule blackrules blank bookmark bottomdistance \
+bottomheight bottomspace but button bypassblocks \
+cap chapter character characters chem \
+clip clonefield color colorbar colorvalue \
+column comment comparecolorgroup comparepalet completecombinedlist \
+completelistoffloats completelistofsorts completelistofsynonyms completepagenumber completeregister \
+component convertnumber copyfield correctwhitespace coupledocument \
+coupledregister couplemarking couplepage couplepaper coupleregister \
+crlf currentdate currentheadnumber cutspace date \
+decouplemarking decrementnumber define defineaccent defineblank \
+defineblock definebodyfont definebodyfontDEF definebodyfontREF definebodyfontenvironment \
+definebuffer definecharacter definecolor definecolorgroup definecolumnbreak \
+definecolumnset definecombination definecombinedlist definecommand defineconversion \
+definedescription definedfont defineenumeration definefield definefieldstack \
+definefiguresymbol definefloat definefont definefontfeature definefonthandling \
+definefontstyle definefontsynonym defineframed defineframedtext definehbox \
+definehead defineindentedtext defineinmargin defineinteractionmenu defineitemgroup \
+definelabel definelayer definelayout definelist definelogo \
+definemainfield definemakeup definemarking definemathalignment defineoutput \
+defineoverlay definepagebreak definepalet definepapersize defineparagraphs \
+defineplacement defineprofile defineprogram definerawfont definereference \
+definereferenceformat definereferencelist defineregister definerule definesection \
+definesectionblock definesorting definestartstop definestyle definesubfield \
+definesymbol definesynonyms definetabletemplate definetabulate definetext \
+definetextposition definetextvariable definetype definetypeface definetyping \
+defineversion description determineheadnumber determinelistcharacteristics determineregistercharacteristics \
+dimension disableinteractionmenu domicile donttest edgedistance \
+edgewidth emptylines enumeration environment externalfigure \
+fact field fieldstack fillinfield fillinline \
+fillinrules fillintext fitfield fixedspace fixedspaces \
+followprofile followprofileversion followversion footerdistance footerheight \
+footnote footnotetext forceblocks formulanumber fraction \
+framed framedtext from getbuffer getmarking \
+getnumber godown goto gotobox gotopage \
+graycolor greyvalue grid hairline head \
+headerdistance headerheight headlevel headnumber headsym \
+headtext hideblocks high hl immediatebetweenlist \
+immediatetolist in incrementnumber indentation indenting \
+inframed infull ininner inleft inleftedge \
+inleftmargin inline inmaframed inmargin inneredgedistance \
+inneredgewidth innermargindistance innermarginwidth inothermargin inouter \
+inright inrightedge inrightmargin installlanguage interactionbar \
+interactionbuttons interactionmenu item items its \
+keepblocks label labeling labels labeltext \
+language leftaligned leftedgedistance leftedgewidth leftmargindistance \
+leftmarginwidth leg linethickness listheight listlength \
+listsymbol listwidth loadsorts loadsynonyms logfields \
+lohi low maframed mainlanguage makeupheight \
+makeupwidth mapfontsize mar margindistance marginrule \
+margintext margintitle marginwidth marginword marking \
+markversion mathematics mediaeval menubutton midaligned \
+mirror month moveformula moveongrid movesidefloat \
+name navigating nextsection nocap nodimension \
+noheaderandfooterlines noindenting nolist nomarking nomoreblocks \
+nomorefiles nop nospace note notopandbottomlines \
+nowhitespace numberofsubpages numbers outeredgedistance outeredgewidth \
+outermargindistance outermarginwidth overbar overbars overstrike \
+overstrikes packed page pagedepth pagenumber \
+pageoffset pagereference paperheight paperwidth paragraph \
+part periods placebookmarks placecombinedlist placefloat \
+placefootnotes placeformula placeheadnumber placeheadtext placelegend \
+placelist placelistoffloats placelistofsorts placelistofsynonyms placelocalfootnotes \
+placelogos placeongrid placeontopofeachother placepagenumber placerawlist \
+placereferencelist placeregister placerule placesidebyside placesubformula \
+placetextvariable position positiontext printpaperheight printpaperwidth \
+processblocks processpage product program project \
+publication quotation quote ran redo \
+ref reference referral referraldate referring \
+register remark reservefloat reset resetmarking \
+resetnumber resettextcontent rightaligned rightedgedistance rightedgewidth \
+rightmargindistance rightmarginwidth romannumerals rotate scale \
+screen section seeregister selectblocks selectpaper \
+selectversion setnumber settextcontent settextvariable setupalign \
+setupanswerarea setuparranging setupbackground setupbackgrounds setupblackrules \
+setupblank setupblock setupbodyfont setupbodyfontenvironment setupbottom \
+setupbottomtexts setupbuffer setupbuttons setupcapitals setupcaption \
+setupcaptions setupclipping setupcolor setupcolors setupcolumns \
+setupcolumnset setupcolumnsetlines setupcolumnsetstart setupcombinations setupcombinedlist \
+setupcomment setupdescriptions setupenumerations setupexternalfigures setupfield \
+setupfields setupfillinlines setupfillinrules setupfloat setupfloats \
+setupfloatsplitting setupfonthandling setupfontsynonym setupfooter setupfootertexts \
+setupfootnotedefinition setupfootnotes setupforms setupformulae setupframed \
+setupframedtexts setuphead setupheader setupheadertexts setupheadnumber \
+setupheads setupheadtext setuphyphenmark setupindentedtext setupindenting \
+setupinmargin setupinteraction setupinteractionbar setupinteractionmenu setupinteractionscreen \
+setupinterlinespace setupinterlinespace2 setupitemgroup setupitemizations setupitems \
+setuplabeltext setuplanguage setuplayout setuplegend setuplinenumbering \
+setuplines setuplinewidth setuplist setuplistalternative setupmakeup \
+setupmarginblocks setupmarginrules setupmarking setupmathalignment setupnarrower \
+setupnumber setupnumbering setupoppositeplacing setupoutput setuppagecomment \
+setuppagenumber setuppagenumbering setuppagetransitions setuppalet setuppaper \
+setuppapersize setupparagraphnumbering setupparagraphs setupplacement setuppositioning \
+setupprofiles setupprograms setuppublications setupquote setupreferencelist \
+setupreferencing setupregister setuprotate setuprule setups \
+setupscreens setupsection setupsectionblock setupsorting setupspacing \
+setupstartstop setupstrut setupsubpagenumber setupsymbolset setupsynchronization \
+setupsynchronizationbar setupsynonyms setupsystem setuptab setuptables \
+setuptabulate setuptext setuptextposition setuptextrules setuptexttexts \
+setuptextvariable setupthinrules setuptolerance setuptop setuptoptexts \
+setuptype setuptyping setupunderbar setupurl setupversions \
+setupwhitespace showbodyfont showbodyfontenvironment showcolor showcolorgroup \
+showexternalfigures showfields showframe showgrid showlayout \
+showmakeup showpalet showprint showsetups showstruts \
+showsymbolset someline somewhere sort space \
+splitfloat startalignment startbackground startbuffer startcoding \
+startcolor startcolumnmakeup startcolumns startcolumnset startcombination \
+startcomment startcomponent startdescription startdocument startenumeration \
+startenvironment startfact startfigure startfloattext startformula \
+startframedtext startglobal starthiding startinteractionmenu startitemgroup \
+startlegend startline startlinecorrection startlinenumbering startlines \
startlocal startlocalenvironment startlocalfootnotes startmakeup startmarginblock \
-startmenuinterattivo startnamemakeup startnarrower startopposite startoverlay \
-startoverview startparagraph startpositioning startpostponing startprodotto \
-startprofile startprogetto startregister startsfondo startsymbolset \
-startsynchronization starttable starttables starttabulate starttyping \
-startunpacked startversione stirato stopalignment stopambiente \
-stopbuffer stopcitazione stopcolore stopcolumnmakeup stopcolumns \
-stopcombination stopcomment stopcomponenet stopdescription stopdocument \
-stopenumeration stopfatto stopfigure stopfloattext stopformula \
-stopframedtext stophiding stopimpaccato stopitemgroup stoplegend \
-stopline stoplineamargine stoplineatesto stoplinecorrection stoplinenumbering \
-stoplines stoplocal stoplocalenvironment stoplocalfootnotes stopmakeup \
-stopmarginblock stopmenuinterattivo stopnamemakeup stopnarrower stopopposite \
-stopoverlay stopoverview stopparagraph stoppositioning stoppostponing \
-stopprodotto stopprofile stopprogetto stopsfondo stopsymbolset \
-stopsynchronization stoptable stoptables stoptabulate stoptyping \
-stopunpacked stopversione sub subject subpagenumber \
-subsection subsubject subsubsection subsubsubject synonym \
-tab terminaallineamento terminaambiente terminabloccomargine terminacitazione \
-terminacodifica terminacolonne terminacolore terminacombinazione terminacomponente \
-terminacorrezioneriga terminadocumento terminaglobale terminagruppocolonne terminaimpaccato \
-terminalineamargine terminalineatesto terminalocale terminamakeup terminanotepdplocali \
-terminanumerazionerighe terminaopposto terminaoverview terminapiustretto terminaposizionamento \
-terminaprodotto terminaprofili terminaprogetto terminaraster terminariga \
-terminarighe terminasfondo terminasincronizzazione terminasovrapposizione terminatabella \
-terminatabelle terminatesto terminaunpacked terminaversioni testa \
-testcolumn testoetichetta testoinmargine testoinstestazioni testonotapdp \
-testoriempimento testpage tex tieniblocchi title \
-titoloinmargine tooltip traduci txt typ \
-type typebuffer typefile underbar underbars \
-usaJSscripts usaURL usablocco usacartella usacodifica \
-usacolonnasonoraesterna usacomandi usadocumentoesterno usafiguraesterna usafileesterni \
-usafileesterno usamoduli usamodulo usariferimenti usasimboli \
-usaspecialita usaurl useXMLfilter usedirectory usetypescript \
-usetypescriptfile vaia vaiabox vaiapagina vaigiu \
-valorecolore valoregrigio variabiletesto versione vl
+startmarginrule startnamemakeup startnarrower startopposite startoverlay \
+startoverview startpacked startparagraph startpositioning startpostponing \
+startproduct startprofile startproject startquotation startraster \
+startregister startsymbolset startsynchronization starttable starttables \
+starttabulate starttext starttextrule starttyping startunpacked \
+startversion stopalignment stopbackground stopbuffer stopcoding \
+stopcolor stopcolumnmakeup stopcolumns stopcolumnset stopcombination \
+stopcomment stopcomponent stopdescription stopdocument stopenumeration \
+stopenvironment stopfact stopfigure stopfloattext stopformula \
+stopframedtext stopglobal stophiding stopinteractionmenu stopitemgroup \
+stoplegend stopline stoplinecorrection stoplinenumbering stoplines \
+stoplocal stoplocalenvironment stoplocalfootnotes stopmakeup stopmarginblock \
+stopmarginrule stopnamemakeup stopnarrower stopopposite stopoverlay \
+stopoverview stoppacked stopparagraph stoppositioning stoppostponing \
+stopproduct stopprofile stopproject stopquotation stopraster \
+stopsymbolset stopsynchronization stoptable stoptables stoptabulate \
+stoptext stoptextrule stoptyping stopunpacked stopversion \
+stretched sub subformulanumber subject subpagenumber \
+subsection subsubject subsubsection subsubsubject switchtobodyfont \
+switchtorawfont sym symbol synchronizationbar synchronize \
+synonym tab testcolumn testpage tex \
+textheight textreference textrule textvariable textwidth \
+thinrule thinrules title tooltip topdistance \
+topheight topspace totalnumberofpages translate txt \
+typ type typebuffer typefile underbar \
+underbars unitmeaning unknown useJSscripts useURL \
+useXMLfilter useblocks usecommands usedirectory useencoding \
+useexternaldocument useexternalfigure useexternalfile useexternalfiles useexternalsoundtrack \
+usemodule usemodules usereferences usespecials usesymbols \
+usetypescript usetypescriptfile useurl version vl \
+weekday whitespace wordright writebetweenlist writetolist \
+writetoreferencelist writetoregister
keywordclass.context.fr=\
CAP Cap Caps Caractere \
@@ -324,6 +311,169 @@ utilisepsiteaudioexterne utilisereferences utilisespecialites utilisesymboles ut
va vaalaboite vaalapage vaenbas valeurcouleur \
valeurgris variabletexte version vide vl
+keywordclass.context.pe=\
+CAP Cap Caps Character \
+Characters MONTH Numbers Romannumerals WEEKDAY \
+WORD WORDS Word Words appendix \
+cap chapter chem comment completecombinedlist \
+completelistoffloats completelistofsorts completelistofsynonyms coupledregister crlf \
+definebodyfontDEF definebodyfontREF definedfont definefontfeature definefonthandling \
+defineindentedtext definetypeface description enumeration framedtext \
+indentation inmframed its labeling loadsorts \
+loadsynonyms mapfontsize mediaeval mframed name \
+nextsection nocap overbar overbars overstrike \
+overstrikes paragraph part placelistoffloats placelistofsorts \
+placelistofsynonyms ran register reservefloat resettextcontent \
+section seeregister setupanswerarea setupcapitals setupfonthandling \
+setupfontsynonym setupindentedtext setupinterlinespace2 setuplistalternative setupurl \
+sort startalignment startbuffer startcolumns startcombination \
+startcomment startdescription startdocument startenumeration startfigure \
+startfloattext startformula startframedtext starthiding startitemgroup \
+startlegend startline startlinecorrection startlinenumbering startlines \
+startlocal startlocalenvironment startlocalfootnotes startmakeup startmarginblock \
+startnamemakeup startnarrower startopposite startoverlay startoverview \
+startparagraph startpositioning startpostponing startprofile startraster \
+startregister startsymbolset startsynchronization starttable starttables \
+starttabulate starttyping startunpacked startتولید startحقیقت \
+startخط‌حاشیه startخط‌متن startرنگ startفشرده startمحیط \
+startمنوی‌پانل startمولفه startنسخه startنقل‌قول startپروژه \
+startپس‌زمینه stopalignment stopbuffer stopcolumns stopcombination \
+stopcomment stopdescription stopdocument stopenumeration stopfigure \
+stopfloattext stopformula stopframedtext stophiding stopitemgroup \
+stoplegend stopline stoplinecorrection stoplinenumbering stoplines \
+stoplocal stoplocalenvironment stoplocalfootnotes stopmakeup stopmarginblock \
+stopnamemakeup stopnarrower stopopposite stopoverlay stopoverview \
+stopparagraph stoppositioning stoppostponing stopprofile stopraster \
+stopsymbolset stopsynchronization stoptable stoptables stoptabulate \
+stoptyping stopunpacked stopتولید stopحقیقت stopخط‌حاشیه \
+stopخط‌متن stopرنگ stopفشرده stopمحیط stopمنوی‌پانل \
+stopمولفه stopنسخه stopنقل‌قول stopپروژه stopپس‌زمینه \
+sub subject subsection subsubject subsubsection \
+subsubsubject synonym title tooltip txt \
+typ underbar underbars useJSscripts useURL \
+useXMLfilter usedirectory useurl آفست‌صفحه آیتم \
+آیتمها آینه اجباربلوکها ارتفاع‌آرایش ارتفاع‌بالا \
+ارتفاع‌برگ ارتفاع‌ته‌برگ ارتفاع‌خط ارتفاع‌سربرگ ارتفاع‌متن \
+ارتفاع‌پایین از ازکارانداختن‌منوی‌پانل استفاده‌بلوکها استفاده‌دستخط‌تایپ \
+استفاده‌رمزینه استفاده‌شکل‌خارجی استفاده‌فرمانها استفاده‌قطعه‌موزیک‌خارجی استفاده‌مدول \
+استفاده‌مدولها استفاده‌مرجعها استفاده‌مسیر استفاده‌نمادها استفاده‌نوشتارخارجی \
+استفاده‌ویژگیها استفاده‌پرونده‌خارجی استفاده‌پرونده‌دستخط‌تایپ استفاده‌پرونده‌های‌خارجی اعدادلاتین \
+افزودن اما امتحان‌نکن انتخاب‌برگ انتخاب‌بلوکها \
+انتخاب‌نسخه انتقال‌به‌توری انتقال‌فرمول انتقال‌کنار‌شناور انجام‌دوباره \
+بارگذاریها بارگذاری‌آرایش بارگذاری‌آیتمها بارگذاری‌ارجاع بارگذاری‌اندازه‌برگ \
+بارگذاری‌باریکتر بارگذاری‌بافر بارگذاری‌بالا بارگذاری‌بخش بارگذاری‌بردباری \
+بارگذاری‌برنامه‌ها بارگذاری‌برگ بارگذاری‌بست بارگذاری‌بلوک بارگذاری‌بلوکهای‌حاشیه \
+بارگذاری‌بلوک‌بخش بارگذاری‌تایپ بارگذاری‌تایپ‌کردن بارگذاری‌تب بارگذاری‌ترتیب \
+بارگذاری‌ترکیب‌ها بارگذاری‌تطابق بارگذاری‌تعریف‌پانوشت بارگذاری‌تنظیم بارگذاری‌تنظیم‌ریاضی \
+بارگذاری‌ته‌برگ بارگذاری‌تورفتگی بارگذاری‌توضیح بارگذاری‌توضیح‌صفحه بارگذاری‌ثبت \
+بارگذاری‌جانشانی بارگذاری‌جدولها بارگذاری‌جدول‌بندی بارگذاری‌خالی بارگذاری‌خروجی \
+بارگذاری‌خط بارگذاری‌خطها بارگذاری‌خطهای‌حاشیه بارگذاری‌خطهای‌سیاه بارگذاری‌خطهای‌متن \
+بارگذاری‌خطهای‌مجموعه‌ستون بارگذاری‌خطها‌ی‌نازک بارگذاری‌درج‌درخطها بارگذاری‌درج‌مخالف بارگذاری‌درون‌حاشیه \
+بارگذاری‌دوران بارگذاری‌دکمه‌ها بارگذاری‌راهنما بارگذاری‌رنگ بارگذاری‌رنگها \
+بارگذاری‌زبان بارگذاری‌ستونها بارگذاری‌سر بارگذاری‌سربرگ بارگذاری‌سرها \
+بارگذاری‌سیستم بارگذاری‌شرح بارگذاری‌شرحها بارگذاری‌شروع‌مجموعه‌ستون بارگذاری‌شروع‌پایان \
+بارگذاری‌شماره بارگذاری‌شماره‌زیرصفحه بارگذاری‌شماره‌سر بارگذاری‌شماره‌صفحه بارگذاری‌شماره‌گذاری \
+بارگذاری‌شماره‌گذاریها بارگذاری‌شماره‌گذاری‌صفحه بارگذاری‌شماره‌گذاری‌پاراگراف بارگذاری‌شماره‌‌گذاری‌خط بارگذاری‌شناور \
+بارگذاری‌شناورها بارگذاری‌شکافتن‌شناورها بارگذاری‌شکلهای‌خارجی بارگذاری‌طرح بارگذاری‌طرح‌بندی \
+بارگذاری‌عرض‌خط بارگذاری‌فاصله‌بین‌خط بارگذاری‌فرمولها بارگذاری‌فضای‌سفید بارگذاری‌فضا‌گذاری \
+بارگذاری‌قالبی بارگذاری‌قلم‌متن بارگذاری‌لوح بارگذاری‌لیست بارگذاری‌لیست‌ترکیبی \
+بارگذاری‌لیست‌مرجع بارگذاری‌مترادفها بارگذاری‌متغیر‌متن بارگذاری‌متن بارگذاری‌متنهای‌بالا \
+بارگذاری‌متن‌سر بارگذاری‌متن‌سربرگ بارگذاری‌متن‌قالبی بارگذاری‌متن‌متنها بارگذاری‌متن‌پانوشت \
+بارگذاری‌متن‌پایین بارگذاری‌مجموعه‌ستون بارگذاری‌مجموعه‌نماد بارگذاری‌محیط‌قلم‌متن بارگذاری‌منوی‌پانل \
+بارگذاری‌مکان‌متن بارگذاری‌مکان‌گذاری بارگذاری‌میدان بارگذاری‌میدانها بارگذاری‌میله‌تطابق \
+بارگذاری‌میله‌زیر بارگذاری‌میله‌پانل بارگذاری‌نسخه‌ها بارگذاری‌نشانه‌شکستن بارگذاری‌نشانه‌گذاری \
+بارگذاری‌نشرها بارگذاری‌نقل بارگذاری‌پاراگرافها بارگذاری‌پانل بارگذاری‌پانوشتها \
+بارگذاری‌پایین بارگذاری‌پرده‌ها بارگذاری‌پرده‌پانل بارگذاری‌پروفایلها بارگذاری‌پرکردن‌خطها \
+بارگذاری‌پس‌زمینه بارگذاری‌پس‌زمینه‌ها بارگذاری‌چیدن بارگذاری‌گذارصفحه بارگذاری‌گروههای‌آیتم \
+بارگذاری‌گروه‌آیتم بازنشانی بازنشانی‌شماره بازنشانی‌متن بازنشانی‌نشانه‌گذاری \
+باگذاری‌متن‌برچسب بدون‌بعد بدون‌بلوکهای‌بیشتر بدون‌تورفتگی بدون‌خط‌بالاوپایین \
+بدون‌خط‌سروته‌برگ بدون‌فایلهای‌بیشتر بدون‌فضا بدون‌فضای‌سفید بدون‌لیست \
+بدون‌نشانه‌گذاری برنامه بروبه بروبه‌جعبه بروبه‌صفحه \
+بروپایین برچسب برچسبها بعد بلند \
+بلوکهای‌پردازش بلوکها‌پنهان بنویس‌بین‌لیست بنویس‌درثبت بنویس‌درلیست‌مرجع \
+بنویس‌در‌لیست تاریخ تاریخ‌جاری تاریخ‌رجوع تایپ \
+تایپ‌بافر تایپ‌پرونده تب ترجمه تطابق \
+تعریف تعریف‌آرایش تعریف‌آرم تعریف‌الگوی‌جدول تعریف‌اندازه‌برگ \
+تعریف‌بافر تعریف‌بخش تعریف‌برنامه تعریف‌برچسب تعریف‌بلوک \
+تعریف‌بلوک‌بخش تعریف‌تایپ تعریف‌تایپ‌کردن تعریف‌تبدیل تعریف‌ترتیب \
+تعریف‌ترکیب تعریف‌تنظیم‌ریاضی تعریف‌توده‌میدان تعریف‌ثبت تعریف‌جانشانی \
+تعریف‌جدول‌بندی تعریف‌جعبه‌‌افقی تعریف‌حرف تعریف‌خالی تعریف‌خروجی \
+تعریف‌خط‌حائل تعریف‌درون‌حاشیه تعریف‌رنگ تعریف‌زیرمیدان تعریف‌سبک \
+تعریف‌سبک‌قلم تعریف‌سر تعریف‌شرح تعریف‌شروع‌پایان تعریف‌شماره‌بندی \
+تعریف‌شمایل‌مرجع تعریف‌شناور تعریف‌شکستن‌ستون تعریف‌شکست‌صفحه تعریف‌طرح‌بندی \
+تعریف‌فرمان تعریف‌قالبی تعریف‌قلم تعریف‌قلم‌خام تعریف‌قلم‌متن \
+تعریف‌لایه تعریف‌لهجه تعریف‌لوح تعریف‌لیست تعریف‌لیست‌ترکیبی \
+تعریف‌لیست‌مرجع تعریف‌مترادفها تعریف‌مترادف‌قلم تعریف‌متغیرمتن تعریف‌متن \
+تعریف‌متن‌قالبی تعریف‌مجموعه‌ستون تعریف‌محیط‌قلم‌بدنه تعریف‌مرجع تعریف‌منوی‌پانل \
+تعریف‌مکان‌متن تعریف‌میدان تعریف‌میدان‌اصلی تعریف‌نسخه تعریف‌نشانه‌گذاری \
+تعریف‌نماد تعریف‌نمادشکل تعریف‌پاراگرافها تعریف‌پروفایل تعریف‌پوشش \
+تعریف‌گروه‌آیتم تعریف‌گروه‌رنگ تعیین‌شماره تعیین‌شماره‌سر تعیین‌متغیر‌متن \
+تعیین‌محتوای‌متن تعیین‌مشخصات‌ثبت تعیین‌مشخصات‌لیست تغییربه‌قلم‌بدنه تغییربه‌قلم‌خام \
+تنظیم‌راست تنظیم‌طرح‌بندی تنظیم‌وسط توجه تورفتگی \
+توری تولید تک ثبت‌زوج ثبت‌کامل \
+جداسازی‌نشانه‌گذاری حاش حرف حرفها حفظ‌بلوکها \
+حقیقت خالی خطهای‌سیاه خطهای‌نازک خطها‌خالی \
+خط‌حاشیه خط‌سیاه خط‌متن خط‌مو خط‌نازک \
+خ‌ا خ‌ع در درج‌آرمها درج‌ثبت \
+درج‌خط درج‌درخط درج‌درخطها درج‌درمتن درج‌درمیدان \
+درج‌در‌بالای‌یکدیگر درج‌در‌توری درج‌راهنما درج‌زیرفرمول درج‌شماره‌سر \
+درج‌شماره‌صفحه درج‌شناور درج‌فرمول درج‌لیست درج‌لیست‌خام \
+درج‌لیست‌مختلط درج‌لیست‌مرجع درج‌متغیرمتن درج‌متن‌سر درج‌پانوشتها \
+درج‌پانوشتهای‌موضعی درج‌چوب‌خط درج‌کنار‌به‌کنار درحاشیه درحاشیه‌دیگر \
+درحاشیه‌راست درحاشیه‌چپ درخارجی درخط درداخلی \
+درراست درصفحه درقالبی درلبه‌راست درلبه‌چپ \
+درمورد درون درپر درچپ دریافت‌بافر \
+دریافت‌شماره دریافت‌نشانه دوران دکمه دکمه‌منو \
+دکمه‌پانل رج رجوع رنگ رنگ‌خاکستری \
+روزهفته ریاضی زبان زبان‌اصلی ستون \
+ستون‌امتحان سر سرپوش‌کوچک‌نه شروع‌آرایش شروع‌آرایش‌ستون \
+شروع‌باریکتر شروع‌بازبینی شروع‌بلوک‌حاشیه شروع‌ترکیب شروع‌تصحیح‌خط \
+شروع‌تطابق شروع‌تنظیم شروع‌تولید شروع‌جدول شروع‌جدولها \
+شروع‌خط شروع‌خطها شروع‌خط‌حاشیه شروع‌خط‌متن شروع‌رنگ \
+شروع‌ستونها شروع‌سراسری شروع‌شماره‌گذاری‌خط شروع‌شکل شروع‌غیر‌فشرده \
+شروع‌فشرده شروع‌متن شروع‌مجموعه‌ستون شروع‌مجموعه‌نماد شروع‌محیط \
+شروع‌مخالف شروع‌موضعی شروع‌مولفه شروع‌مکان‌گذاری شروع‌نسخه \
+شروع‌نقل‌قول شروع‌نوشتار شروع‌پانوشتهای‌موضعی شروع‌پروفایل شروع‌پروژه \
+شروع‌پس‌زمینه شروع‌پوشش شروع‌کد شماره‌افزایش شماره‌زیرصفحه \
+شماره‌زیرفرمول شماره‌سر شماره‌سرجاری شماره‌صفحه شماره‌صفحه‌کامل \
+شماره‌فرمول شماره‌مبدل شماره‌ها شماره‌کاهش شماره‌کل‌صفحه‌ها \
+شکافتن‌شناور شکل‌خارجی صفحه صفحه‌تست صفحه‌زوج \
+صفحه‌پردازش طول‌لیست عبوربلوکها عرض‌آرایش عرض‌برگ \
+عرض‌حاشیه عرض‌حاشیه‌خارجی عرض‌حاشیه‌داخلی عرض‌حاشیه‌راست عرض‌حاشیه‌چپ \
+عرض‌خط عرض‌لبه عرض‌لبه‌خارجی عرض‌لبه‌داخلی عرض‌لبه‌راست \
+عرض‌لبه‌چپ عرض‌لیست عرض‌متن عمق‌صفحه عنوان‌حاشیه \
+فاصله‌بالا فاصله‌ته‌برگ فاصله‌حاشیه فاصله‌حاشیه‌خارجی فاصله‌حاشیه‌داخلی \
+فاصله‌حاشیه‌راست فاصله‌حاشیه‌چپ فاصله‌سربرگ فاصله‌لبه فاصله‌لبه‌خارجی \
+فاصله‌لبه‌داخلی فاصله‌لبه‌راست فاصله‌لبه‌چپ فاصله‌پایین فاصله‌پشت \
+فشرده فضا فضاهای‌ثابت فضای‌بالا فضای‌برش \
+فضای‌ثابت فضای‌سفید فضای‌سفیدصحیح فضای‌پایین فوری‌به‌لیست \
+فوری‌بین‌لیست قالبی لوح‌مقایسه ماه متغیر متن \
+متن‌برچسب متن‌حاشیه متن‌سر متن‌پانوشت محیط \
+مراجعه مرجع مرجع‌صفحه مرجع‌متن مرحله‌سر \
+مسکن معنی‌واحد مقایسه‌گروه‌رنگ مقدارخاکستری مقداررنگ \
+مقیاس منفی منوی‌پانل مولفه مکان \
+مکان‌متن میدان میدانهای‌گزارش میدان‌شبیه‌سازی میدان‌پشته \
+میدان‌کپی میله‌تطابق میله‌رنگ میله‌پانل ناشناس \
+نام‌ماکرو نسخه نسخه‌نشانه نشانه‌گذاری نشانه‌گذاری‌زوج \
+نشر نصب‌زبان نقطه‌ها نقل نقل‌قول \
+نم نماد نمادسر نمادلیست نمایش‌آرایش \
+نمایش‌بارگذاریها نمایش‌بستها نمایش‌توری نمایش‌رنگ نمایش‌شکلهای‌خارجی \
+نمایش‌طرح‌بندی نمایش‌قالب نمایش‌قلم‌بدنه نمایش‌لوح نمایش‌مجموعه‌علامت \
+نمایش‌محیط‌قلم‌بدنه نمایش‌میدانها نمایش‌چاپ نمایش‌گروه‌رنگ نوشتارزوج \
+هدایت پا پابا پانوشت پایان‌آرایش \
+پایان‌آرایش‌ستون پایان‌بازبینی پایان‌بلوک‌حاشیه پایان‌ترکیب پایان‌تصحیح‌خط \
+پایان‌تطابق پایان‌تنظیم پایان‌تولید پایان‌جدول پایان‌جدولها \
+پایان‌خط پایان‌خطها پایان‌خط‌حاشیه پایان‌خط‌متن پایان‌رنگ \
+پایان‌ستونها پایان‌سراسری پایان‌شماره‌گذاری‌خط پایان‌غیرفشرده پایان‌فشرده \
+پایان‌متن پایان‌مجموعه‌ستون پایان‌محیط پایان‌مخالف پایان‌موضعی \
+پایان‌مولفه پایان‌مکان‌گذاری پایان‌نازکتر پایان‌نسخه پایان‌نقل‌قول \
+پایان‌نوشتار پایان‌پانوشتهای‌موضعی پایان‌پروفایل پایان‌پروژه پایان‌پس‌زمینه \
+پایان‌پوشش پایان‌کد پایین پرده پروژه \
+پرکردن‌میدان پس‌زمینه پیروی‌نسخه پیروی‌نسخه‌پروفایل پیروی‌پروفایل \
+چاپ‌ارتفاع‌برگ چاپ‌عرض‌برگ چوبخط چپ‌چین کاغذزوج \
+کسر کشیده کلمه‌حاشیه کلمه‌راست گیره \
+یادداشت یک‌جا یک‌خط
+
keywordclass.context.de=\
Buchstabe Buchstaben CAP Cap \
Caps KAP Kap Kaps MONAT \
@@ -483,316 +633,6 @@ zeigegitter zeigelayout zeigepalette zeigerahmen zeigestruts \
zeigeumbruch zentriert ziffern zitat zitieren \
zu zurbox zurseite zwischenraum
-keywordclass.context.cs=\
-CAP Cap Caps Cisla \
-KAP Kap Kaps MESIC Rimskecislice \
-SLOVA SLOVO Slova Slovo VSEDNIDEN \
-Znak Znaky aktualnicislonadpisu aktualnidatum appendix \
-arg atleftmargin atrightmargin barevnalista barva \
-bilemisto bottomspace bublinkovanapoveda bydliste bypassblocks \
-cap celkovypocetstran cernalinka cernelinky chapter \
-chem cisla cislonadpisu cislopodrovnice cislorovnice \
-cislostrany citace citovat comment completecombinedlist \
-completelistoffloats completelistofsorts completelistofsynonyms completepagenumber completeregister \
-coupledregister crlf cutspace datum decrementnumber \
-definebodyfontDEF definebodyfontREF definecolumnbreak definecolumnset definecombination \
-definedfont definefontfeature definefonthandling defineindentedtext defineinmargin \
-defineitemgroup definelayer definelayout definemathalignment definepagebreak \
-defineplacement definerawfont definerule definetextposition definetextvariable \
-definetype definetypeface definuj definujakcent definujbarvu \
-definujblok definujbloksekce definujbuffer definujfont definujformatodkazu \
-definujhbox definujhlavnipole definujinterakcnimenu definujkombinovanyseznam definujkonverzi \
-definujlogo definujnadpis definujobrazeksymbol definujodkaz definujodstavce \
-definujopis definujoramovani definujoramovanytext definujpaletu definujplvouciobjekt \
-definujpodpole definujpole definujpopis definujpopisek definujprekryv \
-definujpreskok definujprikaz definujprofil definujprogram definujprostredizakladnihofontu \
-definujrejstrik definujsablonutabulky definujsekci definujseznam definujseznamodkazu \
-definujskupinubarev definujstartstop definujstyl definujstylfontu definujsymbol \
-definujsynonumumfontu definujsynonyma definujtabelaci definujtext definujtrideni \
-definujupravu definujvelikostpapiru definujverzi definujvycet definujvystup \
-definujzakladnifont definujzasobnikpoli definujznaceni definujznak delkaseznamu \
-description dodrzujprofil dodrzujverzi dodrzujverziprofilu dvoustrannypapir \
-emptylines enumeration externiobraz fakt footnotetext \
-forceblocks framedtext getnumber headsym hl \
-hlavnijazyk hlavniuroven hodnotabarvy hodnotasedi immediatebetweenlist \
-immediatetolist indentation ininner inneredgedistance inneredgewidth \
-innermargindistance innermarginwidth inouter instalacejazyka interakcnilista \
-interakcnitlacitka interaktivnimenu jazyk jdidolu jdina \
-jdinabox jdinastranu jmeno kap klonujpole \
-komponenta konvertujcislo kopirujpole korekcebilehomista labeling \
-leg listsymbol loadsorts loadsynonyms maoramovani \
-mapfontsize marginalnilinka marginalninadpis marginalnislovo marginalnitext \
-matematika mazaramovani mediaeval meritko mesic \
-mezera moveformula movesidefloat mrizka nadpis \
-nadruhyokraj nalevo nalevyokraj name naokraj \
-napravo napravyokraj nastavbarvu nastavbarvy nastavbilamista \
-nastavblok nastavbloksekce nastavbuffer nastavcernelinky nastavcislonadpisu \
-nastavcislostrany nastavcislovani nastavcislovaniodstavcu nastavcislovaniradku nastavcislovanistran \
-nastavcitaci nastavdefinicipoznamekpodcarou nastavdeleniplvoucichobjektu nastavdelitko nastavdolnitexty \
-nastaveni nastavexterniobrazy nastavhorejsek nastavhornitexty nastavinterakci \
-nastavinterakcnilistu nastavinterakcnimenu nastavinterakcniobrazovku nastavjazyk nastavkapitalky \
-nastavkombinovanyseznam nastavkomentar nastavkomentarstrany nastavlegendu nastavmarginalie \
-nastavmarginalniblok nastavmarginalnilinky nastavmeziradkovoumezeru nastavnadpis nastavnadpisy \
-nastavodkazovani nastavodsazovani nastavodstavce nastavopis nastavoramovanetexty \
-nastavoramovani nastavorez nastavotoceni nastavpaletu nastavplvouciobjekt \
-nastavplvouciobjekty nastavpodcislostrany nastavpodtrzeni nastavpole nastavpolozky \
-nastavpopisek nastavpopisky nastavpopisy nastavpozadi nastavpoznamkypodcarou \
-nastavprechodstrany nastavpreskok nastavprofily nastavprogramy nastavprostredizakladnihofontu \
-nastavpublikace nastavradkovani nastavradky nastavrastr nastavrejstrik \
-nastavrovnice nastavsadusymbolu nastavsekci nastavseznam nastavseznamodkazu \
-nastavsirkucary nastavsloupce nastavspodek nastavspojeni nastavsynchronizaci \
-nastavsynchronizacnilistu nastavsynonyma nastavsystem nastavtab nastavtabelaci \
-nastavtabulky nastavtenkelinky nastavtext nastavtexthlavicky nastavtextovelinky \
-nastavtextpopisku nastavtexttexty nastavtextyupati nastavtextyzahlavi nastavtlacitka \
-nastavtoleranci nastavtrideni nastavtype nastavumisteniprotejsku nastavumistovani \
-nastavupati nastavupravu nastavurl nastavusporadani nastavvelikostpapiru \
-nastavverze nastavvsechnapole nastavvycty nastavvyplnovelinky nastavvyplnoveradky \
-nastavvystup nastavvzhled nastavzahlavi nastavzakladnifont nastavzarovnani \
-nastavznaceni nastavzuzeni nastrane navigating nejakyradek \
-nekde nextsection neznamo nivy nizky \
-nocap nokap nop numberofsubpages obrazovka \
-odkaz odkaznadatum odkaznastranu odkaznatext odkazujici \
-odsazenishora odsazenizleva odsazovani okr opakovat \
-opis opissoubor oramovani oref orez \
-otocit outeredgedistance outeredgewidth outermargindistance outermarginwidth \
-overbar overbars overstrike overstrikes oznaceni \
-oznacverzi pagedepth pageoffset paragraph parovastrana \
-part pis placefloat placeheadnumber placeheadtext \
-placelistoffloats placelistofsorts placelistofsynonyms placepagenumber placerawlist \
-placereferencelist placerule placetextvariable plnezneni pol \
-pole polozka polozky popisky poppisek \
-porovnejpaletu porovnejskupinubarev positiontext pozadi pozice \
-poznamka poznamkapodcarou pref prelozit premistinamrizku \
-prepninazakladnifont preskoc prizpusobivepole prizpusobvzhled produkt \
-program projekt propojeneznaceni propojenydokument propojenyrejstrik \
-prostredi publikace ran ref register \
-reservefloat reset resetnumber resettextcontent resetznaceni \
-rimskecislice rozdelplvouciobjekt rozmer rozpojeneznaceni roztazene \
-schovejbloky section sedabarva seeregister setnumber \
-settextcontent settextvariable setupanswerarea setupcolumnset setupcolumnsetlines \
-setupcolumnsetstart setupfonthandling setupfontsynonym setupforms setupindentedtext \
-setupinterlinespace2 setupitemgroup setuplistalternative setupmathalignment setupnumber \
-setuppaper setupplacement setuprule setupstartstop setupstrut \
-setuptextposition setuptextvariable sirkalevehookraje sirkalevemarginalie sirkamarginalie \
-sirkaokraje sirkapapiru sirkapravehookraje sirkapravemarginalie sirkasazby \
-sirkaseznamu sirkatextu sirkatiskpapiru sloupec slovovpravo \
-sort spodek stanovcharakteristickuseznamu stanovcislonadpisu startalignment \
-startbarva startbuffer startcislovaniradku startcitace startcolumnmakeup \
-startcolumns startcolumnset startcombination startcomment startdescription \
-startdocument startdokument startenumeration startfakt startfigure \
-startfloattext startformula startframedtext startglobalni starthiding \
-startinteraktivnimenu startitemgroup startkodovani startkomponenta startkorekceradku \
-startlegend startline startlinecorrection startlinenumbering startlines \
-startlocal startlocalenvironment startlocalfootnotes startlokalni startlokalnipoznamkypodcarou \
-startmakeup startmarginalniblok startmarginalnilinka startmarginblock startnamemakeup \
-startnarrower startnezhustene startobraz startopposite startoverlay \
-startoverview startparagraph startpositioning startpostponing startpozadi \
-startprehled startprekryv startprodukt startprofil startprofile \
-startprojekt startprostredi startprotejsek startradek startradky \
-startrastr startregister startsadasymbolu startsloupce startspojeni \
-startsymbolset startsynchronizace startsynchronization starttable starttables \
-starttabulate starttabulka starttabulky starttext starttextovalinka \
-starttyping startumistovani startunpacked startuprava startverze \
-startzarovnavani startzhustene startzuzeni stopalignment stopbarva \
-stopbuffer stopcislovaniradku stopcitace stopcolumnmakeup stopcolumns \
-stopcolumnset stopcombination stopcomment stopdescription stopdocument \
-stopdokument stopenumeration stopfakt stopfigure stopfloattext \
-stopformula stopframedtext stopglobalni stophiding stopinteraktivnimenu \
-stopitemgroup stopkodovani stopkomponenta stopkorekceradku stoplegend \
-stopline stoplinecorrection stoplinenumbering stoplines stoplocal \
-stoplocalenvironment stoplocalfootnotes stoplokalni stoplokalnipoznamkypodcarou stopmakeup \
-stopmarginalniblok stopmarginalnilinka stopmarginblock stopnamemakeup stopnarrower \
-stopnezhustene stopopposite stopoverlay stopoverview stopparagraph \
-stoppositioning stoppostponing stoppozadi stopprehled stopprekryv \
-stopprodukt stopprofil stopprofile stopprojekt stopprostredi \
-stopprotejsek stopradek stopradky stoprastr stopsloupce \
-stopspojeni stopsymbolset stopsynchronizace stopsynchronization stoptable \
-stoptables stoptabulate stoptabulka stoptabulky stoptext \
-stoptextovalinka stoptyping stopumistovani stopunpacked stopuprava \
-stopverze stopzarovnavani stopzhustene stopzuzeni strana \
-sub subject subpagenumber subsection subsubject \
-subsubsection subsubsubject switchtorawfont sym symbol \
-synchronizacnilista synchronizovat synonym tab tecky \
-tenkalinka tenkelinky testcolumn testpage tex \
-texthlavicky textovalinka textpopisku textvariable title \
-tlacitko tlacitkomenu tloustkacary tref tvrdamezera \
-tvrdemezery txt typebuffer ukazbarvu ukazexterniobrazy \
-ukazmrizku ukaznastaveni ukazpaletu ukazpodpery ukazpole \
-ukazpostredizakladnihofontu ukazramecek ukazsadusymbolu ukazskupinubarev ukazupravu \
-ukazvytisk ukazvzhled ukazzakladnifont umistikombinovanyseznam umistilegendu \
-umistiloga umistilokalnipoznamkypodcarou umistinadsebe umistinamrizku umistipodrovnici \
-umistipoznamkypodcarou umistirejstrik umistirovnici umistiseznam umistivedlesebe \
-umistizalozky underbar underbars urcicharakteristikurejstriku useXMLfilter \
-usedirectory usetypescript usetypescriptfile uzijJSscripts uzijURL \
-uzijadresar uzijbloky uzijexternidokument uzijexterniobraz uzijexternisoubor \
-uzijexternisoubory uzijexternizvuk uzijkodovani uzijmodul uzijmoduly \
-uzijodkazy uzijprikazy uzijspeciality uzijsymbol uzijurl \
-verze vl vlasovalinka vlevo vpravo \
-vradku vsedniden vyberbloky vyberpapir vyberverzi \
-vyplnenytext vyplnovelinky vyplnovepole vyplnovyradek vyskahorejsku \
-vyskapapiru vyskasazby vyskaseznamu vyskaspodku vyskatextu \
-vyskatiskpapiru vyskaupati vyskazahlavi vysoky vyznam \
-vzdalenosthorejsku vzdalenostlevehookraje vzdalenostlevemarginalie vzdalenostmarginalie vzdalenostokraje \
-vzdalenostpravehookraje vzdalenostpravemarginalie vzdalenostspodku vzdalenostupati vzdalenostzahlavi \
-zablokujinterakcnimenu zachovejbloky zadnamezera zadnebilemisto zadnedalsibloky \
-zadnedalsisoubory zadnehorniadolniradky zadneodsazovani zadnezahlaviaupati zadneznaceni \
-zadnyrozmer zadnyseznam zadnytest zalozka zapisdorejstriku \
-zapisdoseznamu zapisdoseznamuodkazu zapismeziseznam zaramovani zarovnanonastred \
-zarovnanovlevo zarovnanovpravo zasobnikpoli zaznamovepole zhustene \
-ziskejbuffer ziskejznaceni zlomek znaceni znak \
-znaky zpracujbloky zpracujstranu zrcadlit zref \
-zvysujicicislo
-
-keywordclass.context.en=\
-CAP Cap Caps Character \
-Characters MONTH Numbers Romannumerals WEEKDAY \
-WORD WORDS Word Words about \
-adaptlayout adding appendix arg at \
-atleftmargin atpage atrightmargin background backspace \
-blackrule blackrules blank bookmark bottomdistance \
-bottomheight bottomspace but button bypassblocks \
-cap chapter character characters chem \
-clip clonefield color colorbar colorvalue \
-column comment comparecolorgroup comparepalet completecombinedlist \
-completelistoffloats completelistofsorts completelistofsynonyms completepagenumber completeregister \
-component convertnumber copyfield correctwhitespace coupledocument \
-coupledregister couplemarking couplepage couplepaper coupleregister \
-crlf currentdate currentheadnumber cutspace date \
-decouplemarking decrementnumber define defineaccent defineblank \
-defineblock definebodyfont definebodyfontDEF definebodyfontREF definebodyfontenvironment \
-definebuffer definecharacter definecolor definecolorgroup definecolumnbreak \
-definecolumnset definecombination definecombinedlist definecommand defineconversion \
-definedescription definedfont defineenumeration definefield definefieldstack \
-definefiguresymbol definefloat definefont definefontfeature definefonthandling \
-definefontstyle definefontsynonym defineframed defineframedtext definehbox \
-definehead defineindentedtext defineinmargin defineinteractionmenu defineitemgroup \
-definelabel definelayer definelayout definelist definelogo \
-definemainfield definemakeup definemarking definemathalignment defineoutput \
-defineoverlay definepagebreak definepalet definepapersize defineparagraphs \
-defineplacement defineprofile defineprogram definerawfont definereference \
-definereferenceformat definereferencelist defineregister definerule definesection \
-definesectionblock definesorting definestartstop definestyle definesubfield \
-definesymbol definesynonyms definetabletemplate definetabulate definetext \
-definetextposition definetextvariable definetype definetypeface definetyping \
-defineversion description determineheadnumber determinelistcharacteristics determineregistercharacteristics \
-dimension disableinteractionmenu domicile donttest edgedistance \
-edgewidth emptylines enumeration environment externalfigure \
-fact field fieldstack fillinfield fillinline \
-fillinrules fillintext fitfield fixedspace fixedspaces \
-followprofile followprofileversion followversion footerdistance footerheight \
-footnote footnotetext forceblocks formulanumber fraction \
-framed framedtext from getbuffer getmarking \
-getnumber godown goto gotobox gotopage \
-graycolor greyvalue grid hairline head \
-headerdistance headerheight headlevel headnumber headsym \
-headtext hideblocks high hl immediatebetweenlist \
-immediatetolist in incrementnumber indentation indenting \
-inframed infull ininner inleft inleftedge \
-inleftmargin inline inmaframed inmargin inneredgedistance \
-inneredgewidth innermargindistance innermarginwidth inothermargin inouter \
-inright inrightedge inrightmargin installlanguage interactionbar \
-interactionbuttons interactionmenu item items its \
-keepblocks label labeling labels labeltext \
-language leftaligned leftedgedistance leftedgewidth leftmargindistance \
-leftmarginwidth leg linethickness listheight listlength \
-listsymbol listwidth loadsorts loadsynonyms logfields \
-lohi low maframed mainlanguage makeupheight \
-makeupwidth mapfontsize mar margindistance marginrule \
-margintext margintitle marginwidth marginword marking \
-markversion mathematics mediaeval menubutton midaligned \
-mirror month moveformula moveongrid movesidefloat \
-name navigating nextsection nocap nodimension \
-noheaderandfooterlines noindenting nolist nomarking nomoreblocks \
-nomorefiles nop nospace note notopandbottomlines \
-nowhitespace numberofsubpages numbers outeredgedistance outeredgewidth \
-outermargindistance outermarginwidth overbar overbars overstrike \
-overstrikes packed page pagedepth pagenumber \
-pageoffset pagereference paperheight paperwidth paragraph \
-part periods placebookmarks placecombinedlist placefloat \
-placefootnotes placeformula placeheadnumber placeheadtext placelegend \
-placelist placelistoffloats placelistofsorts placelistofsynonyms placelocalfootnotes \
-placelogos placeongrid placeontopofeachother placepagenumber placerawlist \
-placereferencelist placeregister placerule placesidebyside placesubformula \
-placetextvariable position positiontext printpaperheight printpaperwidth \
-processblocks processpage product program project \
-publication quotation quote ran redo \
-ref reference referral referraldate referring \
-register remark reservefloat reset resetmarking \
-resetnumber resettextcontent rightaligned rightedgedistance rightedgewidth \
-rightmargindistance rightmarginwidth romannumerals rotate scale \
-screen section seeregister selectblocks selectpaper \
-selectversion setnumber settextcontent settextvariable setupalign \
-setupanswerarea setuparranging setupbackground setupbackgrounds setupblackrules \
-setupblank setupblock setupbodyfont setupbodyfontenvironment setupbottom \
-setupbottomtexts setupbuffer setupbuttons setupcapitals setupcaption \
-setupcaptions setupclipping setupcolor setupcolors setupcolumns \
-setupcolumnset setupcolumnsetlines setupcolumnsetstart setupcombinations setupcombinedlist \
-setupcomment setupdescriptions setupenumerations setupexternalfigures setupfield \
-setupfields setupfillinlines setupfillinrules setupfloat setupfloats \
-setupfloatsplitting setupfonthandling setupfontsynonym setupfooter setupfootertexts \
-setupfootnotedefinition setupfootnotes setupforms setupformulae setupframed \
-setupframedtexts setuphead setupheader setupheadertexts setupheadnumber \
-setupheads setupheadtext setuphyphenmark setupindentedtext setupindenting \
-setupinmargin setupinteraction setupinteractionbar setupinteractionmenu setupinteractionscreen \
-setupinterlinespace setupinterlinespace2 setupitemgroup setupitemizations setupitems \
-setuplabeltext setuplanguage setuplayout setuplegend setuplinenumbering \
-setuplines setuplinewidth setuplist setuplistalternative setupmakeup \
-setupmarginblocks setupmarginrules setupmarking setupmathalignment setupnarrower \
-setupnumber setupnumbering setupoppositeplacing setupoutput setuppagecomment \
-setuppagenumber setuppagenumbering setuppagetransitions setuppalet setuppaper \
-setuppapersize setupparagraphnumbering setupparagraphs setupplacement setuppositioning \
-setupprofiles setupprograms setuppublications setupquote setupreferencelist \
-setupreferencing setupregister setuprotate setuprule setups \
-setupscreens setupsection setupsectionblock setupsorting setupspacing \
-setupstartstop setupstrut setupsubpagenumber setupsymbolset setupsynchronization \
-setupsynchronizationbar setupsynonyms setupsystem setuptab setuptables \
-setuptabulate setuptext setuptextposition setuptextrules setuptexttexts \
-setuptextvariable setupthinrules setuptolerance setuptop setuptoptexts \
-setuptype setuptyping setupunderbar setupurl setupversions \
-setupwhitespace showbodyfont showbodyfontenvironment showcolor showcolorgroup \
-showexternalfigures showfields showframe showgrid showlayout \
-showmakeup showpalet showprint showsetups showstruts \
-showsymbolset someline somewhere sort space \
-splitfloat startalignment startbackground startbuffer startcoding \
-startcolor startcolumnmakeup startcolumns startcolumnset startcombination \
-startcomment startcomponent startdescription startdocument startenumeration \
-startenvironment startfact startfigure startfloattext startformula \
-startframedtext startglobal starthiding startinteractionmenu startitemgroup \
-startlegend startline startlinecorrection startlinenumbering startlines \
-startlocal startlocalenvironment startlocalfootnotes startmakeup startmarginblock \
-startmarginrule startnamemakeup startnarrower startopposite startoverlay \
-startoverview startpacked startparagraph startpositioning startpostponing \
-startproduct startprofile startproject startquotation startraster \
-startregister startsymbolset startsynchronization starttable starttables \
-starttabulate starttext starttextrule starttyping startunpacked \
-startversion stopalignment stopbackground stopbuffer stopcoding \
-stopcolor stopcolumnmakeup stopcolumns stopcolumnset stopcombination \
-stopcomment stopcomponent stopdescription stopdocument stopenumeration \
-stopenvironment stopfact stopfigure stopfloattext stopformula \
-stopframedtext stopglobal stophiding stopinteractionmenu stopitemgroup \
-stoplegend stopline stoplinecorrection stoplinenumbering stoplines \
-stoplocal stoplocalenvironment stoplocalfootnotes stopmakeup stopmarginblock \
-stopmarginrule stopnamemakeup stopnarrower stopopposite stopoverlay \
-stopoverview stoppacked stopparagraph stoppositioning stoppostponing \
-stopproduct stopprofile stopproject stopquotation stopraster \
-stopsymbolset stopsynchronization stoptable stoptables stoptabulate \
-stoptext stoptextrule stoptyping stopunpacked stopversion \
-stretched sub subformulanumber subject subpagenumber \
-subsection subsubject subsubsection subsubsubject switchtobodyfont \
-switchtorawfont sym symbol synchronizationbar synchronize \
-synonym tab testcolumn testpage tex \
-textheight textreference textrule textvariable textwidth \
-thinrule thinrules title tooltip topdistance \
-topheight topspace totalnumberofpages translate txt \
-typ type typebuffer typefile underbar \
-underbars unitmeaning unknown useJSscripts useURL \
-useXMLfilter useblocks usecommands usedirectory useencoding \
-useexternaldocument useexternalfigure useexternalfile useexternalfiles useexternalsoundtrack \
-usemodule usemodules usereferences usespecials usesymbols \
-usetypescript usetypescriptfile useurl version vl \
-weekday whitespace wordright writebetweenlist writetolist \
-writetoreferencelist writetoregister
-
keywordclass.context.ro=\
CAP CUVANT CUVINTE Cap \
Caps Cuvant Cuvinte KAP Kap \
@@ -951,168 +791,165 @@ urmeazaversiune urmeazaversiuneprofil useXMLfilter usedirectory usetypescript \
usetypescriptfile valoareculoare valoaregri variabilatext versiune \
vl zidinsaptamana
-keywordclass.context.pe=\
-CAP Cap Caps Character \
-Characters MONTH Numbers Romannumerals WEEKDAY \
-WORD WORDS Word Words appendix \
-cap chapter chem comment completecombinedlist \
-completelistoffloats completelistofsorts completelistofsynonyms coupledregister crlf \
-definebodyfontDEF definebodyfontREF definedfont definefontfeature definefonthandling \
-defineindentedtext definetypeface description enumeration framedtext \
-indentation inmframed its labeling loadsorts \
-loadsynonyms mapfontsize mediaeval mframed name \
-nextsection nocap overbar overbars overstrike \
-overstrikes paragraph part placelistoffloats placelistofsorts \
-placelistofsynonyms ran register reservefloat resettextcontent \
-section seeregister setupanswerarea setupcapitals setupfonthandling \
-setupfontsynonym setupindentedtext setupinterlinespace2 setuplistalternative setupurl \
-sort startalignment startbuffer startcolumns startcombination \
-startcomment startdescription startdocument startenumeration startfigure \
-startfloattext startformula startframedtext starthiding startitemgroup \
+keywordclass.context.cs=\
+CAP Cap Caps Cisla \
+KAP Kap Kaps MESIC Rimskecislice \
+SLOVA SLOVO Slova Slovo VSEDNIDEN \
+Znak Znaky aktualnicislonadpisu aktualnidatum appendix \
+arg atleftmargin atrightmargin barevnalista barva \
+bilemisto bottomspace bublinkovanapoveda bydliste bypassblocks \
+cap celkovypocetstran cernalinka cernelinky chapter \
+chem cisla cislonadpisu cislopodrovnice cislorovnice \
+cislostrany citace citovat comment completecombinedlist \
+completelistoffloats completelistofsorts completelistofsynonyms completepagenumber completeregister \
+coupledregister crlf cutspace datum decrementnumber \
+definebodyfontDEF definebodyfontREF definecolumnbreak definecolumnset definecombination \
+definedfont definefontfeature definefonthandling defineindentedtext defineinmargin \
+defineitemgroup definelayer definelayout definemathalignment definepagebreak \
+defineplacement definerawfont definerule definetextposition definetextvariable \
+definetype definetypeface definuj definujakcent definujbarvu \
+definujblok definujbloksekce definujbuffer definujfont definujformatodkazu \
+definujhbox definujhlavnipole definujinterakcnimenu definujkombinovanyseznam definujkonverzi \
+definujlogo definujnadpis definujobrazeksymbol definujodkaz definujodstavce \
+definujopis definujoramovani definujoramovanytext definujpaletu definujplvouciobjekt \
+definujpodpole definujpole definujpopis definujpopisek definujprekryv \
+definujpreskok definujprikaz definujprofil definujprogram definujprostredizakladnihofontu \
+definujrejstrik definujsablonutabulky definujsekci definujseznam definujseznamodkazu \
+definujskupinubarev definujstartstop definujstyl definujstylfontu definujsymbol \
+definujsynonumumfontu definujsynonyma definujtabelaci definujtext definujtrideni \
+definujupravu definujvelikostpapiru definujverzi definujvycet definujvystup \
+definujzakladnifont definujzasobnikpoli definujznaceni definujznak delkaseznamu \
+description dodrzujprofil dodrzujverzi dodrzujverziprofilu dvoustrannypapir \
+emptylines enumeration externiobraz fakt footnotetext \
+forceblocks framedtext getnumber headsym hl \
+hlavnijazyk hlavniuroven hodnotabarvy hodnotasedi immediatebetweenlist \
+immediatetolist indentation ininner inneredgedistance inneredgewidth \
+innermargindistance innermarginwidth inouter instalacejazyka interakcnilista \
+interakcnitlacitka interaktivnimenu jazyk jdidolu jdina \
+jdinabox jdinastranu jmeno kap klonujpole \
+komponenta konvertujcislo kopirujpole korekcebilehomista labeling \
+leg listsymbol loadsorts loadsynonyms maoramovani \
+mapfontsize marginalnilinka marginalninadpis marginalnislovo marginalnitext \
+matematika mazaramovani mediaeval meritko mesic \
+mezera moveformula movesidefloat mrizka nadpis \
+nadruhyokraj nalevo nalevyokraj name naokraj \
+napravo napravyokraj nastavbarvu nastavbarvy nastavbilamista \
+nastavblok nastavbloksekce nastavbuffer nastavcernelinky nastavcislonadpisu \
+nastavcislostrany nastavcislovani nastavcislovaniodstavcu nastavcislovaniradku nastavcislovanistran \
+nastavcitaci nastavdefinicipoznamekpodcarou nastavdeleniplvoucichobjektu nastavdelitko nastavdolnitexty \
+nastaveni nastavexterniobrazy nastavhorejsek nastavhornitexty nastavinterakci \
+nastavinterakcnilistu nastavinterakcnimenu nastavinterakcniobrazovku nastavjazyk nastavkapitalky \
+nastavkombinovanyseznam nastavkomentar nastavkomentarstrany nastavlegendu nastavmarginalie \
+nastavmarginalniblok nastavmarginalnilinky nastavmeziradkovoumezeru nastavnadpis nastavnadpisy \
+nastavodkazovani nastavodsazovani nastavodstavce nastavopis nastavoramovanetexty \
+nastavoramovani nastavorez nastavotoceni nastavpaletu nastavplvouciobjekt \
+nastavplvouciobjekty nastavpodcislostrany nastavpodtrzeni nastavpole nastavpolozky \
+nastavpopisek nastavpopisky nastavpopisy nastavpozadi nastavpoznamkypodcarou \
+nastavprechodstrany nastavpreskok nastavprofily nastavprogramy nastavprostredizakladnihofontu \
+nastavpublikace nastavradkovani nastavradky nastavrastr nastavrejstrik \
+nastavrovnice nastavsadusymbolu nastavsekci nastavseznam nastavseznamodkazu \
+nastavsirkucary nastavsloupce nastavspodek nastavspojeni nastavsynchronizaci \
+nastavsynchronizacnilistu nastavsynonyma nastavsystem nastavtab nastavtabelaci \
+nastavtabulky nastavtenkelinky nastavtext nastavtexthlavicky nastavtextovelinky \
+nastavtextpopisku nastavtexttexty nastavtextyupati nastavtextyzahlavi nastavtlacitka \
+nastavtoleranci nastavtrideni nastavtype nastavumisteniprotejsku nastavumistovani \
+nastavupati nastavupravu nastavurl nastavusporadani nastavvelikostpapiru \
+nastavverze nastavvsechnapole nastavvycty nastavvyplnovelinky nastavvyplnoveradky \
+nastavvystup nastavvzhled nastavzahlavi nastavzakladnifont nastavzarovnani \
+nastavznaceni nastavzuzeni nastrane navigating nejakyradek \
+nekde nextsection neznamo nivy nizky \
+nocap nokap nop numberofsubpages obrazovka \
+odkaz odkaznadatum odkaznastranu odkaznatext odkazujici \
+odsazenishora odsazenizleva odsazovani okr opakovat \
+opis opissoubor oramovani oref orez \
+otocit outeredgedistance outeredgewidth outermargindistance outermarginwidth \
+overbar overbars overstrike overstrikes oznaceni \
+oznacverzi pagedepth pageoffset paragraph parovastrana \
+part pis placefloat placeheadnumber placeheadtext \
+placelistoffloats placelistofsorts placelistofsynonyms placepagenumber placerawlist \
+placereferencelist placerule placetextvariable plnezneni pol \
+pole polozka polozky popisky poppisek \
+porovnejpaletu porovnejskupinubarev positiontext pozadi pozice \
+poznamka poznamkapodcarou pref prelozit premistinamrizku \
+prepninazakladnifont preskoc prizpusobivepole prizpusobvzhled produkt \
+program projekt propojeneznaceni propojenydokument propojenyrejstrik \
+prostredi publikace ran ref register \
+reservefloat reset resetnumber resettextcontent resetznaceni \
+rimskecislice rozdelplvouciobjekt rozmer rozpojeneznaceni roztazene \
+schovejbloky section sedabarva seeregister setnumber \
+settextcontent settextvariable setupanswerarea setupcolumnset setupcolumnsetlines \
+setupcolumnsetstart setupfonthandling setupfontsynonym setupforms setupindentedtext \
+setupinterlinespace2 setupitemgroup setuplistalternative setupmathalignment setupnumber \
+setuppaper setupplacement setuprule setupstartstop setupstrut \
+setuptextposition setuptextvariable sirkalevehookraje sirkalevemarginalie sirkamarginalie \
+sirkaokraje sirkapapiru sirkapravehookraje sirkapravemarginalie sirkasazby \
+sirkaseznamu sirkatextu sirkatiskpapiru sloupec slovovpravo \
+sort spodek stanovcharakteristickuseznamu stanovcislonadpisu startalignment \
+startbarva startbuffer startcislovaniradku startcitace startcolumnmakeup \
+startcolumns startcolumnset startcombination startcomment startdescription \
+startdocument startdokument startenumeration startfakt startfigure \
+startfloattext startformula startframedtext startglobalni starthiding \
+startinteraktivnimenu startitemgroup startkodovani startkomponenta startkorekceradku \
startlegend startline startlinecorrection startlinenumbering startlines \
-startlocal startlocalenvironment startlocalfootnotes startmakeup startmarginblock \
-startnamemakeup startnarrower startopposite startoverlay startoverview \
-startparagraph startpositioning startpostponing startprofile startraster \
-startregister startsymbolset startsynchronization starttable starttables \
-starttabulate starttyping startunpacked startتولید startحقیقت \
-startخط‌حاشیه startخط‌متن startرنگ startفشرده startمحیط \
-startمنوی‌پانل startمولفه startنسخه startنقل‌قول startپروژه \
-startپس‌زمینه stopalignment stopbuffer stopcolumns stopcombination \
-stopcomment stopdescription stopdocument stopenumeration stopfigure \
-stopfloattext stopformula stopframedtext stophiding stopitemgroup \
-stoplegend stopline stoplinecorrection stoplinenumbering stoplines \
-stoplocal stoplocalenvironment stoplocalfootnotes stopmakeup stopmarginblock \
-stopnamemakeup stopnarrower stopopposite stopoverlay stopoverview \
-stopparagraph stoppositioning stoppostponing stopprofile stopraster \
-stopsymbolset stopsynchronization stoptable stoptables stoptabulate \
-stoptyping stopunpacked stopتولید stopحقیقت stopخط‌حاشیه \
-stopخط‌متن stopرنگ stopفشرده stopمحیط stopمنوی‌پانل \
-stopمولفه stopنسخه stopنقل‌قول stopپروژه stopپس‌زمینه \
-sub subject subsection subsubject subsubsection \
-subsubsubject synonym title tooltip txt \
-typ underbar underbars useJSscripts useURL \
-useXMLfilter usedirectory useurl آفست‌صفحه آیتم \
-آیتمها آینه اجباربلوکها ارتفاع‌آرایش ارتفاع‌بالا \
-ارتفاع‌برگ ارتفاع‌ته‌برگ ارتفاع‌خط ارتفاع‌سربرگ ارتفاع‌متن \
-ارتفاع‌پایین از ازکارانداختن‌منوی‌پانل استفاده‌بلوکها استفاده‌دستخط‌تایپ \
-استفاده‌رمزینه استفاده‌شکل‌خارجی استفاده‌فرمانها استفاده‌قطعه‌موزیک‌خارجی استفاده‌مدول \
-استفاده‌مدولها استفاده‌مرجعها استفاده‌مسیر استفاده‌نمادها استفاده‌نوشتارخارجی \
-استفاده‌ویژگیها استفاده‌پرونده‌خارجی استفاده‌پرونده‌دستخط‌تایپ استفاده‌پرونده‌های‌خارجی اعدادلاتین \
-افزودن اما امتحان‌نکن انتخاب‌برگ انتخاب‌بلوکها \
-انتخاب‌نسخه انتقال‌به‌توری انتقال‌فرمول انتقال‌کنار‌شناور انجام‌دوباره \
-بارگذاریها بارگذاری‌آرایش بارگذاری‌آیتمها بارگذاری‌ارجاع بارگذاری‌اندازه‌برگ \
-بارگذاری‌باریکتر بارگذاری‌بافر بارگذاری‌بالا بارگذاری‌بخش بارگذاری‌بردباری \
-بارگذاری‌برنامه‌ها بارگذاری‌برگ بارگذاری‌بست بارگذاری‌بلوک بارگذاری‌بلوکهای‌حاشیه \
-بارگذاری‌بلوک‌بخش بارگذاری‌تایپ بارگذاری‌تایپ‌کردن بارگذاری‌تب بارگذاری‌ترتیب \
-بارگذاری‌ترکیب‌ها بارگذاری‌تطابق بارگذاری‌تعریف‌پانوشت بارگذاری‌تنظیم بارگذاری‌تنظیم‌ریاضی \
-بارگذاری‌ته‌برگ بارگذاری‌تورفتگی بارگذاری‌توضیح بارگذاری‌توضیح‌صفحه بارگذاری‌ثبت \
-بارگذاری‌جانشانی بارگذاری‌جدولها بارگذاری‌جدول‌بندی بارگذاری‌خالی بارگذاری‌خروجی \
-بارگذاری‌خط بارگذاری‌خطها بارگذاری‌خطهای‌حاشیه بارگذاری‌خطهای‌سیاه بارگذاری‌خطهای‌متن \
-بارگذاری‌خطهای‌مجموعه‌ستون بارگذاری‌خطها‌ی‌نازک بارگذاری‌درج‌درخطها بارگذاری‌درج‌مخالف بارگذاری‌درون‌حاشیه \
-بارگذاری‌دوران بارگذاری‌دکمه‌ها بارگذاری‌راهنما بارگذاری‌رنگ بارگذاری‌رنگها \
-بارگذاری‌زبان بارگذاری‌ستونها بارگذاری‌سر بارگذاری‌سربرگ بارگذاری‌سرها \
-بارگذاری‌سیستم بارگذاری‌شرح بارگذاری‌شرحها بارگذاری‌شروع‌مجموعه‌ستون بارگذاری‌شروع‌پایان \
-بارگذاری‌شماره بارگذاری‌شماره‌زیرصفحه بارگذاری‌شماره‌سر بارگذاری‌شماره‌صفحه بارگذاری‌شماره‌گذاری \
-بارگذاری‌شماره‌گذاریها بارگذاری‌شماره‌گذاری‌صفحه بارگذاری‌شماره‌گذاری‌پاراگراف بارگذاری‌شماره‌‌گذاری‌خط بارگذاری‌شناور \
-بارگذاری‌شناورها بارگذاری‌شکافتن‌شناورها بارگذاری‌شکلهای‌خارجی بارگذاری‌طرح بارگذاری‌طرح‌بندی \
-بارگذاری‌عرض‌خط بارگذاری‌فاصله‌بین‌خط بارگذاری‌فرمولها بارگذاری‌فضای‌سفید بارگذاری‌فضا‌گذاری \
-بارگذاری‌قالبی بارگذاری‌قلم‌متن بارگذاری‌لوح بارگذاری‌لیست بارگذاری‌لیست‌ترکیبی \
-بارگذاری‌لیست‌مرجع بارگذاری‌مترادفها بارگذاری‌متغیر‌متن بارگذاری‌متن بارگذاری‌متنهای‌بالا \
-بارگذاری‌متن‌سر بارگذاری‌متن‌سربرگ بارگذاری‌متن‌قالبی بارگذاری‌متن‌متنها بارگذاری‌متن‌پانوشت \
-بارگذاری‌متن‌پایین بارگذاری‌مجموعه‌ستون بارگذاری‌مجموعه‌نماد بارگذاری‌محیط‌قلم‌متن بارگذاری‌منوی‌پانل \
-بارگذاری‌مکان‌متن بارگذاری‌مکان‌گذاری بارگذاری‌میدان بارگذاری‌میدانها بارگذاری‌میله‌تطابق \
-بارگذاری‌میله‌زیر بارگذاری‌میله‌پانل بارگذاری‌نسخه‌ها بارگذاری‌نشانه‌شکستن بارگذاری‌نشانه‌گذاری \
-بارگذاری‌نشرها بارگذاری‌نقل بارگذاری‌پاراگرافها بارگذاری‌پانل بارگذاری‌پانوشتها \
-بارگذاری‌پایین بارگذاری‌پرده‌ها بارگذاری‌پرده‌پانل بارگذاری‌پروفایلها بارگذاری‌پرکردن‌خطها \
-بارگذاری‌پس‌زمینه بارگذاری‌پس‌زمینه‌ها بارگذاری‌چیدن بارگذاری‌گذارصفحه بارگذاری‌گروههای‌آیتم \
-بارگذاری‌گروه‌آیتم بازنشانی بازنشانی‌شماره بازنشانی‌متن بازنشانی‌نشانه‌گذاری \
-باگذاری‌متن‌برچسب بدون‌بعد بدون‌بلوکهای‌بیشتر بدون‌تورفتگی بدون‌خط‌بالاوپایین \
-بدون‌خط‌سروته‌برگ بدون‌فایلهای‌بیشتر بدون‌فضا بدون‌فضای‌سفید بدون‌لیست \
-بدون‌نشانه‌گذاری برنامه بروبه بروبه‌جعبه بروبه‌صفحه \
-بروپایین برچسب برچسبها بعد بلند \
-بلوکهای‌پردازش بلوکها‌پنهان بنویس‌بین‌لیست بنویس‌درثبت بنویس‌درلیست‌مرجع \
-بنویس‌در‌لیست تاریخ تاریخ‌جاری تاریخ‌رجوع تایپ \
-تایپ‌بافر تایپ‌پرونده تب ترجمه تطابق \
-تعریف تعریف‌آرایش تعریف‌آرم تعریف‌الگوی‌جدول تعریف‌اندازه‌برگ \
-تعریف‌بافر تعریف‌بخش تعریف‌برنامه تعریف‌برچسب تعریف‌بلوک \
-تعریف‌بلوک‌بخش تعریف‌تایپ تعریف‌تایپ‌کردن تعریف‌تبدیل تعریف‌ترتیب \
-تعریف‌ترکیب تعریف‌تنظیم‌ریاضی تعریف‌توده‌میدان تعریف‌ثبت تعریف‌جانشانی \
-تعریف‌جدول‌بندی تعریف‌جعبه‌‌افقی تعریف‌حرف تعریف‌خالی تعریف‌خروجی \
-تعریف‌خط‌حائل تعریف‌درون‌حاشیه تعریف‌رنگ تعریف‌زیرمیدان تعریف‌سبک \
-تعریف‌سبک‌قلم تعریف‌سر تعریف‌شرح تعریف‌شروع‌پایان تعریف‌شماره‌بندی \
-تعریف‌شمایل‌مرجع تعریف‌شناور تعریف‌شکستن‌ستون تعریف‌شکست‌صفحه تعریف‌طرح‌بندی \
-تعریف‌فرمان تعریف‌قالبی تعریف‌قلم تعریف‌قلم‌خام تعریف‌قلم‌متن \
-تعریف‌لایه تعریف‌لهجه تعریف‌لوح تعریف‌لیست تعریف‌لیست‌ترکیبی \
-تعریف‌لیست‌مرجع تعریف‌مترادفها تعریف‌مترادف‌قلم تعریف‌متغیرمتن تعریف‌متن \
-تعریف‌متن‌قالبی تعریف‌مجموعه‌ستون تعریف‌محیط‌قلم‌بدنه تعریف‌مرجع تعریف‌منوی‌پانل \
-تعریف‌مکان‌متن تعریف‌میدان تعریف‌میدان‌اصلی تعریف‌نسخه تعریف‌نشانه‌گذاری \
-تعریف‌نماد تعریف‌نمادشکل تعریف‌پاراگرافها تعریف‌پروفایل تعریف‌پوشش \
-تعریف‌گروه‌آیتم تعریف‌گروه‌رنگ تعیین‌شماره تعیین‌شماره‌سر تعیین‌متغیر‌متن \
-تعیین‌محتوای‌متن تعیین‌مشخصات‌ثبت تعیین‌مشخصات‌لیست تغییربه‌قلم‌بدنه تغییربه‌قلم‌خام \
-تنظیم‌راست تنظیم‌طرح‌بندی تنظیم‌وسط توجه تورفتگی \
-توری تولید تک ثبت‌زوج ثبت‌کامل \
-جداسازی‌نشانه‌گذاری حاش حرف حرفها حفظ‌بلوکها \
-حقیقت خالی خطهای‌سیاه خطهای‌نازک خطها‌خالی \
-خط‌حاشیه خط‌سیاه خط‌متن خط‌مو خط‌نازک \
-خ‌ا خ‌ع در درج‌آرمها درج‌ثبت \
-درج‌خط درج‌درخط درج‌درخطها درج‌درمتن درج‌درمیدان \
-درج‌در‌بالای‌یکدیگر درج‌در‌توری درج‌راهنما درج‌زیرفرمول درج‌شماره‌سر \
-درج‌شماره‌صفحه درج‌شناور درج‌فرمول درج‌لیست درج‌لیست‌خام \
-درج‌لیست‌مختلط درج‌لیست‌مرجع درج‌متغیرمتن درج‌متن‌سر درج‌پانوشتها \
-درج‌پانوشتهای‌موضعی درج‌چوب‌خط درج‌کنار‌به‌کنار درحاشیه درحاشیه‌دیگر \
-درحاشیه‌راست درحاشیه‌چپ درخارجی درخط درداخلی \
-درراست درصفحه درقالبی درلبه‌راست درلبه‌چپ \
-درمورد درون درپر درچپ دریافت‌بافر \
-دریافت‌شماره دریافت‌نشانه دوران دکمه دکمه‌منو \
-دکمه‌پانل رج رجوع رنگ رنگ‌خاکستری \
-روزهفته ریاضی زبان زبان‌اصلی ستون \
-ستون‌امتحان سر سرپوش‌کوچک‌نه شروع‌آرایش شروع‌آرایش‌ستون \
-شروع‌باریکتر شروع‌بازبینی شروع‌بلوک‌حاشیه شروع‌ترکیب شروع‌تصحیح‌خط \
-شروع‌تطابق شروع‌تنظیم شروع‌تولید شروع‌جدول شروع‌جدولها \
-شروع‌خط شروع‌خطها شروع‌خط‌حاشیه شروع‌خط‌متن شروع‌رنگ \
-شروع‌ستونها شروع‌سراسری شروع‌شماره‌گذاری‌خط شروع‌شکل شروع‌غیر‌فشرده \
-شروع‌فشرده شروع‌متن شروع‌مجموعه‌ستون شروع‌مجموعه‌نماد شروع‌محیط \
-شروع‌مخالف شروع‌موضعی شروع‌مولفه شروع‌مکان‌گذاری شروع‌نسخه \
-شروع‌نقل‌قول شروع‌نوشتار شروع‌پانوشتهای‌موضعی شروع‌پروفایل شروع‌پروژه \
-شروع‌پس‌زمینه شروع‌پوشش شروع‌کد شماره‌افزایش شماره‌زیرصفحه \
-شماره‌زیرفرمول شماره‌سر شماره‌سرجاری شماره‌صفحه شماره‌صفحه‌کامل \
-شماره‌فرمول شماره‌مبدل شماره‌ها شماره‌کاهش شماره‌کل‌صفحه‌ها \
-شکافتن‌شناور شکل‌خارجی صفحه صفحه‌تست صفحه‌زوج \
-صفحه‌پردازش طول‌لیست عبوربلوکها عرض‌آرایش عرض‌برگ \
-عرض‌حاشیه عرض‌حاشیه‌خارجی عرض‌حاشیه‌داخلی عرض‌حاشیه‌راست عرض‌حاشیه‌چپ \
-عرض‌خط عرض‌لبه عرض‌لبه‌خارجی عرض‌لبه‌داخلی عرض‌لبه‌راست \
-عرض‌لبه‌چپ عرض‌لیست عرض‌متن عمق‌صفحه عنوان‌حاشیه \
-فاصله‌بالا فاصله‌ته‌برگ فاصله‌حاشیه فاصله‌حاشیه‌خارجی فاصله‌حاشیه‌داخلی \
-فاصله‌حاشیه‌راست فاصله‌حاشیه‌چپ فاصله‌سربرگ فاصله‌لبه فاصله‌لبه‌خارجی \
-فاصله‌لبه‌داخلی فاصله‌لبه‌راست فاصله‌لبه‌چپ فاصله‌پایین فاصله‌پشت \
-فشرده فضا فضاهای‌ثابت فضای‌بالا فضای‌برش \
-فضای‌ثابت فضای‌سفید فضای‌سفیدصحیح فضای‌پایین فوری‌به‌لیست \
-فوری‌بین‌لیست قالبی لوح‌مقایسه ماه متغیر متن \
-متن‌برچسب متن‌حاشیه متن‌سر متن‌پانوشت محیط \
-مراجعه مرجع مرجع‌صفحه مرجع‌متن مرحله‌سر \
-مسکن معنی‌واحد مقایسه‌گروه‌رنگ مقدارخاکستری مقداررنگ \
-مقیاس منفی منوی‌پانل مولفه مکان \
-مکان‌متن میدان میدانهای‌گزارش میدان‌شبیه‌سازی میدان‌پشته \
-میدان‌کپی میله‌تطابق میله‌رنگ میله‌پانل ناشناس \
-نام‌ماکرو نسخه نسخه‌نشانه نشانه‌گذاری نشانه‌گذاری‌زوج \
-نشر نصب‌زبان نقطه‌ها نقل نقل‌قول \
-نم نماد نمادسر نمادلیست نمایش‌آرایش \
-نمایش‌بارگذاریها نمایش‌بستها نمایش‌توری نمایش‌رنگ نمایش‌شکلهای‌خارجی \
-نمایش‌طرح‌بندی نمایش‌قالب نمایش‌قلم‌بدنه نمایش‌لوح نمایش‌مجموعه‌علامت \
-نمایش‌محیط‌قلم‌بدنه نمایش‌میدانها نمایش‌چاپ نمایش‌گروه‌رنگ نوشتارزوج \
-هدایت پا پابا پانوشت پایان‌آرایش \
-پایان‌آرایش‌ستون پایان‌بازبینی پایان‌بلوک‌حاشیه پایان‌ترکیب پایان‌تصحیح‌خط \
-پایان‌تطابق پایان‌تنظیم پایان‌تولید پایان‌جدول پایان‌جدولها \
-پایان‌خط پایان‌خطها پایان‌خط‌حاشیه پایان‌خط‌متن پایان‌رنگ \
-پایان‌ستونها پایان‌سراسری پایان‌شماره‌گذاری‌خط پایان‌غیرفشرده پایان‌فشرده \
-پایان‌متن پایان‌مجموعه‌ستون پایان‌محیط پایان‌مخالف پایان‌موضعی \
-پایان‌مولفه پایان‌مکان‌گذاری پایان‌نازکتر پایان‌نسخه پایان‌نقل‌قول \
-پایان‌نوشتار پایان‌پانوشتهای‌موضعی پایان‌پروفایل پایان‌پروژه پایان‌پس‌زمینه \
-پایان‌پوشش پایان‌کد پایین پرده پروژه \
-پرکردن‌میدان پس‌زمینه پیروی‌نسخه پیروی‌نسخه‌پروفایل پیروی‌پروفایل \
-چاپ‌ارتفاع‌برگ چاپ‌عرض‌برگ چوبخط چپ‌چین کاغذزوج \
-کسر کشیده کلمه‌حاشیه کلمه‌راست گیره \
-یادداشت یک‌جا یک‌خط
+startlocal startlocalenvironment startlocalfootnotes startlokalni startlokalnipoznamkypodcarou \
+startmakeup startmarginalniblok startmarginalnilinka startmarginblock startnamemakeup \
+startnarrower startnezhustene startobraz startopposite startoverlay \
+startoverview startparagraph startpositioning startpostponing startpozadi \
+startprehled startprekryv startprodukt startprofil startprofile \
+startprojekt startprostredi startprotejsek startradek startradky \
+startrastr startregister startsadasymbolu startsloupce startspojeni \
+startsymbolset startsynchronizace startsynchronization starttable starttables \
+starttabulate starttabulka starttabulky starttext starttextovalinka \
+starttyping startumistovani startunpacked startuprava startverze \
+startzarovnavani startzhustene startzuzeni stopalignment stopbarva \
+stopbuffer stopcislovaniradku stopcitace stopcolumnmakeup stopcolumns \
+stopcolumnset stopcombination stopcomment stopdescription stopdocument \
+stopdokument stopenumeration stopfakt stopfigure stopfloattext \
+stopformula stopframedtext stopglobalni stophiding stopinteraktivnimenu \
+stopitemgroup stopkodovani stopkomponenta stopkorekceradku stoplegend \
+stopline stoplinecorrection stoplinenumbering stoplines stoplocal \
+stoplocalenvironment stoplocalfootnotes stoplokalni stoplokalnipoznamkypodcarou stopmakeup \
+stopmarginalniblok stopmarginalnilinka stopmarginblock stopnamemakeup stopnarrower \
+stopnezhustene stopopposite stopoverlay stopoverview stopparagraph \
+stoppositioning stoppostponing stoppozadi stopprehled stopprekryv \
+stopprodukt stopprofil stopprofile stopprojekt stopprostredi \
+stopprotejsek stopradek stopradky stoprastr stopsloupce \
+stopspojeni stopsymbolset stopsynchronizace stopsynchronization stoptable \
+stoptables stoptabulate stoptabulka stoptabulky stoptext \
+stoptextovalinka stoptyping stopumistovani stopunpacked stopuprava \
+stopverze stopzarovnavani stopzhustene stopzuzeni strana \
+sub subject subpagenumber subsection subsubject \
+subsubsection subsubsubject switchtorawfont sym symbol \
+synchronizacnilista synchronizovat synonym tab tecky \
+tenkalinka tenkelinky testcolumn testpage tex \
+texthlavicky textovalinka textpopisku textvariable title \
+tlacitko tlacitkomenu tloustkacary tref tvrdamezera \
+tvrdemezery txt typebuffer ukazbarvu ukazexterniobrazy \
+ukazmrizku ukaznastaveni ukazpaletu ukazpodpery ukazpole \
+ukazpostredizakladnihofontu ukazramecek ukazsadusymbolu ukazskupinubarev ukazupravu \
+ukazvytisk ukazvzhled ukazzakladnifont umistikombinovanyseznam umistilegendu \
+umistiloga umistilokalnipoznamkypodcarou umistinadsebe umistinamrizku umistipodrovnici \
+umistipoznamkypodcarou umistirejstrik umistirovnici umistiseznam umistivedlesebe \
+umistizalozky underbar underbars urcicharakteristikurejstriku useXMLfilter \
+usedirectory usetypescript usetypescriptfile uzijJSscripts uzijURL \
+uzijadresar uzijbloky uzijexternidokument uzijexterniobraz uzijexternisoubor \
+uzijexternisoubory uzijexternizvuk uzijkodovani uzijmodul uzijmoduly \
+uzijodkazy uzijprikazy uzijspeciality uzijsymbol uzijurl \
+verze vl vlasovalinka vlevo vpravo \
+vradku vsedniden vyberbloky vyberpapir vyberverzi \
+vyplnenytext vyplnovelinky vyplnovepole vyplnovyradek vyskahorejsku \
+vyskapapiru vyskasazby vyskaseznamu vyskaspodku vyskatextu \
+vyskatiskpapiru vyskaupati vyskazahlavi vysoky vyznam \
+vzdalenosthorejsku vzdalenostlevehookraje vzdalenostlevemarginalie vzdalenostmarginalie vzdalenostokraje \
+vzdalenostpravehookraje vzdalenostpravemarginalie vzdalenostspodku vzdalenostupati vzdalenostzahlavi \
+zablokujinterakcnimenu zachovejbloky zadnamezera zadnebilemisto zadnedalsibloky \
+zadnedalsisoubory zadnehorniadolniradky zadneodsazovani zadnezahlaviaupati zadneznaceni \
+zadnyrozmer zadnyseznam zadnytest zalozka zapisdorejstriku \
+zapisdoseznamu zapisdoseznamuodkazu zapismeziseznam zaramovani zarovnanonastred \
+zarovnanovlevo zarovnanovpravo zasobnikpoli zaznamovepole zhustene \
+ziskejbuffer ziskejznaceni zlomek znaceni znak \
+znaky zpracujbloky zpracujstranu zrcadlit zref \
+zvysujicicislo
keywordclass.context.nl=\
CAP Cap Caps Cijfers \
@@ -1274,3 +1111,166 @@ volledigepaginanummer volledigregister voluit weekdag wilijnd \
wiskunde witruimte woonplaats woordrechts zetbreedte \
zethoogte
+keywordclass.context.it=\
+CAP Cap Caps GIORNOSETTIMANA \
+Lettera Lettere MESE Numeri Numeriromani \
+PAROLA PAROLE Parola Parole accoppiacarta \
+accoppiadocumento accoppiamarcatura accoppiapagina accoppiaregistro adattacampo \
+adattalayout al allineacentro allineadestra allineasinistra \
+altezzacarta altezzacartastampa altezzacima altezzaelenco altezzafondo \
+altezzaintestazione altezzamakeup altezzapdp altezzatesto ambiente \
+ampiezzabordo ampiezzabordodestro ampiezzabordosinistro ampiezzacarta ampiezzacartastampa \
+ampiezzaelenco ampiezzamakeup ampiezzamargine ampiezzamarginedestro ampiezzamarginesinistro \
+ampiezzatesto ap apagina appendix arg \
+atleftmargin atrightmargin barracolori barrainterazione barrasincronizzazione \
+bastablocchi bastafile cambiaafontdeltesto campi camporiempimento \
+cap capello chapter chim circondato \
+citazione clip clonacampo colonna colore \
+coloregrigio comment commento completecombinedlist completelistoffloats \
+completelistofsorts completelistofsynonyms completeregister componenet confrontagruppocolori \
+confrontatavolozza convertinumero copiacampo correggispaziobianco coupledregister \
+crlf cutspace da daqualcheparte data \
+datadioggi datareferral decrementnumber definebodyfontDEF definebodyfontREF \
+definecolumnbreak definecombination definedfont definefontfeature definefonthandling \
+defineindentedtext defineinmargin defineitemgroup definelayer definemathalignment \
+definepagebreak defineplacement definetypeface definisci definisciaccento \
+definisciambientefontdeltesto definisciblocco definiscibloccosezione definiscibuffer definiscicampo \
+definiscicampoprincipale definiscicapoversi definiscicarattere definiscicolore definiscicomando \
+definisciconversione definiscidescrizione definiscidimensionicarta definiscielenco definiscielencocombinato \
+definiscienumerazione definiscietichetta definiscifigurasimbolo definiscifont definiscifontdeltesto \
+definiscifontgrezzo definisciformatoriferimento definiscigruppocolonne definiscigruppocolori definiscihbox \
+definisciincorniciato definisciiniziatermina definiscilayout definiscilinea definiscilistariferimenti \
+definiscilogo definiscimakeup definiscimarcatura definiscimenuinterazione definiscimodellotabella \
+definiscioggettomobile definisciordinamento definiscioutput definisciposizionetesto definisciprofilo \
+definisciprogramma definisciregistro definisciriferimento definiscirigovuoto definiscisezione \
+definiscisimbolo definiscisinonimi definiscisinonimofont definiscisottocampo definiscisovrapposizione \
+definiscistackcampi definiscistile definiscistilefont definiscitabulato definiscitavolozza \
+definiscitesta definiscitesto definiscitestoincorniciato definiscitype definiscityping \
+definiscivariabiletesto definisciversion description determinacaratteristicheregistro determinacarattersticheelenco \
+determinanumerotesta dimensione disabilitamenuinterazione distanzabordo distanzabordodestro \
+distanzabordosinistro distanzacima distanzafondo distanzaintestazione distanzamargine \
+distanzamarginedestro distanzamarginesinistro distanzapdp domicilio el \
+elaborablocchi elaborapagina elementi elemento emptylines \
+enumeration etichetta etichette fatto figuraesterna \
+fondo forzablocchi framedtext frazione getnumber \
+giornosettimana griglia headsym hl ignoto \
+immediatebetweenlist immediatetolist impaccato impostaallineamento impostaambientefontdeltesto \
+impostaampiezzariga impostabarrainterazione impostabarrasincronizzazione impostablocchimargine impostablocco \
+impostabloccosezione impostabuffer impostacampi impostacampo impostacapoversi \
+impostacaption impostacaptions impostacima impostaclippling impostacolonne \
+impostacolore impostacolori impostacombinazioni impostacommento impostacommentopagina \
+impostadefinizionenotepdp impostadescrizioni impostadimensionicarta impostaelementi impostaelencazioni \
+impostaelenco impostaelencocombinato impostaenumerazioni impostafigureesterne impostafondo \
+impostafontdeltesto impostaforms impostaformule impostagruppocolonne impostaincorniciato \
+impostainiziatermina impostainmargine impostainstestazione impostainterazione impostainterlinea \
+impostalayout impostalegenda impostalinea impostalineemargine impostalineenere \
+impostalineeriempimento impostalineesottili impostalineetesto impostalingua impostalistariferimenti \
+impostamaiuscole impostamakeup impostamarcatura impostamenuinterazione impostamenzione \
+impostanotepdp impostanumerazione impostanumerazionecapoversi impostanumerazionepagina impostanumerazionerighe \
+impostanumeropagina impostanumerosottopagina impostanumerotesta impostaoggettimobili impostaoggettomobile \
+impostaordinamento impostaoutput impostaparranging impostapdp impostapiustretto \
+impostaposizionamento impostaposizionamentoopposti impostaposizionetesto impostaprofili impostaprogrammi \
+impostapubblicazioni impostapulsanti impostaregistro impostarientro impostariferimento \
+impostarighe impostarigheriempimento impostarigovuoto impostarotazione impostaschermi \
+impostaschermointerazione impostasegnosillabazione impostasetsimboli impostasezione impostasfondi \
+impostasfondo impostasincronizzazione impostasinonimi impostasistema impostasottolinea \
+impostaspaziatura impostaspaziobianco impostaspezzamentooggettomobile impostastrut impostatab \
+impostatabelle impostatabulato impostatavolozza impostatesta impostateste \
+impostatesticima impostatestifondo impostatestiincorniciati impostatestiintestazioni impostatestipdp \
+impostatesto impostatestoetichette impostatestointestazioni impostatestotesti impostatolleranza \
+impostatransizionepagina impostatype impostatyping impostaurl impostavariabiletesto \
+impostaversioni impostazioni in inaltromargine incorniciato \
+incrementanumero indentation indestra ininner iniziaallineamento \
+iniziaambiente iniziabloccomargine iniziacitazione iniziacodifica iniziacolonne \
+iniziacolore iniziacombinazione iniziacomponente iniziacorrezioneriga iniziadocumento \
+iniziafigura iniziaglobale iniziagruppocolonne iniziaimpaccato inizialineamargine \
+inizialineatesto inizialocale iniziamakeup inizianotepdplocali inizianumerazionerighe \
+iniziaopposto iniziaoverview iniziapiustretto iniziaposizionamento iniziaprodotto \
+iniziaprofilo iniziaprogetto iniziaraster iniziariga iniziarighe \
+iniziasetsimboli iniziasfondo iniziasincronizzazione iniziasovrapposizione iniziatabella \
+iniziatabelle iniziatesto iniziaunpacked iniziaversione inlatodestro \
+inlatosinistro inmaframed inmargine inmarginedestro inmarginesinistro \
+inneredgedistance inneredgewidth innermargindistance innermarginwidth inouter \
+inriga insinistra installalingua intorno labeling \
+leg lettera lettere lineamargine lineanera \
+lineasottile lineatesto lineenere lineeriempimento lineesottili \
+lingua linguaprincipale listsymbol livellotesta loadsorts \
+loadsynonyms logcampi lunghezzaelenco maframed mapfontsize \
+mar marcatura marcaversione matematica mediaeval \
+menuinterattivo menzione mese mettielenco mettielencocombinato \
+mettifiancoafianco mettiformula mettiingriglia mettilegenda mettilinea \
+mettiloghi mettinotepdp mettinotepdplocali mettinumeropagina mettiregistro \
+mettisegnalibro mettisottoformula mettiunosullaltro mettivariabiletesto mostraambientefontdeltesto \
+mostracampi mostracolore mostracornice mostrafiguresterne mostrafontdeltesto \
+mostragriglia mostragruppocolori mostraimpostazioni mostralyout mostramakeup \
+mostrasetsimboli mostrastampa mostrastruts mostratavolozza movesidefloat \
+name nascondiblocchi navigating nextsection nientedimensioni \
+nienteelenco nientelineecimafondo nientelineintestazionepdp nientemarcatura nienterientro \
+nientespazio nientespaziobianco nocap nome nomeunita \
+nop nota notapdp notest numberofsubpages \
+numeri numeriromani numeroformula numeropagina numeropaginacompleto \
+numerosottoformula numerotesta numerotestacorrente numerototaledipagine outeredgedistance \
+outeredgewidth outermargindistance outermarginwidth overbar overbars \
+overstrike overstrikes pagedepth pageoffset pagina \
+paragraph paroladestra parolainmargine part passaafontgrezzo \
+ped pedap perlungo placefloat placelistoffloats \
+placelistofsorts placelistofsynonyms placerawlist placereferencelist posizionanumerotesta \
+posizionatesto posizionatestotesta posizione prendibuffer prendimarcatura \
+prodotto progetto programma pubblicazione pulsante \
+pulsantemenu pulsantinterazione punti qualcheriga ran \
+referral referring register reimposta reimpostamarcatura \
+reservefloat resetnumber resettextcontent rientro rif \
+rifai riferimento riferimentopagina riferimentotesto riflessione \
+rigariempimento rigovuoto ruota saltablocchi scala \
+schermo scrividentroelenco scriviinelenco scriviinlistariferimenti scriviinregistro \
+section seeregister segnalibro seguiprofilo seguiversione \
+seguiversioneprofilo selezionablocchi selezionacarta selezionaversione separamarcatura \
+setnumber settext setupanswerarea setupcolumnsetlines setupcolumnsetstart \
+setupfonthandling setupfontsynonym setupindentedtext setupinterlinespace2 setupitemgroup \
+setuplistalternative setupmathalignment setuppaper setupplacement setvariabiletesto \
+sfondo sim simbolo sincronizza sort \
+spazifissi spazio spaziobianco spaziocima spaziodietro \
+spaziofisso spaziofondo spessoreriga spezzaoggettomobile spostaagriglia \
+spostaformula stackcampi startalignment startambiente startbuffer \
+startcitazione startcolore startcolumnmakeup startcolumns startcombination \
+startcomment startcomponenet startdescription startdocument startenumeration \
+startfatto startfigure startfloattext startformula startframedtext \
+starthiding startimpaccato startitemgroup startlegend startline \
+startlineamargine startlineatesto startlinecorrection startlinenumbering startlines \
+startlocal startlocalenvironment startlocalfootnotes startmakeup startmarginblock \
+startmenuinterattivo startnamemakeup startnarrower startopposite startoverlay \
+startoverview startparagraph startpositioning startpostponing startprodotto \
+startprofile startprogetto startregister startsfondo startsymbolset \
+startsynchronization starttable starttables starttabulate starttyping \
+startunpacked startversione stirato stopalignment stopambiente \
+stopbuffer stopcitazione stopcolore stopcolumnmakeup stopcolumns \
+stopcombination stopcomment stopcomponenet stopdescription stopdocument \
+stopenumeration stopfatto stopfigure stopfloattext stopformula \
+stopframedtext stophiding stopimpaccato stopitemgroup stoplegend \
+stopline stoplineamargine stoplineatesto stoplinecorrection stoplinenumbering \
+stoplines stoplocal stoplocalenvironment stoplocalfootnotes stopmakeup \
+stopmarginblock stopmenuinterattivo stopnamemakeup stopnarrower stopopposite \
+stopoverlay stopoverview stopparagraph stoppositioning stoppostponing \
+stopprodotto stopprofile stopprogetto stopsfondo stopsymbolset \
+stopsynchronization stoptable stoptables stoptabulate stoptyping \
+stopunpacked stopversione sub subject subpagenumber \
+subsection subsubject subsubsection subsubsubject synonym \
+tab terminaallineamento terminaambiente terminabloccomargine terminacitazione \
+terminacodifica terminacolonne terminacolore terminacombinazione terminacomponente \
+terminacorrezioneriga terminadocumento terminaglobale terminagruppocolonne terminaimpaccato \
+terminalineamargine terminalineatesto terminalocale terminamakeup terminanotepdplocali \
+terminanumerazionerighe terminaopposto terminaoverview terminapiustretto terminaposizionamento \
+terminaprodotto terminaprofili terminaprogetto terminaraster terminariga \
+terminarighe terminasfondo terminasincronizzazione terminasovrapposizione terminatabella \
+terminatabelle terminatesto terminaunpacked terminaversioni testa \
+testcolumn testoetichetta testoinmargine testoinstestazioni testonotapdp \
+testoriempimento testpage tex tieniblocchi title \
+titoloinmargine tooltip traduci txt typ \
+type typebuffer typefile underbar underbars \
+usaJSscripts usaURL usablocco usacartella usacodifica \
+usacolonnasonoraesterna usacomandi usadocumentoesterno usafiguraesterna usafileesterni \
+usafileesterno usamoduli usamodulo usariferimenti usasimboli \
+usaspecialita usaurl useXMLfilter usedirectory usetypescript \
+usetypescriptfile vaia vaiabox vaiapagina vaigiu \
+valorecolore valoregrigio variabiletesto versione vl
+
diff --git a/context/data/scite/scite-context-data-metafun.properties b/context/data/scite/scite-context-data-metafun.properties
index cc3981648..80cb13417 100644
--- a/context/data/scite/scite-context-data-metafun.properties
+++ b/context/data/scite/scite-context-data-metafun.properties
@@ -1,10 +1,3 @@
-keywordclass.metafun.internals=\
-nocolormodel greycolormodel graycolormodel rgbcolormodel \
-cmykcolormodel shadefactor textextoffset normaltransparent multiplytransparent \
-screentransparent overlaytransparent softlighttransparent hardlighttransparent colordodgetransparent \
-colorburntransparent darkentransparent lightentransparent differencetransparent exclusiontransparent \
-huetransparent saturationtransparent colortransparent luminositytransparent
-
keywordclass.metafun.commands=\
sqr log ln exp \
inv pow pi radian tand \
@@ -34,21 +27,28 @@ loadfigure externalfigure withmask figure register \
bitmapimage colordecimals ddecimal dddecimal ddddecimal \
textext thetextext rawtextext textextoffset verbatim \
thelabel label autoalign transparent withtransparency \
-asgroup infont set_linear_vector linear_shade define_linear_shade \
-define_circular_linear_shade define_sampled_linear_shade set_circular_vector circular_shade define_circular_shade \
-define_circular_linear_shade define_sampled_circular_shade space CRLF grayscale \
-greyscale withgray withgrey colorpart readfile \
-clearxy unitvector center epsed anchored \
-originpath infinite break xstretched ystretched \
-snapped pathconnectors function constructedpath constructedpairs \
-punkedfunction curvedfunction tightfunction punkedpath curvedpath \
-tightpath punkedpairs curvedpairs tightpairs evenly \
-oddly condition pushcurrentpicture popcurrentpicture arrowpath \
-tensecircle roundedsquare colortype whitecolor blackcolor \
-normalfill normaldraw visualizepaths naturalizepaths drawboundary \
-drawwholepath visualizeddraw visualizedfill draworigin drawboundingbox \
-drawpath drawpoint drawpoints drawcontrolpoints drawcontrollines \
-drawpointlabels drawlineoptions drawpointoptions drawcontroloptions drawlabeloptions \
-draworiginoptions drawboundoptions drawpathoptions resetdrawoptions decorated \
-redecorated undecorated
+property properties withproperties asgroup infont \
+set_linear_vector linear_shade define_linear_shade define_circular_linear_shade define_sampled_linear_shade \
+set_circular_vector circular_shade define_circular_shade define_circular_linear_shade define_sampled_circular_shade \
+space CRLF grayscale greyscale withgray \
+withgrey colorpart readfile clearxy unitvector \
+center epsed anchored originpath infinite \
+break xstretched ystretched snapped pathconnectors \
+function constructedpath constructedpairs punkedfunction curvedfunction \
+tightfunction punkedpath curvedpath tightpath punkedpairs \
+curvedpairs tightpairs evenly oddly condition \
+pushcurrentpicture popcurrentpicture arrowpath tensecircle roundedsquare \
+colortype whitecolor blackcolor normalfill normaldraw \
+visualizepaths naturalizepaths drawboundary drawwholepath visualizeddraw \
+visualizedfill draworigin drawboundingbox drawpath drawpoint \
+drawpoints drawcontrolpoints drawcontrollines drawpointlabels drawlineoptions \
+drawpointoptions drawcontroloptions drawlabeloptions draworiginoptions drawboundoptions \
+drawpathoptions resetdrawoptions decorated redecorated undecorated
+
+keywordclass.metafun.internals=\
+nocolormodel greycolormodel graycolormodel rgbcolormodel \
+cmykcolormodel shadefactor textextoffset normaltransparent multiplytransparent \
+screentransparent overlaytransparent softlighttransparent hardlighttransparent colordodgetransparent \
+colorburntransparent darkentransparent lightentransparent differencetransparent exclusiontransparent \
+huetransparent saturationtransparent colortransparent luminositytransparent metapostversion
diff --git a/context/data/scite/scite-context-data-metapost.properties b/context/data/scite/scite-context-data-metapost.properties
index cade4e8ce..565df0927 100644
--- a/context/data/scite/scite-context-data-metapost.properties
+++ b/context/data/scite/scite-context-data-metapost.properties
@@ -1,3 +1,10 @@
+keywordclass.metapost.internals=\
+mitered rounded beveled butt \
+squared eps epsilon infinity bboxmargin \
+ahlength ahangle labeloffset dotlabeldiam defaultpen \
+defaultscale join_radius pen_lft pen_rt pen_top \
+pen_bot
+
keywordclass.metapost.primitives=\
charcode day linecap linejoin \
miterlimit month pausing prologues showstopping \
@@ -51,6 +58,10 @@ graycolor colormodel graypart dashpart penpart \
stroked filled textual clipped bounded \
expandafter
+keywordclass.metapost.shortcuts=\
+.. ... -- --- \
+&
+
keywordclass.metapost.commands=\
beginfig endfig rotatedaround reflectedabout \
arrowhead currentpen currentpicture cuttings defaultfont \
@@ -85,14 +96,3 @@ cm pc cc in
keywordclass.metapost.tex=\
btex etex verbatimtex
-keywordclass.metapost.internals=\
-mitered rounded beveled butt \
-squared eps epsilon infinity bboxmargin \
-ahlength ahangle labeloffset dotlabeldiam defaultpen \
-defaultscale join_radius pen_lft pen_rt pen_top \
-pen_bot
-
-keywordclass.metapost.shortcuts=\
-.. ... -- --- \
-&
-
diff --git a/context/data/scite/scite-context-data-tex.properties b/context/data/scite/scite-context-data-tex.properties
index 0f63b994d..df065e374 100644
--- a/context/data/scite/scite-context-data-tex.properties
+++ b/context/data/scite/scite-context-data-tex.properties
@@ -1,18 +1,3 @@
-keywordclass.tex.etex=\
-botmarks clubpenalties currentgrouplevel currentgrouptype \
-currentifbranch currentiflevel currentiftype detokenize dimexpr \
-displaywidowpenalties eTeXVersion eTeXminorversion eTeXrevision eTeXversion \
-everyeof firstmarks fontchardp fontcharht fontcharic \
-fontcharwd glueexpr glueshrink glueshrinkorder gluestretch \
-gluestretchorder gluetomu ifcsname ifdefined iffontchar \
-interactionmode interlinepenalties lastlinefit lastnodetype marks \
-muexpr mutoglue numexpr pagediscards parshapedimen \
-parshapeindent parshapelength predisplaydirection protected readline \
-savinghyphcodes savingvdiscards scantokens showgroups showifs \
-showtokens splitbotmarks splitdiscards splitfirstmarks topmarks \
-tracingassigns tracinggroups tracingifs tracingnesting tracingscantokens \
-unexpanded unless widowpenalties
-
keywordclass.tex.pdftex=\
efcode expanded ifincsname ifpdfabsdim \
ifpdfabsnum ifpdfprimitive leftmarginkern letterspacefont lpcode \
@@ -38,9 +23,66 @@ pdftrailer pdfuniformdeviate pdfuniqueresname pdfvorigin pdfxform \
pdfxformattr pdfxformname pdfxformresources pdfximage pdfximagebbox \
quitvmode rightmarginkern rpcode tagcode
+keywordclass.tex.luatex=\
+Udelcode Udelcodenum Udelimiter Udelimiterover \
+Udelimiterunder Umathaccent Umathaccents Umathaxis Umathbinbinspacing \
+Umathbinclosespacing Umathbininnerspacing Umathbinopenspacing Umathbinopspacing Umathbinordspacing \
+Umathbinpunctspacing Umathbinrelspacing Umathbotaccent Umathchar Umathchardef \
+Umathcharnum Umathclosebinspacing Umathcloseclosespacing Umathcloseinnerspacing Umathcloseopenspacing \
+Umathcloseopspacing Umathcloseordspacing Umathclosepunctspacing Umathcloserelspacing Umathcode \
+Umathcodenum Umathconnectoroverlapmin Umathfractiondelsize Umathfractiondenomdown Umathfractiondenomvgap \
+Umathfractionnumup Umathfractionnumvgap Umathfractionrule Umathinnerbinspacing Umathinnerclosespacing \
+Umathinnerinnerspacing Umathinneropenspacing Umathinneropspacing Umathinnerordspacing Umathinnerpunctspacing \
+Umathinnerrelspacing Umathlimitabovebgap Umathlimitabovekern Umathlimitabovevgap Umathlimitbelowbgap \
+Umathlimitbelowkern Umathlimitbelowvgap Umathopbinspacing Umathopclosespacing Umathopenbinspacing \
+Umathopenclosespacing Umathopeninnerspacing Umathopenopenspacing Umathopenopspacing Umathopenordspacing \
+Umathopenpunctspacing Umathopenrelspacing Umathoperatorsize Umathopinnerspacing Umathopopenspacing \
+Umathopopspacing Umathopordspacing Umathoppunctspacing Umathoprelspacing Umathordbinspacing \
+Umathordclosespacing Umathordinnerspacing Umathordopenspacing Umathordopspacing Umathordordspacing \
+Umathordpunctspacing Umathordrelspacing Umathoverbarkern Umathoverbarrule Umathoverbarvgap \
+Umathoverdelimiterbgap Umathoverdelimitervgap Umathpunctbinspacing Umathpunctclosespacing Umathpunctinnerspacing \
+Umathpunctopenspacing Umathpunctopspacing Umathpunctordspacing Umathpunctpunctspacing Umathpunctrelspacing \
+Umathquad Umathradicaldegreeafter Umathradicaldegreebefore Umathradicaldegreeraise Umathradicalkern \
+Umathradicalrule Umathradicalvgap Umathrelbinspacing Umathrelclosespacing Umathrelinnerspacing \
+Umathrelopenspacing Umathrelopspacing Umathrelordspacing Umathrelpunctspacing Umathrelrelspacing \
+Umathspaceafterscript Umathstackdenomdown Umathstacknumup Umathstackvgap Umathsubshiftdown \
+Umathsubshiftdrop Umathsubsupshiftdown Umathsubsupvgap Umathsubtopmax Umathsupbottommin \
+Umathsupshiftdrop Umathsupshiftup Umathsupsubbottommax Umathunderbarkern Umathunderbarrule \
+Umathunderbarvgap Umathunderdelimiterbgap Umathunderdelimitervgap Uoverdelimiter Uradical \
+Uroot Ustack Ustartdisplaymath Ustartmath Ustopdisplaymath \
+Ustopmath Usubscript Usuperscript Uunderdelimiter alignmark \
+aligntab attribute attributedef catcodetable clearmarks \
+crampeddisplaystyle crampedscriptscriptstyle crampedscriptstyle crampedtextstyle fontid \
+formatname gleaders ifabsdim ifabsnum ifprimitive \
+initcatcodetable latelua luaescapestring luastartup luatexdatestamp \
+luatexrevision luatexversion mathstyle nokerns noligs \
+outputbox pageleftoffset pagetopoffset postexhyphenchar posthyphenchar \
+preexhyphenchar prehyphenchar primitive savecatcodetable scantextokens \
+suppressfontnotfounderror suppressifcsnameerror suppresslongerror suppressoutererror synctex
+
+keywordclass.tex.etex=\
+botmarks clubpenalties currentgrouplevel currentgrouptype \
+currentifbranch currentiflevel currentiftype detokenize dimexpr \
+displaywidowpenalties eTeXVersion eTeXminorversion eTeXrevision eTeXversion \
+everyeof firstmarks fontchardp fontcharht fontcharic \
+fontcharwd glueexpr glueshrink glueshrinkorder gluestretch \
+gluestretchorder gluetomu ifcsname ifdefined iffontchar \
+interactionmode interlinepenalties lastlinefit lastnodetype marks \
+muexpr mutoglue numexpr pagediscards parshapedimen \
+parshapeindent parshapelength predisplaydirection protected readline \
+savinghyphcodes savingvdiscards scantokens showgroups showifs \
+showtokens splitbotmarks splitdiscards splitfirstmarks topmarks \
+tracingassigns tracinggroups tracingifs tracingnesting tracingscantokens \
+unexpanded unless widowpenalties
+
keywordclass.tex.xetex=\
XeTeXversion
+keywordclass.tex.aleph=\
+AlephVersion Alephminorversion Alephrevision Alephversion \
+Omegaminorversion Omegarevision Omegaversion boxdir pagebottomoffset \
+pagerightoffset
+
keywordclass.tex.tex=\
- / AlephVersion Alephminorversion \
Alephrevision Alephversion OmegaVersion Omegaminorversion Omegarevision \
@@ -186,48 +228,6 @@ vrule vsize vskip vsplit vss \
vtop wd widowpenalties widowpenalty write \
xdef xleaders xspaceskip year
-keywordclass.tex.aleph=\
-AlephVersion Alephminorversion Alephrevision Alephversion \
-Omegaminorversion Omegarevision Omegaversion boxdir pagebottomoffset \
-pagerightoffset
-
-keywordclass.tex.luatex=\
-Udelcode Udelcodenum Udelimiter Udelimiterover \
-Udelimiterunder Umathaccent Umathaccents Umathaxis Umathbinbinspacing \
-Umathbinclosespacing Umathbininnerspacing Umathbinopenspacing Umathbinopspacing Umathbinordspacing \
-Umathbinpunctspacing Umathbinrelspacing Umathbotaccent Umathchar Umathchardef \
-Umathcharnum Umathclosebinspacing Umathcloseclosespacing Umathcloseinnerspacing Umathcloseopenspacing \
-Umathcloseopspacing Umathcloseordspacing Umathclosepunctspacing Umathcloserelspacing Umathcode \
-Umathcodenum Umathconnectoroverlapmin Umathfractiondelsize Umathfractiondenomdown Umathfractiondenomvgap \
-Umathfractionnumup Umathfractionnumvgap Umathfractionrule Umathinnerbinspacing Umathinnerclosespacing \
-Umathinnerinnerspacing Umathinneropenspacing Umathinneropspacing Umathinnerordspacing Umathinnerpunctspacing \
-Umathinnerrelspacing Umathlimitabovebgap Umathlimitabovekern Umathlimitabovevgap Umathlimitbelowbgap \
-Umathlimitbelowkern Umathlimitbelowvgap Umathopbinspacing Umathopclosespacing Umathopenbinspacing \
-Umathopenclosespacing Umathopeninnerspacing Umathopenopenspacing Umathopenopspacing Umathopenordspacing \
-Umathopenpunctspacing Umathopenrelspacing Umathoperatorsize Umathopinnerspacing Umathopopenspacing \
-Umathopopspacing Umathopordspacing Umathoppunctspacing Umathoprelspacing Umathordbinspacing \
-Umathordclosespacing Umathordinnerspacing Umathordopenspacing Umathordopspacing Umathordordspacing \
-Umathordpunctspacing Umathordrelspacing Umathoverbarkern Umathoverbarrule Umathoverbarvgap \
-Umathoverdelimiterbgap Umathoverdelimitervgap Umathpunctbinspacing Umathpunctclosespacing Umathpunctinnerspacing \
-Umathpunctopenspacing Umathpunctopspacing Umathpunctordspacing Umathpunctpunctspacing Umathpunctrelspacing \
-Umathquad Umathradicaldegreeafter Umathradicaldegreebefore Umathradicaldegreeraise Umathradicalkern \
-Umathradicalrule Umathradicalvgap Umathrelbinspacing Umathrelclosespacing Umathrelinnerspacing \
-Umathrelopenspacing Umathrelopspacing Umathrelordspacing Umathrelpunctspacing Umathrelrelspacing \
-Umathspaceafterscript Umathstackdenomdown Umathstacknumup Umathstackvgap Umathsubshiftdown \
-Umathsubshiftdrop Umathsubsupshiftdown Umathsubsupvgap Umathsubtopmax Umathsupbottommin \
-Umathsupshiftdrop Umathsupshiftup Umathsupsubbottommax Umathunderbarkern Umathunderbarrule \
-Umathunderbarvgap Umathunderdelimiterbgap Umathunderdelimitervgap Uoverdelimiter Uradical \
-Uroot Ustack Ustartdisplaymath Ustartmath Ustopdisplaymath \
-Ustopmath Usubscript Usuperscript Uunderdelimiter alignmark \
-aligntab attribute attributedef catcodetable clearmarks \
-crampeddisplaystyle crampedscriptscriptstyle crampedscriptstyle crampedtextstyle fontid \
-formatname gleaders ifabsdim ifabsnum ifprimitive \
-initcatcodetable latelua luaescapestring luastartup luatexdatestamp \
-luatexrevision luatexversion mathstyle nokerns noligs \
-outputbox pageleftoffset pagetopoffset postexhyphenchar posthyphenchar \
-preexhyphenchar prehyphenchar primitive savecatcodetable scantextokens \
-suppressfontnotfounderror suppressifcsnameerror suppresslongerror suppressoutererror synctex
-
keywordclass.tex.omega=\
OmegaVersion bodydir chardp charht \
charit charwd leftghost localbrokenpenalty localinterlinepenalty \
diff --git a/metapost/context/base/mp-chem.mpiv b/metapost/context/base/mp-chem.mpiv
index 99df52c30..7d3ce6d26 100644
--- a/metapost/context/base/mp-chem.mpiv
+++ b/metapost/context/base/mp-chem.mpiv
@@ -28,11 +28,13 @@ numeric
chem_center_offset, chem_dbl_offset,
chem_bb_angle, chem_axis_rulethickness,
chem_setting_l, chem_setting_r, chem_setting_t, chem_setting_b,
- chem_emwidth, chem_b_length ;
+ chem_emwidth, chem_b_length,
+ chem_front_b[] ;
boolean
chem_setting_axis, chem_setting_fitwidth, chem_setting_fitheight,
- chem_doing_pb, chem_text_trace, chem_bd_wedge ;
+ chem_doing_pb, chem_text_trace, chem_bd_wedge,
+ chem_star[], chem_front[], chem_stacked[], chem_tetra[] ;
string
chem_previous ;
@@ -41,12 +43,14 @@ color
chem_axis_color ;
path
+ chem_setting_bbox,
chem_path[], % scratch
- chem_setting_bbox ;
+ chem_b_path[], chem_c_path[],
+ chem_r_path[], chem_r_path.lft[], chem_r_path.rt[] ;
pair
- chem_pair[], % scratch
chem_origin, chem_mirror,
+ chem_pair[], % scratch
chem_sb_pair, chem_sb_pair.m, chem_sb_pair.p ;
picture
@@ -91,141 +95,110 @@ enddef ;
chem_reset ;
-% How do declare in chem_init_some?
-
-boolean
- chem_star.carbon, chem_front.carbon, chem_stacked.carbon,
- chem_star.alkyl, chem_front.alkyl, chem_stacked.alkyl,
- chem_star.newmanstagger, chem_front.newmanstagger, chem_stacked.newmanstagger,
- chem_star.newmaneclipsed,chem_front.newmaneclipsed, chem_stacked.newmaneclipsed,
- chem_star.one, chem_front.one, chem_stacked.one,
- chem_star.three, chem_front.three, chem_stacked.three,
- chem_star.four, chem_front.four, chem_stacked.four,
- chem_star.five, chem_front.five, chem_stacked.five,
- chem_star.six, chem_front.six, chem_stacked.six,
- chem_star.seven, chem_front.seven, chem_stacked.seven,
- chem_star.eight, chem_front.eight, chem_stacked.eight,
- chem_star.fivefront, chem_front.fivefront, chem_stacked.fivefront,
- chem_star.sixfront, chem_front.sixfront, chem_stacked.sixfront,
- chem_star.chair, chem_front.chair, chem_stacked.chair,
- chem_star.boat, chem_front.boat, chem_stacked.boat ;
-
-path
- chem_b_path.carbon, chem_c_path.carbon,
- chem_b_path.alkyl, chem_c_path.alkyl,
- chem_b_path.newmanstagger, chem_c_path.newmanstagger,
- chem_b_path.newmaneclipsed,chem_c_path.newmaneclipsed,
- chem_b_path.one, chem_c_path.one,
- chem_b_path.three, chem_c_path.three,
- chem_b_path.four, chem_c_path.four,
- chem_b_path.five, chem_c_path.five,
- chem_b_path.six, chem_c_path.six,
- chem_b_path.seven, chem_c_path.seven,
- chem_b_path.eight, chem_c_path.eight,
- chem_b_path.fivefront, chem_c_path.fivefront,
- chem_b_path.sixfront, chem_c_path.sixfront,
- chem_b_path.chair, chem_c_path.chair,
- chem_b_path.boat, chem_c_path.boat,
- chem_r_path.carbon, chem_r_path.lft.carbon, chem_r_path.rt.carbon,
- chem_r_path.alkyl, chem_r_path.lft.alkyl, chem_r_path.rt.alkyl,
- chem_r_path.newmanstagger, chem_r_path.lft.newmanstagger, chem_r_path.rt.newmanstagger,
- chem_r_path.newmaneclipsed,chem_r_path.lft.newmaneclipsed,chem_r_path.rt.newmaneclipsed,
- chem_r_path.one, chem_r_path.lft.one, chem_r_path.rt.one,
- chem_r_path.three, chem_r_path.lft.three, chem_r_path.rt.three,
- chem_r_path.four, chem_r_path.lft.four, chem_r_path.rt.four,
- chem_r_path.five, chem_r_path.lft.five, chem_r_path.rt.five,
- chem_r_path.six, chem_r_path.lft.six, chem_r_path.rt.six,
- chem_r_path.seven, chem_r_path.lft.seven, chem_r_path.rt.seven,
- chem_r_path.eight, chem_r_path.lft.eight, chem_r_path.rt.eight,
- chem_r_path.fivefront, chem_r_path.lft.fivefront, chem_r_path.rt.fivefront,
- chem_r_path.sixfront, chem_r_path.lft.sixfront, chem_r_path.rt.sixfront,
- chem_r_path.chair, chem_r_path.lft.chair, chem_r_path.rt.chair,
- chem_r_path.boat, chem_r_path.lft.boat, chem_r_path.rt.boat ;
+newinternal numeric
+ one, carbon, alkyl, newmanstagger, newmaneclipsed,
+ three, four, five, six, seven, eight, nine,
+ fivefront, sixfront, chair, boat ;
% We define all paths as closed, so that they may be indexed mod length.
vardef chem_init_some (suffix $) (expr e) =
- if not known chem_front.$ :
- chem_front.$ := false ;
+ if not known chem_star[$]:
+ chem_star[$] := false ;
+ fi
+ if not known chem_front[$]:
+ chem_front[$] := false ;
fi
- if not known chem_star.$ :
- chem_star.$ := false ;
+ if not known chem_stacked[$]:
+ chem_stacked[$] := false ;
fi
- if not known chem_stacked.$:
- chem_stacked.$ := false ;
+ if not known chem_tetra[$]:
+ chem_tetra[$] := false ;
fi
if path(e) :
- chem_b_path.$ := e if not cycle(e) : -- cycle fi ;
- chem_num0 := length(chem_b_path.$) - 1 ;
+ chem_b_path[$] := e if not cycle(e) : -- cycle fi ;
+ chem_num0 := length(chem_b_path[$]) ;
else : % polygon
chem_num0 := e ;
chem_num1 := 360/chem_num0 ;
- chem_b_path.$ :=
+ chem_b_path[$] :=
(
for i=0 upto chem_num0-1 :
- dir(if chem_star.$ : -i else : (.5-i) fi *chem_num1) --
- endfor cycle
+ dir(if chem_star[$] : -i else : (.5-i) fi *chem_num1) --
+ endfor
+ cycle
)
- if chem_front.$ :
+ if chem_front[$] :
rotated (chem_num1-90)
fi
- if not chem_star.$ :
+ if not chem_star[$] :
scaled (.5/(sind .5chem_num1))
fi ;
fi ;
+
+ if chem_front[$] and (not known chem_front_b[$]) :
+ chem_front_b[$] := floor(.5(length chem_b_path[$])) + 1 ;
+ fi
+
chem_num2 := 0 ;
- chem_c_path.$ :=
- reverse(fullcircle) rotated angle(point 0 of chem_b_path.$)
- if not chem_star.$ :
- hide (for i=0 upto chem_num0:
- if abs(point i+.5 of chem_b_path.$) <
- abs(point chem_num2+.5 of chem_b_path.$) :
+ chem_c_path[$] :=
+ reverse(fullcircle) rotated angle(point 0 of chem_b_path[$])
+ if not chem_star[$] :
+ hide (for i=0 upto chem_num0-1:
+ if abs(point i+.5 of chem_b_path[$]) <
+ abs(point chem_num2+.5 of chem_b_path[$]) :
chem_num2 := i ;
fi
endfor)
- scaled (2*(abs(point chem_num2+.5 of chem_b_path.$) - chem_dbl_offset))
+ scaled (2*(abs(point chem_num2+.5 of chem_b_path[$]) - chem_dbl_offset))
fi ;
- if not chem_front.$ :
- chem_r_path.$ :=
- if chem_star.$ :
- chem_b_path.$
+
+ chem_r_path[$] :=
+ if chem_star[$] :
+ chem_b_path[$]
+ else :
+ (
+ for i=0 upto chem_num0-1 :
+ (unitvector point i of chem_b_path[$])
+ shifted point i of chem_b_path[$] --
+ endfor
+ cycle
+ )
+ fi ;
+
+ chem_r_path.lft[$] :=
+ (
+ for i=0 upto chem_num0-1 :
+ if chem_front[$] :
+ up
+ scaled .5
+ shifted point i of chem_b_path[$]
+ elseif chem_star[$] :
+ point i of chem_b_path[$]
else :
- (
- for i=0 upto chem_num0-1 :
- (unitvector point i of chem_b_path.$)
- shifted point i of chem_b_path.$ --
- endfor
- cycle
- ) ;
- fi
- fi
- if not chem_star.$ :
- chem_r_path.lft.$ :=
- for i=0 upto chem_num0-1 :
- if chem_front.$ :
- up
- scaled .5
- shifted point i of chem_b_path.$
- else :
- point i+1 of chem_b_path.$
- rotatedabout(point i of chem_b_path.$,180)
- fi --
- endfor
- cycle ;
- chem_r_path.rt.$ := (
- for i=0 upto chem_num0-1 :
- if chem_front.$ :
- down
- scaled .5
- shifted point i of chem_b_path.$
- else :
- point i-1 of chem_b_path.$
- rotatedabout(point i of chem_b_path.$,180)
- fi --
- endfor
- cycle
+ point i+1 of chem_b_path[$]
+ rotatedabout(point i of chem_b_path[$],180)
+ fi --
+ endfor
+ cycle
) ;
- fi
+ chem_r_path.rt[$] :=
+ (
+ for i=0 upto chem_num0-1 :
+ if chem_front[$] :
+ down
+ scaled .5
+ shifted point i of chem_b_path[$]
+ elseif chem_star[$] :
+ point i+2 of chem_b_path[$]
+ else :
+ point i-1 of chem_b_path[$]
+ rotatedabout(point i of chem_b_path[$],180)
+ fi --
+ endfor
+ cycle
+ ) ;
+
enddef ;
% The following is used only once:
@@ -236,11 +209,12 @@ begingroup
% tetrahedrial angle
a := 2angle(1,sqrt 2) ;
+
% solve for chair
2b = 180 - .5a ;
4c = 180 - .5a ;
d + e = 360 - 2a ;
- d = 3e ; % this is the one tunable parameter which fixes the perspective.
+ d = 5e ; % this is the one tunable parameter which fixes the perspective.
z2 = z1 shifted dir(90+a+d) ;
z3 = z2 shifted dir(270-a) ;
z4 = z3 shifted dir(90+a) ;
@@ -249,53 +223,78 @@ begingroup
z4 = z1 xyscaled (-1,-1) ;
z5 = z2 xyscaled (-1,-1) ;
+ save indx ; numeric indx ; indx = 2 ; % starting value doesn't matter, really.
% polygons
+ three := incr indx ; % 3 (these numbers don't matter - they are just indices)
+ four := incr indx ; % 4
+ five := incr indx ; % 5
+ six := incr indx ; % 6
+ seven := incr indx ; % 7
+ eight := incr indx ; % 8
+ nine := incr indx ; % 9
+
chem_init_some(three,3) ;
chem_init_some(four, 4) ;
chem_init_some(five, 5) ;
chem_init_some(six, 6) ;
chem_init_some(seven,7) ;
chem_init_some(eight,8) ;
+ chem_init_some(nine, 9) ;
+
% star-form
- chem_star.one := true ;
- chem_star.carbon := true ;
- chem_star.alkyl := true ;
- chem_star.newmanstagger := true ; chem_stacked.newmanstagger := true ;
- chem_star.newmaneclipsed := true ; chem_stacked.newmaneclipsed := true ;
- chem_init_some(one,8) ;
- chem_init_some(carbon, dir(0)--dir(360-a)--dir(180-.5a+b)--dir(180-.5a)) ;
- chem_init_some(alkyl, dir(0)--dir(360-a)--dir(360-a-90)--dir(90)) ;
- chem_init_some(newmanstagger, dir(30)--dir(270)--dir(150)--dir(330)--dir(210)--dir(90)) ;
- chem_init_some(newmaneclipsed,dir(30)--dir(270)--dir(150)--dir(0)--dir(240)--dir(120)) ;
- % front
- chem_front.fivefront := true ;
- chem_front.sixfront := true ;
- chem_front.chair := true ;
- chem_front.boat := true ;
+ one := incr indx ; % 10
+ carbon := incr indx ; % 11
+ alkyl := incr indx ; % 12
+ newmanstagger := incr indx ; % 13
+ newmaneclipsed := incr indx ; % 14
+
+ chem_star[one] := true ;
+ chem_star[carbon] := true ; chem_tetra[carbon] := true ;
+ chem_star[alkyl] := true ; chem_tetra[alkyl] := true ;
+ chem_star[newmanstagger] := true ; chem_stacked[newmanstagger] := true ;
+ chem_star[newmaneclipsed] := true ; chem_stacked[newmaneclipsed] := true ;
+ chem_init_some(one, 8) ;
+ chem_init_some(carbon, dir(0)--dir(360-a)--dir(180-.5a+b)--dir(180-.5a)) ;
+ chem_init_some(alkyl, dir(0)--dir(360-a)--dir(360-a-90)--dir(90)) ;
+ chem_init_some(newmanstagger, dir(30)--dir(270)--dir(150)--dir(330)--dir(210)--dir(90)) ;
+ chem_init_some(newmaneclipsed, dir(30)--dir(270)--dir(150)--dir(0)--dir(240)--dir(120)) ;
+
+ % front views
+ fivefront := incr indx ; % 15
+ sixfront := incr indx ; % 16
+ chair := incr indx ; % 17
+ boat := incr indx ; % 18
+
+ chem_front[fivefront] := true ; chem_front_b[fivefront] := 3 ;
+ chem_front[sixfront] := true ; chem_front_b[sixfront] := 3 ;
chem_init_some(fivefront,5) ;
chem_init_some(sixfront, 6) ;
% chair
- chem_init_some(chair, z1--z2--z3--z4--z5--z6) ;
- rt := up--dir(270+a)--up--dir(270-a)--up--dir(90+e) ;
+ chem_front[chair] := true ; chem_front_b[chair] := 4 ;
+ chem_init_some(chair, z1--z2--z3--z4--z5--z6) ;
lft := dir(90-a)--down--dir(90+a+d)--down--dir(90+a)--down ;
- forsuffixes $ = lft, rt :
- chem_r_path.$.chair :=
- for i=0 upto 5 : point i of $ shifted point i of chem_b_path.chair -- endfor
- cycle ;
- endfor
+ rt := up--dir(270+a)--up--dir(270-a)--up--dir(90+e) ;
+ chem_r_path.lft[chair] :=
+ for i=0 upto 5 : point i of lft shifted point i of chem_b_path[chair] -- endfor
+ cycle ;
+ chem_r_path.rt[chair] :=
+ for i=0 upto 5 : point i of rt shifted point i of chem_b_path[chair] -- endfor
+ cycle ;
% boat
+ chem_front[boat] := true ; chem_front_b[boat] := 4 ;
chem_init_some(boat,
- for i=1 upto 4 : point i-1 of chem_b_path.sixfront -- endfor
- point 2 of chem_b_path.sixfront yscaled .5 --
- point 1 of chem_b_path.sixfront yscaled .5
+ for i=1 upto 4 : point i-1 of chem_b_path[sixfront] -- endfor
+ point 2 of chem_b_path[sixfront] yscaled .5 --
+ point 1 of chem_b_path[sixfront] yscaled .5
) ;
lft := dir(30+.5a)--dir(330+.5a)--dir(210-.5a)--dir(150-.5a)--dir(120)--dir(60) ;
rt := dir(30-.5a)--dir(330-.5a)--dir(210+.5a)--dir(150+.5a)--dir(120+a)--dir(60-a) ;
- forsuffixes $ = lft, rt :
- chem_r_path.$.boat :=
- for i=0 upto 5 : point i of $ shifted point i of chem_b_path.boat -- endfor
- cycle ;
- endfor
+ chem_r_path.lft[boat] :=
+ for i=0 upto 5 : point i of lft shifted point i of chem_b_path[boat] -- endfor
+ cycle ;
+ chem_r_path.rt[boat] :=
+ for i=0 upto 5 : point i of rt shifted point i of chem_b_path[boat] -- endfor
+ cycle ;
endgroup
enddef ;
@@ -358,7 +357,7 @@ vardef chem_stop_structure =
for i = 0 step -chem_num0 until -chem_setting_b : draw (-chem_num1,i) -- (chem_num1,i)
withpen pencircle scaled chem_axis_rulethickness withcolor chem_axis_color ; endfor
% frame=on : draw chem_setting_bbox withcolor chem_axis_color ;
-addto currentpicture also chem_pic ;
+ addto currentpicture also chem_pic ;
fi ;
setbounds currentpicture to chem_setting_bbox ;
enddef ;
@@ -427,10 +426,7 @@ vardef chem_restore = % RESTORE
chem_rotation := chem_stack_rotation[chem_stack_n] ;
chem_mirror := chem_stack_mirror [chem_stack_n] ;
chem_previous := chem_stack_previous[chem_stack_n] ;
-
- if chem_stack_n>1 : % Save the bottom of the stack.
- chem_stack_n := chem_stack_n - 1 ;
- fi
+ chem_stack_n := chem_stack_n - 1 ;
fi ;
enddef ;
@@ -438,7 +434,7 @@ enddef ;
vardef chem_adj (suffix $) (expr d, s) = % ADJ
% scale s is ignored (for now?)
- if not chem_front.$ :
+ if not chem_front[$] :
chem_substituent := 0 ;
chem_substituent.lft := 0 ;
chem_substituent.rt := 0 ;
@@ -466,7 +462,7 @@ enddef ;
def chem_transformed (suffix $) = % not vardef!
scaled chem_b_length
- if not chem_front.$ :
+ if not chem_front[$] :
if chem_mirror<>origin : reflectedabout(origin,chem_mirror) fi
rotated chem_rotation
fi
@@ -499,10 +495,10 @@ vardef chem_set (suffix $) =
% This is a fairly complicated optimization and ajustement. It took some
% thinking to get right, so beware!
- if (chem_adjacent<>0) and chem_star.P and chem_star.$ :
+ if (chem_adjacent<>0) and chem_star[P] and chem_star[$] :
% nop
chem_adjacent := 0 ;
- elseif (chem_adjacent<>0) and (chem_front.P or chem_front.$) :
+ elseif (chem_adjacent<>0) and (chem_front[P] or chem_front[$]) :
% not allowed for FRONT
chem_adjacent := 0 ;
elseif chem_adjacent<>0 :
@@ -511,28 +507,28 @@ vardef chem_set (suffix $) =
chem_substituent.rt := 0 ;
% move to the bond midpoint of the first structure
chem_pair0 := center (
- if chem_star.P :
+ if chem_star[P] :
origin -- point (chem_adjacent-1)
else :
subpath (chem_adjacent-1,chem_adjacent)
fi
- of chem_b_path.P
+ of chem_b_path[P]
) chem_transformed(P) ;
% find the closest opposite bond of the second structure
- chem_pair1 := chem_pair0 rotated if chem_star.P : 90 else : 180 fi ;
+ chem_pair1 := chem_pair0 rotated if chem_star[P] : 90 else : 180 fi ;
chem_num0 := abs(chem_pair1) ;
% only consider even indices (cardinal points) for ONE
- for i=0 step if chem_star.$ : 2 else : 1 fi until (length chem_b_path.$) :
+ for i=0 step if chem_star[$] : 2 else : 1 fi until (length chem_b_path[$]) :
chem_pair2 := (
(
unitvector
center (
- if chem_star.$ :
+ if chem_star[$] :
origin -- point i
else :
subpath (i,i+1)
fi
- of chem_b_path.$)
+ of chem_b_path[$])
)
scaled chem_num0
) chem_transformed($) ;
@@ -544,23 +540,23 @@ vardef chem_set (suffix $) =
chem_num1 := i ;
fi
endfor
- if chem_star.$ :
+ if chem_star[$] :
chem_pair4 := chem_pair0 shifted
- -((point (chem_adjacent-1) of chem_b_path.P) chem_transformed(P)) ;
+ -((point (chem_adjacent-1) of chem_b_path[P]) chem_transformed(P)) ;
fi
% adjust the bond angles
chem_rotation := (chem_rotation + angle(chem_pair1)-angle(chem_pair3)) mod 360 ;
- if not chem_star.$ :
+ if not chem_star[$] :
chem_pair4 :=
- if chem_star.P :
+ if chem_star[P] :
(point chem_num1
else :
center(subpath (chem_num1,chem_num1+1)
fi
- of chem_b_path.$)
+ of chem_b_path[$])
chem_transformed($) ;
fi
- if not chem_star.P :
+ if not chem_star[P] :
chem_pair4 := chem_pair4 shifted -chem_pair0 ;
fi
currentpicture := currentpicture shifted chem_pair4 ;
@@ -579,34 +575,32 @@ vardef chem_set (suffix $) =
if (chem_substituent <> 0) or (chem_substituent.lft <> 0) or (chem_substituent.rt <> 0) :
% move origin to radical endpoint of the first structure
if chem_substituent.lft > 0 :
- chem_pair0 := point chem_substituent.lft-1 of chem_r_path.lft.P ;
+ chem_pair0 := point chem_substituent.lft-1 of chem_r_path.lft[P] ;
chem_substituent := chem_substituent.lft ;
chem_substituent.lft := 0 ;
- elseif chem_substituent.rt>0 :
- chem_pair0 := point chem_substituent.rt-1 of chem_r_path.rt.P ;
+ elseif chem_substituent.rt > 0 :
+ chem_pair0 := point chem_substituent.rt-1 of chem_r_path.rt[P] ;
chem_substituent := chem_substituent.rt ;
chem_substituent.rt := 0 ;
- elseif not chem_front.P :
- chem_pair0 := point chem_substituent-1 of chem_r_path.P ;
else :
- chem_pair0 := point chem_substituent-1 of chem_r_path.lft.P ;
+ chem_pair0 := point chem_substituent-1 of chem_r_path[P] ;
fi
- chem_pair1 := chem_pair0 if not chem_star.P :
- shifted -(point chem_substituent-1 of chem_b_path.P) fi ;
+ chem_pair1 := chem_pair0 if not chem_star[P] :
+ shifted -(point chem_substituent-1 of chem_b_path[P]) fi ;
chem_t := identity chem_transformed(P) ;
chem_pair0 := chem_pair0 transformed chem_t ;
chem_pair1 := chem_pair1 transformed chem_t ;
currentpicture := currentpicture shifted -chem_pair0 ;
chem_origin := chem_origin - chem_pair0 ;
- if not (chem_star.P and chem_star.$) :
+ if not (chem_star[P] and chem_star[$]) :
% find the closest node
chem_pair1 := chem_pair1 rotated 180 ;
chem_num0 := abs(chem_pair1) ;
- chem_num1 := length chem_b_path.$ ;
+ chem_num1 := length chem_b_path[$] ;
chem_t := identity chem_transformed($) ;
% only consider even indices (cardinal points) for ONE
- for i=0 step if chem_star.$ : 2 else : 1 fi until chem_num1 :
- chem_pair2 := (unitvector(point i of chem_b_path.$) scaled chem_num0)
+ for i=0 step if chem_star[$] : 2 else : 1 fi until chem_num1 :
+ chem_pair2 := (unitvector(point i of chem_b_path[$]) scaled chem_num0)
transformed chem_t ;
if i=0 :
chem_pair3 := chem_pair2 ;
@@ -617,11 +611,11 @@ vardef chem_set (suffix $) =
chem_num2 := i ;
fi
endfor
- if not chem_front.$ :
+ if not chem_front[$] :
chem_rotation := (chem_rotation + angle(chem_pair1)-angle(chem_pair3)) mod 360 ;
fi ;
- chem_pair4 := (point chem_num2 of chem_b_path.$) transformed chem_t ;
- if not chem_star.$ :
+ chem_pair4 := (point chem_num2 of chem_b_path[$]) transformed chem_t ;
+ if not chem_star[$] :
currentpicture := currentpicture shifted chem_pair4 ;
chem_origin := chem_origin + chem_pair4 ;
fi
@@ -635,26 +629,26 @@ enddef ;
% line (f_rom, t_o, r_ule, c_olor)
vardef chem_b (suffix $) (expr f, t, r, c) = % B
- if chem_star.$ :
+ if chem_star[$] :
chem_r($,f,t,r,c) ;
else :
chem_draw(
- (subpath (f-1,t) of chem_b_path.$) chem_transformed($),
+ (subpath (f-1,t) of chem_b_path[$]) chem_transformed($),
r,c,) ;
fi
enddef ;
vardef chem_sb@# (suffix $) (expr f, t, r, c) = % SB
- if chem_star.$ :
+ if chem_star[$] :
chem_sr@#($,f,t,r,c) ;
else :
chem_draw(
- (subpath (f-1,t) of chem_b_path.$) chem_transformed($),
+ (subpath (f-1,t) of chem_b_path[$]) chem_transformed($),
r,c,dashed chem_sb_dash@# scaled chem_b_length) ;
%chem_t := identity chem_transformed($) ;
%for i=f upto t :
% chem_draw(
- % (subpath (chem_sb_pair@# shifted (i-1,i-1)) of chem_b_path.$)
+ % (subpath (chem_sb_pair@# shifted (i-1,i-1)) of chem_b_path[$])
% transformed chem_t,
% r,c,) ;
%endfor
@@ -666,23 +660,19 @@ enddef ;
% or continue to calculate them on the fly?
vardef chem_r_fragment@# (suffix $) (expr i) =
- if chem_front.$ and (length(str @#)=0) : % note that length=3, not 2...
- (point i-1 of chem_r_path.rt.$ --
- point i-1 of chem_b_path.$ --
- point i-1 of chem_r_path.lft.$)
- else :
- (if chem_star.$ :
+ (
+ if chem_star[$] :
origin
- else :
- point i-1 of chem_b_path.$
- fi --
- point i-1 of chem_r_path@#.$)
- fi % no ;
+ else :
+ point i-1 of chem_b_path[$]
+ fi --
+ point i-1 of chem_r_path@#[$]
+ ) % no ;
enddef ;
vardef chem_r (suffix $) (expr f, t, r, c) = % R
- chem_num0 := length chem_b_path.$ ;
- chem_num1 := if chem_stacked.$ : floor(.5chem_num0) else : chem_num0 fi ;
+ chem_num0 := length chem_b_path[$] ;
+ chem_num1 := if chem_stacked[$] : floor(.5chem_num0) else : chem_num0 fi ;
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_draw(
@@ -692,7 +682,7 @@ vardef chem_r (suffix $) (expr f, t, r, c) = % R
enddef ;
vardef chem_er (suffix $) (expr f, t, r, c) = % ER
- if not chem_front.$ :
+ if not chem_front[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_path0 := chem_r_fragment($,i) ;
@@ -707,7 +697,7 @@ vardef chem_er (suffix $) (expr f, t, r, c) = % ER
enddef ;
vardef chem_lr (suffix $) (expr f, t, r, c) = % LR
- if not chem_star.$ :
+ if not chem_star[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_draw(
@@ -718,7 +708,7 @@ vardef chem_lr (suffix $) (expr f, t, r, c) = % LR
enddef ;
vardef chem_rr (suffix $) (expr f, t, r, c) = % RR
- if not chem_star.$ :
+ if not chem_star[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_draw(
@@ -729,14 +719,14 @@ vardef chem_rr (suffix $) (expr f, t, r, c) = % RR
enddef ;
vardef chem_eb (suffix $) (expr f, t, r, c) = % EB
- if not chem_star.$ :
+ if not chem_star[$] :
chem_draw(
- ((subpath (f-1,t) of chem_b_path.$) paralleled -2chem_dbl_offset) chem_transformed($),
+ ((subpath (f-1,t) of chem_b_path[$]) paralleled -2chem_dbl_offset) chem_transformed($),
r,c,dashed chem_sb_dash scaled chem_b_length) ;
%for i=f upto t :
% chem_t := identity chem_transformed($) ;
% chem_draw(
- % ((subpath (chem_sb_pair shifted (i-1,i-1)) of chem_b_path.$)
+ % ((subpath (chem_sb_pair shifted (i-1,i-1)) of chem_b_path[$])
% paralleled -2chem_dbl_offset) transformed chem_t,
% r,c,) ;
%endfor
@@ -744,11 +734,11 @@ vardef chem_eb (suffix $) (expr f, t, r, c) = % EB
enddef ;
vardef chem_ad (suffix $) (expr f, t, r, c) = % AD
- if not chem_star.$ :
+ if not chem_star[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_drawarrow(
- ((subpath (chem_sb_pair shifted (i-1,i-1)) of chem_b_path.$)
+ ((subpath (chem_sb_pair shifted (i-1,i-1)) of chem_b_path[$])
paralleled 2chem_dbl_offset) transformed chem_t,
r,c,) ;
endfor
@@ -756,12 +746,12 @@ vardef chem_ad (suffix $) (expr f, t, r, c) = % AD
enddef ;
vardef chem_au (suffix $) (expr f, t, r, c) = % AU
- if not chem_star.$ :
+ if not chem_star[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_drawarrow(
reverse(
- (subpath (chem_sb_pair shifted (i-1,i-1)) of chem_b_path.$)
+ (subpath (chem_sb_pair shifted (i-1,i-1)) of chem_b_path[$])
paralleled 2chem_dbl_offset) transformed chem_t,
r,c,) ;
endfor
@@ -769,11 +759,11 @@ vardef chem_au (suffix $) (expr f, t, r, c) = % AU
enddef ;
vardef chem_es (suffix $) (expr f, t, r, c) = % ES
- if chem_star.$ :
+ if chem_star[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_draw(
- ((point i-1 of chem_r_path.$) scaled (xpart chem_sb_pair)) transformed chem_t,
+ ((point i-1 of chem_r_path[$]) scaled (xpart chem_sb_pair)) transformed chem_t,
chem_dot_factor*r,c,) ;
endfor
fi
@@ -782,7 +772,7 @@ enddef ;
vardef chem_ed (suffix $) (expr f, t, r, c) = % ED
chem_t := identity chem_transformed($) ;
for i=f upto t :
- if chem_star.$ :
+ if chem_star[$] :
chem_path0 := subpath chem_sb_pair of chem_r_fragment($,i) ;
chem_draw(
(point 0 of (chem_path0 paralleled -chem_dbl_offset)) transformed chem_t,
@@ -792,7 +782,7 @@ vardef chem_ed (suffix $) (expr f, t, r, c) = % ED
chem_dot_factor*r,c,) ;
else :
chem_draw(
- ((subpath (chem_sb_pair shifted (i-1,i-1)) of chem_b_path.$)
+ ((subpath (chem_sb_pair shifted (i-1,i-1)) of chem_b_path[$])
paralleled -2chem_dbl_offset) transformed chem_t,
r,c,dashed evenly) ;
fi
@@ -800,7 +790,7 @@ vardef chem_ed (suffix $) (expr f, t, r, c) = % ED
enddef ;
vardef chem_ep (suffix $) (expr f, t, r, c) = % EP
- if chem_star.$ :
+ if chem_star[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_path0 := subpath chem_sb_pair of chem_r_fragment($,i) ;
@@ -813,7 +803,7 @@ vardef chem_ep (suffix $) (expr f, t, r, c) = % EP
enddef ;
vardef chem_et (suffix $) (expr f, t, r, c) = % ET
- if chem_star.$ :
+ if chem_star[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_path0 := subpath chem_sb_pair of chem_r_fragment($,i) ;
@@ -831,18 +821,18 @@ vardef chem_et (suffix $) (expr f, t, r, c) = % ET
enddef ;
vardef chem_db@# (suffix $) (expr f, t, r, c) = % DB
- if chem_star.$ :
+ if chem_star[$] :
chem_dr@#($,f,t,r,c) ;
- elseif not chem_front.$ :
+ elseif not chem_front[$] :
chem_t := identity chem_transformed($) ;
chem_draw(
- ((subpath (f-1,t) of chem_b_path.$) paralleled -chem_dbl_offset) transformed chem_t,
+ ((subpath (f-1,t) of chem_b_path[$]) paralleled -chem_dbl_offset) transformed chem_t,
r,c,dashed chem_sb_dash@# scaled chem_b_length) ;
chem_draw(
- ((subpath (f-1,t) of chem_b_path.$) paralleled chem_dbl_offset) transformed chem_t,
+ ((subpath (f-1,t) of chem_b_path[$]) paralleled chem_dbl_offset) transformed chem_t,
r,c,dashed chem_sb_dash@# scaled chem_b_length) ;
%for i=f upto t :
- % chem_path0 := subpath (chem_sb_pair@# shifted (i-1,i-1)) of chem_b_path.$ ;
+ % chem_path0 := subpath (chem_sb_pair@# shifted (i-1,i-1)) of chem_b_path[$] ;
% chem_draw(
% (chem_path0 paralleled -chem_dbl_offset) transformed chem_t,
% r,c,) ;
@@ -855,7 +845,7 @@ vardef chem_db@# (suffix $) (expr f, t, r, c) = % DB
enddef ;
vardef chem_tb@# (suffix $) (expr f, t, r, c) = % TB
- if chem_star.$ :
+ if chem_star[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_path0 := subpath chem_sb_pair@# of chem_r_fragment($,i) ;
@@ -874,8 +864,8 @@ enddef ;
vardef chem_sr@# (suffix $) (expr f, t, r, c) = % SR
chem_t := identity chem_transformed($) ;
- if chem_stacked.$ :
- chem_num0 := length chem_b_path.$ ; chem_num1 := floor(.5chem_num0) ;
+ if chem_stacked[$] :
+ chem_num0 := length chem_b_path[$] ; chem_num1 := floor(.5chem_num0) ;
for i=f upto t :
chem_draw(
(subpath (if i>chem_num1: .5,ypart fi chem_sb_pair@#) of chem_r_fragment($,i))
@@ -884,7 +874,7 @@ vardef chem_sr@# (suffix $) (expr f, t, r, c) = % SR
endfor
else:
for i=f upto t :
- if chem_front.$ : % length=3...
+ if chem_front[$] : % length=3...
chem_draw(
(subpath chem_sb_pair@# of (subpath (1,0) of chem_r_fragment($,i)))
transformed chem_t,
@@ -904,7 +894,7 @@ vardef chem_sr@# (suffix $) (expr f, t, r, c) = % SR
enddef ;
vardef chem_sd@# (suffix $) (expr f, t, r, c) = % SD
- if chem_star.$ :
+ if chem_star[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_draw(
@@ -917,7 +907,7 @@ enddef ;
vardef chem_rd@# (suffix $) (expr f, t, r, c) = % RD
chem_t := identity chem_transformed($) ;
for i=f upto t :
- if chem_front.$ :
+ if chem_front[$] :
chem_draw(
(subpath chem_sb_pair@# of (subpath (1,0) of chem_r_fragment($,i)))
transformed chem_t,
@@ -938,7 +928,7 @@ enddef ;
vardef chem_rh@# (suffix $) (expr f, t, r, c) = % RH
chem_t := identity chem_transformed($) ;
for i=f upto t :
- if chem_front.$ :
+ if chem_front[$] :
chem_draw(
(subpath chem_sb_pair@# of (subpath (1,0) of chem_r_fragment($,i)))
transformed chem_t,
@@ -957,13 +947,13 @@ vardef chem_rh@# (suffix $) (expr f, t, r, c) = % RH
enddef ;
vardef chem_hb@# (suffix $) (expr f, t, r, c) = % HB
- if chem_star.$ :
+ if chem_star[$] :
chem_rh@#($,f,t,r,c)
fi
enddef ;
vardef chem_dr@# (suffix $) (expr f, t, r, c) = % DR
- if not chem_front.$ :
+ if not chem_front[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_path0 := (subpath chem_sb_pair@# of chem_r_fragment($,i)) ;
@@ -978,15 +968,16 @@ vardef chem_dr@# (suffix $) (expr f, t, r, c) = % DR
enddef ;
vardef chem_bb (suffix $) (expr f, t, r, c) = % BB
- if chem_star.$ :
+ if chem_star[$] :
chem_rb($,f,t,r,c) ;
- elseif chem_front.$ :
+ elseif chem_front[$] :
chem_t := identity chem_transformed($) ;
chem_draw(
- (subpath (f-1,t) of chem_b_path.$) transformed chem_t,
+ (subpath (f-1,t) of chem_b_path[$]) transformed chem_t,
r,c,) ;
- chem_num0 := length chem_b_path.$ ;
- chem_num1 := floor(.5chem_num0) + 1 ;
+ chem_num0 := length chem_b_path[$] ; % total number of bonds
+ chem_num1 := chem_front_b[$] ; % number of bonds to be made bold
+ % bold bonds within f and t
chem_num2 := if f<0 :((f+1) mod chem_num0) + chem_num0 else : ((f-1) mod chem_num0) + 1 fi ;
chem_num3 := if t<0 :((t+1) mod chem_num0) + chem_num0 else : ((t-1) mod chem_num0) + 1 fi ;
if chem_num3<chem_num2 :
@@ -994,19 +985,19 @@ vardef chem_bb (suffix $) (expr f, t, r, c) = % BB
chem_num3 := chem_num2 ;
chem_num2 := chem_num4 ;
fi
- if chem_num2<chem_num1 :
- if chem_num2=1 :
+ if chem_num2<chem_num1 : % Are there any bonds to be made bold?
+ if chem_num2=1 : % Skip the first bold bond.
chem_fill(
- (point chem_num2-1 of chem_b_path.$ --
- point chem_num2 of chem_b_path.$ shifted (0,-.5chem_dbl_offset) --
- point chem_num2 of chem_b_path.$ shifted (0, .5chem_dbl_offset) --
+ (point chem_num2-1 of chem_b_path[$] --
+ point chem_num2 of chem_b_path[$] shifted (0,-.5chem_dbl_offset) --
+ point chem_num2 of chem_b_path[$] shifted (0, .5chem_dbl_offset) --
cycle) transformed chem_t,
r,c,) ;
fi
if (chem_num2<=chem_num1-1) and (chem_num3>1) :
chem_path0 := subpath (if chem_num2>2 : chem_num2-1 else : 1 fi,
if chem_num3<chem_num1 : chem_num3 else : chem_num1-1 fi)
- of chem_b_path.$ ;
+ of chem_b_path[$] ;
chem_fill(
(chem_path0 paralleled -.5chem_dbl_offset --
reverse(chem_path0) paralleled -.5chem_dbl_offset --
@@ -1015,9 +1006,9 @@ vardef chem_bb (suffix $) (expr f, t, r, c) = % BB
fi
if chem_num3>=chem_num1 :
chem_fill(
- (point chem_num1 of chem_b_path.$ --
- point chem_num1-1 of chem_b_path.$ shifted (0,-.5chem_dbl_offset) --
- point chem_num1-1 of chem_b_path.$ shifted (0, .5chem_dbl_offset) --
+ (point chem_num1 of chem_b_path[$] --
+ point chem_num1-1 of chem_b_path[$] shifted (0,-.5chem_dbl_offset) --
+ point chem_num1-1 of chem_b_path[$] shifted (0, .5chem_dbl_offset) --
cycle) transformed chem_t,
r,c,) ;
fi
@@ -1034,7 +1025,7 @@ vardef chem_rrb (suffix $) (expr f, t, r, c) = % RRB
enddef ;
vardef chem_rb@# (suffix $) (expr f, t, r, c) = % RB
- if not chem_front.$ :
+ if not chem_front[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_path0 := subpath chem_sb_pair of chem_r_fragment@#($,i) ;
@@ -1049,7 +1040,7 @@ vardef chem_rb@# (suffix $) (expr f, t, r, c) = % RB
enddef ;
vardef chem_lsr@# (suffix $) (expr f, t, r, c) = % LSR
- if not chem_star.$ :
+ if not chem_star[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_draw(
@@ -1060,7 +1051,7 @@ vardef chem_lsr@# (suffix $) (expr f, t, r, c) = % LSR
enddef ;
vardef chem_rsr@# (suffix $) (expr f, t, r, c) = % RSR
- if not chem_star.$ :
+ if not chem_star[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_draw(
@@ -1071,7 +1062,7 @@ vardef chem_rsr@# (suffix $) (expr f, t, r, c) = % RSR
enddef ;
vardef chem_lrd@# (suffix $) (expr f, t, r, c) = % LRD
- if not chem_star.$ :
+ if not chem_star[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_draw(
@@ -1082,7 +1073,7 @@ vardef chem_lrd@# (suffix $) (expr f, t, r, c) = % LRD
enddef ;
vardef chem_rrd@# (suffix $) (expr f, t, r, c) = % RRD
- if not chem_star.$ :
+ if not chem_star[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_draw(
@@ -1093,39 +1084,39 @@ vardef chem_rrd@# (suffix $) (expr f, t, r, c) = % RRD
enddef ;
vardef chem_s (suffix $) (expr f, t, r, c) = % S
- if not (chem_star.$ or chem_front.$) :
+ if not (chem_star[$] or chem_front[$]) :
chem_draw(
- (point f-2 of chem_b_path.$ -- point t of chem_b_path.$) chem_transformed($),
+ (point f-2 of chem_b_path[$] -- point t of chem_b_path[$]) chem_transformed($),
r,c,) ;
fi
enddef ;
vardef chem_ss@# (suffix $) (expr f, t, r, c) = % SS
- if not (chem_star.$ or chem_front.$) :
+ if not (chem_star[$] or chem_front[$]) :
chem_draw(
- subpath chem_sb_pair@# of (point f-2 of chem_b_path.$ -- point t of chem_b_path.$)
+ subpath chem_sb_pair@# of (point f-2 of chem_b_path[$] -- point t of chem_b_path[$])
chem_transformed($),
r,c,) ;
fi
enddef ;
vardef chem_mid (suffix $) (expr f, t, r, c) = % MID
- if not (chem_star.$ or chem_front.$) :
+ if not (chem_star[$] or chem_front[$]) :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_draw(
- (origin -- point i-1 of chem_b_path.$) transformed chem_t,
+ (origin -- point i-1 of chem_b_path[$]) transformed chem_t,
r,c,) ;
endfor
fi
enddef ;
vardef chem_mids@# (suffix $) (expr f, t, r, c) = % MIDS
- if not (chem_star.$ or chem_front.$) :
+ if not (chem_star[$] or chem_front[$]) :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_draw(
- (subpath chem_sb_pair@# of (origin -- point i-1 of chem_b_path.$))
+ (subpath chem_sb_pair@# of (origin -- point i-1 of chem_b_path[$]))
transformed chem_t,
r,c,) ;
endfor
@@ -1134,44 +1125,44 @@ enddef ;
vardef chem_cd (suffix $) (expr r, c) = % CD
chem_draw(
- chem_c_path.$ chem_transformed($),
+ chem_c_path[$] chem_transformed($),
r,c,dashed evenly) ;
enddef ;
vardef chem_c (suffix $) (expr r, c) = % C
chem_draw(
- chem_c_path.$ chem_transformed($),
+ chem_c_path[$] chem_transformed($),
r,c,) ;
enddef ;
vardef chem_ccd (suffix $) (expr f, t, r, c) = % CCD
- chem_num0 := ypart((origin--center(subpath (f-2,f-1) of chem_b_path.$))
- intersectiontimes chem_c_path.$) ;
- chem_num1 := ypart((origin--center(subpath (t-1,t) of chem_b_path.$))
- intersectiontimes chem_c_path.$) ;
+ chem_num0 := ypart((origin--center(subpath (f-2,f-1) of chem_b_path[$]))
+ intersectiontimes chem_c_path[$]) ;
+ chem_num1 := ypart((origin--center(subpath (t-1,t) of chem_b_path[$]))
+ intersectiontimes chem_c_path[$]) ;
if chem_num1>chem_num0 :
- chem_num0 := chem_num0 + length chem_c_path.$ ;
+ chem_num0 := chem_num0 + length chem_c_path[$] ;
fi
chem_draw(
- subpath (chem_num1,chem_num0) of chem_c_path.$ chem_transformed($),
+ subpath (chem_num1,chem_num0) of chem_c_path[$] chem_transformed($),
r,c,dashed evenly) ;
enddef ;
vardef chem_cc (suffix $) (expr f, t, r, c) = % CC
- chem_num0 := ypart((origin--center(subpath (f-2,f-1) of chem_b_path.$))
- intersectiontimes chem_c_path.$) ;
- chem_num1 := ypart((origin--center(subpath (t-1,t) of chem_b_path.$))
- intersectiontimes chem_c_path.$) ;
+ chem_num0 := ypart((origin--center(subpath (f-2,f-1) of chem_b_path[$]))
+ intersectiontimes chem_c_path[$]) ;
+ chem_num1 := ypart((origin--center(subpath (t-1,t) of chem_b_path[$]))
+ intersectiontimes chem_c_path[$]) ;
if chem_num1>chem_num0 :
- chem_num0 := chem_num0 + length chem_c_path.$ ;
+ chem_num0 := chem_num0 + length chem_c_path[$] ;
fi
chem_draw(
- subpath (chem_num1,chem_num0) of chem_c_path.$ chem_transformed($),
+ subpath (chem_num1,chem_num0) of chem_c_path[$] chem_transformed($),
r,c,) ;
enddef ;
vardef chem_ld@# (suffix $) (expr f, t, r, c) = % LD
- if chem_star.$ :
+ if chem_star[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_path0 := subpath chem_sb_pair@# of chem_r_fragment($,i) ;
@@ -1186,7 +1177,7 @@ vardef chem_ld@# (suffix $) (expr f, t, r, c) = % LD
enddef ;
vardef chem_rd@# (suffix $) (expr f, t, r, c) = % RD
- if chem_star.$ :
+ if chem_star[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_path0 := subpath chem_sb_pair@# of chem_r_fragment($,i) ;
@@ -1201,7 +1192,7 @@ vardef chem_rd@# (suffix $) (expr f, t, r, c) = % RD
enddef ;
vardef chem_ldd@# (suffix $) (expr f, t, r, c) = % LDD
- if chem_star.$ :
+ if chem_star[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_path0 := subpath chem_sb_pair@# of chem_r_fragment($,i) ;
@@ -1216,7 +1207,7 @@ vardef chem_ldd@# (suffix $) (expr f, t, r, c) = % LDD
enddef ;
vardef chem_rdd@# (suffix $) (expr f, t, r, c) = % RDD
- if chem_star.$ :
+ if chem_star[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_path0 := subpath chem_sb_pair@# of chem_r_fragment($,i) ;
@@ -1231,7 +1222,7 @@ vardef chem_rdd@# (suffix $) (expr f, t, r, c) = % RDD
enddef ;
vardef chem_oe (suffix $) (expr f, t, r, c) = % OE
- if chem_star.$ :
+ if chem_star[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_path0 := subpath chem_sb_pair of chem_r_fragment($,i) ;
@@ -1253,7 +1244,7 @@ vardef chem_oe (suffix $) (expr f, t, r, c) = % OE
enddef ;
vardef chem_bw (suffix $) (expr f, t, r, c) = % BW
- if chem_star.$ :
+ if chem_star[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_path0 := subpath chem_sb_pair of chem_r_fragment($,i) ;
@@ -1277,7 +1268,7 @@ vardef chem_bw (suffix $) (expr f, t, r, c) = % BW
enddef ;
vardef chem_bd (suffix $) (expr f, t, r, c) = % BD
- if chem_star.$ :
+ if chem_star[$] :
chem_t := identity chem_transformed($) ;
for i=f upto t :
chem_path0 := subpath chem_sb_pair of chem_r_fragment($,i) ;
@@ -1305,7 +1296,7 @@ vardef chem_z@#(suffix $) (expr p) (text t) = % Z
if p=0 :
origin
else :
- (point p-1 of chem_b_path.$) chem_transformed($)
+ (point p-1 of chem_b_path[$]) chem_transformed($)
fi
)
) ;
@@ -1317,17 +1308,17 @@ vardef chem_cz@#(suffix $) (expr p) (text t) = % CZ ? (same as above)
if p=0 :
origin
else :
- (point p-1 of chem_b_path.$) chem_transformed($)
+ (point p-1 of chem_b_path[$]) chem_transformed($)
fi
)
) ;
enddef ;
vardef chem_midz@#(suffix $) (expr p) (text t) = % MIDZ
- if not (chem_star.$ or chem_front.$) :
+ if not (chem_star[$] or chem_front[$]) :
draw chem_text@#(t,
chem_do (
- (xpart chem_sb_pair, 0) scaled (xpart point 0 of chem_b_path.$)
+ (xpart chem_sb_pair, 0) scaled (xpart point 0 of chem_b_path[$])
chem_transformed($)
)
) ;
@@ -1335,38 +1326,36 @@ vardef chem_midz@#(suffix $) (expr p) (text t) = % MIDZ
enddef ;
vardef chem_rz@#(suffix $) (expr p) (text t) = % RZ
- if not chem_front.$ :
- draw
- if (length(str @#)>0) and (str @# = "auto") :
- chem_text.autoalign(angle((point p-1 of chem_r_path.$) chem_transformed($)))
- else :
- chem_text@#
- fi
- (t, chem_do((point p-1 of chem_r_path.$) chem_transformed($))) ;
- fi
+ draw
+ if (length(str @#)>0) and (str @# = "auto") :
+ chem_text.autoalign(angle((point p-1 of chem_r_path[$]) chem_transformed($)))
+ else :
+ chem_text@#
+ fi
+ (t, chem_do((point p-1 of chem_r_path[$]) chem_transformed($))) ;
enddef ;
vardef chem_lrz@#(suffix $) (expr p) (text t) = % LRZ
- if not chem_star.$ :
+ if not chem_star[$] :
draw
if (length(str @#)>0) and (str @# = "auto") :
- chem_text.autoalign(angle((point p-1 of chem_r_path.lft.$) chem_transformed($)))
+ chem_text.autoalign(angle((point p-1 of chem_r_path.lft[$]) chem_transformed($)))
else :
chem_text@#
fi
- (t, chem_do((point p-1 of chem_r_path.lft.$) chem_transformed($))) ;
+ (t, chem_do((point p-1 of chem_r_path.lft[$]) chem_transformed($))) ;
fi
enddef ;
vardef chem_rrz@#(suffix $) (expr p) (text t) = % RRZ
- if not chem_star.$ :
+ if not chem_star[$] :
draw
if (length(str @#)>0) and (str @# = "auto") :
- chem_text.autoalign(angle((point p-1 of chem_r_path.rt.$) chem_transformed($)))
+ chem_text.autoalign(angle((point p-1 of chem_r_path.rt[$]) chem_transformed($)))
else :
chem_text@#
fi
- (t, chem_do((point p-1 of chem_r_path.rt.$) chem_transformed($))) ;
+ (t, chem_do((point p-1 of chem_r_path.rt[$]) chem_transformed($))) ;
fi
enddef ;
@@ -1375,7 +1364,7 @@ vardef chem_zn@#(suffix $) (expr p) (text t) = % ZN
enddef ;
vardef chem_zt@#(suffix $) (expr p) (text t) = % ZT
- draw chem_text@#(t,chem_do ((point p-1 of chem_b_path.$) chem_transformed($)
+ draw chem_text@#(t,chem_do ((point p-1 of chem_b_path[$]) chem_transformed($)
scaled chem_text_min)) ;
enddef ;
@@ -1384,7 +1373,7 @@ vardef chem_zln@#(suffix $) (expr p) (text t) = % ZLN
enddef ;
vardef chem_zlt@#(suffix $) (expr p) (text t) = % ZLT
- draw chem_text@#(t, chem_do((point p-1.5 of chem_b_path.$) chem_transformed($)
+ draw chem_text@#(t, chem_do((point p-1.5 of chem_b_path[$]) chem_transformed($)
scaled chem_text_min)) ;
enddef ;
@@ -1393,13 +1382,13 @@ vardef chem_zrn@#(suffix $) (expr p) (text t) = % ZRN
enddef ;
vardef chem_zrt@#(suffix $) (expr p) (text t) = % ZRT
- draw chem_text@#(t, chem_do((point p-0.5 of chem_b_path.$) chem_transformed($)
+ draw chem_text@#(t, chem_do((point p-0.5 of chem_b_path[$]) chem_transformed($)
scaled chem_text_min)) ;
enddef ;
vardef chem_crz@#(suffix $) (expr p) (text t) = % CRZ ????
- if chem_star.$ :
- draw chem_text(t, chem_do((point p-1 of chem_b_path.$ enlonged chem_center_offset)
+ if chem_star[$] :
+ draw chem_text(t, chem_do((point p-1 of chem_b_path[$] enlonged chem_center_offset)
chem_transformed($))) ;
fi
enddef ;
@@ -1446,13 +1435,13 @@ enddef ;
% rotations and reflections
vardef chem_rot (suffix $) (expr d, s) = % ROT
- if not chem_front.$ :
+ if not chem_front[$] :
if d=0 :
chem_rotation := 0
else :
- chem_num0 := if chem_stacked.$ : 3 else : 0 fi ;
- chem_num1 := .5(angle(point d+chem_num0 of chem_b_path.$) -
- angle(point d+chem_num0-1 of chem_b_path.$)) ;
+ chem_num0 := if chem_stacked[$] : 3 else : 0 fi ;
+ chem_num1 := .5(angle(point d+chem_num0 of chem_b_path[$]) -
+ angle(point d+chem_num0-1 of chem_b_path[$])) ;
chem_rotation := (chem_rotation + s*chem_num1) mod 360 ;
fi
fi
@@ -1461,7 +1450,7 @@ enddef ;
vardef chem_mir (suffix $) (expr d, s) = % MIR
% We take the scale factor s to multiply the rotation, but only ONCE.
% For example: CARBON,.5MIR12 will give a rotation by 104°
- if not chem_front.$ :
+ if not chem_front[$] :
if d=0 : % inversion
if chem_mirror=origin :
chem_rotation := (chem_rotation + 180*s) mod 360 ;
@@ -1469,7 +1458,7 @@ vardef chem_mir (suffix $) (expr d, s) = % MIR
chem_mirror := chem_mirror rotated 90 ;
fi
else :
- chem_pair0 := (point d-1 of chem_b_path.$) scaled s ; % not chem_transformed
+ chem_pair0 := (point d-1 of chem_b_path[$]) scaled s ; % not chem_transformed
if chem_mirror=origin :
chem_mirror := chem_pair0 ;
else :
@@ -1490,13 +1479,13 @@ enddef ;
% translations
vardef chem_dir (suffix $) (expr d, s) = % DIR (same as MOV(d-1)MOV(d+1))
- if not chem_front.$ :
+ if not chem_front[$] :
if d=0 :
currentpicture := currentpicture shifted - chem_origin ;
chem_origin := origin ;
else :
chem_pair0 :=
- (((point d-2 of chem_b_path.$) shifted (point d of chem_b_path.$)) scaled s)
+ (((point d-2 of chem_b_path[$]) shifted (point d of chem_b_path[$])) scaled s)
chem_transformed($) ;
currentpicture := currentpicture shifted -chem_pair0 ;
chem_origin := chem_origin - chem_pair0 ;
@@ -1509,7 +1498,7 @@ vardef chem_mov (suffix $) (expr d, s) = % MOV
currentpicture := currentpicture shifted - chem_origin ;
chem_origin := origin ;
else :
- chem_pair0 := ((point d-1 of chem_b_path.$) scaled s) chem_transformed($) ;
+ chem_pair0 := ((point d-1 of chem_b_path[$]) scaled s) chem_transformed($) ;
currentpicture := currentpicture shifted -chem_pair0 ;
chem_origin := chem_origin - chem_pair0 ;
fi ;
@@ -1555,8 +1544,8 @@ vardef chem_arrow (suffix $) (expr f, t, r, c) = % ARROW
enddef ;
vardef chem_rm (suffix $) (expr d, s) = % RM
- if (not chem_front.$) and (d<>0) :
- chem_pair0 := ((point d-1 of chem_r_path.$) scaled s) chem_transformed($) ;
+ if (not chem_front[$]) and (d<>0) :
+ chem_pair0 := ((point d-1 of chem_r_path[$]) scaled s) chem_transformed($) ;
currentpicture := currentpicture shifted -chem_pair0 ;
chem_origin := chem_origin - chem_pair0 ;
fi ;
@@ -1567,7 +1556,7 @@ vardef chem_off (suffix $) (expr d, s) = % OFF
currentpicture := currentpicture shifted - chem_origin ;
chem_origin := origin ;
else :
- chem_pair0 := (unitvector(point d-1 of chem_b_path.one)) scaled chem_setting_offset*s ;
+ chem_pair0 := (unitvector(point d-1 of chem_b_path[one])) scaled chem_setting_offset*s ;
% not chem_transformed
currentpicture := currentpicture shifted -chem_pair0 ;
chem_origin := chem_origin - chem_pair0 ;
diff --git a/metapost/context/base/mp-mlib.mpiv b/metapost/context/base/mp-mlib.mpiv
index 83e708b91..029bd3d6e 100644
--- a/metapost/context/base/mp-mlib.mpiv
+++ b/metapost/context/base/mp-mlib.mpiv
@@ -571,7 +571,10 @@ def bitmapimage(expr xresolution, yresolution, data) =
)
enddef ;
-% TODO:
+% Experimental:
+%
+% property p ; p = properties(withcolor (1,1,0,0)) ;
+% fill fullcircle scaled 20cm withproperties p ;
let property = picture ;
@@ -579,24 +582,33 @@ vardef properties(text t) =
image(draw unitcircle t)
enddef ;
-def withproperties expr p =
- if colormodel p = 3 :
- withcolor greypart p
- elseif colormodel p = 5 :
- withcolor (redpart p,greenpart p,bluepart p)
- elseif colormodel p = 7 :
- withcolor (cyanpart p,magentapart p,yellowpart p,blackpart p)
- fi
- % todo, when available in mp:
- %
- % withprescript prescript p
- % withpostscript postscript p
- %
- % todo, penpart
-enddef ;
+if metapostversion < 1.770 :
-% property p ; p = properties(withcolor (1,1,0,1)) ;
-% fill fullcircle scaled 20cm withproperties p ;
+ def withproperties expr p =
+ if colormodel p = 3 :
+ withcolor greypart p
+ elseif colormodel p = 5 :
+ withcolor (redpart p,greenpart p,bluepart p)
+ elseif colormodel p = 7 :
+ withcolor (cyanpart p,magentapart p,yellowpart p,blackpart p)
+ fi
+ enddef ;
+
+else :
+
+ def withproperties expr p =
+ if colormodel p = 3 :
+ withcolor greypart p
+ elseif colormodel p = 5 :
+ withcolor (redpart p,greenpart p,bluepart p)
+ elseif colormodel p = 7 :
+ withcolor (cyanpart p,magentapart p,yellowpart p,blackpart p)
+ fi
+ withprescript prescript p
+ withpostscript postscript p
+ enddef ;
+
+fi ;
% Experimental:
diff --git a/metapost/context/base/mp-tool.mpiv b/metapost/context/base/mp-tool.mpiv
index 9dd00bfb4..0566c5b44 100644
--- a/metapost/context/base/mp-tool.mpiv
+++ b/metapost/context/base/mp-tool.mpiv
@@ -28,33 +28,7 @@ let @## = @# ;
if not known mpversion : string mpversion ; mpversion := "0.641" ; fi ;
-% vardef mpversiongt(expr s) =
-% scantokens (mpversion & " > " & if numeric s : decimal s else : s fi)
-% enddef ;
-% vardef mpversionlt(expr s) =
-% scantokens (mpversion & " < " & if numeric s : decimal s else : s fi)
-% enddef ;
-% vardef mpversioneq(expr s) =
-% scantokens (mpversion & " = " & if numeric s : decimal s else : s fi)
-% enddef ;
-
-%D More interesting:
-%D
-%D \starttyping
-%D fill fullcircle scaled 4cm withcolor if mpversiongt("0.6") : red else : green fi ;
-%D fill fullcircle scaled 2cm withcolor if mpversionlt(0.6) : blue else : white fi ;
-%D fill fullcircle scaled 1cm withcolor if mpversioncmp(0.6,">=") : yellow else : black fi ;
-%D \stoptyping
-
-% no longer needed as we load runtime
-
-vardef mpversioncmp(expr s, c) =
- scantokens (mpversion & c & if numeric s : decimal s else : s fi)
-enddef ;
-
-vardef mpversionlt (expr s) = mpversioncmp(s, "<") enddef ;
-vardef mpversioneq (expr s) = mpversioncmp(s, "=") enddef ;
-vardef mpversiongt (expr s) = mpversioncmp(s, ">") enddef ;
+newinternal metapostversion ; metapostversion := scantokens(mpversion) ;
%D We always want \EPS\ conforming output, so we say:
@@ -2214,43 +2188,82 @@ vardef undecorated (text imagedata) text decoration =
currentpicture
enddef ;
-vardef decorated (text imagedata) text decoration =
- save mfun_decorated_path, currentpicture ;
- picture mfun_decorated_path, currentpicture ;
- currentpicture := nullpicture ;
- imagedata ;
- mfun_decorated_path := currentpicture ;
- currentpicture := nullpicture ;
- for i within mfun_decorated_path :
- addto currentpicture
- if stroked i :
- doublepath pathpart i
- dashed dashpart i
- withpen penpart i
- withcolor colorpart i
- % withprescript prescriptpart i
- % withpostscript postscriptpart i
- decoration
- elseif filled i :
- contour pathpart i
- withpen penpart i
- withcolor colorpart i
- % withprescript prescriptpart i
- % withpostscript postscriptpart i
- decoration
- elseif textual i :
- also i
- withcolor colorpart i
- % withprescript prescriptpart i
- % withpostscript postscriptpart i
- decoration
- else :
- also i
- fi
- ;
- endfor ;
- currentpicture
-enddef ;
+
+if metapostversion < 1.770 :
+
+ vardef decorated (text imagedata) text decoration =
+ save mfun_decorated_path, currentpicture ;
+ picture mfun_decorated_path, currentpicture ;
+ currentpicture := nullpicture ;
+ imagedata ;
+ mfun_decorated_path := currentpicture ;
+ currentpicture := nullpicture ;
+ for i within mfun_decorated_path :
+ addto currentpicture
+ if stroked i :
+ doublepath pathpart i
+ dashed dashpart i
+ withpen penpart i
+ withcolor colorpart i
+ decoration
+ elseif filled i :
+ contour pathpart i
+ withpen penpart i
+ withcolor colorpart i
+ decoration
+ elseif textual i :
+ also i
+ withcolor colorpart i
+ decoration
+ else :
+ also i
+ fi
+ ;
+ endfor ;
+ currentpicture
+ enddef ;
+
+else:
+
+ vardef decorated (text imagedata) text decoration =
+ save mfun_decorated_path, currentpicture ;
+ picture mfun_decorated_path, currentpicture ;
+ currentpicture := nullpicture ;
+ imagedata ;
+ mfun_decorated_path := currentpicture ;
+ currentpicture := nullpicture ;
+ for i within mfun_decorated_path :
+ addto currentpicture
+ if stroked i :
+ doublepath pathpart i
+ dashed dashpart i
+ withpen penpart i
+ withcolor colorpart i
+ withprescript prescriptpart i
+ withpostscript postscriptpart i
+ decoration
+ elseif filled i :
+ contour pathpart i
+ withpen penpart i
+ withcolor colorpart i
+ withprescript prescriptpart i
+ withpostscript postscriptpart i
+ decoration
+ elseif textual i :
+ also i
+ withcolor colorpart i
+ withprescript prescriptpart i
+ withpostscript postscriptpart i
+ decoration
+ else :
+ also i
+ fi
+ ;
+ endfor ;
+ currentpicture
+ enddef ;
+
+fi ;
vardef redecorated (text imagedata) text decoration =
save mfun_decorated_path, currentpicture ;
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index be3acb7da..01c601eb5 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -1625,7 +1625,8 @@ function lpeg.replacer(one,two,makefunction)
elseif no == 1 then
local o = one[1]
one, two = P(o[1]), o[2]
- pattern = Cs(((1-one)^1 + one/two)^0)
+ -- pattern = Cs(((1-one)^1 + one/two)^0)
+ pattern = Cs((one/two + 1)^0)
else
for i=1,no do
local o = one[i]
@@ -1636,7 +1637,28 @@ function lpeg.replacer(one,two,makefunction)
else
one = P(one)
two = two or ""
- pattern = Cs(((1-one)^1 + one/two)^0)
+ -- pattern = Cs(((1-one)^1 + one/two)^0)
+ pattern = Cs((one/two +1)^0)
+ end
+ if makefunction then
+ return function(str)
+ return lpegmatch(pattern,str)
+ end
+ else
+ return pattern
+ end
+end
+
+function lpeg.finder(lst,makefunction)
+ local pattern
+ if type(lst) == "table" then
+ local p = P(false)
+ for i=1,#lst do
+ p = p + P(lst[i])
+ end
+ pattern = (p + 1)^0
+ else
+ pattern = (P(lst) + 1)^0
end
if makefunction then
return function(str)
@@ -3058,66 +3080,145 @@ file = file or { }
local file = file
local insert, concat = table.insert, table.concat
-local find, gmatch, match, gsub, sub, char, lower = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char, string.lower
+local match = string.match
local lpegmatch = lpeg.match
local getcurrentdir, attributes = lfs.currentdir, lfs.attributes
+local checkedsplit = string.checkedsplit
+
+-- local patterns = file.patterns or { }
+-- file.patterns = patterns
-local P, R, S, C, Cs, Cp, Cc = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Cc
+local P, R, S, C, Cs, Cp, Cc, Ct = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Cc, lpeg.Ct
-local function dirname(name,default)
- return match(name,"^(.+)[/\\].-$") or (default or "")
+local colon = P(":")
+local period = P(".")
+local periods = P("..")
+local fwslash = P("/")
+local bwslash = P("\\")
+local slashes = S("\\/")
+local noperiod = 1-period
+local noslashes = 1-slashes
+local name = noperiod^1
+local suffix = period/"" * (1-period-slashes)^1 * -1
+
+local pattern = C((noslashes^0 * slashes^1)^1)
+
+local function pathpart(name,default)
+ return lpegmatch(pattern,name) or default or ""
end
+local pattern = (noslashes^0 * slashes)^1 * C(noslashes^1) * -1
+
local function basename(name)
- return match(name,"^.+[/\\](.-)$") or name
+ return lpegmatch(pattern,name) or name
end
--- local function nameonly(name)
--- return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$",""))
--- end
+local pattern = (noslashes^0 * slashes^1)^0 * Cs((1-suffix)^1) * suffix^0
local function nameonly(name)
- return (gsub(match(name,"^.+[/\\](.-)$") or name,"%.[%a%d]+$",""))
+ return lpegmatch(pattern,name) or name
end
-local function suffixonly(name,default)
- return match(name,"^.+%.([^/\\]-)$") or default or ""
-end
+local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * C(noperiod^1) * -1
-local function splitname(name)
- local n, s = match(name,"^(.+)%.([^/\\]-)$")
- return n or name, s or ""
+local function suffixonly(name)
+ return lpegmatch(pattern,name) or ""
end
+file.pathpart = pathpart
file.basename = basename
-
-file.pathpart = dirname
-file.dirname = dirname
-
file.nameonly = nameonly
-
file.suffixonly = suffixonly
-file.extname = suffixonly -- obsolete
file.suffix = suffixonly
-function file.removesuffix(filename)
- return (gsub(filename,"%.[%a%d]+$",""))
+file.dirname = pathpart -- obsolete
+file.extname = suffixonly -- obsolete
+
+-- actually these are schemes
+
+local drive = C(R("az","AZ")) * colon
+local path = C(((1-slashes)^0 * slashes)^0)
+local suffix = period * C(P(1-period)^0 * P(-1))
+local base = C((1-suffix)^0)
+local rest = C(P(1)^0)
+
+drive = drive + Cc("")
+path = path + Cc("")
+base = base + Cc("")
+suffix = suffix + Cc("")
+
+local pattern_a = drive * path * base * suffix
+local pattern_b = path * base * suffix
+local pattern_c = C(drive * path) * C(base * suffix) -- trick: two extra captures
+local pattern_d = path * rest
+
+function file.splitname(str,splitdrive)
+ if splitdrive then
+ return lpegmatch(pattern_a,str) -- returns drive, path, base, suffix
+ else
+ return lpegmatch(pattern_b,str) -- returns path, base, suffix
+ end
+end
+
+function file.splitbase(str)
+ return lpegmatch(pattern_d,str) -- returns path, base+suffix
+end
+
+function file.nametotable(str,splitdrive) -- returns table
+ local path, drive, subpath, name, base, suffix = lpegmatch(pattern_c,str)
+ if splitdrive then
+ return {
+ path = path,
+ drive = drive,
+ subpath = subpath,
+ name = name,
+ base = base,
+ suffix = suffix,
+ }
+ else
+ return {
+ path = path,
+ name = name,
+ base = base,
+ suffix = suffix,
+ }
+ end
+end
+
+local pattern = Cs(((period * noperiod^1 * -1)/"" + 1)^1)
+
+function file.removesuffix(name)
+ return lpegmatch(pattern,name)
end
+-- local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * Cp() * noperiod^1 * -1
+--
+-- function file.addsuffix(name, suffix)
+-- local p = lpegmatch(pattern,name)
+-- if p then
+-- return name
+-- else
+-- return name .. "." .. suffix
+-- end
+-- end
+
+local suffix = period/"" * (1-period-slashes)^1 * -1
+local pattern = Cs((noslashes^0 * slashes^1)^0 * ((1-suffix)^1)) * Cs(suffix)
+
function file.addsuffix(filename, suffix, criterium)
if not suffix or suffix == "" then
return filename
elseif criterium == true then
return filename .. "." .. suffix
elseif not criterium then
- local n, s = splitname(filename)
+ local n, s = lpegmatch(pattern,filename)
if not s or s == "" then
return filename .. "." .. suffix
else
return filename
end
else
- local n, s = splitname(filename)
+ local n, s = lpegmatch(pattern,filename)
if s and s ~= "" then
local t = type(criterium)
if t == "table" then
@@ -3134,88 +3235,49 @@ function file.addsuffix(filename, suffix, criterium)
end
end
end
- return n .. "." .. suffix
+ return (n or filename) .. "." .. suffix
end
end
+-- print("1 " .. file.addsuffix("name","new") .. " -> name.new")
+-- print("2 " .. file.addsuffix("name.old","new") .. " -> name.old")
+-- print("3 " .. file.addsuffix("name.old","new",true) .. " -> name.old.new")
+-- print("4 " .. file.addsuffix("name.old","new","new") .. " -> name.new")
+-- print("5 " .. file.addsuffix("name.old","new","old") .. " -> name.old")
+-- print("6 " .. file.addsuffix("name.old","new","foo") .. " -> name.new")
+-- print("7 " .. file.addsuffix("name.old","new",{"foo","bar"}) .. " -> name.new")
+-- print("8 " .. file.addsuffix("name.old","new",{"old","bar"}) .. " -> name.old")
-function file.replacesuffix(filename, suffix)
- return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix
+local suffix = period * (1-period-slashes)^1 * -1
+local pattern = Cs((1-suffix)^0)
+
+function file.replacesuffix(name,suffix)
+ if suffix and suffix ~= "" then
+ return lpegmatch(pattern,name) .. "." .. suffix
+ else
+ return name
+ end
end
-local trick_1 = char(1)
-local trick_2 = "^" .. trick_1 .. "/+"
+--
-function file.join(...) -- rather dirty
- local lst = { ... }
- local a, b = lst[1], lst[2]
- if not a or a == "" then -- not a added
- lst[1] = trick_1
- elseif b and find(a,"^/+$") and find(b,"^/") then
- lst[1] = ""
- lst[2] = gsub(b,"^/+","")
- end
- local pth = concat(lst,"/")
- pth = gsub(pth,"\\","/")
- local a, b = match(pth,"^(.*://)(.*)$")
- if a and b then
- return a .. gsub(b,"//+","/")
- end
- a, b = match(pth,"^(//)(.*)$")
- if a and b then
- return a .. gsub(b,"//+","/")
- end
- pth = gsub(pth,trick_2,"")
- return (gsub(pth,"//+","/"))
-end
-
--- local slash = P("/")
--- local colon = P(":")
-
--- local replacer = lpeg.replacer(S("\\/")^1,"/")
--- local stripper = Cs(P(slash)^0/"" * replacer)
--- local isnetwork = slash * slash * (1-slash) + (1-slash-colon)^1 * colon
--- local isroot = slash^1 * -1
--- local hasroot = slash^1
-
--- function file.newjoin(...) -- rather dirty
--- local lst = { ... }
--- local one = lst[1]
--- if lpegmatch(isnetwork,one) then
--- local two = lpegmatch(replacer,concat(lst,"/",2))
--- return one .. two
--- elseif lpegmatch(isroot,one) then
--- local two = lpegmatch(replacer,concat(lst,"/",2))
--- if lpegmatch(hasroot,two) then
--- return two
--- else
--- return "/" .. two
--- end
--- elseif one == "" then
--- return lpegmatch(stripper,concat(lst,"/",2))
--- else
--- return lpegmatch(replacer,concat(lst,"/"))
--- end
--- end
+local reslasher = lpeg.replacer(S("\\"),"/")
--- print(file.join("//","/y"))
--- print(file.join("/","/y"))
--- print(file.join("","/y"))
--- print(file.join("/x/","/y"))
--- print(file.join("x/","/y"))
--- print(file.join("http://","/y"))
--- print(file.join("http://a","/y"))
--- print(file.join("http:///a","/y"))
--- print(file.join("//nas-1","/y"))
+function file.reslash(str)
+ return lpegmatch(reslasher,str)
+end
-- We should be able to use:
--
+-- local writable = P(1) * P("w") * Cc(true)
+--
-- function file.is_writable(name)
--- local a = attributes(name) or attributes(dirname(name,"."))
--- return a and sub(a.permissions,2,2) == "w"
+-- local a = attributes(name) or attributes(pathpart(name,"."))
+-- return a and lpegmatch(writable,a.permissions) or false
-- end
--
--- But after some testing Taco and I came up with:
+-- But after some testing Taco and I came up with the more robust
+-- variant:
function file.is_writable(name)
if lfs.isdir(name) then
@@ -3243,9 +3305,11 @@ function file.is_writable(name)
return false
end
+local readable = P("r") * Cc(true)
+
function file.is_readable(name)
local a = attributes(name)
- return a and sub(a.permissions,1,1) == "r"
+ return a and lpegmatch(readable,a.permissions) or false
end
file.isreadable = file.is_readable -- depricated
@@ -3256,41 +3320,74 @@ function file.size(name)
return a and a.size or 0
end
--- todo: lpeg \\ / .. does not save much
-
-local checkedsplit = string.checkedsplit
-
-function file.splitpath(str,separator) -- string
- str = gsub(str,"\\","/")
- return checkedsplit(str,separator or io.pathseparator)
+function file.splitpath(str,separator) -- string .. reslash is a bonus (we could do a direct split)
+ return checkedsplit(lpegmatch(reslasher,str),separator or io.pathseparator)
end
function file.joinpath(tab,separator) -- table
return concat(tab,separator or io.pathseparator) -- can have trailing //
end
--- we can hash them weakly
+local stripper = Cs(P(fwslash)^0/"" * reslasher)
+local isnetwork = fwslash * fwslash * (1-fwslash) + (1-fwslash-colon)^1 * colon
+local isroot = fwslash^1 * -1
+local hasroot = fwslash^1
+
+function file.join(...) -- rather dirty
+ local lst = { ... }
+ local one = lst[1]
+ if lpegmatch(isnetwork,one) then
+ local two = lpegmatch(reslasher,concat(lst,"/",2))
+ return one .. "/" .. two
+ elseif lpegmatch(isroot,one) then
+ local two = lpegmatch(reslasher,concat(lst,"/",2))
+ if lpegmatch(hasroot,two) then
+ return two
+ else
+ return "/" .. two
+ end
+ elseif one == "" then
+ return lpegmatch(stripper,concat(lst,"/",2))
+ else
+ return lpegmatch(reslasher,concat(lst,"/"))
+ end
+end
+
+-- print(file.join("c:/whatever","name"))
+-- print(file.join("//","/y"))
+-- print(file.join("/","/y"))
+-- print(file.join("","/y"))
+-- print(file.join("/x/","/y"))
+-- print(file.join("x/","/y"))
+-- print(file.join("http://","/y"))
+-- print(file.join("http://a","/y"))
+-- print(file.join("http:///a","/y"))
+-- print(file.join("//nas-1","/y"))
+
+-- The previous one fails on "a.b/c" so Taco came up with a split based
+-- variant. After some skyping we got it sort of compatible with the old
+-- one. After that the anchoring to currentdir was added in a better way.
+-- Of course there are some optimizations too. Finally we had to deal with
+-- windows drive prefixes and things like sys://. Eventually gsubs and
+-- finds were replaced by lpegs.
+local drivespec = R("az","AZ")^1 * colon
+local anchors = fwslash + drivespec
+local untouched = periods + (1-period)^1 * P(-1)
+local splitstarter = (Cs(drivespec * (bwslash/"/" + fwslash)^0) + Cc(false)) * Ct(lpeg.splitat(S("/\\")^1))
+local absolute = fwslash
function file.collapsepath(str,anchor)
- if anchor and not find(str,"^/") and not find(str,"^%a:") then
+ if anchor and not lpegmatch(anchors,str) then
str = getcurrentdir() .. "/" .. str
end
if str == "" or str =="." then
return "."
- elseif find(str,"^%.%.") then
- str = gsub(str,"\\","/")
- return str
- elseif not find(str,"%.") then
- str = gsub(str,"\\","/")
- return str
- end
- str = gsub(str,"\\","/")
- local starter, rest = match(str,"^(%a+:/*)(.-)$")
- if starter then
- str = rest
+ elseif lpegmatch(untouched,str) then
+ return lpegmatch(reslasher,str)
end
- local oldelements = checkedsplit(str,"/")
+ local starter, oldelements = lpegmatch(splitstarter,str)
+-- inspect(oldelements)
local newelements = { }
local i = #oldelements
while i > 0 do
@@ -3320,7 +3417,7 @@ function file.collapsepath(str,anchor)
return starter or "."
elseif starter then
return starter .. concat(newelements, '/')
- elseif find(str,"^/") then
+ elseif lpegmatch(absolute,str) then
return "/" .. concat(newelements,'/')
else
return concat(newelements, '/')
@@ -3337,29 +3434,21 @@ end
-- test("a/./b/..") test("a/aa/../b/bb") test("a/.././././b/..") test("a/./././b/..")
-- test("a/b/c/../..") test("./a/b/c/../..") test("a/b/c/../..")
+local validchars = R("az","09","AZ","--","..")
+local pattern_a = lpeg.replacer(1-validchars)
+local pattern_a = Cs((validchars + P(1)/"-")^1)
+local whatever = P("-")^0 / ""
+local pattern_b = Cs(whatever * (1 - whatever * -1)^1)
+
function file.robustname(str,strict)
- str = gsub(str,"[^%a%d%/%-%.\\]+","-")
+ str = lpegmatch(pattern_a,str) or str
if strict then
- return lower(gsub(str,"^%-*(.-)%-*$","%1"))
+ return lpegmatch(pattern_b,str) or str -- two step is cleaner (less backtracking)
else
return str
end
end
--- local pattern_a = lpeg.replacer(1-R("az","09","AZ","--",".."))
--- local pattern_a = Cs((R("az","09","AZ","--","..") + P(1)/"-")^1)
--- local whatever = P("-")^0 / ""
--- local pattern_b = Cs(whatever * (1 - whatever * -1)^1)
-
--- function file.robustname(str,strict)
--- str = lpegmatch(pattern_a,str) or str
--- if strict then
--- return lpegmatch(pattern_b,str) or str -- two step is cleaner (less backtracking)
--- else
--- return str
--- end
--- end
-
file.readdata = io.loaddata
file.savedata = io.savedata
@@ -3367,92 +3456,17 @@ function file.copy(oldname,newname)
file.savedata(newname,io.loaddata(oldname))
end
--- lpeg variants, slightly faster, not always
-
--- local period = P(".")
--- local slashes = S("\\/")
--- local noperiod = 1-period
--- local noslashes = 1-slashes
--- local name = noperiod^1
-
--- local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * C(noperiod^1) * -1
-
--- function file.suffixonly(name)
--- return lpegmatch(pattern,name) or ""
--- end
-
--- local pattern = Cs(((period * noperiod^1 * -1)/"" + 1)^1)
-
--- function file.removesuffix(name)
--- return lpegmatch(pattern,name)
--- end
-
--- local pattern = (noslashes^0 * slashes)^1 * C(noslashes^1) * -1
-
--- function file.basename(name)
--- return lpegmatch(pattern,name) or name
--- end
-
--- local pattern = Cs ((1 - slashes * noslashes^1 * -1)^1)
-
--- function file.dirname(name)
--- return lpegmatch(pattern,name) or ""
--- end
-
--- local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * Cp() * noperiod^1 * -1
-
--- function file.addsuffix(name, suffix)
--- local p = lpegmatch(pattern,name)
--- if p then
--- return name
--- else
--- return name .. "." .. suffix
--- end
--- end
-
--- local suffix = period * (1-period-slashes)^1 * -1
--- local pattern = Cs((1-suffix)^1)
-
--- function file.replacesuffix(name,suffix)
--- if suffix and suffix ~= "" then
--- return lpegmatch(pattern,name) .. "." .. suffix
--- else
--- return name
--- end
--- end
-
--- local path = noslashes^0 * slashes^1
--- local suffix = period * (1-period-slashes)^1 * -1
--- local pattern = path^0 * Cs((1-suffix)^1) * suffix^0
-
--- function file.nameonly(name)
--- return lpegmatch(pattern,name) or name
--- end
-
--- local test = file.suffixonly
--- local test = file.basename
--- local test = file.dirname
--- local test = file.addsuffix
--- local test = file.replacesuffix
--- local test = file.nameonly
-
--- print(1,test("./a/b/c/abd.def.xxx","!!!"))
--- print(2,test("./../b/c/abd.def.xxx","!!!"))
--- print(3,test("a/b/c/abd.def.xxx","!!!"))
--- print(4,test("a/b/c/def.xxx","!!!"))
--- print(5,test("a/b/c/def","!!!"))
--- print(6,test("def","!!!"))
--- print(7,test("def.xxx","!!!"))
-
--- local tim = os.clock() for i=1,250000 do local ext = test("abd.def.xxx","!!!") end print(os.clock()-tim)
-
-- also rewrite previous
local letter = R("az","AZ") + S("_-+")
local separator = P("://")
-local qualified = P(".")^0 * P("/") + letter*P(":") + letter^1*separator + letter^1 * P("/")
-local rootbased = P("/") + letter*P(":")
+local qualified = period^0 * fwslash
+ + letter * colon
+ + letter^1 * separator
+ + letter^1 * fwslash
+local rootbased = fwslash
+ + letter * colon
lpeg.patterns.qualified = qualified
lpeg.patterns.rootbased = rootbased
@@ -3467,61 +3481,6 @@ function file.is_rootbased_path(filename)
return lpegmatch(rootbased,filename) ~= nil
end
--- actually these are schemes
-
-local slash = S("\\/")
-local period = P(".")
-local drive = C(R("az","AZ")) * P(":")
-local path = C(((1-slash)^0 * slash)^0)
-local suffix = period * C(P(1-period)^0 * P(-1))
-local base = C((1-suffix)^0)
-local rest = C(P(1)^0)
-
-drive = drive + Cc("")
-path = path + Cc("")
-base = base + Cc("")
-suffix = suffix + Cc("")
-
-local pattern_a = drive * path * base * suffix
-local pattern_b = path * base * suffix
-local pattern_c = C(drive * path) * C(base * suffix) -- trick: two extra captures
-local pattern_d = path * rest
-
-function file.splitname(str,splitdrive)
- if splitdrive then
- return lpegmatch(pattern_a,str) -- returns drive, path, base, suffix
- else
- return lpegmatch(pattern_b,str) -- returns path, base, suffix
- end
-end
-
-function file.splitbase(str)
- return lpegmatch(pattern_d,str) -- returns path, base+suffix
-end
-
-function file.nametotable(str,splitdrive) -- returns table
- local path, drive, subpath, name, base, suffix = lpegmatch(pattern_c,str)
- if splitdrive then
- return {
- path = path,
- drive = drive,
- subpath = subpath,
- name = name,
- base = base,
- suffix = suffix,
- }
- else
- return {
- path = path,
- name = name,
- base = base,
- suffix = suffix,
- }
- end
-end
-
--- print(file.splitbase("a/b/c.txt"))
-
-- function test(t) for k, v in next, t do print(v, "=>", file.splitname(v)) end end
--
-- test { "c:", "c:/aa", "c:/aa/bb", "c:/aa/bb/cc", "c:/aa/bb/cc.dd", "c:/aa/bb/cc.dd.ee" }
@@ -3529,6 +3488,14 @@ end
-- test { "/aa", "/aa/bb", "/aa/bb/cc", "/aa/bb/cc.dd", "/aa/bb/cc.dd.ee" }
-- test { "aa", "aa/bb", "aa/bb/cc", "aa/bb/cc.dd", "aa/bb/cc.dd.ee" }
+-- -- maybe:
+--
+-- if os.type == "windows" then
+-- local currentdir = getcurrentdir
+-- function getcurrentdir()
+-- return lpegmatch(reslasher,currentdir())
+-- end
+-- end
-- for myself:
@@ -3537,6 +3504,21 @@ function file.strip(name,dir)
return a ~= "" and a or name
end
+-- local debuglist = {
+-- "pathpart", "basename", "nameonly", "suffixonly", "suffix", "dirname", "extname",
+-- "addsuffix", "removesuffix", "replacesuffix", "join",
+-- "strip","collapsepath", "joinpath", "splitpath",
+-- }
+
+-- for i=1,#debuglist do
+-- local name = debuglist[i]
+-- local f = file[name]
+-- file[name] = function(...)
+-- print(name,f(...))
+-- return f(...)
+-- end
+-- end
+
end -- of closure
@@ -3661,7 +3643,7 @@ if not modules then modules = { } end modules ['l-url'] = {
license = "see context related readme files"
}
-local char, gmatch, gsub, format, byte, find = string.char, string.gmatch, string.gsub, string.format, string.byte, string.find
+local char, format, byte = string.char, string.format, string.byte
local concat = table.concat
local tonumber, type = tonumber, type
local P, C, R, S, Cs, Cc, Ct, Cf, Cg, V = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cs, lpeg.Cc, lpeg.Ct, lpeg.Cf, lpeg.Cg, lpeg.V
@@ -3700,6 +3682,8 @@ local nothing = Cc("")
local escapedchar = (percent * C(hexdigit * hexdigit)) / tochar
local escaped = (plus / " ") + escapedchar
+local noslash = P("/") / ""
+
-- we assume schemes with more than 1 character (in order to avoid problems with windows disks)
-- we also assume that when we have a scheme, we also have an authority
--
@@ -3878,29 +3862,23 @@ function url.construct(hash) -- dodo: we need to escape !
return lpegmatch(escaper,concat(fullurl))
end
-function url.filename(filename) -- why no lpeg here ?
- local t = hashed(filename)
- return (t.scheme == "file" and (gsub(t.path,"^/([a-zA-Z])([:|])/)","%1:"))) or filename
+local pattern = Cs(noslash * R("az","AZ") * (S(":|")/":") * noslash * P(1)^0)
+
+function url.filename(filename)
+ local spec = hashed(filename)
+ local path = spec.path
+ return (spec.scheme == "file" and path and lpegmatch(pattern,path)) or filename
end
+-- print(url.filename("/c|/test"))
+-- print(url.filename("/c/test"))
+
local function escapestring(str)
return lpegmatch(escaper,str)
end
url.escape = escapestring
--- function url.query(str) -- separator could be an option
--- if type(str) == "string" then
--- local t = { }
--- for k, v in gmatch(str,"([^&=]*)=([^&=]*)") do
--- t[k] = v
--- end
--- return t
--- else
--- return str
--- end
--- end
-
function url.query(str)
if type(str) == "string" then
return lpegmatch(splitquery,str) or ""
@@ -3928,14 +3906,19 @@ end
-- /test/ | /test | test/ | test => test
+local pattern = Cs(noslash^0 * (1 - noslash * P(-1))^0)
+
function url.barepath(path)
if not path or path == "" then
return ""
else
- return (gsub(path,"^/?(.-)/?$","%1"))
+ return lpegmatch(pattern,path)
end
end
+-- print(url.barepath("/test"),url.barepath("test/"),url.barepath("/test/"),url.barepath("test"))
+-- print(url.barepath("/x/yz"),url.barepath("x/yz/"),url.barepath("/x/yz/"),url.barepath("x/yz"))
+
@@ -6191,8 +6174,8 @@ end
-- for chem (currently one level)
local value = P(lbrace * C((nobrace + nestedbraces)^0) * rbrace)
- + C(digit^1 * lparent * (noparent + nestedparents)^0 * rparent)
- + C((nestedbraces + (1-comma))^0)
+ + C(digit^1 * lparent * (noparent + nestedparents)^1 * rparent)
+ + C((nestedbraces + (1-comma))^1)
local pattern_a = spaces * Ct(value*(separator*value)^0)
local function repeater(n,str)
@@ -6216,15 +6199,15 @@ local function repeater(n,str)
end
local value = P(lbrace * C((nobrace + nestedbraces)^0) * rbrace)
- + (C(digit^1)/tonumber * lparent * Cs((noparent + nestedparents)^0) * rparent) / repeater
- + C((nestedbraces + (1-comma))^0)
+ + (C(digit^1)/tonumber * lparent * Cs((noparent + nestedparents)^1) * rparent) / repeater
+ + C((nestedbraces + (1-comma))^1)
local pattern_b = spaces * Ct(value*(separator*value)^0)
-function parsers.settings_to_array_with_repeat(str,expand)
+function parsers.settings_to_array_with_repeat(str,expand) -- beware: "" => { }
if expand then
- return lpegmatch(pattern_b,str)
+ return lpegmatch(pattern_b,str) or { }
else
- return lpegmatch(pattern_a,str)
+ return lpegmatch(pattern_a,str) or { }
end
end
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index be3acb7da..01c601eb5 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -1625,7 +1625,8 @@ function lpeg.replacer(one,two,makefunction)
elseif no == 1 then
local o = one[1]
one, two = P(o[1]), o[2]
- pattern = Cs(((1-one)^1 + one/two)^0)
+ -- pattern = Cs(((1-one)^1 + one/two)^0)
+ pattern = Cs((one/two + 1)^0)
else
for i=1,no do
local o = one[i]
@@ -1636,7 +1637,28 @@ function lpeg.replacer(one,two,makefunction)
else
one = P(one)
two = two or ""
- pattern = Cs(((1-one)^1 + one/two)^0)
+ -- pattern = Cs(((1-one)^1 + one/two)^0)
+ pattern = Cs((one/two +1)^0)
+ end
+ if makefunction then
+ return function(str)
+ return lpegmatch(pattern,str)
+ end
+ else
+ return pattern
+ end
+end
+
+function lpeg.finder(lst,makefunction)
+ local pattern
+ if type(lst) == "table" then
+ local p = P(false)
+ for i=1,#lst do
+ p = p + P(lst[i])
+ end
+ pattern = (p + 1)^0
+ else
+ pattern = (P(lst) + 1)^0
end
if makefunction then
return function(str)
@@ -3058,66 +3080,145 @@ file = file or { }
local file = file
local insert, concat = table.insert, table.concat
-local find, gmatch, match, gsub, sub, char, lower = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char, string.lower
+local match = string.match
local lpegmatch = lpeg.match
local getcurrentdir, attributes = lfs.currentdir, lfs.attributes
+local checkedsplit = string.checkedsplit
+
+-- local patterns = file.patterns or { }
+-- file.patterns = patterns
-local P, R, S, C, Cs, Cp, Cc = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Cc
+local P, R, S, C, Cs, Cp, Cc, Ct = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Cc, lpeg.Ct
-local function dirname(name,default)
- return match(name,"^(.+)[/\\].-$") or (default or "")
+local colon = P(":")
+local period = P(".")
+local periods = P("..")
+local fwslash = P("/")
+local bwslash = P("\\")
+local slashes = S("\\/")
+local noperiod = 1-period
+local noslashes = 1-slashes
+local name = noperiod^1
+local suffix = period/"" * (1-period-slashes)^1 * -1
+
+local pattern = C((noslashes^0 * slashes^1)^1)
+
+local function pathpart(name,default)
+ return lpegmatch(pattern,name) or default or ""
end
+local pattern = (noslashes^0 * slashes)^1 * C(noslashes^1) * -1
+
local function basename(name)
- return match(name,"^.+[/\\](.-)$") or name
+ return lpegmatch(pattern,name) or name
end
--- local function nameonly(name)
--- return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$",""))
--- end
+local pattern = (noslashes^0 * slashes^1)^0 * Cs((1-suffix)^1) * suffix^0
local function nameonly(name)
- return (gsub(match(name,"^.+[/\\](.-)$") or name,"%.[%a%d]+$",""))
+ return lpegmatch(pattern,name) or name
end
-local function suffixonly(name,default)
- return match(name,"^.+%.([^/\\]-)$") or default or ""
-end
+local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * C(noperiod^1) * -1
-local function splitname(name)
- local n, s = match(name,"^(.+)%.([^/\\]-)$")
- return n or name, s or ""
+local function suffixonly(name)
+ return lpegmatch(pattern,name) or ""
end
+file.pathpart = pathpart
file.basename = basename
-
-file.pathpart = dirname
-file.dirname = dirname
-
file.nameonly = nameonly
-
file.suffixonly = suffixonly
-file.extname = suffixonly -- obsolete
file.suffix = suffixonly
-function file.removesuffix(filename)
- return (gsub(filename,"%.[%a%d]+$",""))
+file.dirname = pathpart -- obsolete
+file.extname = suffixonly -- obsolete
+
+-- actually these are schemes
+
+local drive = C(R("az","AZ")) * colon
+local path = C(((1-slashes)^0 * slashes)^0)
+local suffix = period * C(P(1-period)^0 * P(-1))
+local base = C((1-suffix)^0)
+local rest = C(P(1)^0)
+
+drive = drive + Cc("")
+path = path + Cc("")
+base = base + Cc("")
+suffix = suffix + Cc("")
+
+local pattern_a = drive * path * base * suffix
+local pattern_b = path * base * suffix
+local pattern_c = C(drive * path) * C(base * suffix) -- trick: two extra captures
+local pattern_d = path * rest
+
+function file.splitname(str,splitdrive)
+ if splitdrive then
+ return lpegmatch(pattern_a,str) -- returns drive, path, base, suffix
+ else
+ return lpegmatch(pattern_b,str) -- returns path, base, suffix
+ end
+end
+
+function file.splitbase(str)
+ return lpegmatch(pattern_d,str) -- returns path, base+suffix
+end
+
+function file.nametotable(str,splitdrive) -- returns table
+ local path, drive, subpath, name, base, suffix = lpegmatch(pattern_c,str)
+ if splitdrive then
+ return {
+ path = path,
+ drive = drive,
+ subpath = subpath,
+ name = name,
+ base = base,
+ suffix = suffix,
+ }
+ else
+ return {
+ path = path,
+ name = name,
+ base = base,
+ suffix = suffix,
+ }
+ end
+end
+
+local pattern = Cs(((period * noperiod^1 * -1)/"" + 1)^1)
+
+function file.removesuffix(name)
+ return lpegmatch(pattern,name)
end
+-- local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * Cp() * noperiod^1 * -1
+--
+-- function file.addsuffix(name, suffix)
+-- local p = lpegmatch(pattern,name)
+-- if p then
+-- return name
+-- else
+-- return name .. "." .. suffix
+-- end
+-- end
+
+local suffix = period/"" * (1-period-slashes)^1 * -1
+local pattern = Cs((noslashes^0 * slashes^1)^0 * ((1-suffix)^1)) * Cs(suffix)
+
function file.addsuffix(filename, suffix, criterium)
if not suffix or suffix == "" then
return filename
elseif criterium == true then
return filename .. "." .. suffix
elseif not criterium then
- local n, s = splitname(filename)
+ local n, s = lpegmatch(pattern,filename)
if not s or s == "" then
return filename .. "." .. suffix
else
return filename
end
else
- local n, s = splitname(filename)
+ local n, s = lpegmatch(pattern,filename)
if s and s ~= "" then
local t = type(criterium)
if t == "table" then
@@ -3134,88 +3235,49 @@ function file.addsuffix(filename, suffix, criterium)
end
end
end
- return n .. "." .. suffix
+ return (n or filename) .. "." .. suffix
end
end
+-- print("1 " .. file.addsuffix("name","new") .. " -> name.new")
+-- print("2 " .. file.addsuffix("name.old","new") .. " -> name.old")
+-- print("3 " .. file.addsuffix("name.old","new",true) .. " -> name.old.new")
+-- print("4 " .. file.addsuffix("name.old","new","new") .. " -> name.new")
+-- print("5 " .. file.addsuffix("name.old","new","old") .. " -> name.old")
+-- print("6 " .. file.addsuffix("name.old","new","foo") .. " -> name.new")
+-- print("7 " .. file.addsuffix("name.old","new",{"foo","bar"}) .. " -> name.new")
+-- print("8 " .. file.addsuffix("name.old","new",{"old","bar"}) .. " -> name.old")
-function file.replacesuffix(filename, suffix)
- return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix
+local suffix = period * (1-period-slashes)^1 * -1
+local pattern = Cs((1-suffix)^0)
+
+function file.replacesuffix(name,suffix)
+ if suffix and suffix ~= "" then
+ return lpegmatch(pattern,name) .. "." .. suffix
+ else
+ return name
+ end
end
-local trick_1 = char(1)
-local trick_2 = "^" .. trick_1 .. "/+"
+--
-function file.join(...) -- rather dirty
- local lst = { ... }
- local a, b = lst[1], lst[2]
- if not a or a == "" then -- not a added
- lst[1] = trick_1
- elseif b and find(a,"^/+$") and find(b,"^/") then
- lst[1] = ""
- lst[2] = gsub(b,"^/+","")
- end
- local pth = concat(lst,"/")
- pth = gsub(pth,"\\","/")
- local a, b = match(pth,"^(.*://)(.*)$")
- if a and b then
- return a .. gsub(b,"//+","/")
- end
- a, b = match(pth,"^(//)(.*)$")
- if a and b then
- return a .. gsub(b,"//+","/")
- end
- pth = gsub(pth,trick_2,"")
- return (gsub(pth,"//+","/"))
-end
-
--- local slash = P("/")
--- local colon = P(":")
-
--- local replacer = lpeg.replacer(S("\\/")^1,"/")
--- local stripper = Cs(P(slash)^0/"" * replacer)
--- local isnetwork = slash * slash * (1-slash) + (1-slash-colon)^1 * colon
--- local isroot = slash^1 * -1
--- local hasroot = slash^1
-
--- function file.newjoin(...) -- rather dirty
--- local lst = { ... }
--- local one = lst[1]
--- if lpegmatch(isnetwork,one) then
--- local two = lpegmatch(replacer,concat(lst,"/",2))
--- return one .. two
--- elseif lpegmatch(isroot,one) then
--- local two = lpegmatch(replacer,concat(lst,"/",2))
--- if lpegmatch(hasroot,two) then
--- return two
--- else
--- return "/" .. two
--- end
--- elseif one == "" then
--- return lpegmatch(stripper,concat(lst,"/",2))
--- else
--- return lpegmatch(replacer,concat(lst,"/"))
--- end
--- end
+local reslasher = lpeg.replacer(S("\\"),"/")
--- print(file.join("//","/y"))
--- print(file.join("/","/y"))
--- print(file.join("","/y"))
--- print(file.join("/x/","/y"))
--- print(file.join("x/","/y"))
--- print(file.join("http://","/y"))
--- print(file.join("http://a","/y"))
--- print(file.join("http:///a","/y"))
--- print(file.join("//nas-1","/y"))
+function file.reslash(str)
+ return lpegmatch(reslasher,str)
+end
-- We should be able to use:
--
+-- local writable = P(1) * P("w") * Cc(true)
+--
-- function file.is_writable(name)
--- local a = attributes(name) or attributes(dirname(name,"."))
--- return a and sub(a.permissions,2,2) == "w"
+-- local a = attributes(name) or attributes(pathpart(name,"."))
+-- return a and lpegmatch(writable,a.permissions) or false
-- end
--
--- But after some testing Taco and I came up with:
+-- But after some testing Taco and I came up with the more robust
+-- variant:
function file.is_writable(name)
if lfs.isdir(name) then
@@ -3243,9 +3305,11 @@ function file.is_writable(name)
return false
end
+local readable = P("r") * Cc(true)
+
function file.is_readable(name)
local a = attributes(name)
- return a and sub(a.permissions,1,1) == "r"
+ return a and lpegmatch(readable,a.permissions) or false
end
file.isreadable = file.is_readable -- depricated
@@ -3256,41 +3320,74 @@ function file.size(name)
return a and a.size or 0
end
--- todo: lpeg \\ / .. does not save much
-
-local checkedsplit = string.checkedsplit
-
-function file.splitpath(str,separator) -- string
- str = gsub(str,"\\","/")
- return checkedsplit(str,separator or io.pathseparator)
+function file.splitpath(str,separator) -- string .. reslash is a bonus (we could do a direct split)
+ return checkedsplit(lpegmatch(reslasher,str),separator or io.pathseparator)
end
function file.joinpath(tab,separator) -- table
return concat(tab,separator or io.pathseparator) -- can have trailing //
end
--- we can hash them weakly
+local stripper = Cs(P(fwslash)^0/"" * reslasher)
+local isnetwork = fwslash * fwslash * (1-fwslash) + (1-fwslash-colon)^1 * colon
+local isroot = fwslash^1 * -1
+local hasroot = fwslash^1
+
+function file.join(...) -- rather dirty
+ local lst = { ... }
+ local one = lst[1]
+ if lpegmatch(isnetwork,one) then
+ local two = lpegmatch(reslasher,concat(lst,"/",2))
+ return one .. "/" .. two
+ elseif lpegmatch(isroot,one) then
+ local two = lpegmatch(reslasher,concat(lst,"/",2))
+ if lpegmatch(hasroot,two) then
+ return two
+ else
+ return "/" .. two
+ end
+ elseif one == "" then
+ return lpegmatch(stripper,concat(lst,"/",2))
+ else
+ return lpegmatch(reslasher,concat(lst,"/"))
+ end
+end
+
+-- print(file.join("c:/whatever","name"))
+-- print(file.join("//","/y"))
+-- print(file.join("/","/y"))
+-- print(file.join("","/y"))
+-- print(file.join("/x/","/y"))
+-- print(file.join("x/","/y"))
+-- print(file.join("http://","/y"))
+-- print(file.join("http://a","/y"))
+-- print(file.join("http:///a","/y"))
+-- print(file.join("//nas-1","/y"))
+
+-- The previous one fails on "a.b/c" so Taco came up with a split based
+-- variant. After some skyping we got it sort of compatible with the old
+-- one. After that the anchoring to currentdir was added in a better way.
+-- Of course there are some optimizations too. Finally we had to deal with
+-- windows drive prefixes and things like sys://. Eventually gsubs and
+-- finds were replaced by lpegs.
+local drivespec = R("az","AZ")^1 * colon
+local anchors = fwslash + drivespec
+local untouched = periods + (1-period)^1 * P(-1)
+local splitstarter = (Cs(drivespec * (bwslash/"/" + fwslash)^0) + Cc(false)) * Ct(lpeg.splitat(S("/\\")^1))
+local absolute = fwslash
function file.collapsepath(str,anchor)
- if anchor and not find(str,"^/") and not find(str,"^%a:") then
+ if anchor and not lpegmatch(anchors,str) then
str = getcurrentdir() .. "/" .. str
end
if str == "" or str =="." then
return "."
- elseif find(str,"^%.%.") then
- str = gsub(str,"\\","/")
- return str
- elseif not find(str,"%.") then
- str = gsub(str,"\\","/")
- return str
- end
- str = gsub(str,"\\","/")
- local starter, rest = match(str,"^(%a+:/*)(.-)$")
- if starter then
- str = rest
+ elseif lpegmatch(untouched,str) then
+ return lpegmatch(reslasher,str)
end
- local oldelements = checkedsplit(str,"/")
+ local starter, oldelements = lpegmatch(splitstarter,str)
+-- inspect(oldelements)
local newelements = { }
local i = #oldelements
while i > 0 do
@@ -3320,7 +3417,7 @@ function file.collapsepath(str,anchor)
return starter or "."
elseif starter then
return starter .. concat(newelements, '/')
- elseif find(str,"^/") then
+ elseif lpegmatch(absolute,str) then
return "/" .. concat(newelements,'/')
else
return concat(newelements, '/')
@@ -3337,29 +3434,21 @@ end
-- test("a/./b/..") test("a/aa/../b/bb") test("a/.././././b/..") test("a/./././b/..")
-- test("a/b/c/../..") test("./a/b/c/../..") test("a/b/c/../..")
+local validchars = R("az","09","AZ","--","..")
+local pattern_a = lpeg.replacer(1-validchars)
+local pattern_a = Cs((validchars + P(1)/"-")^1)
+local whatever = P("-")^0 / ""
+local pattern_b = Cs(whatever * (1 - whatever * -1)^1)
+
function file.robustname(str,strict)
- str = gsub(str,"[^%a%d%/%-%.\\]+","-")
+ str = lpegmatch(pattern_a,str) or str
if strict then
- return lower(gsub(str,"^%-*(.-)%-*$","%1"))
+ return lpegmatch(pattern_b,str) or str -- two step is cleaner (less backtracking)
else
return str
end
end
--- local pattern_a = lpeg.replacer(1-R("az","09","AZ","--",".."))
--- local pattern_a = Cs((R("az","09","AZ","--","..") + P(1)/"-")^1)
--- local whatever = P("-")^0 / ""
--- local pattern_b = Cs(whatever * (1 - whatever * -1)^1)
-
--- function file.robustname(str,strict)
--- str = lpegmatch(pattern_a,str) or str
--- if strict then
--- return lpegmatch(pattern_b,str) or str -- two step is cleaner (less backtracking)
--- else
--- return str
--- end
--- end
-
file.readdata = io.loaddata
file.savedata = io.savedata
@@ -3367,92 +3456,17 @@ function file.copy(oldname,newname)
file.savedata(newname,io.loaddata(oldname))
end
--- lpeg variants, slightly faster, not always
-
--- local period = P(".")
--- local slashes = S("\\/")
--- local noperiod = 1-period
--- local noslashes = 1-slashes
--- local name = noperiod^1
-
--- local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * C(noperiod^1) * -1
-
--- function file.suffixonly(name)
--- return lpegmatch(pattern,name) or ""
--- end
-
--- local pattern = Cs(((period * noperiod^1 * -1)/"" + 1)^1)
-
--- function file.removesuffix(name)
--- return lpegmatch(pattern,name)
--- end
-
--- local pattern = (noslashes^0 * slashes)^1 * C(noslashes^1) * -1
-
--- function file.basename(name)
--- return lpegmatch(pattern,name) or name
--- end
-
--- local pattern = Cs ((1 - slashes * noslashes^1 * -1)^1)
-
--- function file.dirname(name)
--- return lpegmatch(pattern,name) or ""
--- end
-
--- local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * Cp() * noperiod^1 * -1
-
--- function file.addsuffix(name, suffix)
--- local p = lpegmatch(pattern,name)
--- if p then
--- return name
--- else
--- return name .. "." .. suffix
--- end
--- end
-
--- local suffix = period * (1-period-slashes)^1 * -1
--- local pattern = Cs((1-suffix)^1)
-
--- function file.replacesuffix(name,suffix)
--- if suffix and suffix ~= "" then
--- return lpegmatch(pattern,name) .. "." .. suffix
--- else
--- return name
--- end
--- end
-
--- local path = noslashes^0 * slashes^1
--- local suffix = period * (1-period-slashes)^1 * -1
--- local pattern = path^0 * Cs((1-suffix)^1) * suffix^0
-
--- function file.nameonly(name)
--- return lpegmatch(pattern,name) or name
--- end
-
--- local test = file.suffixonly
--- local test = file.basename
--- local test = file.dirname
--- local test = file.addsuffix
--- local test = file.replacesuffix
--- local test = file.nameonly
-
--- print(1,test("./a/b/c/abd.def.xxx","!!!"))
--- print(2,test("./../b/c/abd.def.xxx","!!!"))
--- print(3,test("a/b/c/abd.def.xxx","!!!"))
--- print(4,test("a/b/c/def.xxx","!!!"))
--- print(5,test("a/b/c/def","!!!"))
--- print(6,test("def","!!!"))
--- print(7,test("def.xxx","!!!"))
-
--- local tim = os.clock() for i=1,250000 do local ext = test("abd.def.xxx","!!!") end print(os.clock()-tim)
-
-- also rewrite previous
local letter = R("az","AZ") + S("_-+")
local separator = P("://")
-local qualified = P(".")^0 * P("/") + letter*P(":") + letter^1*separator + letter^1 * P("/")
-local rootbased = P("/") + letter*P(":")
+local qualified = period^0 * fwslash
+ + letter * colon
+ + letter^1 * separator
+ + letter^1 * fwslash
+local rootbased = fwslash
+ + letter * colon
lpeg.patterns.qualified = qualified
lpeg.patterns.rootbased = rootbased
@@ -3467,61 +3481,6 @@ function file.is_rootbased_path(filename)
return lpegmatch(rootbased,filename) ~= nil
end
--- actually these are schemes
-
-local slash = S("\\/")
-local period = P(".")
-local drive = C(R("az","AZ")) * P(":")
-local path = C(((1-slash)^0 * slash)^0)
-local suffix = period * C(P(1-period)^0 * P(-1))
-local base = C((1-suffix)^0)
-local rest = C(P(1)^0)
-
-drive = drive + Cc("")
-path = path + Cc("")
-base = base + Cc("")
-suffix = suffix + Cc("")
-
-local pattern_a = drive * path * base * suffix
-local pattern_b = path * base * suffix
-local pattern_c = C(drive * path) * C(base * suffix) -- trick: two extra captures
-local pattern_d = path * rest
-
-function file.splitname(str,splitdrive)
- if splitdrive then
- return lpegmatch(pattern_a,str) -- returns drive, path, base, suffix
- else
- return lpegmatch(pattern_b,str) -- returns path, base, suffix
- end
-end
-
-function file.splitbase(str)
- return lpegmatch(pattern_d,str) -- returns path, base+suffix
-end
-
-function file.nametotable(str,splitdrive) -- returns table
- local path, drive, subpath, name, base, suffix = lpegmatch(pattern_c,str)
- if splitdrive then
- return {
- path = path,
- drive = drive,
- subpath = subpath,
- name = name,
- base = base,
- suffix = suffix,
- }
- else
- return {
- path = path,
- name = name,
- base = base,
- suffix = suffix,
- }
- end
-end
-
--- print(file.splitbase("a/b/c.txt"))
-
-- function test(t) for k, v in next, t do print(v, "=>", file.splitname(v)) end end
--
-- test { "c:", "c:/aa", "c:/aa/bb", "c:/aa/bb/cc", "c:/aa/bb/cc.dd", "c:/aa/bb/cc.dd.ee" }
@@ -3529,6 +3488,14 @@ end
-- test { "/aa", "/aa/bb", "/aa/bb/cc", "/aa/bb/cc.dd", "/aa/bb/cc.dd.ee" }
-- test { "aa", "aa/bb", "aa/bb/cc", "aa/bb/cc.dd", "aa/bb/cc.dd.ee" }
+-- -- maybe:
+--
+-- if os.type == "windows" then
+-- local currentdir = getcurrentdir
+-- function getcurrentdir()
+-- return lpegmatch(reslasher,currentdir())
+-- end
+-- end
-- for myself:
@@ -3537,6 +3504,21 @@ function file.strip(name,dir)
return a ~= "" and a or name
end
+-- local debuglist = {
+-- "pathpart", "basename", "nameonly", "suffixonly", "suffix", "dirname", "extname",
+-- "addsuffix", "removesuffix", "replacesuffix", "join",
+-- "strip","collapsepath", "joinpath", "splitpath",
+-- }
+
+-- for i=1,#debuglist do
+-- local name = debuglist[i]
+-- local f = file[name]
+-- file[name] = function(...)
+-- print(name,f(...))
+-- return f(...)
+-- end
+-- end
+
end -- of closure
@@ -3661,7 +3643,7 @@ if not modules then modules = { } end modules ['l-url'] = {
license = "see context related readme files"
}
-local char, gmatch, gsub, format, byte, find = string.char, string.gmatch, string.gsub, string.format, string.byte, string.find
+local char, format, byte = string.char, string.format, string.byte
local concat = table.concat
local tonumber, type = tonumber, type
local P, C, R, S, Cs, Cc, Ct, Cf, Cg, V = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cs, lpeg.Cc, lpeg.Ct, lpeg.Cf, lpeg.Cg, lpeg.V
@@ -3700,6 +3682,8 @@ local nothing = Cc("")
local escapedchar = (percent * C(hexdigit * hexdigit)) / tochar
local escaped = (plus / " ") + escapedchar
+local noslash = P("/") / ""
+
-- we assume schemes with more than 1 character (in order to avoid problems with windows disks)
-- we also assume that when we have a scheme, we also have an authority
--
@@ -3878,29 +3862,23 @@ function url.construct(hash) -- dodo: we need to escape !
return lpegmatch(escaper,concat(fullurl))
end
-function url.filename(filename) -- why no lpeg here ?
- local t = hashed(filename)
- return (t.scheme == "file" and (gsub(t.path,"^/([a-zA-Z])([:|])/)","%1:"))) or filename
+local pattern = Cs(noslash * R("az","AZ") * (S(":|")/":") * noslash * P(1)^0)
+
+function url.filename(filename)
+ local spec = hashed(filename)
+ local path = spec.path
+ return (spec.scheme == "file" and path and lpegmatch(pattern,path)) or filename
end
+-- print(url.filename("/c|/test"))
+-- print(url.filename("/c/test"))
+
local function escapestring(str)
return lpegmatch(escaper,str)
end
url.escape = escapestring
--- function url.query(str) -- separator could be an option
--- if type(str) == "string" then
--- local t = { }
--- for k, v in gmatch(str,"([^&=]*)=([^&=]*)") do
--- t[k] = v
--- end
--- return t
--- else
--- return str
--- end
--- end
-
function url.query(str)
if type(str) == "string" then
return lpegmatch(splitquery,str) or ""
@@ -3928,14 +3906,19 @@ end
-- /test/ | /test | test/ | test => test
+local pattern = Cs(noslash^0 * (1 - noslash * P(-1))^0)
+
function url.barepath(path)
if not path or path == "" then
return ""
else
- return (gsub(path,"^/?(.-)/?$","%1"))
+ return lpegmatch(pattern,path)
end
end
+-- print(url.barepath("/test"),url.barepath("test/"),url.barepath("/test/"),url.barepath("test"))
+-- print(url.barepath("/x/yz"),url.barepath("x/yz/"),url.barepath("/x/yz/"),url.barepath("x/yz"))
+
@@ -6191,8 +6174,8 @@ end
-- for chem (currently one level)
local value = P(lbrace * C((nobrace + nestedbraces)^0) * rbrace)
- + C(digit^1 * lparent * (noparent + nestedparents)^0 * rparent)
- + C((nestedbraces + (1-comma))^0)
+ + C(digit^1 * lparent * (noparent + nestedparents)^1 * rparent)
+ + C((nestedbraces + (1-comma))^1)
local pattern_a = spaces * Ct(value*(separator*value)^0)
local function repeater(n,str)
@@ -6216,15 +6199,15 @@ local function repeater(n,str)
end
local value = P(lbrace * C((nobrace + nestedbraces)^0) * rbrace)
- + (C(digit^1)/tonumber * lparent * Cs((noparent + nestedparents)^0) * rparent) / repeater
- + C((nestedbraces + (1-comma))^0)
+ + (C(digit^1)/tonumber * lparent * Cs((noparent + nestedparents)^1) * rparent) / repeater
+ + C((nestedbraces + (1-comma))^1)
local pattern_b = spaces * Ct(value*(separator*value)^0)
-function parsers.settings_to_array_with_repeat(str,expand)
+function parsers.settings_to_array_with_repeat(str,expand) -- beware: "" => { }
if expand then
- return lpegmatch(pattern_b,str)
+ return lpegmatch(pattern_b,str) or { }
else
- return lpegmatch(pattern_a,str)
+ return lpegmatch(pattern_a,str) or { }
end
end
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index be3acb7da..01c601eb5 100644
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -1625,7 +1625,8 @@ function lpeg.replacer(one,two,makefunction)
elseif no == 1 then
local o = one[1]
one, two = P(o[1]), o[2]
- pattern = Cs(((1-one)^1 + one/two)^0)
+ -- pattern = Cs(((1-one)^1 + one/two)^0)
+ pattern = Cs((one/two + 1)^0)
else
for i=1,no do
local o = one[i]
@@ -1636,7 +1637,28 @@ function lpeg.replacer(one,two,makefunction)
else
one = P(one)
two = two or ""
- pattern = Cs(((1-one)^1 + one/two)^0)
+ -- pattern = Cs(((1-one)^1 + one/two)^0)
+ pattern = Cs((one/two +1)^0)
+ end
+ if makefunction then
+ return function(str)
+ return lpegmatch(pattern,str)
+ end
+ else
+ return pattern
+ end
+end
+
+function lpeg.finder(lst,makefunction)
+ local pattern
+ if type(lst) == "table" then
+ local p = P(false)
+ for i=1,#lst do
+ p = p + P(lst[i])
+ end
+ pattern = (p + 1)^0
+ else
+ pattern = (P(lst) + 1)^0
end
if makefunction then
return function(str)
@@ -3058,66 +3080,145 @@ file = file or { }
local file = file
local insert, concat = table.insert, table.concat
-local find, gmatch, match, gsub, sub, char, lower = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char, string.lower
+local match = string.match
local lpegmatch = lpeg.match
local getcurrentdir, attributes = lfs.currentdir, lfs.attributes
+local checkedsplit = string.checkedsplit
+
+-- local patterns = file.patterns or { }
+-- file.patterns = patterns
-local P, R, S, C, Cs, Cp, Cc = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Cc
+local P, R, S, C, Cs, Cp, Cc, Ct = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Cc, lpeg.Ct
-local function dirname(name,default)
- return match(name,"^(.+)[/\\].-$") or (default or "")
+local colon = P(":")
+local period = P(".")
+local periods = P("..")
+local fwslash = P("/")
+local bwslash = P("\\")
+local slashes = S("\\/")
+local noperiod = 1-period
+local noslashes = 1-slashes
+local name = noperiod^1
+local suffix = period/"" * (1-period-slashes)^1 * -1
+
+local pattern = C((noslashes^0 * slashes^1)^1)
+
+local function pathpart(name,default)
+ return lpegmatch(pattern,name) or default or ""
end
+local pattern = (noslashes^0 * slashes)^1 * C(noslashes^1) * -1
+
local function basename(name)
- return match(name,"^.+[/\\](.-)$") or name
+ return lpegmatch(pattern,name) or name
end
--- local function nameonly(name)
--- return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$",""))
--- end
+local pattern = (noslashes^0 * slashes^1)^0 * Cs((1-suffix)^1) * suffix^0
local function nameonly(name)
- return (gsub(match(name,"^.+[/\\](.-)$") or name,"%.[%a%d]+$",""))
+ return lpegmatch(pattern,name) or name
end
-local function suffixonly(name,default)
- return match(name,"^.+%.([^/\\]-)$") or default or ""
-end
+local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * C(noperiod^1) * -1
-local function splitname(name)
- local n, s = match(name,"^(.+)%.([^/\\]-)$")
- return n or name, s or ""
+local function suffixonly(name)
+ return lpegmatch(pattern,name) or ""
end
+file.pathpart = pathpart
file.basename = basename
-
-file.pathpart = dirname
-file.dirname = dirname
-
file.nameonly = nameonly
-
file.suffixonly = suffixonly
-file.extname = suffixonly -- obsolete
file.suffix = suffixonly
-function file.removesuffix(filename)
- return (gsub(filename,"%.[%a%d]+$",""))
+file.dirname = pathpart -- obsolete
+file.extname = suffixonly -- obsolete
+
+-- actually these are schemes
+
+local drive = C(R("az","AZ")) * colon
+local path = C(((1-slashes)^0 * slashes)^0)
+local suffix = period * C(P(1-period)^0 * P(-1))
+local base = C((1-suffix)^0)
+local rest = C(P(1)^0)
+
+drive = drive + Cc("")
+path = path + Cc("")
+base = base + Cc("")
+suffix = suffix + Cc("")
+
+local pattern_a = drive * path * base * suffix
+local pattern_b = path * base * suffix
+local pattern_c = C(drive * path) * C(base * suffix) -- trick: two extra captures
+local pattern_d = path * rest
+
+function file.splitname(str,splitdrive)
+ if splitdrive then
+ return lpegmatch(pattern_a,str) -- returns drive, path, base, suffix
+ else
+ return lpegmatch(pattern_b,str) -- returns path, base, suffix
+ end
+end
+
+function file.splitbase(str)
+ return lpegmatch(pattern_d,str) -- returns path, base+suffix
+end
+
+function file.nametotable(str,splitdrive) -- returns table
+ local path, drive, subpath, name, base, suffix = lpegmatch(pattern_c,str)
+ if splitdrive then
+ return {
+ path = path,
+ drive = drive,
+ subpath = subpath,
+ name = name,
+ base = base,
+ suffix = suffix,
+ }
+ else
+ return {
+ path = path,
+ name = name,
+ base = base,
+ suffix = suffix,
+ }
+ end
+end
+
+local pattern = Cs(((period * noperiod^1 * -1)/"" + 1)^1)
+
+function file.removesuffix(name)
+ return lpegmatch(pattern,name)
end
+-- local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * Cp() * noperiod^1 * -1
+--
+-- function file.addsuffix(name, suffix)
+-- local p = lpegmatch(pattern,name)
+-- if p then
+-- return name
+-- else
+-- return name .. "." .. suffix
+-- end
+-- end
+
+local suffix = period/"" * (1-period-slashes)^1 * -1
+local pattern = Cs((noslashes^0 * slashes^1)^0 * ((1-suffix)^1)) * Cs(suffix)
+
function file.addsuffix(filename, suffix, criterium)
if not suffix or suffix == "" then
return filename
elseif criterium == true then
return filename .. "." .. suffix
elseif not criterium then
- local n, s = splitname(filename)
+ local n, s = lpegmatch(pattern,filename)
if not s or s == "" then
return filename .. "." .. suffix
else
return filename
end
else
- local n, s = splitname(filename)
+ local n, s = lpegmatch(pattern,filename)
if s and s ~= "" then
local t = type(criterium)
if t == "table" then
@@ -3134,88 +3235,49 @@ function file.addsuffix(filename, suffix, criterium)
end
end
end
- return n .. "." .. suffix
+ return (n or filename) .. "." .. suffix
end
end
+-- print("1 " .. file.addsuffix("name","new") .. " -> name.new")
+-- print("2 " .. file.addsuffix("name.old","new") .. " -> name.old")
+-- print("3 " .. file.addsuffix("name.old","new",true) .. " -> name.old.new")
+-- print("4 " .. file.addsuffix("name.old","new","new") .. " -> name.new")
+-- print("5 " .. file.addsuffix("name.old","new","old") .. " -> name.old")
+-- print("6 " .. file.addsuffix("name.old","new","foo") .. " -> name.new")
+-- print("7 " .. file.addsuffix("name.old","new",{"foo","bar"}) .. " -> name.new")
+-- print("8 " .. file.addsuffix("name.old","new",{"old","bar"}) .. " -> name.old")
-function file.replacesuffix(filename, suffix)
- return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix
+local suffix = period * (1-period-slashes)^1 * -1
+local pattern = Cs((1-suffix)^0)
+
+function file.replacesuffix(name,suffix)
+ if suffix and suffix ~= "" then
+ return lpegmatch(pattern,name) .. "." .. suffix
+ else
+ return name
+ end
end
-local trick_1 = char(1)
-local trick_2 = "^" .. trick_1 .. "/+"
+--
-function file.join(...) -- rather dirty
- local lst = { ... }
- local a, b = lst[1], lst[2]
- if not a or a == "" then -- not a added
- lst[1] = trick_1
- elseif b and find(a,"^/+$") and find(b,"^/") then
- lst[1] = ""
- lst[2] = gsub(b,"^/+","")
- end
- local pth = concat(lst,"/")
- pth = gsub(pth,"\\","/")
- local a, b = match(pth,"^(.*://)(.*)$")
- if a and b then
- return a .. gsub(b,"//+","/")
- end
- a, b = match(pth,"^(//)(.*)$")
- if a and b then
- return a .. gsub(b,"//+","/")
- end
- pth = gsub(pth,trick_2,"")
- return (gsub(pth,"//+","/"))
-end
-
--- local slash = P("/")
--- local colon = P(":")
-
--- local replacer = lpeg.replacer(S("\\/")^1,"/")
--- local stripper = Cs(P(slash)^0/"" * replacer)
--- local isnetwork = slash * slash * (1-slash) + (1-slash-colon)^1 * colon
--- local isroot = slash^1 * -1
--- local hasroot = slash^1
-
--- function file.newjoin(...) -- rather dirty
--- local lst = { ... }
--- local one = lst[1]
--- if lpegmatch(isnetwork,one) then
--- local two = lpegmatch(replacer,concat(lst,"/",2))
--- return one .. two
--- elseif lpegmatch(isroot,one) then
--- local two = lpegmatch(replacer,concat(lst,"/",2))
--- if lpegmatch(hasroot,two) then
--- return two
--- else
--- return "/" .. two
--- end
--- elseif one == "" then
--- return lpegmatch(stripper,concat(lst,"/",2))
--- else
--- return lpegmatch(replacer,concat(lst,"/"))
--- end
--- end
+local reslasher = lpeg.replacer(S("\\"),"/")
--- print(file.join("//","/y"))
--- print(file.join("/","/y"))
--- print(file.join("","/y"))
--- print(file.join("/x/","/y"))
--- print(file.join("x/","/y"))
--- print(file.join("http://","/y"))
--- print(file.join("http://a","/y"))
--- print(file.join("http:///a","/y"))
--- print(file.join("//nas-1","/y"))
+function file.reslash(str)
+ return lpegmatch(reslasher,str)
+end
-- We should be able to use:
--
+-- local writable = P(1) * P("w") * Cc(true)
+--
-- function file.is_writable(name)
--- local a = attributes(name) or attributes(dirname(name,"."))
--- return a and sub(a.permissions,2,2) == "w"
+-- local a = attributes(name) or attributes(pathpart(name,"."))
+-- return a and lpegmatch(writable,a.permissions) or false
-- end
--
--- But after some testing Taco and I came up with:
+-- But after some testing Taco and I came up with the more robust
+-- variant:
function file.is_writable(name)
if lfs.isdir(name) then
@@ -3243,9 +3305,11 @@ function file.is_writable(name)
return false
end
+local readable = P("r") * Cc(true)
+
function file.is_readable(name)
local a = attributes(name)
- return a and sub(a.permissions,1,1) == "r"
+ return a and lpegmatch(readable,a.permissions) or false
end
file.isreadable = file.is_readable -- depricated
@@ -3256,41 +3320,74 @@ function file.size(name)
return a and a.size or 0
end
--- todo: lpeg \\ / .. does not save much
-
-local checkedsplit = string.checkedsplit
-
-function file.splitpath(str,separator) -- string
- str = gsub(str,"\\","/")
- return checkedsplit(str,separator or io.pathseparator)
+function file.splitpath(str,separator) -- string .. reslash is a bonus (we could do a direct split)
+ return checkedsplit(lpegmatch(reslasher,str),separator or io.pathseparator)
end
function file.joinpath(tab,separator) -- table
return concat(tab,separator or io.pathseparator) -- can have trailing //
end
--- we can hash them weakly
+local stripper = Cs(P(fwslash)^0/"" * reslasher)
+local isnetwork = fwslash * fwslash * (1-fwslash) + (1-fwslash-colon)^1 * colon
+local isroot = fwslash^1 * -1
+local hasroot = fwslash^1
+
+function file.join(...) -- rather dirty
+ local lst = { ... }
+ local one = lst[1]
+ if lpegmatch(isnetwork,one) then
+ local two = lpegmatch(reslasher,concat(lst,"/",2))
+ return one .. "/" .. two
+ elseif lpegmatch(isroot,one) then
+ local two = lpegmatch(reslasher,concat(lst,"/",2))
+ if lpegmatch(hasroot,two) then
+ return two
+ else
+ return "/" .. two
+ end
+ elseif one == "" then
+ return lpegmatch(stripper,concat(lst,"/",2))
+ else
+ return lpegmatch(reslasher,concat(lst,"/"))
+ end
+end
+
+-- print(file.join("c:/whatever","name"))
+-- print(file.join("//","/y"))
+-- print(file.join("/","/y"))
+-- print(file.join("","/y"))
+-- print(file.join("/x/","/y"))
+-- print(file.join("x/","/y"))
+-- print(file.join("http://","/y"))
+-- print(file.join("http://a","/y"))
+-- print(file.join("http:///a","/y"))
+-- print(file.join("//nas-1","/y"))
+
+-- The previous one fails on "a.b/c" so Taco came up with a split based
+-- variant. After some skyping we got it sort of compatible with the old
+-- one. After that the anchoring to currentdir was added in a better way.
+-- Of course there are some optimizations too. Finally we had to deal with
+-- windows drive prefixes and things like sys://. Eventually gsubs and
+-- finds were replaced by lpegs.
+local drivespec = R("az","AZ")^1 * colon
+local anchors = fwslash + drivespec
+local untouched = periods + (1-period)^1 * P(-1)
+local splitstarter = (Cs(drivespec * (bwslash/"/" + fwslash)^0) + Cc(false)) * Ct(lpeg.splitat(S("/\\")^1))
+local absolute = fwslash
function file.collapsepath(str,anchor)
- if anchor and not find(str,"^/") and not find(str,"^%a:") then
+ if anchor and not lpegmatch(anchors,str) then
str = getcurrentdir() .. "/" .. str
end
if str == "" or str =="." then
return "."
- elseif find(str,"^%.%.") then
- str = gsub(str,"\\","/")
- return str
- elseif not find(str,"%.") then
- str = gsub(str,"\\","/")
- return str
- end
- str = gsub(str,"\\","/")
- local starter, rest = match(str,"^(%a+:/*)(.-)$")
- if starter then
- str = rest
+ elseif lpegmatch(untouched,str) then
+ return lpegmatch(reslasher,str)
end
- local oldelements = checkedsplit(str,"/")
+ local starter, oldelements = lpegmatch(splitstarter,str)
+-- inspect(oldelements)
local newelements = { }
local i = #oldelements
while i > 0 do
@@ -3320,7 +3417,7 @@ function file.collapsepath(str,anchor)
return starter or "."
elseif starter then
return starter .. concat(newelements, '/')
- elseif find(str,"^/") then
+ elseif lpegmatch(absolute,str) then
return "/" .. concat(newelements,'/')
else
return concat(newelements, '/')
@@ -3337,29 +3434,21 @@ end
-- test("a/./b/..") test("a/aa/../b/bb") test("a/.././././b/..") test("a/./././b/..")
-- test("a/b/c/../..") test("./a/b/c/../..") test("a/b/c/../..")
+local validchars = R("az","09","AZ","--","..")
+local pattern_a = lpeg.replacer(1-validchars)
+local pattern_a = Cs((validchars + P(1)/"-")^1)
+local whatever = P("-")^0 / ""
+local pattern_b = Cs(whatever * (1 - whatever * -1)^1)
+
function file.robustname(str,strict)
- str = gsub(str,"[^%a%d%/%-%.\\]+","-")
+ str = lpegmatch(pattern_a,str) or str
if strict then
- return lower(gsub(str,"^%-*(.-)%-*$","%1"))
+ return lpegmatch(pattern_b,str) or str -- two step is cleaner (less backtracking)
else
return str
end
end
--- local pattern_a = lpeg.replacer(1-R("az","09","AZ","--",".."))
--- local pattern_a = Cs((R("az","09","AZ","--","..") + P(1)/"-")^1)
--- local whatever = P("-")^0 / ""
--- local pattern_b = Cs(whatever * (1 - whatever * -1)^1)
-
--- function file.robustname(str,strict)
--- str = lpegmatch(pattern_a,str) or str
--- if strict then
--- return lpegmatch(pattern_b,str) or str -- two step is cleaner (less backtracking)
--- else
--- return str
--- end
--- end
-
file.readdata = io.loaddata
file.savedata = io.savedata
@@ -3367,92 +3456,17 @@ function file.copy(oldname,newname)
file.savedata(newname,io.loaddata(oldname))
end
--- lpeg variants, slightly faster, not always
-
--- local period = P(".")
--- local slashes = S("\\/")
--- local noperiod = 1-period
--- local noslashes = 1-slashes
--- local name = noperiod^1
-
--- local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * C(noperiod^1) * -1
-
--- function file.suffixonly(name)
--- return lpegmatch(pattern,name) or ""
--- end
-
--- local pattern = Cs(((period * noperiod^1 * -1)/"" + 1)^1)
-
--- function file.removesuffix(name)
--- return lpegmatch(pattern,name)
--- end
-
--- local pattern = (noslashes^0 * slashes)^1 * C(noslashes^1) * -1
-
--- function file.basename(name)
--- return lpegmatch(pattern,name) or name
--- end
-
--- local pattern = Cs ((1 - slashes * noslashes^1 * -1)^1)
-
--- function file.dirname(name)
--- return lpegmatch(pattern,name) or ""
--- end
-
--- local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * Cp() * noperiod^1 * -1
-
--- function file.addsuffix(name, suffix)
--- local p = lpegmatch(pattern,name)
--- if p then
--- return name
--- else
--- return name .. "." .. suffix
--- end
--- end
-
--- local suffix = period * (1-period-slashes)^1 * -1
--- local pattern = Cs((1-suffix)^1)
-
--- function file.replacesuffix(name,suffix)
--- if suffix and suffix ~= "" then
--- return lpegmatch(pattern,name) .. "." .. suffix
--- else
--- return name
--- end
--- end
-
--- local path = noslashes^0 * slashes^1
--- local suffix = period * (1-period-slashes)^1 * -1
--- local pattern = path^0 * Cs((1-suffix)^1) * suffix^0
-
--- function file.nameonly(name)
--- return lpegmatch(pattern,name) or name
--- end
-
--- local test = file.suffixonly
--- local test = file.basename
--- local test = file.dirname
--- local test = file.addsuffix
--- local test = file.replacesuffix
--- local test = file.nameonly
-
--- print(1,test("./a/b/c/abd.def.xxx","!!!"))
--- print(2,test("./../b/c/abd.def.xxx","!!!"))
--- print(3,test("a/b/c/abd.def.xxx","!!!"))
--- print(4,test("a/b/c/def.xxx","!!!"))
--- print(5,test("a/b/c/def","!!!"))
--- print(6,test("def","!!!"))
--- print(7,test("def.xxx","!!!"))
-
--- local tim = os.clock() for i=1,250000 do local ext = test("abd.def.xxx","!!!") end print(os.clock()-tim)
-
-- also rewrite previous
local letter = R("az","AZ") + S("_-+")
local separator = P("://")
-local qualified = P(".")^0 * P("/") + letter*P(":") + letter^1*separator + letter^1 * P("/")
-local rootbased = P("/") + letter*P(":")
+local qualified = period^0 * fwslash
+ + letter * colon
+ + letter^1 * separator
+ + letter^1 * fwslash
+local rootbased = fwslash
+ + letter * colon
lpeg.patterns.qualified = qualified
lpeg.patterns.rootbased = rootbased
@@ -3467,61 +3481,6 @@ function file.is_rootbased_path(filename)
return lpegmatch(rootbased,filename) ~= nil
end
--- actually these are schemes
-
-local slash = S("\\/")
-local period = P(".")
-local drive = C(R("az","AZ")) * P(":")
-local path = C(((1-slash)^0 * slash)^0)
-local suffix = period * C(P(1-period)^0 * P(-1))
-local base = C((1-suffix)^0)
-local rest = C(P(1)^0)
-
-drive = drive + Cc("")
-path = path + Cc("")
-base = base + Cc("")
-suffix = suffix + Cc("")
-
-local pattern_a = drive * path * base * suffix
-local pattern_b = path * base * suffix
-local pattern_c = C(drive * path) * C(base * suffix) -- trick: two extra captures
-local pattern_d = path * rest
-
-function file.splitname(str,splitdrive)
- if splitdrive then
- return lpegmatch(pattern_a,str) -- returns drive, path, base, suffix
- else
- return lpegmatch(pattern_b,str) -- returns path, base, suffix
- end
-end
-
-function file.splitbase(str)
- return lpegmatch(pattern_d,str) -- returns path, base+suffix
-end
-
-function file.nametotable(str,splitdrive) -- returns table
- local path, drive, subpath, name, base, suffix = lpegmatch(pattern_c,str)
- if splitdrive then
- return {
- path = path,
- drive = drive,
- subpath = subpath,
- name = name,
- base = base,
- suffix = suffix,
- }
- else
- return {
- path = path,
- name = name,
- base = base,
- suffix = suffix,
- }
- end
-end
-
--- print(file.splitbase("a/b/c.txt"))
-
-- function test(t) for k, v in next, t do print(v, "=>", file.splitname(v)) end end
--
-- test { "c:", "c:/aa", "c:/aa/bb", "c:/aa/bb/cc", "c:/aa/bb/cc.dd", "c:/aa/bb/cc.dd.ee" }
@@ -3529,6 +3488,14 @@ end
-- test { "/aa", "/aa/bb", "/aa/bb/cc", "/aa/bb/cc.dd", "/aa/bb/cc.dd.ee" }
-- test { "aa", "aa/bb", "aa/bb/cc", "aa/bb/cc.dd", "aa/bb/cc.dd.ee" }
+-- -- maybe:
+--
+-- if os.type == "windows" then
+-- local currentdir = getcurrentdir
+-- function getcurrentdir()
+-- return lpegmatch(reslasher,currentdir())
+-- end
+-- end
-- for myself:
@@ -3537,6 +3504,21 @@ function file.strip(name,dir)
return a ~= "" and a or name
end
+-- local debuglist = {
+-- "pathpart", "basename", "nameonly", "suffixonly", "suffix", "dirname", "extname",
+-- "addsuffix", "removesuffix", "replacesuffix", "join",
+-- "strip","collapsepath", "joinpath", "splitpath",
+-- }
+
+-- for i=1,#debuglist do
+-- local name = debuglist[i]
+-- local f = file[name]
+-- file[name] = function(...)
+-- print(name,f(...))
+-- return f(...)
+-- end
+-- end
+
end -- of closure
@@ -3661,7 +3643,7 @@ if not modules then modules = { } end modules ['l-url'] = {
license = "see context related readme files"
}
-local char, gmatch, gsub, format, byte, find = string.char, string.gmatch, string.gsub, string.format, string.byte, string.find
+local char, format, byte = string.char, string.format, string.byte
local concat = table.concat
local tonumber, type = tonumber, type
local P, C, R, S, Cs, Cc, Ct, Cf, Cg, V = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cs, lpeg.Cc, lpeg.Ct, lpeg.Cf, lpeg.Cg, lpeg.V
@@ -3700,6 +3682,8 @@ local nothing = Cc("")
local escapedchar = (percent * C(hexdigit * hexdigit)) / tochar
local escaped = (plus / " ") + escapedchar
+local noslash = P("/") / ""
+
-- we assume schemes with more than 1 character (in order to avoid problems with windows disks)
-- we also assume that when we have a scheme, we also have an authority
--
@@ -3878,29 +3862,23 @@ function url.construct(hash) -- dodo: we need to escape !
return lpegmatch(escaper,concat(fullurl))
end
-function url.filename(filename) -- why no lpeg here ?
- local t = hashed(filename)
- return (t.scheme == "file" and (gsub(t.path,"^/([a-zA-Z])([:|])/)","%1:"))) or filename
+local pattern = Cs(noslash * R("az","AZ") * (S(":|")/":") * noslash * P(1)^0)
+
+function url.filename(filename)
+ local spec = hashed(filename)
+ local path = spec.path
+ return (spec.scheme == "file" and path and lpegmatch(pattern,path)) or filename
end
+-- print(url.filename("/c|/test"))
+-- print(url.filename("/c/test"))
+
local function escapestring(str)
return lpegmatch(escaper,str)
end
url.escape = escapestring
--- function url.query(str) -- separator could be an option
--- if type(str) == "string" then
--- local t = { }
--- for k, v in gmatch(str,"([^&=]*)=([^&=]*)") do
--- t[k] = v
--- end
--- return t
--- else
--- return str
--- end
--- end
-
function url.query(str)
if type(str) == "string" then
return lpegmatch(splitquery,str) or ""
@@ -3928,14 +3906,19 @@ end
-- /test/ | /test | test/ | test => test
+local pattern = Cs(noslash^0 * (1 - noslash * P(-1))^0)
+
function url.barepath(path)
if not path or path == "" then
return ""
else
- return (gsub(path,"^/?(.-)/?$","%1"))
+ return lpegmatch(pattern,path)
end
end
+-- print(url.barepath("/test"),url.barepath("test/"),url.barepath("/test/"),url.barepath("test"))
+-- print(url.barepath("/x/yz"),url.barepath("x/yz/"),url.barepath("/x/yz/"),url.barepath("x/yz"))
+
@@ -6191,8 +6174,8 @@ end
-- for chem (currently one level)
local value = P(lbrace * C((nobrace + nestedbraces)^0) * rbrace)
- + C(digit^1 * lparent * (noparent + nestedparents)^0 * rparent)
- + C((nestedbraces + (1-comma))^0)
+ + C(digit^1 * lparent * (noparent + nestedparents)^1 * rparent)
+ + C((nestedbraces + (1-comma))^1)
local pattern_a = spaces * Ct(value*(separator*value)^0)
local function repeater(n,str)
@@ -6216,15 +6199,15 @@ local function repeater(n,str)
end
local value = P(lbrace * C((nobrace + nestedbraces)^0) * rbrace)
- + (C(digit^1)/tonumber * lparent * Cs((noparent + nestedparents)^0) * rparent) / repeater
- + C((nestedbraces + (1-comma))^0)
+ + (C(digit^1)/tonumber * lparent * Cs((noparent + nestedparents)^1) * rparent) / repeater
+ + C((nestedbraces + (1-comma))^1)
local pattern_b = spaces * Ct(value*(separator*value)^0)
-function parsers.settings_to_array_with_repeat(str,expand)
+function parsers.settings_to_array_with_repeat(str,expand) -- beware: "" => { }
if expand then
- return lpegmatch(pattern_b,str)
+ return lpegmatch(pattern_b,str) or { }
else
- return lpegmatch(pattern_a,str)
+ return lpegmatch(pattern_a,str) or { }
end
end
diff --git a/tex/context/base/char-ent.lua b/tex/context/base/char-ent.lua
index ef55be7e4..58ee9472c 100644
--- a/tex/context/base/char-ent.lua
+++ b/tex/context/base/char-ent.lua
@@ -567,7 +567,8 @@ local entities = utilities.storage.allocate {
["Ugr"] = "Υ", -- U+003A5
["Ugrave"] = "Ù", -- U+000D9
["Umacr"] = "Ū", -- U+0016A
- ["UnderBar"] = "_", -- U+0005F
+ -- ["UnderBar"] = "_", -- U+0005F
+ ["UnderBar"] = "‾", -- U+0203E
["UnderBrace"] = "⏟", -- U+023DF
["UnderBracket"] = "⎵", -- U+023B5
["UnderParenthesis"] = "⏝", -- U+023DD
diff --git a/tex/context/base/chem-str.lua b/tex/context/base/chem-str.lua
index 0ca82d2e1..dc4bd746f 100644
--- a/tex/context/base/chem-str.lua
+++ b/tex/context/base/chem-str.lua
@@ -62,22 +62,35 @@ local common_keys = {
cd = "fixed",
z = "text",
zt = "text",
+ zlt = "text",
+ zrt = "text",
+ rz = "text",
+ rt = "text",
+ lrt = "text",
+ rrt = "text",
+ zln = "number",
+ zrn = "number",
+ rn = "number",
+ lrn = "number",
+ rrn = "number",
zn = "number",
mov = "transform",
mark = "transform",
+ move = "transform",
off = "transform",
adj = "transform",
+ sub = "transform",
}
local front_keys = {
bb = "line",
+ eb = "line",
rr = "line",
lr = "line",
lsr = "line",
rsr = "line",
lrz = "text",
rrz = "text",
- -- rz = "text", -- no
lsub = "transform",
rsub = "transform",
}
@@ -101,17 +114,11 @@ local one_keys = {
es = "line",
ed = "line",
et = "line",
- zlt = "text",
- zln = "number",
- zrt = "text",
- zrn = "number",
- rz = "text",
cz = "text",
rot = "transform",
dir = "transform",
rm = "transform",
mir = "transform",
- sub = "transform",
}
local ring_keys = {
@@ -137,24 +144,12 @@ local ring_keys = {
mid = "line",
mids = "line",
midz = "text",
- zlt = "text",
- zln = "number",
- zrt = "text",
- zrn = "number",
- rz = "text",
lrz = "text",
rrz = "text",
crz = "text",
- rt = "text",
- lrt = "text",
- rrt = "text",
- rn = "number",
- lrn = "number",
- rrn = "number",
rot = "transform",
mir = "transform",
adj = "transform",
- sub = "transform",
lsub = "transform",
rsub = "transform",
rm = "transform",
@@ -182,6 +177,7 @@ local syntax = {
six = { max = 6, keys = ring_keys, },
seven = { max = 7, keys = ring_keys, },
eight = { max = 8, keys = ring_keys, },
+ nine = { max = 9, keys = ring_keys, },
fivefront = { max = 5, keys = front_keys, },
sixfront = { max = 6, keys = front_keys, },
chair = { max = 6, keys = front_keys, },
@@ -217,7 +213,7 @@ function chemistry.define(name,spec,text)
definitions[name] = dn
end
dn[#dn+1] = {
- spec = settings_to_array_with_repeat(lower(spec),true),
+ spec = settings_to_array_with_repeat(spec,true),
text = settings_to_array_with_repeat(text,true),
}
end
@@ -228,6 +224,7 @@ local molecule = chemistry.molecule -- or use lpegmatch(chemistry.moleculeparser
local function fetch(txt)
local st = stack[txt]
local t = st.text[st.n]
+-- inspect(stack)
while not t and txt > 1 do
txt = txt - 1
st = stack[txt]
@@ -338,9 +335,6 @@ local function process(spec,text,n,rulethickness,rulecolor,offset)
m = m + 1 ; metacode[m] = syntax.save.direct
elseif operation == "restore" then
variant = remove(sstack)
- if variant and #sstack == 0 then
- insert(sstack,variant) -- allow multiple restores at the bottom of the stack.
- end
local ss = syntax[variant]
keys, max = ss.keys, ss.max
m = m + 1 ; metacode[m] = syntax[operation].direct
@@ -580,7 +574,12 @@ function chemistry.stop()
if metapost.instance(chemistry.instance) then
t_initialize = ""
end
- metapost.graphic(chemistry.instance,chemistry.format,mpcode,"","",t_initialize)
+ metapost.graphic {
+ instance = chemistry.instance,
+ format = chemistry.format,
+ data = mpcode,
+ definitions = t_initialize,
+ }
t_initialize = ""
metacode = nil
end
diff --git a/tex/context/base/chem-str.mkiv b/tex/context/base/chem-str.mkiv
index 2d4449a25..205675c46 100644
--- a/tex/context/base/chem-str.mkiv
+++ b/tex/context/base/chem-str.mkiv
@@ -388,7 +388,15 @@
\unexpanded\def\chemicaloxidationsix {\chemicaloxidation\relax6}
\unexpanded\def\chemicaloxidationseven{\chemicaloxidation\relax7}
+\unexpanded\def\chemicalbar
+ {\hbox \!!spread .5\emwidth \bgroup
+ \hss
+ \vrule \!!height .9\strutht \!!depth .65\strutdp \!!width .1\exheight
+ \hss
+ \egroup}
+
\appendtoks
+ \let|\chemicalbar % \SR{N|NH}
\let \+\chemicaloxidationplus
\let \-\chemicaloxidationminus
\let \[\chemicalforeveropen
@@ -419,6 +427,7 @@
\let\SM\chemicalsmashedmiddle
\let\SR\chemicalsmashedright
\to \everychemical
+
% Should these also be defined in lower case, so as to be case independent?
\appendtoks
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 749ec9477..3f5956611 100644
--- a/tex/context/base/cont-new.mkii
+++ b/tex/context/base/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2012.12.06 22:36}
+\newcontextversion{2012.12.10 23:20}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 952d14da1..e67181585 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2012.12.06 22:36}
+\newcontextversion{2012.12.10 23:20}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index afeae25e9..73f23e3ab 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png
index 7002ba4ae..fb3daf3d5 100644
--- a/tex/context/base/context-version.png
+++ b/tex/context/base/context-version.png
Binary files differ
diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii
index 71a16df3a..dfe757926 100644
--- a/tex/context/base/context.mkii
+++ b/tex/context/base/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2012.12.06 22:36}
+\edef\contextversion{2012.12.10 23:20}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 387888068..e47b0e4f1 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -25,7 +25,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2012.12.06 22:36}
+\edef\contextversion{2012.12.10 23:20}
%D For those who want to use this:
diff --git a/tex/context/base/font-def.lua b/tex/context/base/font-def.lua
index f50e57113..03037f1c6 100644
--- a/tex/context/base/font-def.lua
+++ b/tex/context/base/font-def.lua
@@ -48,7 +48,9 @@ local internalized = allocate() -- internal tex numbers (private)
local loadedfonts = constructors.loadedfonts
local designsizes = constructors.designsizes
-local resolvefile = fontgoodies.filenames.resolve
+-- not in generic (some day I'll make two defs, one for context, one for generic)
+
+local resolvefile = fontgoodies and fontgoodies.filenames and fontgoodies.filenames.resolve or function(s) return s end
--[[ldx--
<p>We hardly gain anything when we cache the final (pre scaled)
diff --git a/tex/context/base/l-file.lua b/tex/context/base/l-file.lua
index 03323d29e..d1ec753b1 100644
--- a/tex/context/base/l-file.lua
+++ b/tex/context/base/l-file.lua
@@ -12,66 +12,145 @@ file = file or { }
local file = file
local insert, concat = table.insert, table.concat
-local find, gmatch, match, gsub, sub, char, lower = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char, string.lower
+local match = string.match
local lpegmatch = lpeg.match
local getcurrentdir, attributes = lfs.currentdir, lfs.attributes
+local checkedsplit = string.checkedsplit
+
+-- local patterns = file.patterns or { }
+-- file.patterns = patterns
+
+local P, R, S, C, Cs, Cp, Cc, Ct = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Cc, lpeg.Ct
+
+local colon = P(":")
+local period = P(".")
+local periods = P("..")
+local fwslash = P("/")
+local bwslash = P("\\")
+local slashes = S("\\/")
+local noperiod = 1-period
+local noslashes = 1-slashes
+local name = noperiod^1
+local suffix = period/"" * (1-period-slashes)^1 * -1
-local P, R, S, C, Cs, Cp, Cc = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Cc
+local pattern = C((noslashes^0 * slashes^1)^1)
-local function dirname(name,default)
- return match(name,"^(.+)[/\\].-$") or (default or "")
+local function pathpart(name,default)
+ return lpegmatch(pattern,name) or default or ""
end
+local pattern = (noslashes^0 * slashes)^1 * C(noslashes^1) * -1
+
local function basename(name)
- return match(name,"^.+[/\\](.-)$") or name
+ return lpegmatch(pattern,name) or name
end
--- local function nameonly(name)
--- return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$",""))
--- end
+local pattern = (noslashes^0 * slashes^1)^0 * Cs((1-suffix)^1) * suffix^0
local function nameonly(name)
- return (gsub(match(name,"^.+[/\\](.-)$") or name,"%.[%a%d]+$",""))
+ return lpegmatch(pattern,name) or name
end
-local function suffixonly(name,default)
- return match(name,"^.+%.([^/\\]-)$") or default or ""
-end
+local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * C(noperiod^1) * -1
-local function splitname(name)
- local n, s = match(name,"^(.+)%.([^/\\]-)$")
- return n or name, s or ""
+local function suffixonly(name)
+ return lpegmatch(pattern,name) or ""
end
+file.pathpart = pathpart
file.basename = basename
-
-file.pathpart = dirname
-file.dirname = dirname
-
file.nameonly = nameonly
-
file.suffixonly = suffixonly
-file.extname = suffixonly -- obsolete
file.suffix = suffixonly
-function file.removesuffix(filename)
- return (gsub(filename,"%.[%a%d]+$",""))
+file.dirname = pathpart -- obsolete
+file.extname = suffixonly -- obsolete
+
+-- actually these are schemes
+
+local drive = C(R("az","AZ")) * colon
+local path = C(((1-slashes)^0 * slashes)^0)
+local suffix = period * C(P(1-period)^0 * P(-1))
+local base = C((1-suffix)^0)
+local rest = C(P(1)^0)
+
+drive = drive + Cc("")
+path = path + Cc("")
+base = base + Cc("")
+suffix = suffix + Cc("")
+
+local pattern_a = drive * path * base * suffix
+local pattern_b = path * base * suffix
+local pattern_c = C(drive * path) * C(base * suffix) -- trick: two extra captures
+local pattern_d = path * rest
+
+function file.splitname(str,splitdrive)
+ if splitdrive then
+ return lpegmatch(pattern_a,str) -- returns drive, path, base, suffix
+ else
+ return lpegmatch(pattern_b,str) -- returns path, base, suffix
+ end
+end
+
+function file.splitbase(str)
+ return lpegmatch(pattern_d,str) -- returns path, base+suffix
end
+function file.nametotable(str,splitdrive) -- returns table
+ local path, drive, subpath, name, base, suffix = lpegmatch(pattern_c,str)
+ if splitdrive then
+ return {
+ path = path,
+ drive = drive,
+ subpath = subpath,
+ name = name,
+ base = base,
+ suffix = suffix,
+ }
+ else
+ return {
+ path = path,
+ name = name,
+ base = base,
+ suffix = suffix,
+ }
+ end
+end
+
+local pattern = Cs(((period * noperiod^1 * -1)/"" + 1)^1)
+
+function file.removesuffix(name)
+ return lpegmatch(pattern,name)
+end
+
+-- local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * Cp() * noperiod^1 * -1
+--
+-- function file.addsuffix(name, suffix)
+-- local p = lpegmatch(pattern,name)
+-- if p then
+-- return name
+-- else
+-- return name .. "." .. suffix
+-- end
+-- end
+
+local suffix = period/"" * (1-period-slashes)^1 * -1
+local pattern = Cs((noslashes^0 * slashes^1)^0 * ((1-suffix)^1)) * Cs(suffix)
+
function file.addsuffix(filename, suffix, criterium)
if not suffix or suffix == "" then
return filename
elseif criterium == true then
return filename .. "." .. suffix
elseif not criterium then
- local n, s = splitname(filename)
+ local n, s = lpegmatch(pattern,filename)
if not s or s == "" then
return filename .. "." .. suffix
else
return filename
end
else
- local n, s = splitname(filename)
+ local n, s = lpegmatch(pattern,filename)
if s and s ~= "" then
local t = type(criterium)
if t == "table" then
@@ -88,96 +167,49 @@ function file.addsuffix(filename, suffix, criterium)
end
end
end
- return n .. "." .. suffix
+ return (n or filename) .. "." .. suffix
end
end
---~ print("1 " .. file.addsuffix("name","new") .. " -> name.new")
---~ print("2 " .. file.addsuffix("name.old","new") .. " -> name.old")
---~ print("3 " .. file.addsuffix("name.old","new",true) .. " -> name.old.new")
---~ print("4 " .. file.addsuffix("name.old","new","new") .. " -> name.new")
---~ print("5 " .. file.addsuffix("name.old","new","old") .. " -> name.old")
---~ print("6 " .. file.addsuffix("name.old","new","foo") .. " -> name.new")
---~ print("7 " .. file.addsuffix("name.old","new",{"foo","bar"}) .. " -> name.new")
---~ print("8 " .. file.addsuffix("name.old","new",{"old","bar"}) .. " -> name.old")
-
-function file.replacesuffix(filename, suffix)
- return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix
-end
-
-local trick_1 = char(1)
-local trick_2 = "^" .. trick_1 .. "/+"
-
-function file.join(...) -- rather dirty
- local lst = { ... }
- local a, b = lst[1], lst[2]
- if not a or a == "" then -- not a added
- lst[1] = trick_1
- elseif b and find(a,"^/+$") and find(b,"^/") then
- lst[1] = ""
- lst[2] = gsub(b,"^/+","")
- end
- local pth = concat(lst,"/")
- pth = gsub(pth,"\\","/")
- local a, b = match(pth,"^(.*://)(.*)$")
- if a and b then
- return a .. gsub(b,"//+","/")
- end
- a, b = match(pth,"^(//)(.*)$")
- if a and b then
- return a .. gsub(b,"//+","/")
+-- print("1 " .. file.addsuffix("name","new") .. " -> name.new")
+-- print("2 " .. file.addsuffix("name.old","new") .. " -> name.old")
+-- print("3 " .. file.addsuffix("name.old","new",true) .. " -> name.old.new")
+-- print("4 " .. file.addsuffix("name.old","new","new") .. " -> name.new")
+-- print("5 " .. file.addsuffix("name.old","new","old") .. " -> name.old")
+-- print("6 " .. file.addsuffix("name.old","new","foo") .. " -> name.new")
+-- print("7 " .. file.addsuffix("name.old","new",{"foo","bar"}) .. " -> name.new")
+-- print("8 " .. file.addsuffix("name.old","new",{"old","bar"}) .. " -> name.old")
+
+local suffix = period * (1-period-slashes)^1 * -1
+local pattern = Cs((1-suffix)^0)
+
+function file.replacesuffix(name,suffix)
+ if suffix and suffix ~= "" then
+ return lpegmatch(pattern,name) .. "." .. suffix
+ else
+ return name
end
- pth = gsub(pth,trick_2,"")
- return (gsub(pth,"//+","/"))
end
--- local slash = P("/")
--- local colon = P(":")
-
--- local replacer = lpeg.replacer(S("\\/")^1,"/")
--- local stripper = Cs(P(slash)^0/"" * replacer)
--- local isnetwork = slash * slash * (1-slash) + (1-slash-colon)^1 * colon
--- local isroot = slash^1 * -1
--- local hasroot = slash^1
-
--- function file.newjoin(...) -- rather dirty
--- local lst = { ... }
--- local one = lst[1]
--- if lpegmatch(isnetwork,one) then
--- local two = lpegmatch(replacer,concat(lst,"/",2))
--- return one .. two
--- elseif lpegmatch(isroot,one) then
--- local two = lpegmatch(replacer,concat(lst,"/",2))
--- if lpegmatch(hasroot,two) then
--- return two
--- else
--- return "/" .. two
--- end
--- elseif one == "" then
--- return lpegmatch(stripper,concat(lst,"/",2))
--- else
--- return lpegmatch(replacer,concat(lst,"/"))
--- end
--- end
+--
--- print(file.join("//","/y"))
--- print(file.join("/","/y"))
--- print(file.join("","/y"))
--- print(file.join("/x/","/y"))
--- print(file.join("x/","/y"))
--- print(file.join("http://","/y"))
--- print(file.join("http://a","/y"))
--- print(file.join("http:///a","/y"))
--- print(file.join("//nas-1","/y"))
+local reslasher = lpeg.replacer(S("\\"),"/")
+
+function file.reslash(str)
+ return lpegmatch(reslasher,str)
+end
-- We should be able to use:
--
+-- local writable = P(1) * P("w") * Cc(true)
+--
-- function file.is_writable(name)
--- local a = attributes(name) or attributes(dirname(name,"."))
--- return a and sub(a.permissions,2,2) == "w"
+-- local a = attributes(name) or attributes(pathpart(name,"."))
+-- return a and lpegmatch(writable,a.permissions) or false
-- end
--
--- But after some testing Taco and I came up with:
+-- But after some testing Taco and I came up with the more robust
+-- variant:
function file.is_writable(name)
if lfs.isdir(name) then
@@ -205,9 +237,11 @@ function file.is_writable(name)
return false
end
+local readable = P("r") * Cc(true)
+
function file.is_readable(name)
local a = attributes(name)
- return a and sub(a.permissions,1,1) == "r"
+ return a and lpegmatch(readable,a.permissions) or false
end
file.isreadable = file.is_readable -- depricated
@@ -218,64 +252,74 @@ function file.size(name)
return a and a.size or 0
end
--- todo: lpeg \\ / .. does not save much
-
-local checkedsplit = string.checkedsplit
-
-function file.splitpath(str,separator) -- string
- str = gsub(str,"\\","/")
- return checkedsplit(str,separator or io.pathseparator)
+function file.splitpath(str,separator) -- string .. reslash is a bonus (we could do a direct split)
+ return checkedsplit(lpegmatch(reslasher,str),separator or io.pathseparator)
end
function file.joinpath(tab,separator) -- table
return concat(tab,separator or io.pathseparator) -- can have trailing //
end
--- we can hash them weakly
-
---~ function file.collapsepath(str) -- fails on b.c/..
---~ str = gsub(str,"\\","/")
---~ if find(str,"/") then
---~ str = gsub(str,"^%./",(gsub(getcurrentdir(),"\\","/")) .. "/") -- ./xx in qualified
---~ str = gsub(str,"/%./","/")
---~ local n, m = 1, 1
---~ while n > 0 or m > 0 do
---~ str, n = gsub(str,"[^/%.]+/%.%.$","")
---~ str, m = gsub(str,"[^/%.]+/%.%./","")
---~ end
---~ str = gsub(str,"([^/])/$","%1")
---~ -- str = gsub(str,"^%./","") -- ./xx in qualified
---~ str = gsub(str,"/%.$","")
---~ end
---~ if str == "" then str = "." end
---~ return str
---~ end
---~
---~ The previous one fails on "a.b/c" so Taco came up with a split based
---~ variant. After some skyping we got it sort of compatible with the old
---~ one. After that the anchoring to currentdir was added in a better way.
---~ Of course there are some optimizations too. Finally we had to deal with
---~ windows drive prefixes and things like sys://.
+local stripper = Cs(P(fwslash)^0/"" * reslasher)
+local isnetwork = fwslash * fwslash * (1-fwslash) + (1-fwslash-colon)^1 * colon
+local isroot = fwslash^1 * -1
+local hasroot = fwslash^1
+
+function file.join(...) -- rather dirty
+ local lst = { ... }
+ local one = lst[1]
+ if lpegmatch(isnetwork,one) then
+ local two = lpegmatch(reslasher,concat(lst,"/",2))
+ return one .. "/" .. two
+ elseif lpegmatch(isroot,one) then
+ local two = lpegmatch(reslasher,concat(lst,"/",2))
+ if lpegmatch(hasroot,two) then
+ return two
+ else
+ return "/" .. two
+ end
+ elseif one == "" then
+ return lpegmatch(stripper,concat(lst,"/",2))
+ else
+ return lpegmatch(reslasher,concat(lst,"/"))
+ end
+end
+
+-- print(file.join("c:/whatever","name"))
+-- print(file.join("//","/y"))
+-- print(file.join("/","/y"))
+-- print(file.join("","/y"))
+-- print(file.join("/x/","/y"))
+-- print(file.join("x/","/y"))
+-- print(file.join("http://","/y"))
+-- print(file.join("http://a","/y"))
+-- print(file.join("http:///a","/y"))
+-- print(file.join("//nas-1","/y"))
+
+-- The previous one fails on "a.b/c" so Taco came up with a split based
+-- variant. After some skyping we got it sort of compatible with the old
+-- one. After that the anchoring to currentdir was added in a better way.
+-- Of course there are some optimizations too. Finally we had to deal with
+-- windows drive prefixes and things like sys://. Eventually gsubs and
+-- finds were replaced by lpegs.
+
+local drivespec = R("az","AZ")^1 * colon
+local anchors = fwslash + drivespec
+local untouched = periods + (1-period)^1 * P(-1)
+local splitstarter = (Cs(drivespec * (bwslash/"/" + fwslash)^0) + Cc(false)) * Ct(lpeg.splitat(S("/\\")^1))
+local absolute = fwslash
function file.collapsepath(str,anchor)
- if anchor and not find(str,"^/") and not find(str,"^%a:") then
+ if anchor and not lpegmatch(anchors,str) then
str = getcurrentdir() .. "/" .. str
end
if str == "" or str =="." then
return "."
- elseif find(str,"^%.%.") then
- str = gsub(str,"\\","/")
- return str
- elseif not find(str,"%.") then
- str = gsub(str,"\\","/")
- return str
- end
- str = gsub(str,"\\","/")
- local starter, rest = match(str,"^(%a+:/*)(.-)$")
- if starter then
- str = rest
+ elseif lpegmatch(untouched,str) then
+ return lpegmatch(reslasher,str)
end
- local oldelements = checkedsplit(str,"/")
+ local starter, oldelements = lpegmatch(splitstarter,str)
+-- inspect(oldelements)
local newelements = { }
local i = #oldelements
while i > 0 do
@@ -305,7 +349,7 @@ function file.collapsepath(str,anchor)
return starter or "."
elseif starter then
return starter .. concat(newelements, '/')
- elseif find(str,"^/") then
+ elseif lpegmatch(absolute,str) then
return "/" .. concat(newelements,'/')
else
return concat(newelements, '/')
@@ -322,29 +366,21 @@ end
-- test("a/./b/..") test("a/aa/../b/bb") test("a/.././././b/..") test("a/./././b/..")
-- test("a/b/c/../..") test("./a/b/c/../..") test("a/b/c/../..")
+local validchars = R("az","09","AZ","--","..")
+local pattern_a = lpeg.replacer(1-validchars)
+local pattern_a = Cs((validchars + P(1)/"-")^1)
+local whatever = P("-")^0 / ""
+local pattern_b = Cs(whatever * (1 - whatever * -1)^1)
+
function file.robustname(str,strict)
- str = gsub(str,"[^%a%d%/%-%.\\]+","-")
+ str = lpegmatch(pattern_a,str) or str
if strict then
- return lower(gsub(str,"^%-*(.-)%-*$","%1"))
+ return lpegmatch(pattern_b,str) or str -- two step is cleaner (less backtracking)
else
return str
end
end
--- local pattern_a = lpeg.replacer(1-R("az","09","AZ","--",".."))
--- local pattern_a = Cs((R("az","09","AZ","--","..") + P(1)/"-")^1)
--- local whatever = P("-")^0 / ""
--- local pattern_b = Cs(whatever * (1 - whatever * -1)^1)
-
--- function file.robustname(str,strict)
--- str = lpegmatch(pattern_a,str) or str
--- if strict then
--- return lpegmatch(pattern_b,str) or str -- two step is cleaner (less backtracking)
--- else
--- return str
--- end
--- end
-
file.readdata = io.loaddata
file.savedata = io.savedata
@@ -352,92 +388,17 @@ function file.copy(oldname,newname)
file.savedata(newname,io.loaddata(oldname))
end
--- lpeg variants, slightly faster, not always
-
--- local period = P(".")
--- local slashes = S("\\/")
--- local noperiod = 1-period
--- local noslashes = 1-slashes
--- local name = noperiod^1
-
--- local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * C(noperiod^1) * -1
-
--- function file.suffixonly(name)
--- return lpegmatch(pattern,name) or ""
--- end
-
--- local pattern = Cs(((period * noperiod^1 * -1)/"" + 1)^1)
-
--- function file.removesuffix(name)
--- return lpegmatch(pattern,name)
--- end
-
--- local pattern = (noslashes^0 * slashes)^1 * C(noslashes^1) * -1
-
--- function file.basename(name)
--- return lpegmatch(pattern,name) or name
--- end
-
--- local pattern = Cs ((1 - slashes * noslashes^1 * -1)^1)
-
--- function file.dirname(name)
--- return lpegmatch(pattern,name) or ""
--- end
-
--- local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * Cp() * noperiod^1 * -1
-
--- function file.addsuffix(name, suffix)
--- local p = lpegmatch(pattern,name)
--- if p then
--- return name
--- else
--- return name .. "." .. suffix
--- end
--- end
-
--- local suffix = period * (1-period-slashes)^1 * -1
--- local pattern = Cs((1-suffix)^1)
-
--- function file.replacesuffix(name,suffix)
--- if suffix and suffix ~= "" then
--- return lpegmatch(pattern,name) .. "." .. suffix
--- else
--- return name
--- end
--- end
-
--- local path = noslashes^0 * slashes^1
--- local suffix = period * (1-period-slashes)^1 * -1
--- local pattern = path^0 * Cs((1-suffix)^1) * suffix^0
-
--- function file.nameonly(name)
--- return lpegmatch(pattern,name) or name
--- end
-
--- local test = file.suffixonly
--- local test = file.basename
--- local test = file.dirname
--- local test = file.addsuffix
--- local test = file.replacesuffix
--- local test = file.nameonly
-
--- print(1,test("./a/b/c/abd.def.xxx","!!!"))
--- print(2,test("./../b/c/abd.def.xxx","!!!"))
--- print(3,test("a/b/c/abd.def.xxx","!!!"))
--- print(4,test("a/b/c/def.xxx","!!!"))
--- print(5,test("a/b/c/def","!!!"))
--- print(6,test("def","!!!"))
--- print(7,test("def.xxx","!!!"))
-
--- local tim = os.clock() for i=1,250000 do local ext = test("abd.def.xxx","!!!") end print(os.clock()-tim)
-
-- also rewrite previous
local letter = R("az","AZ") + S("_-+")
local separator = P("://")
-local qualified = P(".")^0 * P("/") + letter*P(":") + letter^1*separator + letter^1 * P("/")
-local rootbased = P("/") + letter*P(":")
+local qualified = period^0 * fwslash
+ + letter * colon
+ + letter^1 * separator
+ + letter^1 * fwslash
+local rootbased = fwslash
+ + letter * colon
lpeg.patterns.qualified = qualified
lpeg.patterns.rootbased = rootbased
@@ -452,61 +413,6 @@ function file.is_rootbased_path(filename)
return lpegmatch(rootbased,filename) ~= nil
end
--- actually these are schemes
-
-local slash = S("\\/")
-local period = P(".")
-local drive = C(R("az","AZ")) * P(":")
-local path = C(((1-slash)^0 * slash)^0)
-local suffix = period * C(P(1-period)^0 * P(-1))
-local base = C((1-suffix)^0)
-local rest = C(P(1)^0)
-
-drive = drive + Cc("")
-path = path + Cc("")
-base = base + Cc("")
-suffix = suffix + Cc("")
-
-local pattern_a = drive * path * base * suffix
-local pattern_b = path * base * suffix
-local pattern_c = C(drive * path) * C(base * suffix) -- trick: two extra captures
-local pattern_d = path * rest
-
-function file.splitname(str,splitdrive)
- if splitdrive then
- return lpegmatch(pattern_a,str) -- returns drive, path, base, suffix
- else
- return lpegmatch(pattern_b,str) -- returns path, base, suffix
- end
-end
-
-function file.splitbase(str)
- return lpegmatch(pattern_d,str) -- returns path, base+suffix
-end
-
-function file.nametotable(str,splitdrive) -- returns table
- local path, drive, subpath, name, base, suffix = lpegmatch(pattern_c,str)
- if splitdrive then
- return {
- path = path,
- drive = drive,
- subpath = subpath,
- name = name,
- base = base,
- suffix = suffix,
- }
- else
- return {
- path = path,
- name = name,
- base = base,
- suffix = suffix,
- }
- end
-end
-
--- print(file.splitbase("a/b/c.txt"))
-
-- function test(t) for k, v in next, t do print(v, "=>", file.splitname(v)) end end
--
-- test { "c:", "c:/aa", "c:/aa/bb", "c:/aa/bb/cc", "c:/aa/bb/cc.dd", "c:/aa/bb/cc.dd.ee" }
@@ -514,14 +420,14 @@ end
-- test { "/aa", "/aa/bb", "/aa/bb/cc", "/aa/bb/cc.dd", "/aa/bb/cc.dd.ee" }
-- test { "aa", "aa/bb", "aa/bb/cc", "aa/bb/cc.dd", "aa/bb/cc.dd.ee" }
---~ -- todo:
---~
---~ if os.type == "windows" then
---~ local currentdir = getcurrentdir
---~ function getcurrentdir()
---~ return (gsub(currentdir(),"\\","/"))
---~ end
---~ end
+-- -- maybe:
+--
+-- if os.type == "windows" then
+-- local currentdir = getcurrentdir
+-- function getcurrentdir()
+-- return lpegmatch(reslasher,currentdir())
+-- end
+-- end
-- for myself:
@@ -529,3 +435,18 @@ function file.strip(name,dir)
local b, a = match(name,"^(.-)" .. dir .. "(.*)$")
return a ~= "" and a or name
end
+
+-- local debuglist = {
+-- "pathpart", "basename", "nameonly", "suffixonly", "suffix", "dirname", "extname",
+-- "addsuffix", "removesuffix", "replacesuffix", "join",
+-- "strip","collapsepath", "joinpath", "splitpath",
+-- }
+
+-- for i=1,#debuglist do
+-- local name = debuglist[i]
+-- local f = file[name]
+-- file[name] = function(...)
+-- print(name,f(...))
+-- return f(...)
+-- end
+-- end
diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua
index c461df1ce..a5fdec765 100644
--- a/tex/context/base/l-lpeg.lua
+++ b/tex/context/base/l-lpeg.lua
@@ -443,7 +443,8 @@ function lpeg.replacer(one,two,makefunction)
elseif no == 1 then
local o = one[1]
one, two = P(o[1]), o[2]
- pattern = Cs(((1-one)^1 + one/two)^0)
+ -- pattern = Cs(((1-one)^1 + one/two)^0)
+ pattern = Cs((one/two + 1)^0)
else
for i=1,no do
local o = one[i]
@@ -454,7 +455,28 @@ function lpeg.replacer(one,two,makefunction)
else
one = P(one)
two = two or ""
- pattern = Cs(((1-one)^1 + one/two)^0)
+ -- pattern = Cs(((1-one)^1 + one/two)^0)
+ pattern = Cs((one/two +1)^0)
+ end
+ if makefunction then
+ return function(str)
+ return lpegmatch(pattern,str)
+ end
+ else
+ return pattern
+ end
+end
+
+function lpeg.finder(lst,makefunction)
+ local pattern
+ if type(lst) == "table" then
+ local p = P(false)
+ for i=1,#lst do
+ p = p + P(lst[i])
+ end
+ pattern = (p + 1)^0
+ else
+ pattern = (P(lst) + 1)^0
end
if makefunction then
return function(str)
diff --git a/tex/context/base/l-url.lua b/tex/context/base/l-url.lua
index ab5002881..4624a0507 100644
--- a/tex/context/base/l-url.lua
+++ b/tex/context/base/l-url.lua
@@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['l-url'] = {
license = "see context related readme files"
}
-local char, gmatch, gsub, format, byte, find = string.char, string.gmatch, string.gsub, string.format, string.byte, string.find
+local char, format, byte = string.char, string.format, string.byte
local concat = table.concat
local tonumber, type = tonumber, type
local P, C, R, S, Cs, Cc, Ct, Cf, Cg, V = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cs, lpeg.Cc, lpeg.Ct, lpeg.Cf, lpeg.Cg, lpeg.V
@@ -45,6 +45,8 @@ local nothing = Cc("")
local escapedchar = (percent * C(hexdigit * hexdigit)) / tochar
local escaped = (plus / " ") + escapedchar
+local noslash = P("/") / ""
+
-- we assume schemes with more than 1 character (in order to avoid problems with windows disks)
-- we also assume that when we have a scheme, we also have an authority
--
@@ -233,29 +235,23 @@ function url.construct(hash) -- dodo: we need to escape !
return lpegmatch(escaper,concat(fullurl))
end
-function url.filename(filename) -- why no lpeg here ?
- local t = hashed(filename)
- return (t.scheme == "file" and (gsub(t.path,"^/([a-zA-Z])([:|])/)","%1:"))) or filename
+local pattern = Cs(noslash * R("az","AZ") * (S(":|")/":") * noslash * P(1)^0)
+
+function url.filename(filename)
+ local spec = hashed(filename)
+ local path = spec.path
+ return (spec.scheme == "file" and path and lpegmatch(pattern,path)) or filename
end
+-- print(url.filename("/c|/test"))
+-- print(url.filename("/c/test"))
+
local function escapestring(str)
return lpegmatch(escaper,str)
end
url.escape = escapestring
--- function url.query(str) -- separator could be an option
--- if type(str) == "string" then
--- local t = { }
--- for k, v in gmatch(str,"([^&=]*)=([^&=]*)") do
--- t[k] = v
--- end
--- return t
--- else
--- return str
--- end
--- end
-
function url.query(str)
if type(str) == "string" then
return lpegmatch(splitquery,str) or ""
@@ -283,14 +279,19 @@ end
-- /test/ | /test | test/ | test => test
+local pattern = Cs(noslash^0 * (1 - noslash * P(-1))^0)
+
function url.barepath(path)
if not path or path == "" then
return ""
else
- return (gsub(path,"^/?(.-)/?$","%1"))
+ return lpegmatch(pattern,path)
end
end
+-- print(url.barepath("/test"),url.barepath("test/"),url.barepath("/test/"),url.barepath("test"))
+-- print(url.barepath("/x/yz"),url.barepath("x/yz/"),url.barepath("/x/yz/"),url.barepath("x/yz"))
+
--~ print(url.filename("file:///c:/oeps.txt"))
--~ print(url.filename("c:/oeps.txt"))
--~ print(url.filename("file:///oeps.txt"))
diff --git a/tex/context/base/lang-lab.lua b/tex/context/base/lang-lab.lua
index 755f236cf..568964251 100644
--- a/tex/context/base/lang-lab.lua
+++ b/tex/context/base/lang-lab.lua
@@ -170,7 +170,7 @@ commands.definelabels = labels.define
-- text : "a,b,c"
-- separators : "{, },{ and }"
-function commands.concat(settings) -- it's too easy to forget that this one is there
+function commands.concatcommalist(settings) -- it's too easy to forget that this one is there
local list = settings.list or settings_to_array(settings.text or "")
local size = #list
local command = settings.command and context[settings.command] or context
diff --git a/tex/context/base/lxml-tex.lua b/tex/context/base/lxml-tex.lua
index 3f1ec8254..6ff96bf05 100644
--- a/tex/context/base/lxml-tex.lua
+++ b/tex/context/base/lxml-tex.lua
@@ -1402,18 +1402,6 @@ function lxml.raw(id,pattern) -- the content, untouched by commands
end
function lxml.context(id,pattern) -- the content, untouched by commands
- if not pattern then
- local collected = getid(id)
- ctx_text(collected.dt[1])
- else
- local collected = xmlapplylpath(getid(id),pattern) or getid(id)
- if collected and #collected > 0 then
- contextsprint(ctxcatcodes,collected[1].dt)
- end
- end
-end
-
-function lxml.context(id,pattern) -- the content, untouched by commands
if pattern then
local collected = xmlapplylpath(getid(id),pattern) or getid(id)
if collected and #collected > 0 then
@@ -1421,8 +1409,11 @@ function lxml.context(id,pattern) -- the content, untouched by commands
end
else
local collected = getid(id)
- if collected and #collected > 0 then
- ctx_text(collected.dt[1])
+ if collected then
+ local dt = collected.dt
+ if #dt > 0 then
+ ctx_text(dt[1])
+ end
end
end
end
diff --git a/tex/context/base/math-frc.mkiv b/tex/context/base/math-frc.mkiv
index 59bd588c0..17879cbe0 100644
--- a/tex/context/base/math-frc.mkiv
+++ b/tex/context/base/math-frc.mkiv
@@ -68,8 +68,30 @@
%D So we stick to the next definitions (watch the local
%D overloading of \type {\xfrac}).
-\def\math_fractions_forced#1#2#3{\relax\mathematics{\Ustack{{#1{#2}}\normalover{#1{#3}}}}}
-\def\math_fractions_auto #1#2{\relax\mathematics{\Ustack{{#1}\normalover{#2}}}}
+% \def\math_fractions_forced#1#2#3{\relax\mathematics{\Ustack{{#1{#2}}\normalover{#1{#3}}}}}
+% \def\math_fractions_auto #1#2{\relax\mathematics{\Ustack{{#1}\normalover{#2}}}}
+
+\def\math_fractions_forced#1#2#3%
+ {\vcenter\expandafter\bgroup
+ \expandafter\hbox\expandafter\bgroup\expandafter
+ \startimath
+ \triggermathstyle\normalmathstyle
+ \Ustack{{#1{#2}}\normalover{#1{#3}}}%
+ \stopimath
+ \egroup
+ \egroup}
+
+\def\math_fractions_auto#1#2%
+ {\vcenter\expandafter\bgroup
+ \expandafter\hbox\expandafter\bgroup\expandafter
+ \startimath
+ \triggermathstyle\normalmathstyle
+ \Ustack{{#1}\normalover{#2}}%
+ \stopimath
+ \egroup
+ \egroup}
+
+% \def\math_fractions_auto{\math_fractions_forced\firstofoneargument}
% $\mathfracmode0 \frac{1}{2}$
% $\mathfracmode1 \frac{1}{2}$
@@ -82,7 +104,7 @@
\setnewconstant\mathfracmode\zerocount
-\unexpanded\def\frac % overloaded later on
+\unexpanded\def\frac
{\ifcase\mathfracmode
\expandafter\math_fractions_auto
\or
diff --git a/tex/context/base/math-ini.lua b/tex/context/base/math-ini.lua
index 632bd0bbc..c83bac309 100644
--- a/tex/context/base/math-ini.lua
+++ b/tex/context/base/math-ini.lua
@@ -304,26 +304,98 @@ end
-- needed for mathml analysis
+-- we could cache
+
local function utfmathclass(chr, default)
local cd = chardata[utfbyte(chr)]
- return (cd and cd.mathclass) or default or "unknown"
+ return cd and cd.mathclass or default or "unknown"
end
-local function utfmathaccent(chr, default)
+local function utfmathaccent(chr,default,asked)
local cd = chardata[utfbyte(chr)]
- local mc = cd and cd.mathclass or "unknown"
- return mc and accents[mc] or false
+ if not cd then
+ return default or false
+ end
+ if asked then
+ local mc = cd.mathclass
+ if mc and mc == asked then
+ return true
+ end
+ local ms = cd.mathspec
+ if ms then
+ for i=1,#ms do
+ local msi = ms[i]
+ local mc = msi.class
+ if mc and mc == asked then
+ return true
+ end
+ end
+ end
+ else
+ local mc = cd.mathclass
+ if mc then
+ return accents[mc] or default or false
+ end
+ local ms = cd.mathspec
+ if ms then
+ for i=1,#ms do
+ local msi = ms[i]
+ local mc = msi.class
+ if mc then
+ return accents[mc] or default or false
+ end
+ end
+ end
+ end
+ return default or false
end
local function utfmathstretch(chr, default) -- "h", "v", "b", ""
local cd = chardata[utfbyte(chr)]
- return (cd and cd.mathstretch) or default or ""
+ return cd and cd.mathstretch or default or ""
end
-local function utfmathcommand(chr, default)
+local function utfmathcommand(chr,default,asked)
+-- local cd = chardata[utfbyte(chr)]
+-- local cmd = cd and cd.mathname
+-- return cmd or default or ""
local cd = chardata[utfbyte(chr)]
- local cmd = cd and cd.mathname
- return cmd or default or ""
+ if not cd then
+ return default or ""
+ end
+ if asked then
+ local mn = cd.mathname
+ local mc = cd.mathclass
+ if mn and mc and mc == asked then
+ return mn
+ end
+ local ms = cd.mathspec
+ if ms then
+ for i=1,#ms do
+ local msi = ms[i]
+ local mn = msi.name
+ if mn and msi.class == asked then
+ return mn
+ end
+ end
+ end
+ else
+ local mn = cd.mathname
+ if mn then
+ return mn
+ end
+ local ms = cd.mathspec
+ if ms then
+ for i=1,#ms do
+ local msi = ms[i]
+ local mn = msi.name
+ if mn then
+ return mn
+ end
+ end
+ end
+ end
+ return default or ""
end
local function utfmathfiller(chr, default)
@@ -339,13 +411,13 @@ mathematics.utfmathfiller = utfmathfiller
-- interfaced
-function commands.utfmathclass (chr) context(utfmathclass (chr)) end
-function commands.utfmathstretch(chr) context(utfmathstretch(chr)) end
-function commands.utfmathcommand(chr) context(utfmathcommand(chr)) end
-function commands.utfmathfiller (chr) context(utfmathfiller (chr)) end
+function commands.utfmathclass (...) context(utfmathclass (...)) end
+function commands.utfmathstretch(...) context(utfmathstretch(...)) end
+function commands.utfmathcommand(...) context(utfmathcommand(...)) end
+function commands.utfmathfiller (...) context(utfmathfiller (...)) end
-function commands.doifelseutfmathaccent(chr)
- commands.doifelse(utfmathaccent(chr))
+function commands.doifelseutfmathaccent(chr,asked)
+ commands.doifelse(utfmathaccent(chr,nil,asked))
end
-- helpers
diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv
index ebe8ea709..3de4c808f 100644
--- a/tex/context/base/math-ini.mkiv
+++ b/tex/context/base/math-ini.mkiv
@@ -250,7 +250,11 @@
\def\utfmathcommand#1{\ctxcommand{utfmathcommand(\!!bs#1\!!es)}}
\def\utfmathfiller #1{\ctxcommand{utfmathfiller (\!!bs#1\!!es)}}
-\unexpanded\def\doifelseutfmathaccent#1{\ctxcommand{doifelseutfmathaccent(\!!bs#1\!!es)}}
+\def\utfmathclassfiltered #1#2{\ctxcommand{utfmathclass (\!!bs#1\!!es,nil,"#2")}}
+\def\utfmathcommandfiltered#1#2{\ctxcommand{utfmathcommand(\!!bs#1\!!es,nil,"#2")}}
+
+\unexpanded\def\doifelseutfmathaccent #1{\ctxcommand{doifelseutfmathaccent(\!!bs#1\!!es)}}
+\unexpanded\def\doifelseutfmathaccentfiltered#1#2{\ctxcommand{doifelseutfmathaccent(\!!bs#1\!!es,"#2")}}
%D Not used that much:
diff --git a/tex/context/base/meta-ini.mkiv b/tex/context/base/meta-ini.mkiv
index fec3a64f9..e731d26e0 100644
--- a/tex/context/base/meta-ini.mkiv
+++ b/tex/context/base/meta-ini.mkiv
@@ -51,7 +51,7 @@
\ifx\currentMPinstance\empty
\let\currentMPinstance\defaultMPinstance
\fi
- \global\t_meta_instance\expandafter{\the\t_meta_instance#2}%
+ \global\t_meta_definitions\expandafter{\the\t_meta_definitions#2}%
\let\currentMPinstance\m_meta_saved_instance}
\let\stopMPdefinitions\relax
@@ -95,7 +95,7 @@
\edef\currentwidth {\the\hsize \space}%
\edef\currentheight {\the\vsize \space}}
-\def\t_meta_instance{\csname\??mpinstancetokens\currentMPinstance\endcsname} % token register
+\def\t_meta_definitions{\csname\??mpinstancetokens\currentMPinstance\endcsname} % token register
\installcommandhandler \??mpinstance {MPinstance} \??mpinstance
@@ -103,6 +103,7 @@
[\s!format=metafun,
\s!extensions=\v!no,
\s!initializations=\v!no,
+ \c!method=\s!default,
\c!textstyle=,
\c!textcolor=]
@@ -110,7 +111,7 @@
\ifcsname\??mpinstancetokens\currentMPinstance\endcsname \else
\expandafter\newtoks\csname\??mpinstancetokens\currentMPinstance\endcsname
\fi
- \t_meta_instance\emptytoks % in case we redefine
+ \t_meta_definitions\emptytoks % in case we redefine
\to \everydefineMPinstance
\unexpanded\def\resetMPinstance[#1]%
@@ -134,11 +135,13 @@
\def\currentMPinstance{\defaultMPinstance}
\def\currentMPformat {\currentMPinstance}
-\defineMPinstance[metafun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes]
-\defineMPinstance[extrafun][\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes]
-\defineMPinstance[mprun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes]
-\defineMPinstance[metapost][\s!format=mpost]
-\defineMPinstance[nofun] [\s!format=mpost]
+\defineMPinstance[metafun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes]
+\defineMPinstance[extrafun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes]
+\defineMPinstance[doublefun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes,\c!method=\s!double]
+\defineMPinstance[decimalfun][\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes,\c!method=\s!decimal]
+\defineMPinstance[mprun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes]
+\defineMPinstance[metapost] [\s!format=mpost]
+\defineMPinstance[nofun] [\s!format=mpost]
\newconditional\c_meta_include_extensions
\newconditional\c_meta_include_initializations
@@ -154,18 +157,28 @@
\def\meta_flush_current_initializations
{\ifconditional\c_meta_include_initializations
- \the\t_meta_initializations;%
+ \the\t_meta_initializations
\fi
\theMPrandomseed;}
-\def\meta_flush_current_preamble
+% \def\meta_flush_current_preamble
+% {\ifconditional\c_meta_include_extensions
+% \the\t_meta_extensions
+% \the\t_meta_userinclusions
+% \fi}
+
+\def\meta_flush_current_extensions
+ {\ifconditional\c_meta_include_extensions
+ \the\t_meta_extensions
+ \fi}
+
+\def\meta_flush_current_userinclusions
{\ifconditional\c_meta_include_extensions
- \the\t_meta_extensions;%
- \the\t_meta_userinclusions;%
+ \the\t_meta_userinclusions
\fi}
-\def\meta_flush_current_instance
- {\the\t_meta_instance;}
+\def\meta_flush_current_definitions
+ {\the\t_meta_definitions}
\def\meta_reset_current_preamble
{\ifconditional\c_meta_include_extensions
@@ -199,7 +212,7 @@
\useMPinstancestyleandcolor\c!textstyle\c!textcolor}
\def\meta_stop_current_graphic
- {\global\t_meta_instance\emptytoks
+ {\global\t_meta_definitions\emptytoks
\endgroup}
\def\meta_process_graphic_start
@@ -213,15 +226,17 @@
{\meta_start_current_graphic
\forgetall
\meta_process_graphic_start
- \normalexpanded{\noexpand\ctxlua{metapost.graphic(
- "\currentMPinstance",
- "\currentMPformat",
- \!!bs#1;\!!es,
- \!!bs\meta_flush_current_initializations;\!!es,
- \!!bs\meta_flush_current_preamble;\!!es,
- \!!bs\meta_flush_current_instance;\!!es,
- "\MPaskedfigure"
- )}}%
+ \normalexpanded{\noexpand\ctxlua{metapost.graphic {
+ instance = "\currentMPinstance",
+ format = "\currentMPformat",
+ data = \!!bs#1;\!!es,
+ initializations = \!!bs\meta_flush_current_initializations\!!es,
+ extensions = \!!bs\meta_flush_current_extensions\!!es,
+ inclusions = \!!bs\meta_flush_current_userinclusions\!!es,
+ definitions = \!!bs\meta_flush_current_definitions\!!es,
+ figure = "\MPaskedfigure",
+ method = "\MPinstanceparameter\c!method",
+ }}}%
\meta_process_graphic_stop
\meta_reset_current_preamble
\meta_stop_current_graphic}
@@ -319,13 +334,15 @@
\edef\height{#3\space}\let\overlayheight\height
\ifcsname\??mpclip#1\endcsname
\meta_start_current_graphic
- \xdef\MPclippath{\normalexpanded{\noexpand\ctxlua{metapost.theclippath(
- "\currentMPinstance",
- "\currentMPformat",
- \!!bs\getvalue{\??mpclip#1}\!!es,
- \!!bs\meta_flush_current_initializations\!!es,
- \!!bs\meta_flush_current_preamble\!!es
- )}}}%
+ \xdef\MPclippath{\normalexpanded{\noexpand\ctxlua{metapost.theclippath {
+ instance = "\currentMPinstance",
+ format = "\currentMPformat",
+ data = \!!bs\getvalue{\??mpclip#1}\!!es,
+ initializations = \!!bs\meta_flush_current_initializations\!!es,
+ extensions = \!!bs\meta_flush_current_extensions\!!es,
+ inclusions = \!!bs\meta_flush_current_userinclusions\!!es,
+ method = "\MPinstanceparameter\c!method",
+ }}}}%
\meta_stop_current_graphic
\meta_reset_current_preamble
\ifx\MPclippath\empty
diff --git a/tex/context/base/mlib-ctx.lua b/tex/context/base/mlib-ctx.lua
index 4b1a5035d..5a3becd7a 100644
--- a/tex/context/base/mlib-ctx.lua
+++ b/tex/context/base/mlib-ctx.lua
@@ -19,19 +19,47 @@ local mplib = mplib
metapost = metapost or {}
local metapost = metapost
-metapost.defaultformat = "metafun"
+metapost.defaultformat = "metafun"
+metapost.defaultinstance = "metafun"
+metapost.defaultmethod = "default"
+
+local function setmpsformat(specification)
+ local instance = specification.instance
+ local format = specification.format
+ local method = specification.method
+ if not instance or instance == "" then
+ instance = metapost.defaultinstance
+ specification.instance = instance
+ end
+ if not format or format == "" then
+ format = metapost.defaultformat
+ specification.format = format
+ end
+ if not method or method == "" then
+ method = metapost.defaultmethod
+ specification.method = method
+ end
+ specification.mpx = metapost.format(instance,format,method)
+end
-function metapost.graphic(instance,mpsformat,str,initializations,preamble,definitions,askedfig)
- local mpx = metapost.format(instance,mpsformat or metapost.defaultformat)
- metapost.graphic_base_pass(mpx,str,initializations,preamble,definitions,askedfig)
+function metapost.graphic(specification)
+ setmpsformat(specification)
+ metapost.graphic_base_pass(specification)
end
-function metapost.getclippath(instance,mpsformat,data,initializations,preamble)
- local mpx = metapost.format(instance,mpsformat or metapost.defaultformat)
- if mpx and data then
+function metapost.getclippath(specification)
+ setmpsformat(specification)
+ local mpx = specification.mpx
+ local data = specification.data or ""
+ if mpx and data ~= "" then
starttiming(metapost)
starttiming(metapost.exectime)
- local result = mpx:execute(format("%s;beginfig(1);%s;%s;endfig;",preamble or "",initializations or "",data))
+ local result = mpx:execute ( format ( "%s;%s;beginfig(1);%s;%s;endfig;",
+ specification.extensions or "",
+ specification.inclusions or "",
+ specification.initializations or "",
+ data
+ ) )
stoptiming(metapost.exectime)
if result.status > 0 then
report_metapost("%s: %s", result.status, result.error or result.term or result.log)
diff --git a/tex/context/base/mlib-pps.lua b/tex/context/base/mlib-pps.lua
index dfa475b68..21b6657de 100644
--- a/tex/context/base/mlib-pps.lua
+++ b/tex/context/base/mlib-pps.lua
@@ -512,36 +512,67 @@ local function checkaskedfig(askedfig) -- return askedfig, wrappit
end
end
-function metapost.graphic_base_pass(mpsformat,str,initializations,preamble,definitions,askedfig)
+function metapost.graphic_base_pass(specification)
+ local mpx = specification.mpx -- mandate
+ local data = specification.data or ""
+ local definitions = specification.definitions or ""
+ local extensions = specification.extensions or ""
+ local inclusions = specification.inclusions or ""
+ local initializations = specification.initializations or ""
+ local askedfig = specification.figure -- no default else no wrapper
+ --
nofruns = nofruns + 1
local askedfig, wrappit = checkaskedfig(askedfig)
- local done_1, done_2, forced_1, forced_2
- str, done_1, forced_1 = checktexts(str)
- if not preamble or preamble == "" then
- preamble, done_2, forced_2 = "", false, false
+ local done_1, done_2, done_3, forced_1, forced_2, forced_3
+ data, done_1, forced_1 = checktexts(data)
+ -- we had preamble = extensions + inclusions
+ if extensions == "" then
+ extensions, done_2, forced_2 = "", false, false
else
- preamble, done_2, forced_2 = checktexts(preamble)
+ extensions, done_2, forced_2 = checktexts(extensions)
+ end
+ if inclusions == "" then
+ inclusions, done_3, forced_3 = "", false, false
+ else
+ inclusions, done_3, forced_3 = checktexts(inclusions)
end
metapost.intermediate.needed = false
metapost.multipass = false -- no needed here
- current_format = mpsformat
- current_graphic = str
- current_initializations = initializations or ""
- if metapost.method == 1 or (metapost.method == 2 and (done_1 or done_2)) then
+ current_format = mpx
+ current_graphic = data
+ current_initializations = initializations
+ local method = metapost.method
+ if trace_runs then
+ if method == 1 then
+ report_metapost("forcing two runs due to library configuration")
+ elseif method ~= 2 then
+ report_metapost("ignoring run due to library configuration")
+ elseif not (done_1 or done_2 or done_3) then
+ report_metapost("forcing one run only due to analysis")
+ elseif done_1 then
+ report_metapost("forcing at max two runs due to main code")
+ elseif done_2 then
+ report_metapost("forcing at max two runs due to extensions")
+ else
+ report_metapost("forcing at max two runs due to inclusions")
+ end
+ end
+ if method == 1 or (method == 2 and (done_1 or done_2 or done_3)) then
if trace_runs then
report_metapost("first run of job %s (asked: %s)",nofruns,tostring(askedfig))
end
-- first true means: trialrun, second true means: avoid extra run if no multipass
- local flushed = metapost.process(mpsformat, {
+ local flushed = metapost.process(mpx, {
definitions,
- preamble,
+ extensions,
+ inclusions,
wrappit and do_begin_fig or "",
do_trial_run,
current_initializations,
do_safeguard,
current_graphic,
wrappit and do_end_fig or "",
- }, true, nil, not (forced_1 or forced_2), false, askedfig)
+ }, true, nil, not (forced_1 or forced_2 or forced_3), false, askedfig)
if metapost.intermediate.needed then
for _, action in next, metapost.intermediate.actions do
action()
@@ -556,7 +587,7 @@ function metapost.graphic_base_pass(mpsformat,str,initializations,preamble,defin
if trace_runs then
report_metapost("running job %s (asked: %s)",nofruns,tostring(askedfig))
end
- metapost.process(mpsformat, {
+ metapost.process(mpx, {
preamble,
wrappit and do_begin_fig or "",
no_trial_run,
@@ -564,7 +595,7 @@ function metapost.graphic_base_pass(mpsformat,str,initializations,preamble,defin
do_safeguard,
current_graphic,
wrappit and do_end_fig or "",
- }, false, nil, false, false, askedfig )
+ }, false, nil, false, false, askedfig)
end
end
diff --git a/tex/context/base/mlib-run.lua b/tex/context/base/mlib-run.lua
index 62203e95e..5e702245d 100644
--- a/tex/context/base/mlib-run.lua
+++ b/tex/context/base/mlib-run.lua
@@ -284,11 +284,17 @@ else
input "%s" ;
]]
- function metapost.load(name)
+ local methods = {
+ double = "double",
+ decimal = false, -- for the moment
+ }
+
+ function metapost.load(name,method)
starttiming(mplib)
local mpx = mplib.new {
ini_version = true,
- find_file = finder,
+ find_file = finder,
+ math_mode = method and methods[method] or nil,
}
local result
if not mpx then
@@ -301,7 +307,7 @@ else
return mpx, result
end
- function metapost.checkformat(mpsinput)
+ function metapost.checkformat(mpsinput,method)
local mpsversion = environment.version or "unset version"
local mpsinput = mpsinput or "metafun"
local foundfile = ""
@@ -320,8 +326,8 @@ else
if foundfile == "" then
report_metapost("loading '%s' fails, format not found",mpsinput)
else
- report_metapost("loading '%s': %s",mpsinput,foundfile)
- local mpx, result = metapost.load(foundfile)
+ report_metapost("loading '%s': %s, using method: %s",mpsinput,foundfile,method or "default")
+ local mpx, result = metapost.load(foundfile,method)
if mpx then
return mpx
else
@@ -343,12 +349,15 @@ end
local mpxformats = { }
-function metapost.format(instance,name)
+function metapost.format(instance,name,method)
+ if not instance or instance == "" then
+ instance = "metafun" -- brrr
+ end
name = name or instance
local mpx = mpxformats[instance]
if not mpx then
report_metapost("initializing instance '%s' using format '%s'",instance,name)
- mpx = metapost.checkformat(name)
+ mpx = metapost.checkformat(name,method)
mpxformats[instance] = mpx
end
return mpx
@@ -401,6 +410,7 @@ function metapost.process(mpx, data, trialrun, flusher, multipass, isextrapass,
end
if type(data) == "table" then
-- this hack is needed because the library currently barks on \n\n
+ -- eventually we can text for "" in the next loop
local n = 0
local nofsnippets = #data
for i=1,nofsnippets do
@@ -427,11 +437,15 @@ function metapost.process(mpx, data, trialrun, flusher, multipass, isextrapass,
if trace_tracingall then
mpx:execute("tracingall;")
end
+-- table.insert(data,2,"")
for i=1,#data do
local d = data[i]
+-- d = string.gsub(d,"\r","")
if d then
if trace_graphics then
+ mp_inp[mpx]:write(format("\n%% begin snippet %s\n",i))
mp_inp[mpx]:write(d)
+ mp_inp[mpx]:write(format("\n%% end snippet %s\n",i))
end
starttiming(metapost.exectime)
result = mpx:execute(d)
@@ -484,7 +498,7 @@ function metapost.process(mpx, data, trialrun, flusher, multipass, isextrapass,
metapost.lastlog = metapost.lastlog .. "\n" .. result.term
report_metapost("info: %s",result.term or "no-term")
end
- if result.fig then
+ if result.fig then
converted = metapost.convert(result, trialrun, flusher, multipass, askedfig)
end
end
diff --git a/tex/context/base/mult-def.mkiv b/tex/context/base/mult-def.mkiv
index ceb15de90..eb4624ee8 100644
--- a/tex/context/base/mult-def.mkiv
+++ b/tex/context/base/mult-def.mkiv
@@ -73,6 +73,9 @@
\def\s!integral {integral}
\def\s!insert {insert} % maybe insertclass
+\def\s!double {double}
+\def\s!decimal {decimal}
+
\def\c!HL {HL}
\def\c!VL {VL}
\def\c!NL {NL}
diff --git a/tex/context/base/mult-fun.lua b/tex/context/base/mult-fun.lua
index 260497f52..f7a7792e5 100644
--- a/tex/context/base/mult-fun.lua
+++ b/tex/context/base/mult-fun.lua
@@ -10,6 +10,7 @@ return {
-- "originlength", "tickstep ", "ticklength",
-- "autoarrows", "ahfactor",
-- "angleoffset", anglelength", anglemethod",
+ "metapostversion",
},
commands = {
--
@@ -45,6 +46,7 @@ return {
"colordecimals", "ddecimal", "dddecimal", "ddddecimal",
"textext", "thetextext", "rawtextext", "textextoffset", "verbatim", "thelabel", "label", "autoalign",
"transparent", "withtransparency",
+ "property", "properties", "withproperties",
"asgroup",
"infont", -- redefined usign textext
-- "property", "withproperties", "properties", -- not yet
diff --git a/tex/context/base/mult-low.lua b/tex/context/base/mult-low.lua
index 863ee3860..8338d41eb 100644
--- a/tex/context/base/mult-low.lua
+++ b/tex/context/base/mult-low.lua
@@ -302,5 +302,10 @@ return {
"inneropenspacing", "innerclosespacing", "innerpunctspacing", "innerinnerspacing",
--
"normalreqno",
+ --
+ "startimath", "stopimath", "normalstartimath", "normalstopimath",
+ "startdmath", "stopdmath", "normalstartdmath", "normalstopdmath",
+ --
+ "uncramped", "cramped", "triggermathstyle", "mathstylefont", "mathstyleface",
}
}
diff --git a/tex/context/base/ppchtex.mkii b/tex/context/base/ppchtex.mkii
index d1209cd97..07ca9789a 100644
--- a/tex/context/base/ppchtex.mkii
+++ b/tex/context/base/ppchtex.mkii
@@ -2130,7 +2130,8 @@
\def\RB{\chemicalrightbottom}%
\def\SL{\chemicalsmashedleft}%
\def\SM{\chemicalsmashedmiddle}%
- \def\SR{\chemicalsmashedright}}
+ \def\SR{\chemicalsmashedright}%
+}
% \reversechemical#1#2#3
%
diff --git a/tex/context/base/s-mod-00.mkiv b/tex/context/base/s-mod-00.mkiv
index 94f6edcb6..7af56dc2d 100644
--- a/tex/context/base/s-mod-00.mkiv
+++ b/tex/context/base/s-mod-00.mkiv
@@ -13,6 +13,12 @@
\unprotect
-% gone
+\startmode[nocode]
+
+ % \definieerbuffer[definition] % ignore
+
+ \def\startdefinition#1\stopdefinition{}
+
+\stopmode
\protect \endinput
diff --git a/tex/context/base/s-mod-02.mkiv b/tex/context/base/s-mod-02.mkiv
index 032ace8a6..37e3d2f14 100644
--- a/tex/context/base/s-mod-02.mkiv
+++ b/tex/context/base/s-mod-02.mkiv
@@ -13,6 +13,12 @@
\unprotect
-% gone
+\startmode[nocode]
+
+ % \definieerbuffer[definition] % ignore
+
+ \def\startdefinition#1\stopdefinition{}
+
+\stopmode
\protect \endinput
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 84c7adbe3..2819a3f4b 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index 9b7fd7ee5..2371c0934 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/syst-con.lua b/tex/context/base/syst-con.lua
index f3f1b98cf..ae9d15a26 100644
--- a/tex/context/base/syst-con.lua
+++ b/tex/context/base/syst-con.lua
@@ -43,10 +43,18 @@ end
local cosd, sind, tand = math.cosd, math.sind, math.tand
local cos, sin, tan = math.cos, math.sin, math.tan
-function commands.sind(n) context("%0.6f",sind(n)) end
-function commands.cosd(n) context("%0.6f",cosd(n)) end
-function commands.tand(n) context("%0.6f",tand(n)) end
+-- function commands.sind(n) context("%0.6f",sind(n)) end
+-- function commands.cosd(n) context("%0.6f",cosd(n)) end
+-- function commands.tand(n) context("%0.6f",tand(n)) end
-function commands.sin(n) context("%0.6f",sin(n)) end
-function commands.cos(n) context("%0.6f",cos(n)) end
-function commands.tan(n) context("%0.6f",tan(n)) end
+-- function commands.sin (n) context("%0.6f",sin (n)) end
+-- function commands.cos (n) context("%0.6f",cos (n)) end
+-- function commands.tan (n) context("%0.6f",tan (n)) end
+
+function commands.sind(n) context(sind(n)) end
+function commands.cosd(n) context(cosd(n)) end
+function commands.tand(n) context(tand(n)) end
+
+function commands.sin (n) context(sin (n)) end
+function commands.cos (n) context(cos (n)) end
+function commands.tan (n) context(tan (n)) end
diff --git a/tex/context/base/util-prs.lua b/tex/context/base/util-prs.lua
index dc1526df7..506497875 100644
--- a/tex/context/base/util-prs.lua
+++ b/tex/context/base/util-prs.lua
@@ -232,8 +232,8 @@ end
-- for chem (currently one level)
local value = P(lbrace * C((nobrace + nestedbraces)^0) * rbrace)
- + C(digit^1 * lparent * (noparent + nestedparents)^0 * rparent)
- + C((nestedbraces + (1-comma))^0)
+ + C(digit^1 * lparent * (noparent + nestedparents)^1 * rparent)
+ + C((nestedbraces + (1-comma))^1)
local pattern_a = spaces * Ct(value*(separator*value)^0)
local function repeater(n,str)
@@ -257,15 +257,15 @@ local function repeater(n,str)
end
local value = P(lbrace * C((nobrace + nestedbraces)^0) * rbrace)
- + (C(digit^1)/tonumber * lparent * Cs((noparent + nestedparents)^0) * rparent) / repeater
- + C((nestedbraces + (1-comma))^0)
+ + (C(digit^1)/tonumber * lparent * Cs((noparent + nestedparents)^1) * rparent) / repeater
+ + C((nestedbraces + (1-comma))^1)
local pattern_b = spaces * Ct(value*(separator*value)^0)
-function parsers.settings_to_array_with_repeat(str,expand)
+function parsers.settings_to_array_with_repeat(str,expand) -- beware: "" => { }
if expand then
- return lpegmatch(pattern_b,str)
+ return lpegmatch(pattern_b,str) or { }
else
- return lpegmatch(pattern_a,str)
+ return lpegmatch(pattern_a,str) or { }
end
end
diff --git a/tex/context/base/x-mathml.mkiv b/tex/context/base/x-mathml.mkiv
index d461bf149..cf861cd7b 100644
--- a/tex/context/base/x-mathml.mkiv
+++ b/tex/context/base/x-mathml.mkiv
@@ -1681,7 +1681,7 @@
\ifdefined\asciimath
\expanded{\asciimath{\xmlflush{#1}}}
\else
- \hbox{\tt no am loaded}%
+ \hbox{\tt no am loaded}
\fi
} {
\xmlall{#1}{../!mml:annotation}
@@ -2182,33 +2182,27 @@
{\csname#1\endcsname}}
\startxmlsetups mml:mover
-% \mathop {
- \edef\mmlovertoken{\xmlraw{#1}{/mml:*[2]}}
- \doifelseutfmathaccent\mmlovertoken {
- \edef\mmlovercommand{\utfmathcommand\mmlovertoken}
- \mmlexecuteifdefined\mmlovercommand\mathematics{\mmlfirst{#1}}
- } {
- \edef\mmlbasetoken{\xmlraw{#1}{/mml:*[1]}}
- \edef\mmlbasecommand{\utfmathfiller\mmlbasetoken}
- \edef\mmlovercommand{\utfmathfiller\mmlovertoken}
-% todo: proper math mode/size
- \vbox {
- \mathsurround\zeropoint \ialign {
-% \hss##\hss
-\hss$##$\hss
- \crcr
- \noalign{\kern3\onepoint}%
-% \mmlexecuteifdefined\mmlovercommand{\mathematics{\mmlsecond{#1}}}
-\mmlexecuteifdefined\mmlovercommand{\mmlsecond{#1}}
- \crcr
- \noalign{\kern3\onepoint\nointerlineskip}%
-% \mmlexecuteifdefined\mmlbasecommand{\mathematics{\mmlfirst{#1}}}
-\mmlexecuteifdefined\mmlbasecommand{\mmlfirst{#1}}
- \crcr
- }
+ \edef\mmlovertoken{\xmlraw{#1}{/mml:*[2]}}
+ \doifelseutfmathaccentfiltered\mmlovertoken{topaccent} {
+ \edef\mmlovercommand{\utfmathcommandfiltered\mmlovertoken{topaccent}}
+ \mmlexecuteifdefined\mmlovercommand\mathematics{\mmlfirst{#1}}
+ } {
+ \edef\mmlbasetoken{\xmlraw{#1}{/mml:*[1]}}
+ \edef\mmlbasecommand{\utfmathfiller\mmlbasetoken}
+ \edef\mmlovercommand{\utfmathfiller\mmlovertoken}
+ \vbox {
+ \mathsurround\zeropoint \ialign {
+ \hss$##$\hss
+ \crcr
+ \noalign{\kern3\onepoint}%
+ \mmlexecuteifdefined\mmlovercommand{\mmlsecond{#1}}
+ \crcr
+ \noalign{\kern3\onepoint\nointerlineskip}%
+ \mmlexecuteifdefined\mmlbasecommand{\mmlfirst{#1}}
+ \crcr
}
}
-% }
+ }
% \limits % spoils spacing
\stopxmlsetups
@@ -2217,25 +2211,21 @@
\startxmlsetups mml:munder
% \mathop {
\edef\mmlundertoken{\xmlraw{#1}{/mml:*[2]}}
- \doifelseutfmathaccent\mmlundertoken {
- \edef\mmlundercommand{\utfmathcommand\mmlundertoken}
+ \doifelseutfmathaccentfiltered\mmlundertoken{botaccent} {
+ \edef\mmlundercommand{\utfmathcommandfiltered\mmlundertoken{botaccent}}
\mmlexecuteifdefined\mmlundercommand\mathematics{\mmlfirst{#1}}
} {
\edef\mmlbasetoken {\xmlraw{#1}{/mml:*[1]}}
\edef\mmlbasecommand {\utfmathfiller\mmlbasetoken}
\edef\mmlundercommand{\utfmathfiller\mmlundertoken}
-% todo: proper math mode/size
\vtop {
\mathsurround\zeropoint \ialign {
-% \hss##\hss
-\hss$##$\hss
+ \hss$##$\hss
\crcr
-% \mmlexecuteifdefined\mmlbasecommand {\mathematics{\mmlfirst{#1}}}
-\mmlexecuteifdefined\mmlbasecommand {\mmlfirst{#1}}
+ \mmlexecuteifdefined\mmlbasecommand {\mmlfirst{#1}}
\crcr
\noalign{\kern3\onepoint\nointerlineskip}%
-% \mmlexecuteifdefined\mmlundercommand{\mathematics{\mmlsecond{#1}}}
-\mmlexecuteifdefined\mmlundercommand{\mmlsecond{#1}}
+ \mmlexecuteifdefined\mmlundercommand{\mmlsecond{#1}}
\crcr
\noalign{\kern3\onepoint}
}
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 4b5d60492..1f402cd4f 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 12/06/12 22:36:49
+-- merge date : 12/10/12 23:20:34
do -- begin closure to overcome local limits and interference
@@ -1617,7 +1617,8 @@ function lpeg.replacer(one,two,makefunction)
elseif no == 1 then
local o = one[1]
one, two = P(o[1]), o[2]
- pattern = Cs(((1-one)^1 + one/two)^0)
+ -- pattern = Cs(((1-one)^1 + one/two)^0)
+ pattern = Cs((one/two + 1)^0)
else
for i=1,no do
local o = one[i]
@@ -1628,7 +1629,28 @@ function lpeg.replacer(one,two,makefunction)
else
one = P(one)
two = two or ""
- pattern = Cs(((1-one)^1 + one/two)^0)
+ -- pattern = Cs(((1-one)^1 + one/two)^0)
+ pattern = Cs((one/two +1)^0)
+ end
+ if makefunction then
+ return function(str)
+ return lpegmatch(pattern,str)
+ end
+ else
+ return pattern
+ end
+end
+
+function lpeg.finder(lst,makefunction)
+ local pattern
+ if type(lst) == "table" then
+ local p = P(false)
+ for i=1,#lst do
+ p = p + P(lst[i])
+ end
+ pattern = (p + 1)^0
+ else
+ pattern = (P(lst) + 1)^0
end
if makefunction then
return function(str)
@@ -2159,66 +2181,145 @@ file = file or { }
local file = file
local insert, concat = table.insert, table.concat
-local find, gmatch, match, gsub, sub, char, lower = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char, string.lower
+local match = string.match
local lpegmatch = lpeg.match
local getcurrentdir, attributes = lfs.currentdir, lfs.attributes
+local checkedsplit = string.checkedsplit
+
+-- local patterns = file.patterns or { }
+-- file.patterns = patterns
-local P, R, S, C, Cs, Cp, Cc = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Cc
+local P, R, S, C, Cs, Cp, Cc, Ct = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Cc, lpeg.Ct
-local function dirname(name,default)
- return match(name,"^(.+)[/\\].-$") or (default or "")
+local colon = P(":")
+local period = P(".")
+local periods = P("..")
+local fwslash = P("/")
+local bwslash = P("\\")
+local slashes = S("\\/")
+local noperiod = 1-period
+local noslashes = 1-slashes
+local name = noperiod^1
+local suffix = period/"" * (1-period-slashes)^1 * -1
+
+local pattern = C((noslashes^0 * slashes^1)^1)
+
+local function pathpart(name,default)
+ return lpegmatch(pattern,name) or default or ""
end
+local pattern = (noslashes^0 * slashes)^1 * C(noslashes^1) * -1
+
local function basename(name)
- return match(name,"^.+[/\\](.-)$") or name
+ return lpegmatch(pattern,name) or name
end
--- local function nameonly(name)
--- return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$",""))
--- end
+local pattern = (noslashes^0 * slashes^1)^0 * Cs((1-suffix)^1) * suffix^0
local function nameonly(name)
- return (gsub(match(name,"^.+[/\\](.-)$") or name,"%.[%a%d]+$",""))
+ return lpegmatch(pattern,name) or name
end
-local function suffixonly(name,default)
- return match(name,"^.+%.([^/\\]-)$") or default or ""
-end
+local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * C(noperiod^1) * -1
-local function splitname(name)
- local n, s = match(name,"^(.+)%.([^/\\]-)$")
- return n or name, s or ""
+local function suffixonly(name)
+ return lpegmatch(pattern,name) or ""
end
+file.pathpart = pathpart
file.basename = basename
-
-file.pathpart = dirname
-file.dirname = dirname
-
file.nameonly = nameonly
-
file.suffixonly = suffixonly
-file.extname = suffixonly -- obsolete
file.suffix = suffixonly
-function file.removesuffix(filename)
- return (gsub(filename,"%.[%a%d]+$",""))
+file.dirname = pathpart -- obsolete
+file.extname = suffixonly -- obsolete
+
+-- actually these are schemes
+
+local drive = C(R("az","AZ")) * colon
+local path = C(((1-slashes)^0 * slashes)^0)
+local suffix = period * C(P(1-period)^0 * P(-1))
+local base = C((1-suffix)^0)
+local rest = C(P(1)^0)
+
+drive = drive + Cc("")
+path = path + Cc("")
+base = base + Cc("")
+suffix = suffix + Cc("")
+
+local pattern_a = drive * path * base * suffix
+local pattern_b = path * base * suffix
+local pattern_c = C(drive * path) * C(base * suffix) -- trick: two extra captures
+local pattern_d = path * rest
+
+function file.splitname(str,splitdrive)
+ if splitdrive then
+ return lpegmatch(pattern_a,str) -- returns drive, path, base, suffix
+ else
+ return lpegmatch(pattern_b,str) -- returns path, base, suffix
+ end
+end
+
+function file.splitbase(str)
+ return lpegmatch(pattern_d,str) -- returns path, base+suffix
end
+function file.nametotable(str,splitdrive) -- returns table
+ local path, drive, subpath, name, base, suffix = lpegmatch(pattern_c,str)
+ if splitdrive then
+ return {
+ path = path,
+ drive = drive,
+ subpath = subpath,
+ name = name,
+ base = base,
+ suffix = suffix,
+ }
+ else
+ return {
+ path = path,
+ name = name,
+ base = base,
+ suffix = suffix,
+ }
+ end
+end
+
+local pattern = Cs(((period * noperiod^1 * -1)/"" + 1)^1)
+
+function file.removesuffix(name)
+ return lpegmatch(pattern,name)
+end
+
+-- local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * Cp() * noperiod^1 * -1
+--
+-- function file.addsuffix(name, suffix)
+-- local p = lpegmatch(pattern,name)
+-- if p then
+-- return name
+-- else
+-- return name .. "." .. suffix
+-- end
+-- end
+
+local suffix = period/"" * (1-period-slashes)^1 * -1
+local pattern = Cs((noslashes^0 * slashes^1)^0 * ((1-suffix)^1)) * Cs(suffix)
+
function file.addsuffix(filename, suffix, criterium)
if not suffix or suffix == "" then
return filename
elseif criterium == true then
return filename .. "." .. suffix
elseif not criterium then
- local n, s = splitname(filename)
+ local n, s = lpegmatch(pattern,filename)
if not s or s == "" then
return filename .. "." .. suffix
else
return filename
end
else
- local n, s = splitname(filename)
+ local n, s = lpegmatch(pattern,filename)
if s and s ~= "" then
local t = type(criterium)
if t == "table" then
@@ -2235,96 +2336,49 @@ function file.addsuffix(filename, suffix, criterium)
end
end
end
- return n .. "." .. suffix
+ return (n or filename) .. "." .. suffix
end
end
---~ print("1 " .. file.addsuffix("name","new") .. " -> name.new")
---~ print("2 " .. file.addsuffix("name.old","new") .. " -> name.old")
---~ print("3 " .. file.addsuffix("name.old","new",true) .. " -> name.old.new")
---~ print("4 " .. file.addsuffix("name.old","new","new") .. " -> name.new")
---~ print("5 " .. file.addsuffix("name.old","new","old") .. " -> name.old")
---~ print("6 " .. file.addsuffix("name.old","new","foo") .. " -> name.new")
---~ print("7 " .. file.addsuffix("name.old","new",{"foo","bar"}) .. " -> name.new")
---~ print("8 " .. file.addsuffix("name.old","new",{"old","bar"}) .. " -> name.old")
+-- print("1 " .. file.addsuffix("name","new") .. " -> name.new")
+-- print("2 " .. file.addsuffix("name.old","new") .. " -> name.old")
+-- print("3 " .. file.addsuffix("name.old","new",true) .. " -> name.old.new")
+-- print("4 " .. file.addsuffix("name.old","new","new") .. " -> name.new")
+-- print("5 " .. file.addsuffix("name.old","new","old") .. " -> name.old")
+-- print("6 " .. file.addsuffix("name.old","new","foo") .. " -> name.new")
+-- print("7 " .. file.addsuffix("name.old","new",{"foo","bar"}) .. " -> name.new")
+-- print("8 " .. file.addsuffix("name.old","new",{"old","bar"}) .. " -> name.old")
+
+local suffix = period * (1-period-slashes)^1 * -1
+local pattern = Cs((1-suffix)^0)
-function file.replacesuffix(filename, suffix)
- return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix
+function file.replacesuffix(name,suffix)
+ if suffix and suffix ~= "" then
+ return lpegmatch(pattern,name) .. "." .. suffix
+ else
+ return name
+ end
end
-local trick_1 = char(1)
-local trick_2 = "^" .. trick_1 .. "/+"
+--
-function file.join(...) -- rather dirty
- local lst = { ... }
- local a, b = lst[1], lst[2]
- if not a or a == "" then -- not a added
- lst[1] = trick_1
- elseif b and find(a,"^/+$") and find(b,"^/") then
- lst[1] = ""
- lst[2] = gsub(b,"^/+","")
- end
- local pth = concat(lst,"/")
- pth = gsub(pth,"\\","/")
- local a, b = match(pth,"^(.*://)(.*)$")
- if a and b then
- return a .. gsub(b,"//+","/")
- end
- a, b = match(pth,"^(//)(.*)$")
- if a and b then
- return a .. gsub(b,"//+","/")
- end
- pth = gsub(pth,trick_2,"")
- return (gsub(pth,"//+","/"))
-end
-
--- local slash = P("/")
--- local colon = P(":")
-
--- local replacer = lpeg.replacer(S("\\/")^1,"/")
--- local stripper = Cs(P(slash)^0/"" * replacer)
--- local isnetwork = slash * slash * (1-slash) + (1-slash-colon)^1 * colon
--- local isroot = slash^1 * -1
--- local hasroot = slash^1
-
--- function file.newjoin(...) -- rather dirty
--- local lst = { ... }
--- local one = lst[1]
--- if lpegmatch(isnetwork,one) then
--- local two = lpegmatch(replacer,concat(lst,"/",2))
--- return one .. two
--- elseif lpegmatch(isroot,one) then
--- local two = lpegmatch(replacer,concat(lst,"/",2))
--- if lpegmatch(hasroot,two) then
--- return two
--- else
--- return "/" .. two
--- end
--- elseif one == "" then
--- return lpegmatch(stripper,concat(lst,"/",2))
--- else
--- return lpegmatch(replacer,concat(lst,"/"))
--- end
--- end
+local reslasher = lpeg.replacer(S("\\"),"/")
--- print(file.join("//","/y"))
--- print(file.join("/","/y"))
--- print(file.join("","/y"))
--- print(file.join("/x/","/y"))
--- print(file.join("x/","/y"))
--- print(file.join("http://","/y"))
--- print(file.join("http://a","/y"))
--- print(file.join("http:///a","/y"))
--- print(file.join("//nas-1","/y"))
+function file.reslash(str)
+ return lpegmatch(reslasher,str)
+end
-- We should be able to use:
--
+-- local writable = P(1) * P("w") * Cc(true)
+--
-- function file.is_writable(name)
--- local a = attributes(name) or attributes(dirname(name,"."))
--- return a and sub(a.permissions,2,2) == "w"
+-- local a = attributes(name) or attributes(pathpart(name,"."))
+-- return a and lpegmatch(writable,a.permissions) or false
-- end
--
--- But after some testing Taco and I came up with:
+-- But after some testing Taco and I came up with the more robust
+-- variant:
function file.is_writable(name)
if lfs.isdir(name) then
@@ -2352,9 +2406,11 @@ function file.is_writable(name)
return false
end
+local readable = P("r") * Cc(true)
+
function file.is_readable(name)
local a = attributes(name)
- return a and sub(a.permissions,1,1) == "r"
+ return a and lpegmatch(readable,a.permissions) or false
end
file.isreadable = file.is_readable -- depricated
@@ -2365,64 +2421,74 @@ function file.size(name)
return a and a.size or 0
end
--- todo: lpeg \\ / .. does not save much
-
-local checkedsplit = string.checkedsplit
-
-function file.splitpath(str,separator) -- string
- str = gsub(str,"\\","/")
- return checkedsplit(str,separator or io.pathseparator)
+function file.splitpath(str,separator) -- string .. reslash is a bonus (we could do a direct split)
+ return checkedsplit(lpegmatch(reslasher,str),separator or io.pathseparator)
end
function file.joinpath(tab,separator) -- table
return concat(tab,separator or io.pathseparator) -- can have trailing //
end
--- we can hash them weakly
+local stripper = Cs(P(fwslash)^0/"" * reslasher)
+local isnetwork = fwslash * fwslash * (1-fwslash) + (1-fwslash-colon)^1 * colon
+local isroot = fwslash^1 * -1
+local hasroot = fwslash^1
---~ function file.collapsepath(str) -- fails on b.c/..
---~ str = gsub(str,"\\","/")
---~ if find(str,"/") then
---~ str = gsub(str,"^%./",(gsub(getcurrentdir(),"\\","/")) .. "/") -- ./xx in qualified
---~ str = gsub(str,"/%./","/")
---~ local n, m = 1, 1
---~ while n > 0 or m > 0 do
---~ str, n = gsub(str,"[^/%.]+/%.%.$","")
---~ str, m = gsub(str,"[^/%.]+/%.%./","")
---~ end
---~ str = gsub(str,"([^/])/$","%1")
---~ -- str = gsub(str,"^%./","") -- ./xx in qualified
---~ str = gsub(str,"/%.$","")
---~ end
---~ if str == "" then str = "." end
---~ return str
---~ end
---~
---~ The previous one fails on "a.b/c" so Taco came up with a split based
---~ variant. After some skyping we got it sort of compatible with the old
---~ one. After that the anchoring to currentdir was added in a better way.
---~ Of course there are some optimizations too. Finally we had to deal with
---~ windows drive prefixes and things like sys://.
+function file.join(...) -- rather dirty
+ local lst = { ... }
+ local one = lst[1]
+ if lpegmatch(isnetwork,one) then
+ local two = lpegmatch(reslasher,concat(lst,"/",2))
+ return one .. "/" .. two
+ elseif lpegmatch(isroot,one) then
+ local two = lpegmatch(reslasher,concat(lst,"/",2))
+ if lpegmatch(hasroot,two) then
+ return two
+ else
+ return "/" .. two
+ end
+ elseif one == "" then
+ return lpegmatch(stripper,concat(lst,"/",2))
+ else
+ return lpegmatch(reslasher,concat(lst,"/"))
+ end
+end
+
+-- print(file.join("c:/whatever","name"))
+-- print(file.join("//","/y"))
+-- print(file.join("/","/y"))
+-- print(file.join("","/y"))
+-- print(file.join("/x/","/y"))
+-- print(file.join("x/","/y"))
+-- print(file.join("http://","/y"))
+-- print(file.join("http://a","/y"))
+-- print(file.join("http:///a","/y"))
+-- print(file.join("//nas-1","/y"))
+
+-- The previous one fails on "a.b/c" so Taco came up with a split based
+-- variant. After some skyping we got it sort of compatible with the old
+-- one. After that the anchoring to currentdir was added in a better way.
+-- Of course there are some optimizations too. Finally we had to deal with
+-- windows drive prefixes and things like sys://. Eventually gsubs and
+-- finds were replaced by lpegs.
+
+local drivespec = R("az","AZ")^1 * colon
+local anchors = fwslash + drivespec
+local untouched = periods + (1-period)^1 * P(-1)
+local splitstarter = (Cs(drivespec * (bwslash/"/" + fwslash)^0) + Cc(false)) * Ct(lpeg.splitat(S("/\\")^1))
+local absolute = fwslash
function file.collapsepath(str,anchor)
- if anchor and not find(str,"^/") and not find(str,"^%a:") then
+ if anchor and not lpegmatch(anchors,str) then
str = getcurrentdir() .. "/" .. str
end
if str == "" or str =="." then
return "."
- elseif find(str,"^%.%.") then
- str = gsub(str,"\\","/")
- return str
- elseif not find(str,"%.") then
- str = gsub(str,"\\","/")
- return str
- end
- str = gsub(str,"\\","/")
- local starter, rest = match(str,"^(%a+:/*)(.-)$")
- if starter then
- str = rest
+ elseif lpegmatch(untouched,str) then
+ return lpegmatch(reslasher,str)
end
- local oldelements = checkedsplit(str,"/")
+ local starter, oldelements = lpegmatch(splitstarter,str)
+-- inspect(oldelements)
local newelements = { }
local i = #oldelements
while i > 0 do
@@ -2452,7 +2518,7 @@ function file.collapsepath(str,anchor)
return starter or "."
elseif starter then
return starter .. concat(newelements, '/')
- elseif find(str,"^/") then
+ elseif lpegmatch(absolute,str) then
return "/" .. concat(newelements,'/')
else
return concat(newelements, '/')
@@ -2469,29 +2535,21 @@ end
-- test("a/./b/..") test("a/aa/../b/bb") test("a/.././././b/..") test("a/./././b/..")
-- test("a/b/c/../..") test("./a/b/c/../..") test("a/b/c/../..")
+local validchars = R("az","09","AZ","--","..")
+local pattern_a = lpeg.replacer(1-validchars)
+local pattern_a = Cs((validchars + P(1)/"-")^1)
+local whatever = P("-")^0 / ""
+local pattern_b = Cs(whatever * (1 - whatever * -1)^1)
+
function file.robustname(str,strict)
- str = gsub(str,"[^%a%d%/%-%.\\]+","-")
+ str = lpegmatch(pattern_a,str) or str
if strict then
- return lower(gsub(str,"^%-*(.-)%-*$","%1"))
+ return lpegmatch(pattern_b,str) or str -- two step is cleaner (less backtracking)
else
return str
end
end
--- local pattern_a = lpeg.replacer(1-R("az","09","AZ","--",".."))
--- local pattern_a = Cs((R("az","09","AZ","--","..") + P(1)/"-")^1)
--- local whatever = P("-")^0 / ""
--- local pattern_b = Cs(whatever * (1 - whatever * -1)^1)
-
--- function file.robustname(str,strict)
--- str = lpegmatch(pattern_a,str) or str
--- if strict then
--- return lpegmatch(pattern_b,str) or str -- two step is cleaner (less backtracking)
--- else
--- return str
--- end
--- end
-
file.readdata = io.loaddata
file.savedata = io.savedata
@@ -2499,92 +2557,17 @@ function file.copy(oldname,newname)
file.savedata(newname,io.loaddata(oldname))
end
--- lpeg variants, slightly faster, not always
-
--- local period = P(".")
--- local slashes = S("\\/")
--- local noperiod = 1-period
--- local noslashes = 1-slashes
--- local name = noperiod^1
-
--- local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * C(noperiod^1) * -1
-
--- function file.suffixonly(name)
--- return lpegmatch(pattern,name) or ""
--- end
-
--- local pattern = Cs(((period * noperiod^1 * -1)/"" + 1)^1)
-
--- function file.removesuffix(name)
--- return lpegmatch(pattern,name)
--- end
-
--- local pattern = (noslashes^0 * slashes)^1 * C(noslashes^1) * -1
-
--- function file.basename(name)
--- return lpegmatch(pattern,name) or name
--- end
-
--- local pattern = Cs ((1 - slashes * noslashes^1 * -1)^1)
-
--- function file.dirname(name)
--- return lpegmatch(pattern,name) or ""
--- end
-
--- local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * Cp() * noperiod^1 * -1
-
--- function file.addsuffix(name, suffix)
--- local p = lpegmatch(pattern,name)
--- if p then
--- return name
--- else
--- return name .. "." .. suffix
--- end
--- end
-
--- local suffix = period * (1-period-slashes)^1 * -1
--- local pattern = Cs((1-suffix)^1)
-
--- function file.replacesuffix(name,suffix)
--- if suffix and suffix ~= "" then
--- return lpegmatch(pattern,name) .. "." .. suffix
--- else
--- return name
--- end
--- end
-
--- local path = noslashes^0 * slashes^1
--- local suffix = period * (1-period-slashes)^1 * -1
--- local pattern = path^0 * Cs((1-suffix)^1) * suffix^0
-
--- function file.nameonly(name)
--- return lpegmatch(pattern,name) or name
--- end
-
--- local test = file.suffixonly
--- local test = file.basename
--- local test = file.dirname
--- local test = file.addsuffix
--- local test = file.replacesuffix
--- local test = file.nameonly
-
--- print(1,test("./a/b/c/abd.def.xxx","!!!"))
--- print(2,test("./../b/c/abd.def.xxx","!!!"))
--- print(3,test("a/b/c/abd.def.xxx","!!!"))
--- print(4,test("a/b/c/def.xxx","!!!"))
--- print(5,test("a/b/c/def","!!!"))
--- print(6,test("def","!!!"))
--- print(7,test("def.xxx","!!!"))
-
--- local tim = os.clock() for i=1,250000 do local ext = test("abd.def.xxx","!!!") end print(os.clock()-tim)
-
-- also rewrite previous
local letter = R("az","AZ") + S("_-+")
local separator = P("://")
-local qualified = P(".")^0 * P("/") + letter*P(":") + letter^1*separator + letter^1 * P("/")
-local rootbased = P("/") + letter*P(":")
+local qualified = period^0 * fwslash
+ + letter * colon
+ + letter^1 * separator
+ + letter^1 * fwslash
+local rootbased = fwslash
+ + letter * colon
lpeg.patterns.qualified = qualified
lpeg.patterns.rootbased = rootbased
@@ -2599,61 +2582,6 @@ function file.is_rootbased_path(filename)
return lpegmatch(rootbased,filename) ~= nil
end
--- actually these are schemes
-
-local slash = S("\\/")
-local period = P(".")
-local drive = C(R("az","AZ")) * P(":")
-local path = C(((1-slash)^0 * slash)^0)
-local suffix = period * C(P(1-period)^0 * P(-1))
-local base = C((1-suffix)^0)
-local rest = C(P(1)^0)
-
-drive = drive + Cc("")
-path = path + Cc("")
-base = base + Cc("")
-suffix = suffix + Cc("")
-
-local pattern_a = drive * path * base * suffix
-local pattern_b = path * base * suffix
-local pattern_c = C(drive * path) * C(base * suffix) -- trick: two extra captures
-local pattern_d = path * rest
-
-function file.splitname(str,splitdrive)
- if splitdrive then
- return lpegmatch(pattern_a,str) -- returns drive, path, base, suffix
- else
- return lpegmatch(pattern_b,str) -- returns path, base, suffix
- end
-end
-
-function file.splitbase(str)
- return lpegmatch(pattern_d,str) -- returns path, base+suffix
-end
-
-function file.nametotable(str,splitdrive) -- returns table
- local path, drive, subpath, name, base, suffix = lpegmatch(pattern_c,str)
- if splitdrive then
- return {
- path = path,
- drive = drive,
- subpath = subpath,
- name = name,
- base = base,
- suffix = suffix,
- }
- else
- return {
- path = path,
- name = name,
- base = base,
- suffix = suffix,
- }
- end
-end
-
--- print(file.splitbase("a/b/c.txt"))
-
-- function test(t) for k, v in next, t do print(v, "=>", file.splitname(v)) end end
--
-- test { "c:", "c:/aa", "c:/aa/bb", "c:/aa/bb/cc", "c:/aa/bb/cc.dd", "c:/aa/bb/cc.dd.ee" }
@@ -2661,14 +2589,14 @@ end
-- test { "/aa", "/aa/bb", "/aa/bb/cc", "/aa/bb/cc.dd", "/aa/bb/cc.dd.ee" }
-- test { "aa", "aa/bb", "aa/bb/cc", "aa/bb/cc.dd", "aa/bb/cc.dd.ee" }
---~ -- todo:
---~
---~ if os.type == "windows" then
---~ local currentdir = getcurrentdir
---~ function getcurrentdir()
---~ return (gsub(currentdir(),"\\","/"))
---~ end
---~ end
+-- -- maybe:
+--
+-- if os.type == "windows" then
+-- local currentdir = getcurrentdir
+-- function getcurrentdir()
+-- return lpegmatch(reslasher,currentdir())
+-- end
+-- end
-- for myself:
@@ -2677,6 +2605,21 @@ function file.strip(name,dir)
return a ~= "" and a or name
end
+-- local debuglist = {
+-- "pathpart", "basename", "nameonly", "suffixonly", "suffix", "dirname", "extname",
+-- "addsuffix", "removesuffix", "replacesuffix", "join",
+-- "strip","collapsepath", "joinpath", "splitpath",
+-- }
+
+-- for i=1,#debuglist do
+-- local name = debuglist[i]
+-- local f = file[name]
+-- file[name] = function(...)
+-- print(name,f(...))
+-- return f(...)
+-- end
+-- end
+
end -- closure
do -- begin closure to overcome local limits and interference
@@ -12698,7 +12641,9 @@ local internalized = allocate() -- internal tex numbers (private)
local loadedfonts = constructors.loadedfonts
local designsizes = constructors.designsizes
-local resolvefile = fontgoodies.filenames.resolve
+-- not in generic (some day I'll make two defs, one for context, one for generic)
+
+local resolvefile = fontgoodies and fontgoodies.filenames and fontgoodies.filenames.resolve or function(s) return s end
--[[ldx--
<p>We hardly gain anything when we cache the final (pre scaled)